00001 #include "ampi.h"
00002 #include "ampiimpl.h"
00003
00004 FDECL {
00005 #define mpi_send FTN_NAME( MPI_SEND , mpi_send )
00006 #define mpi_recv FTN_NAME( MPI_RECV , mpi_recv )
00007 #define mpi_get_count FTN_NAME( MPI_GET_COUNT , mpi_get_count )
00008 #define mpi_isend FTN_NAME( MPI_ISEND , mpi_isend )
00009 #define mpi_bsend FTN_NAME( MPI_BSEND , mpi_bsend )
00010 #define mpi_rsend FTN_NAME( MPI_RSEND , mpi_rsend )
00011 #define mpi_ssend FTN_NAME( MPI_SSEND , mpi_ssend )
00012 #define mpi_issend FTN_NAME( MPI_ISSEND , mpi_issend )
00013 #define mpi_irecv FTN_NAME( MPI_IRECV , mpi_irecv )
00014 #define mpi_wait FTN_NAME( MPI_WAIT , mpi_wait )
00015 #define mpi_test FTN_NAME( MPI_TEST , mpi_test )
00016 #define mpi_waitany FTN_NAME( MPI_WAITANY , mpi_waitany )
00017 #define mpi_testany FTN_NAME( MPI_TESTANY , mpi_testany )
00018 #define mpi_waitall FTN_NAME( MPI_WAITALL , mpi_waitall )
00019 #define mpi_testall FTN_NAME( MPI_TESTALL , mpi_testall )
00020 #define mpi_waitsome FTN_NAME( MPI_WAITSOME , mpi_waitsome )
00021 #define mpi_testsome FTN_NAME( MPI_TESTSOME , mpi_testsome )
00022 #define mpi_request_free FTN_NAME(MPI_REQUEST_FREE , mpi_request_free)
00023 #define mpi_cancel FTN_NAME(MPI_CANCEL, mpi_cancel)
00024 #define mpi_iprobe FTN_NAME( MPI_IPROBE , mpi_iprobe )
00025 #define mpi_probe FTN_NAME( MPI_PROBE , mpi_probe )
00026 #define mpi_send_init FTN_NAME( MPI_SEND_INIT , mpi_send_init )
00027 #define mpi_recv_init FTN_NAME( MPI_RECV_INIT , mpi_recv_init )
00028 #define mpi_start FTN_NAME( MPI_START , mpi_start )
00029 #define mpi_startall FTN_NAME( MPI_STARTALL , mpi_startall )
00030 #define mpi_sendrecv FTN_NAME( MPI_SENDRECV , mpi_sendrecv )
00031 #define mpi_sendrecv_replace FTN_NAME( MPI_SENDRECV_REPLACE , mpi_sendrecv_replace )
00032 #define mpi_type_contiguous FTN_NAME( MPI_TYPE_CONTIGUOUS , mpi_type_contiguous )
00033 #define mpi_type_vector FTN_NAME( MPI_TYPE_VECTOR , mpi_type_vector )
00034 #define mpi_type_hvector FTN_NAME( MPI_TYPE_HVECTOR , mpi_type_hvector )
00035 #define mpi_type_indexed FTN_NAME( MPI_TYPE_INDEXED , mpi_type_indexed )
00036 #define mpi_type_hindexed FTN_NAME( MPI_TYPE_HINDEXED , mpi_type_hindexed )
00037 #define mpi_type_struct FTN_NAME( MPI_TYPE_STRUCT , mpi_type_struct )
00038 #define mpi_type_commit FTN_NAME( MPI_TYPE_COMMIT , mpi_type_commit )
00039 #define mpi_type_free FTN_NAME( MPI_TYPE_FREE , mpi_type_free )
00040 #define mpi_type_extent FTN_NAME( MPI_TYPE_EXTENT , mpi_type_extent )
00041 #define mpi_type_size FTN_NAME( MPI_TYPE_SIZE , mpi_type_size )
00042 #define mpi_type_lb FTN_NAME( MPI_TYPE_LB , mpi_type_lb )
00043 #define mpi_type_ub FTN_NAME( MPI_TYPE_UB , mpi_type_ub )
00044 #define mpi_address FTN_NAME( MPI_ADDRESS , mpi_address )
00045 #define mpi_get_elements FTN_NAME( MPI_GET_ELEMENTS , mpi_get_elements )
00046 #define mpi_pack FTN_NAME( MPI_PACK , mpi_pack )
00047 #define mpi_unpack FTN_NAME( MPI_UNPACK , mpi_unpack )
00048 #define mpi_pack_size FTN_NAME( MPI_PACK_SIZE , mpi_pack_size )
00049
00050 #define mpi_barrier FTN_NAME( MPI_BARRIER , mpi_barrier )
00051 #define mpi_bcast FTN_NAME( MPI_BCAST , mpi_bcast )
00052 #define mpi_gather FTN_NAME( MPI_GATHER , mpi_gather )
00053 #define mpi_gatherv FTN_NAME( MPI_GATHERV , mpi_gatherv )
00054 #define mpi_scatter FTN_NAME( MPI_SCATTER , mpi_scatter )
00055 #define mpi_scatterv FTN_NAME( MPI_SCATTERV , mpi_scatterv )
00056 #define mpi_allgather FTN_NAME( MPI_ALLGATHER , mpi_allgather )
00057 #define mpi_iallgather FTN_NAME( MPI_IALLGATHER , mpi_iallgather )
00058 #define mpi_allgatherv FTN_NAME( MPI_ALLGATHERV , mpi_allgatherv )
00059 #define mpi_alltoall FTN_NAME( MPI_ALLTOALL , mpi_alltoall )
00060 #define mpi_ialltoall FTN_NAME( MPI_IALLTOALL , mpi_ialltoall )
00061 #define mpi_alltoallv FTN_NAME( MPI_ALLTOALLV , mpi_alltoallv )
00062 #define mpi_reduce FTN_NAME( MPI_REDUCE , mpi_reduce )
00063 #define mpi_ireduce FTN_NAME( MPI_IREDUCE , mpi_ireduce )
00064 #define mpi_allreduce FTN_NAME( MPI_ALLREDUCE , mpi_allreduce )
00065 #define mpi_iallreduce FTN_NAME( MPI_IALLREDUCE , mpi_iallreduce )
00066 #define mpi_reduce_scatter FTN_NAME( MPI_REDUCE_SCATTER , mpi_reduce_scatter )
00067 #define mpi_scan FTN_NAME( MPI_SCAN , mpi_scan )
00068 #define mpi_op_create FTN_NAME( MPI_OP_CREATE , mpi_op_create )
00069 #define mpi_op_free FTN_NAME( MPI_OP_FREE , mpi_op_free )
00070
00071 #define mpi_group_size FTN_NAME( MPI_GROUP_SIZE, mpi_group_size)
00072 #define mpi_group_rank FTN_NAME( MPI_GROUP_RANK, mpi_group_rank)
00073 #define mpi_group_translate_ranks FTN_NAME(MPI_GROUP_TRANSLATE_RANKS, mpi_group_translate_ranks)
00074 #define mpi_group_compare FTN_NAME(MPI_GROUP_COMPARE, mpi_group_compare)
00075
00076 #define mpi_comm_group FTN_NAME( MPI_COMM_GROUP, mpi_comm_group)
00077 #define mpi_group_union FTN_NAME(MPI_GROUP_UNION, mpi_group_union)
00078 #define mpi_group_intersection FTN_NAME(MPI_GROUP_INTERSECTION, mpi_group_intersection)
00079 #define mpi_group_difference FTN_NAME(MPI_GROUP_DIFFERENCE, mpi_group_difference)
00080 #define mpi_group_incl FTN_NAME(MPI_GROUP_INCL, mpi_group_incl)
00081 #define mpi_group_excl FTN_NAME(MPI_GROUP_EXCL, mpi_group_excl)
00082 #define mpi_group_range_incl FTN_NAME(MPI_GROUP_RANGE_INCL, mpi_group_range_incl)
00083 #define mpi_group_range_excl FTN_NAME(MPI_GROUP_RANGE_EXCL, mpi_group_range_excl)
00084 #define mpi_group_free FTN_NAME(MPI_GROUP_FREE, mpi_group_free)
00085 #define mpi_comm_create FTN_NAME(MPI_COMM_CREATE, mpi_comm_create)
00086
00087 #define mpi_comm_rank FTN_NAME( MPI_COMM_RANK , mpi_comm_rank )
00088 #define mpi_comm_size FTN_NAME( MPI_COMM_SIZE , mpi_comm_size )
00089 #define mpi_comm_dup FTN_NAME( MPI_COMM_DUP , mpi_comm_dup )
00090 #define mpi_comm_split FTN_NAME( MPI_COMM_SPLIT , mpi_comm_split )
00091 #define mpi_comm_free FTN_NAME( MPI_COMM_FREE , mpi_comm_free )
00092 #define mpi_comm_test_inter FTN_NAME( MPI_COMM_TEST_INTER , mpi_comm_test_inter )
00093 #define mpi_comm_remote_size FTN_NAME ( MPI_COMM_REMOTE_SIZE , mpi_comm_remote_size )
00094 #define mpi_comm_remote_group FTN_NAME ( MPI_COMM_REMOTE_GROUP , mpi_comm_remote_group )
00095 #define mpi_intercomm_create FTN_NAME ( MPI_INTERCOMM_CREATE , mpi_intercomm_create )
00096 #define mpi_intercomm_merge FTN_NAME ( MPI_INTERCOMM_MERGE , mpi_intercomm_merge )
00097 #define mpi_keyval_create FTN_NAME ( MPI_KEYVAL_CREATE , mpi_keyval_create )
00098 #define mpi_keyval_free FTN_NAME ( MPI_KEYVAL_FREE , mpi_keyval_free )
00099 #define mpi_attr_put FTN_NAME ( MPI_ATTR_PUT , mpi_attr_put )
00100 #define mpi_attr_get FTN_NAME ( MPI_ATTR_GET , mpi_attr_get )
00101 #define mpi_attr_delete FTN_NAME ( MPI_ATTR_DELETE , mpi_attr_delete )
00102
00103 #define mpi_cart_create FTN_NAME ( MPI_CART_CREATE , mpi_cart_create )
00104 #define mpi_graph_create FTN_NAME ( MPI_GRAPH_CREATE , mpi_graph_create )
00105 #define mpi_topo_test FTN_NAME ( MPI_TOPO_TEST , mpi_topo_test )
00106 #define mpi_cart_map FTN_NAME ( MPI_CART_MAP , mpi_cart_map )
00107 #define mpi_graph_map FTN_NAME ( MPI_GRAPH_MAP , mpi_graph_map )
00108 #define mpi_cartdim_get FTN_NAME ( MPI_CARTDIM_GET , mpi_cartdim_get )
00109 #define mpi_cart_get FTN_NAME ( MPI_CART_GET , mpi_cart_get )
00110 #define mpi_cart_rank FTN_NAME ( MPI_CART_RANK , mpi_cart_rank )
00111 #define mpi_cart_coords FTN_NAME ( MPI_CART_COORDS , mpi_cart_coords )
00112 #define mpi_cart_shift FTN_NAME ( MPI_CART_SHIFT , mpi_cart_shift )
00113 #define mpi_graphdims_get FTN_NAME ( MPI_GRAPHDIMS_GET , mpi_graphdims_get )
00114 #define mpi_graph_get FTN_NAME ( MPI_GRAPH_GET , mpi_graph_get )
00115 #define mpi_graph_neighbors_count FTN_NAME ( MPI_GRAPH_NEIGHBORS_COUNT , mpi_graph_neighbors_count )
00116 #define mpi_graph_neighbors FTN_NAME ( MPI_GRAPH_NEIGHBORS , mpi_graph_neighbors )
00117 #define mpi_dims_create FTN_NAME ( MPI_DIMS_CREATE , mpi_dims_create )
00118 #define mpi_cart_sub FTN_NAME ( MPI_CART_SUB , mpi_cart_sub )
00119
00120 #define mpi_get_processor_name FTN_NAME ( MPI_GET_PROCESSOR_NAME , mpi_get_processor_name )
00121 #define mpi_errhandler_create FTN_NAME( MPI_ERRHANDLER_CREATE , mpi_errhandler_create )
00122 #define mpi_errhandler_set FTN_NAME( MPI_ERRHANDLER_SET , mpi_errhandler_set )
00123 #define mpi_errhandler_get FTN_NAME( MPI_ERRHANDLER_GET , mpi_errhandler_get )
00124 #define mpi_errhandler_free FTN_NAME( MPI_ERRHANDLER_FREE , mpi_errhandler_free )
00125 #define mpi_error_string FTN_NAME( MPI_ERROR_STRING , mpi_error_string )
00126 #define mpi_error_class FTN_NAME( MPI_ERROR_CLASS , mpi_error_class )
00127 #define mpi_wtime FTN_NAME( MPI_WTIME , mpi_wtime )
00128 #define mpi_wtick FTN_NAME( MPI_WTICK , mpi_wtick )
00129 #define mpi_init FTN_NAME( MPI_INIT , mpi_init )
00130 #define mpi_initialized FTN_NAME( MPI_INITIALIZED , mpi_initialized )
00131 #define mpi_init_universe FTN_NAME( MPI_INIT_UNIVERSE , mpi_init_universe )
00132 #define mpi_finalize FTN_NAME( MPI_FINALIZE , mpi_finalize )
00133 #define mpi_finalized FTN_NAME( MPI_FINALIZED , mpi_finalized )
00134 #define mpi_abort FTN_NAME( MPI_ABORT , mpi_abort )
00135
00136 #define mpi_yield FTN_NAME ( MPI_YIELD , mpi_yield )
00137 #define mpi_resume FTN_NAME ( MPI_RESUME, mpi_resume )
00138 #define mpi_print FTN_NAME( MPI_PRINT , mpi_print )
00139 #define mpi_Start_measure FTN_NAME( MPI_START_MEASURE, mpi_start_measure)
00140 #define mpi_Stop_measure FTN_NAME( MPI_STOP_MEASURE, mpi_stop_measure)
00141 #define mpi_set_load FTN_NAME( MPI_SET_LOAD, mpi_set_load)
00142 #define mpi_register FTN_NAME( MPI_REGISTER , mpi_register )
00143 #define mpi_migrate FTN_NAME( MPI_MIGRATE , mpi_migrate )
00144 #define mpi_migrateto FTN_NAME( MPI_MIGRATETO , mpi_migrateto )
00145 #define mpi_async_migrate FTN_NAME( MPI_ASYNC_MIGRATE , mpi_async_migrate )
00146 #define mpi_allow_migrate FTN_NAME( MPI_ALLOW_MIGRATE , mpi_allow_migrate )
00147 #define mpi_setmigratable FTN_NAME (MPI_SETMIGRATABLE , mpi_setmigratable )
00148 #define mpi_checkpoint FTN_NAME( MPI_CHECKPOINT , mpi_checkpoint )
00149 #define mpi_memcheckpoint FTN_NAME( MPI_MEMCHECKPOINT , mpi_memcheckpoint )
00150
00151
00152 #define mpi_type_get_envelope FTN_NAME ( MPI_TYPE_GET_ENVELOPE , mpi_type_get_envelope )
00153 #define mpi_type_get_contents FTN_NAME ( MPI_TYPE_GET_CONTENTS , mpi_type_get_contents )
00154
00155 #define mpi_win_create FTN_NAME ( MPI_WIN_CREATE , mpi_win_create )
00156 #define mpi_win_free FTN_NAME ( MPI_WIN_FREE , mpi_win_free )
00157 #define mpi_win_delete_attr FTN_NAME ( MPI_WIN_DELETE_ATTR , mpi_win_delete_attr )
00158 #define mpi_win_get_group FTN_NAME ( MPI_WIN_GET_GROUP , mpi_win_get_group )
00159 #define mpi_win_set_name FTN_NAME ( MPI_WIN_SET_NAME , mpi_win_set_name )
00160 #define mpi_win_get_name FTN_NAME ( MPI_WIN_GET_NAME , mpi_win_get_name )
00161 #define mpi_win_fence FTN_NAME ( MPI_WIN_FENCE , mpi_win_fence )
00162 #define mpi_win_lock FTN_NAME ( MPI_WIN_LOCK , mpi_win_lock )
00163 #define mpi_win_unlock FTN_NAME ( MPI_WIN_UNLOCK , mpi_win_unlock )
00164 #define mpi_win_post FTN_NAME ( MPI_WIN_POST , mpi_win_post )
00165 #define mpi_win_wait FTN_NAME ( MPI_WIN_WAIT , mpi_win_wait )
00166 #define mpi_win_start FTN_NAME ( MPI_WIN_START , mpi_win_start )
00167 #define mpi_win_complete FTN_NAME ( MPI_WIN_COMPLETE , mpi_win_complete )
00168 #define mpi_alloc_mem FTN_NAME ( MPI_ALLOC_MEM , mpi_alloc_mem )
00169 #define mpi_free_mem FTN_NAME ( MPI_FREE_MEM , mpi_free_mem )
00170 #define mpi_put FTN_NAME ( MPI_PUT , mpi_put )
00171 #define mpi_get FTN_NAME ( MPI_GET , mpi_get )
00172 #define mpi_accumulate FTN_NAME ( MPI_ACCUMULATE , mpi_accumulate )
00173
00174 #define mpi_info_create FTN_NAME ( MPI_INFO_CREATE , mpi_info_create )
00175 #define mpi_info_set FTN_NAME ( MPI_INFO_SET , mpi_info_set )
00176 #define mpi_info_delete FTN_NAME ( MPI_INFO_DELETE , mpi_info_delete )
00177 #define mpi_info_get FTN_NAME ( MPI_INFO_GET , mpi_info_get )
00178 #define mpi_info_get_valuelen FTN_NAME ( MPI_INFO_GET_VALUELEN , mpi_info_get_valuelen )
00179 #define mpi_info_get_nkeys FTN_NAME ( MPI_INFO_GET_NKEYS , mpi_info_get_nkeys )
00180 #define mpi_info_get_nthkey FTN_NAME ( MPI_INFO_GET_NTHKEYS , mpi_info_get_nthkey )
00181 #define mpi_info_dup FTN_NAME ( MPI_INFO_DUP , mpi_info_dup )
00182 #define mpi_info_free FTN_NAME ( MPI_INFO_FREE , mpi_info_free )
00183
00184 #define REDUCERF(caps, nocaps) \
00185 void FTN_NAME(caps, nocaps)(void *iv, void *iov, int *len, MPI_Datatype *dt){ \
00186 caps(iv, iov, len, dt); \
00187 }
00188
00189 #define mpi_info_maxmemory FTN_NAME (MPI_INFO_MAXMEMORY, mpi_info_maxmemory)
00190 #define mpi_info_memory FTN_NAME (MPI_INFO_MEMORY, mpi_info_memory)
00191
00192 #if !CMK_FORTRAN_USES_ALLCAPS
00193 REDUCERF(MPI_MAX , mpi_max)
00194 REDUCERF(MPI_MIN , mpi_min)
00195 REDUCERF(MPI_SUM , mpi_sum)
00196 REDUCERF(MPI_PROD , mpi_prod)
00197 REDUCERF(MPI_LAND , mpi_land)
00198 REDUCERF(MPI_BAND , mpi_band)
00199 REDUCERF(MPI_LOR , mpi_lor)
00200 REDUCERF(MPI_BOR , mpi_bor)
00201 REDUCERF(MPI_LXOR , mpi_lxor)
00202 REDUCERF(MPI_BXOR , mpi_bxor)
00203 REDUCERF(MPI_MAXLOC , mpi_maxloc)
00204 REDUCERF(MPI_MINLOC , mpi_minloc)
00205 #endif
00206
00207 typedef MPI_Op MPI_Op_Array[128];
00208 CtvExtern(MPI_Op_Array, mpi_ops);
00209 CtvExtern(int, mpi_opc);
00210
00211
00212 #define MPI_OP_FIRST 100
00213
00214
00215 inline MPI_Op & GET_MPI_OP(int idx) { MPI_Op *tab=CtvAccess(mpi_ops); return tab[idx - MPI_OP_FIRST]; }
00216
00217 void mpi_init_universe(int *unicomm)
00218 {
00219 AMPIAPI("mpi_init_universe");
00220 for(int i=0;i<_mpi_nworlds; i++)
00221 {
00222 unicomm[i] = MPI_COMM_UNIVERSE[i];
00223 }
00224 }
00225
00226 void mpi_init(int *ierr){
00227 *ierr = AMPI_Init(NULL,NULL);
00228 }
00229
00230 void mpi_initialized(int *isInit, int* ierr)
00231 {
00232 *ierr = AMPI_Initialized(isInit);
00233 }
00234
00235 void mpi_finalized(int *isFinalized, int* ierr)
00236 {
00237 *ierr = AMPI_Finalized(isFinalized);
00238 }
00239
00240 void mpi_comm_rank(int *comm, int *rank, int *ierr)
00241 {
00242 *ierr = AMPI_Comm_rank(*comm, rank);
00243 }
00244
00245 void mpi_comm_size(int *comm, int *size, int *ierr)
00246 {
00247 *ierr = AMPI_Comm_size(*comm, size);
00248 }
00249
00250 void mpi_finalize(int *ierr)
00251 {
00252 *ierr = AMPI_Finalize();
00253 }
00254
00255 void mpi_send(void *msg, int *count, int *type, int *dest,
00256 int *tag, int *comm, int *ierr)
00257 {
00258 *ierr = AMPI_Send(msg, *count, *type, *dest, *tag, *comm);
00259 }
00260
00261 void mpi_recv(void *msg, int *count, int *type, int *src,
00262 int *tag, int *comm, int *status, int *ierr)
00263 {
00264 *ierr = AMPI_Recv(msg, *count, *type, *src, *tag, *comm,
00265 (MPI_Status*) status);
00266 }
00267
00268 void mpi_bsend(void *msg, int *count, int *type, int *dest,
00269 int *tag, int *comm, int *ierr)
00270 {
00271 *ierr = AMPI_Bsend(msg, *count, *type, *dest, *tag, *comm);
00272 }
00273
00274 void mpi_rsend(void *msg, int *count, int *type, int *dest,
00275 int *tag, int *comm, int *ierr)
00276 {
00277 *ierr = AMPI_Rsend(msg, *count, *type, *dest, *tag, *comm);
00278 }
00279
00280 void mpi_ssend(void *msg, int *count, int *type, int *dest,
00281 int *tag, int *comm, int *ierr)
00282 {
00283 *ierr = AMPI_Ssend(msg, *count, *type, *dest, *tag, *comm);
00284 }
00285
00286 void mpi_issend(void *buf, int *count, int *datatype, int *dest,
00287 int *tag, int *comm, int *request, int *ierr)
00288 {
00289 *ierr = AMPI_Issend(buf, *count, *datatype, *dest, *tag, *comm, (MPI_Request *)request);
00290 }
00291
00292 void mpi_probe(int *src, int *tag, int *comm, int *status, int *ierr)
00293 {
00294 *ierr = AMPI_Probe(*src, *tag, *comm, (MPI_Status*) status);
00295 }
00296
00297 void mpi_iprobe(int *src,int *tag,int *comm,int *flag,int *status,int *ierr)
00298 {
00299 *ierr = AMPI_Iprobe(*src, *tag, *comm, flag, (MPI_Status*) status);
00300 }
00301
00302 void mpi_sendrecv(void *sndbuf, int *sndcount, int *sndtype,
00303 int *dest, int *sndtag, void *rcvbuf,
00304 int *rcvcount, int *rcvtype, int *src,
00305 int *rcvtag, int *comm, int *status, int *ierr)
00306 {
00307 *ierr = AMPI_Sendrecv(sndbuf, *sndcount, *sndtype, *dest, *sndtag,
00308 rcvbuf, *rcvcount, *rcvtype, *src, *rcvtag,
00309 *comm, (MPI_Status*) status);
00310 }
00311
00312 void mpi_sendrecv_replace(void *buf, int* count, int* datatype,
00313 int* dest, int* sendtag, int* source, int* recvtag,
00314 int* comm, int* status, int *ierr)
00315 {
00316 *ierr = AMPI_Sendrecv_replace(buf, *count, *datatype, *dest, *sendtag,
00317 *source, *recvtag, *comm, (MPI_Status*) status);
00318 }
00319
00320 void mpi_barrier(int *comm, int *ierr)
00321 {
00322 *ierr = AMPI_Barrier(*comm);
00323 }
00324
00325 void mpi_bcast(void *buf, int *count, int *type, int *root, int *comm,
00326 int *ierr)
00327 {
00328 *ierr = AMPI_Bcast(buf, *count, *type, *root, *comm);
00329 }
00330
00331 void mpi_reduce(void *inbuf, void *outbuf, int *count, int *type,
00332 int *opc, int *root, int *comm, int *ierr)
00333 {
00334 MPI_Op op = GET_MPI_OP(*opc);
00335 if (inbuf == NULL) inbuf = MPI_IN_PLACE;
00336 if (outbuf == NULL) outbuf = MPI_IN_PLACE;
00337 *ierr = AMPI_Reduce(inbuf, outbuf, *count, *type, op, *root, *comm);
00338 }
00339
00340 void mpi_allreduce(void *inbuf,void *outbuf,int *count,int *type,
00341 int *opc, int *comm, int *ierr)
00342 {
00343 MPI_Op op = GET_MPI_OP(*opc);
00344 if (inbuf == NULL) inbuf = MPI_IN_PLACE;
00345 if (outbuf == NULL) outbuf = MPI_IN_PLACE;
00346 *ierr = AMPI_Allreduce(inbuf, outbuf, *count, *type, op, *comm);
00347 }
00348
00349 double mpi_wtime(void)
00350 {
00351 return AMPI_Wtime();
00352 }
00353
00354 double mpi_wtick(void)
00355 {
00356 return AMPI_Wtick();
00357 }
00358
00359 void mpi_start(int *reqnum, int *ierr)
00360 {
00361 *ierr = AMPI_Start((MPI_Request*) reqnum);
00362 }
00363
00364 void mpi_startall(int *count, int *reqnum, int *ierr)
00365 {
00366 *ierr = AMPI_Startall(*count, (MPI_Request*) reqnum);
00367 }
00368
00369 void mpi_waitall(int *count, int *request, int *status, int *ierr)
00370 {
00371 *ierr = AMPI_Waitall(*count, (MPI_Request*) request, (MPI_Status*) status);
00372 }
00373
00374 void mpi_waitany(int *count, int *request, int *index, int *status, int *ierr)
00375 {
00376 *ierr = AMPI_Waitany(*count, (MPI_Request*) request, index,
00377 (MPI_Status*) status);
00378 }
00379
00380 void mpi_wait(int *request, int *status, int *ierr)
00381 {
00382 *ierr = AMPI_Wait((MPI_Request*) request, (MPI_Status*) status);
00383 }
00384
00385 void mpi_testall(int *count, int *request, int *flag, int *status, int *ierr)
00386 {
00387 *ierr = AMPI_Testall(*count, (MPI_Request*) request, flag,
00388 (MPI_Status*) status);
00389 }
00390
00391 void mpi_waitsome(int *incount, int *array_of_requests, int *outcount, int *array_of_indices, int *array_of_statuses, int *ierr)
00392 {
00393 *ierr = AMPI_Waitsome(*incount, (MPI_Request *)array_of_requests, outcount, array_of_indices, (MPI_Status*) array_of_statuses);
00394 }
00395
00396 void mpi_testsome(int *incount, int *array_of_requests, int *outcount, int *array_of_indices, int *array_of_statuses, int *ierr)
00397 {
00398 *ierr = AMPI_Testsome(*incount, (MPI_Request *)array_of_requests, outcount, array_of_indices, (MPI_Status*) array_of_statuses);
00399 }
00400
00401 void mpi_testany(int *count, int *request, int *index, int *flag, int *status, int *ierr)
00402 {
00403 *ierr = AMPI_Testany(*count, (MPI_Request*) request, index, flag,
00404 (MPI_Status*) status);
00405 }
00406
00407 void mpi_test(int *request, int *flag, int *status, int *ierr)
00408 {
00409 *ierr = AMPI_Test((MPI_Request*) request, flag, (MPI_Status*) status);
00410 }
00411
00412 void mpi_request_free(int *request, int *ierr)
00413 {
00414 *ierr = AMPI_Request_free((MPI_Request *)request);
00415 }
00416
00417 void mpi_cancel(int *request, int *ierr)
00418 {
00419 *ierr = AMPI_Cancel((MPI_Request *)request);
00420 }
00421
00422 void mpi_recv_init(void *buf, int *count, int *type, int *srcpe,
00423 int *tag, int *comm, int *req, int *ierr)
00424 {
00425 *ierr = AMPI_Recv_init(buf,*count,*type,*srcpe,*tag,*comm,(MPI_Request*)req);
00426 }
00427
00428 void mpi_send_init(void *buf, int *count, int *type, int *destpe,
00429 int *tag, int *comm, int *req, int *ierr)
00430 {
00431 *ierr = AMPI_Send_init(buf,*count,*type,*destpe,*tag,*comm,
00432 (MPI_Request*)req);
00433 }
00434
00435 void mpi_type_contiguous(int *count, int *oldtype, int *newtype, int *ierr)
00436 {
00437 *ierr = AMPI_Type_contiguous(*count, *oldtype, newtype);
00438 }
00439
00440 void mpi_type_vector(int *count, int *blocklength, int *stride,
00441 int *oldtype, int* newtype, int *ierr)
00442 {
00443 *ierr = AMPI_Type_vector(*count, *blocklength, *stride, *oldtype, newtype);
00444 }
00445
00446 void mpi_type_hvector(int *count, int *blocklength, int *stride,
00447 int* oldtype, int* newtype, int* ierr)
00448 {
00449 *ierr = AMPI_Type_hvector(*count, *blocklength, *stride, *oldtype, newtype);
00450 }
00451
00452 void mpi_type_indexed(int *count, int* arrBlength, int* arrDisp,
00453 int* oldtype, int* newtype, int* ierr)
00454 {
00455 *ierr = AMPI_Type_indexed(*count, arrBlength, arrDisp, *oldtype, newtype);
00456 }
00457
00458 void mpi_type_hindexed(int* count, int* arrBlength, int* arrDisp,
00459 int* oldtype, int* newtype, int* ierr)
00460 {
00461 *ierr = AMPI_Type_hindexed(*count, arrBlength, arrDisp, *oldtype, newtype);
00462 }
00463
00464 void mpi_type_struct(int* count, int* arrBlength, int* arrDisp,
00465 int* oldtype, int* newtype, int* ierr)
00466 {
00467 *ierr = AMPI_Type_struct(*count, arrBlength, arrDisp, oldtype, newtype);
00468 }
00469
00470
00471 void mpi_type_commit(int *type, int *ierr)
00472 {
00473 *ierr = AMPI_Type_commit(type);
00474 }
00475
00476 void mpi_type_free(int *type, int *ierr)
00477 {
00478 *ierr = AMPI_Type_free(type);
00479 }
00480
00481 void mpi_type_extent(int* type, int* extent, int* ierr)
00482 {
00483 *ierr = AMPI_Type_extent(*type, extent);
00484 }
00485
00486 void mpi_type_size(int* type, int* size, int* ierr)
00487 {
00488 *ierr = AMPI_Type_size(*type, size);
00489 }
00490
00491 void mpi_type_lb(int* datatype, int* displacement, int* ierr)
00492 {
00493 *ierr = AMPI_Type_lb(*datatype, displacement);
00494 }
00495
00496 void mpi_type_ub(int* datatype, int* displacement, int* ierr)
00497 {
00498 *ierr = AMPI_Type_ub(*datatype, displacement);
00499 }
00500
00501 void mpi_address(int* location, int *address, int* ierr)
00502 {
00503 *ierr = AMPI_Address(location, address);
00504 }
00505
00506 void mpi_get_elements(int *status, int* datatype, int *count, int* ierr)
00507 {
00508 *ierr = AMPI_Get_elements((MPI_Status*) status, *datatype, count);
00509 }
00510
00511 void mpi_pack(void *inbuf, int *incount, int *datatype, void *outbuf,
00512 int *outsize, int *position, int *comm, int *ierr)
00513 {
00514 *ierr = AMPI_Pack(inbuf, *incount, (MPI_Datatype)*datatype, outbuf,
00515 *outsize, position, *comm);
00516 }
00517
00518 void mpi_unpack(void *inbuf, int *insize, int *position, void *outbuf,
00519 int *outcount, int *datatype, int *comm, int *ierr)
00520 {
00521 *ierr = AMPI_Unpack(inbuf, *insize, position, outbuf, *outcount,
00522 (MPI_Datatype) *datatype, (MPI_Comm) *comm);
00523 }
00524
00525 void mpi_pack_size(int *incount, int *datatype, int *comm, int *size, int *ierr)
00526 {
00527 *ierr = AMPI_Pack_size(*incount, (MPI_Datatype) *datatype, *comm, size);
00528 }
00529
00530 void mpi_isend(void *buf, int *count, int *datatype, int *dest,
00531 int *tag, int *comm, int *request, int *ierr)
00532 {
00533 *ierr = AMPI_Isend(buf, *count, *datatype, *dest, *tag, *comm, (MPI_Request *)request);
00534 }
00535
00536 void mpi_irecv(void *buf, int *count, int *datatype, int *src,
00537 int *tag, int *comm, int *request, int *ierr)
00538 {
00539 *ierr = AMPI_Irecv(buf, *count, *datatype, *src, *tag, *comm, (MPI_Request *)request);
00540 }
00541
00542 void mpi_allgatherv(void *sendbuf, int *sendcount, int *sendtype,
00543 void *recvbuf, int *recvcounts, int *displs,
00544 int *recvtype, int *comm, int *ierr)
00545 {
00546 *ierr = AMPI_Allgatherv(sendbuf, *sendcount, *sendtype, recvbuf, recvcounts,
00547 displs, *recvtype, *comm);
00548 }
00549
00550 void mpi_allgather(void *sendbuf, int *sendcount, int *sendtype,
00551 void *recvbuf, int *recvcount, int *recvtype,
00552 int *comm, int *ierr)
00553 {
00554 *ierr = AMPI_Allgather(sendbuf, *sendcount, *sendtype, recvbuf, *recvcount,
00555 *recvtype, *comm);
00556 }
00557
00558 void mpi_gatherv(void *sendbuf, int *sendcount, int *sendtype,
00559 void *recvbuf, int *recvcounts, int *displs,
00560 int *recvtype, int *root, int *comm, int *ierr)
00561 {
00562 *ierr = AMPI_Gatherv(sendbuf, *sendcount, *sendtype, recvbuf, recvcounts,
00563 displs, *recvtype, *root, *comm);
00564 }
00565
00566 void mpi_gather(void *sendbuf, int *sendcount, int *sendtype,
00567 void *recvbuf, int *recvcount, int *recvtype,
00568 int *root, int *comm, int *ierr)
00569 {
00570 *ierr = AMPI_Gather(sendbuf, *sendcount, *sendtype, recvbuf, *recvcount,
00571 *recvtype, *root, *comm);
00572 }
00573
00574 void mpi_scatterv(void *sendbuf, int *sendcounts, int *displs, int *sendtype,
00575 void *recvbuf, int *recvcount, int *recvtype, int *root, int *comm, int *ierr)
00576 {
00577 *ierr = AMPI_Scatterv(sendbuf, sendcounts, displs, *sendtype, recvbuf, *recvcount,
00578 *recvtype, *root, *comm);
00579 }
00580
00581 void mpi_scatter(void *sendbuf, int *sendcount, int *sendtype,
00582 void *recvbuf, int *recvcount, int *recvtype,
00583 int *root, int *comm, int *ierr)
00584 {
00585 *ierr = AMPI_Scatter(sendbuf, *sendcount, *sendtype, recvbuf, *recvcount,
00586 *recvtype, *root, *comm);
00587 }
00588
00589 void mpi_alltoallv(void *sendbuf, int *sendcounts, int *sdispls,
00590 int *sendtype, void *recvbuf, int *recvcounts,
00591 int *rdispls, int *recvtype, int *comm, int *ierr)
00592 {
00593 *ierr = AMPI_Alltoallv(sendbuf, sendcounts, sdispls, *sendtype, recvbuf,
00594 recvcounts, rdispls, *recvtype, *comm);
00595 }
00596
00597 void mpi_alltoall(void *sendbuf, int *sendcount, int *sendtype,
00598 void *recvbuf, int *recvcount, int *recvtype,
00599 int *comm, int *ierr)
00600 {
00601 *ierr = AMPI_Alltoall(sendbuf, *sendcount, *sendtype, recvbuf, *recvcount,
00602 *recvtype, *comm);
00603 }
00604
00605 void mpi_iallgather(void *sendbuf, int* sendcount, int* sendtype,
00606 void *recvbuf, int* recvcount, int* recvtype,
00607 int* comm, int* request, int* ierr)
00608 {
00609 *ierr = AMPI_Iallgather(sendbuf, *sendcount, *sendtype, recvbuf, *recvcount,
00610 *recvtype, *comm, (MPI_Request *)request);
00611
00612 }
00613
00614 void mpi_ialltoall(void *sendbuf, int* sendcount, int* sendtype,
00615 void *recvbuf, int* recvcount, int* recvtype,
00616 int* comm, int *request, int* ierr)
00617 {
00618 *ierr = AMPI_Ialltoall(sendbuf, *sendcount, *sendtype,
00619 recvbuf, *recvcount, *recvtype,
00620 *comm, (MPI_Request *)request);
00621 }
00622
00623 void mpi_ireduce(void *sendbuf, void *recvbuf, int* count, int* type,
00624 int* opc, int* root, int* comm, int *request, int* ierr)
00625 {
00626 MPI_Op op = GET_MPI_OP(*opc);
00627 *ierr = AMPI_Ireduce(sendbuf, recvbuf, *count, *type,
00628 op, *root, *comm, (MPI_Request*) request);
00629 }
00630
00631 void mpi_iallreduce(void *inbuf, void *outbuf, int* count, int* type,
00632 int* opc, int* comm, int *request, int* ierr)
00633 {
00634 MPI_Op op = GET_MPI_OP(*opc);
00635 *ierr = AMPI_Iallreduce(inbuf, outbuf, *count, *type,
00636 op, *comm, (MPI_Request*) request);
00637 }
00638 void mpi_reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
00639 int* datatype, int* opc, int* comm, int* ierr)
00640 {
00641 MPI_Op op = GET_MPI_OP(*opc);
00642 *ierr = AMPI_Reduce_scatter(sendbuf, recvbuf, recvcounts,
00643 *datatype, op, *comm);
00644 }
00645
00646 void mpi_scan(void* sendbuf, void* recvbuf, int* count, int* datatype, int* opc, int* comm, int* ierr)
00647 {
00648 MPI_Op op = GET_MPI_OP(*opc);
00649 *ierr = AMPI_Scan(sendbuf,recvbuf,*count,*datatype,op,*comm );
00650 }
00651
00652 void mpi_op_create(int* function, int* commute, int* opc, int* ierr){
00653 MPI_Op op;
00654 *ierr = MPI_Op_create((MPI_User_function *)function, *commute, (MPI_Op *)&op);
00655 GET_MPI_OP(CtvAccess(mpi_opc)++) = op;
00656 *opc = CtvAccess(mpi_opc)-1;
00657 }
00658
00659 void mpi_op_free(int* opc, int* ierr){
00660 MPI_Op op = GET_MPI_OP(*opc);
00661 GET_MPI_OP(*opc) = NULL;
00662 *ierr = MPI_Op_free((MPI_Op *)&op);
00663 }
00664
00665 void mpi_comm_dup(int *comm, int *newcomm, int *ierr)
00666 {
00667 *newcomm = *comm;
00668 *ierr = 0;
00669 }
00670
00671 void mpi_comm_split(int* src, int* color, int* key, int *dest, int *ierr)
00672 {
00673 *ierr = AMPI_Comm_split(*src, *color, *key, dest);
00674 }
00675
00676 void mpi_comm_free(int *comm, int *ierr)
00677 {
00678 *ierr = 0;
00679 }
00680
00681 void mpi_comm_test_inter(int* comm, int* flag, int* ierr)
00682 {
00683 *ierr = AMPI_Comm_test_inter(*comm, flag);
00684 }
00685
00686 void mpi_cart_create(int* comm_old, int* ndims, int *dims, int *periods,
00687 int* reorder, int* comm_cart, int* ierr)
00688 {
00689 *ierr = AMPI_Cart_create(*comm_old, *ndims, dims, periods, *reorder, comm_cart);
00690 }
00691
00692 void mpi_graph_create(int* comm_old, int* nnodes, int *index, int *edges,
00693 int* reorder, int* comm_graph, int* ierr)
00694 {
00695 *ierr = AMPI_Graph_create(*comm_old, *nnodes, index, edges, *reorder, comm_graph);
00696 }
00697
00698 void mpi_topo_test(int* comm, int *status, int* ierr)
00699 {
00700 *ierr = AMPI_Topo_test(*comm, status);
00701 }
00702
00703 void mpi_cart_map(int* comm, int* ndims, int *dims, int *periods,
00704 int *newrank, int* ierr)
00705 {
00706 *ierr = AMPI_Cart_map(*comm, *ndims, dims, periods, newrank);
00707 }
00708
00709 void mpi_graph_map(int* comm, int* nnodes, int *index, int *edges,
00710 int *newrank, int* ierr)
00711 {
00712 *ierr = AMPI_Graph_map(*comm, *nnodes, index, edges, newrank);
00713 }
00714
00715 void mpi_cartdim_get(int* comm, int *ndims, int* ierr)
00716 {
00717 *ierr = AMPI_Cartdim_get(*comm, ndims);
00718 }
00719
00720 void mpi_cart_get(int* comm, int* maxdims, int *dims, int *periods,
00721 int *coords, int* ierr)
00722 {
00723 *ierr = AMPI_Cart_get(*comm, *maxdims, dims, periods, coords);
00724 }
00725
00726 void mpi_cart_rank(int* comm, int *coords, int *rank, int* ierr)
00727 {
00728 *ierr = AMPI_Cart_rank(*comm, coords, rank);
00729 }
00730
00731 void mpi_cart_coords(int* comm, int* rank, int* maxdims, int *coords, int* ierr)
00732 {
00733 *ierr = AMPI_Cart_coords(*comm, *rank, *maxdims, coords);
00734 }
00735
00736 void mpi_cart_shift(int* comm, int* direction, int* disp, int *rank_source,
00737 int *rank_dest, int* ierr)
00738 {
00739 *ierr = AMPI_Cart_shift(*comm, *direction, *disp, rank_source, rank_dest);
00740 }
00741
00742 void mpi_graphdims_get(int* comm, int *nnodes, int *nedges, int* ierr)
00743 {
00744 *ierr = AMPI_Graphdims_get(*comm, nnodes, nedges);
00745 }
00746
00747 void mpi_graph_get(int* comm, int *maxindex, int *maxedges, int *index,
00748 int *edges, int* ierr)
00749 {
00750 *ierr = AMPI_Graph_get(*comm, *maxindex, *maxedges, index, edges);
00751 }
00752
00753 void mpi_graph_neighbors_count(int* comm, int *rank, int *nneighbors, int* ierr)
00754 {
00755 *ierr = AMPI_Graph_neighbors_count(*comm, *rank, nneighbors);
00756 }
00757
00758 void mpi_graph_neighbors(int* comm, int *rank, int *maxneighbors,
00759 int *neighbors, int* ierr)
00760 {
00761 *ierr = AMPI_Graph_neighbors(*comm, *rank, *maxneighbors, neighbors);
00762 }
00763
00764 void mpi_dims_create(int *nnodes, int *ndims, int *dims, int* ierr)
00765 {
00766 *ierr = AMPI_Dims_create(*nnodes, *ndims, dims);
00767 }
00768
00769 void mpi_cart_sub(int* comm, int *remain_dims, int* newcomm, int* ierr)
00770 {
00771 *ierr = AMPI_Cart_sub(*comm, remain_dims, newcomm);
00772 }
00773
00774 void mpi_get_processor_name(char* name, int *resultlen, int *ierr)
00775 {
00776 *ierr = AMPI_Get_processor_name(name, resultlen);
00777 }
00778
00779 void mpi_errhandler_create(int *function, int *errhandler, int *ierr){ *ierr = 0; }
00780 void mpi_errhandler_set(int* comm, int* errhandler, int *ierr){ *ierr = 0; }
00781 void mpi_errhandler_get(int* comm, int *errhandler, int *ierr){ *ierr = 0; }
00782 void mpi_errhandler_free(int *errhandler, int *ierr){ *ierr = 0; }
00783 void mpi_error_string(int* errorcode, char *string, int *resultlen, int *ierr)
00784 {
00785 *ierr = AMPI_Error_string(*errorcode, string, resultlen);
00786 }
00787 void mpi_error_class(int* errorcode, int *errorclass, int *ierr)
00788 {
00789 *ierr = AMPI_Error_class(*errorcode, errorclass);
00790 }
00791
00792 void mpi_group_size(int* group, int* size, int* ierror){
00793 *ierror = AMPI_Group_size(*group, size);
00794 }
00795 void mpi_group_rank(int* group, int* rank, int* ierror){
00796 *ierror = AMPI_Group_rank(*group, rank);
00797 }
00798 void mpi_group_translate_ranks(int* group1, int* n, int* ranks1, int* group2, int* ranks2, int* ierror){
00799 *ierror = AMPI_Group_translate_ranks(*group1, *n, ranks1, *group2, ranks2);
00800 }
00801 void mpi_group_compare(int* group1, int* group2, int* result, int* ierror){
00802 *ierror = AMPI_Group_compare(*group1, *group2, result);
00803 }
00804 void mpi_comm_group(int* comm, int* group, int* ierror){
00805 *ierror = AMPI_Comm_group(*comm, group);
00806 }
00807 void mpi_group_union(int* group1, int* group2, int* newgroup, int* ierror){
00808 *ierror = AMPI_Group_union(*group1, *group2, newgroup);
00809 }
00810 void mpi_group_intersection(int* group1, int* group2, int* newgroup, int* ierror){
00811 *ierror = AMPI_Group_intersection(*group1, *group2, newgroup);
00812 }
00813 void mpi_group_difference(int* group1, int* group2, int* newgroup, int* ierror){
00814 *ierror = AMPI_Group_difference(*group1, *group2, newgroup);
00815 }
00816 void mpi_group_incl(int* group, int* n, int* ranks, int* newgroup, int* ierror){
00817 *ierror = AMPI_Group_incl(*group, *n, ranks, newgroup);
00818 }
00819 void mpi_group_excl(int* group, int* n, int* ranks, int* newgroup, int* ierror){
00820 *ierror = AMPI_Group_excl(*group, *n, ranks, newgroup);
00821 }
00822 void mpi_group_range_incl(int* group, int* n, int ranges[][3], int* newgroup, int* ierror){
00823 *ierror = AMPI_Group_range_incl(*group, *n, ranges, newgroup);
00824 }
00825 void mpi_group_range_excl(int* group,int* n, int ranges[][3], int* newgroup, int* ierror){
00826 *ierror = AMPI_Group_range_excl(*group, *n, ranges, newgroup);
00827 }
00828 void mpi_group_free(int* group, int* ierror){
00829 *ierror = 0;
00830 }
00831 void mpi_comm_create(int* comm, int* group, int* newcomm, int* ierror){
00832 *ierror = AMPI_Comm_create(*comm, *group, newcomm);
00833 }
00834
00835 void mpi_abort(int *comm, int *errorcode, int *ierr)
00836 {
00837 *ierr = AMPI_Abort(*comm, *errorcode);
00838 }
00839
00840 void mpi_get_count(int *sts, int *dtype, int *cnt, int *ierr)
00841 {
00842 *ierr = AMPI_Get_count((MPI_Status*) sts, *dtype, cnt);
00843 }
00844
00845 void mpi_print(char *str, int *len)
00846 {
00847 char *buf = new char[*len+1];
00848 memcpy(buf, str, *len);
00849 buf[*len] = '\0';
00850 AMPI_Print(buf);
00851 delete [] buf;
00852 }
00853
00854 void mpi_migrate(void)
00855 {
00856 AMPI_Migrate();
00857 }
00858
00859 void mpi_setmigratable(int *comm, int *mig)
00860 {
00861 AMPI_Setmigratable(*comm, * mig);
00862 }
00863
00864 void mpi_migrateto(int *destPE)
00865 {
00866 AMPI_Migrateto(*destPE);
00867 }
00868
00869 void mpi_start_measure()
00870 {
00871 AMPI_Start_measure();
00872 }
00873
00874 void mpi_stop_measure()
00875 {
00876 AMPI_Stop_measure();
00877 }
00878
00879 void mpi_set_load(double *load)
00880 {
00881 AMPI_Set_load(*load);
00882 }
00883
00884 void mpi_register(void *d, MPI_PupFn f)
00885 {
00886 AMPI_Register(d,f);
00887 }
00888
00889 void mpi_get_userdata(int* dn, void *data)
00890 {
00891 data = AMPI_Get_userdata(*dn);
00892 }
00893
00894 void mpi_checkpoint(char *dname){
00895 AMPI_Checkpoint(dname);
00896 }
00897
00898 void mpi_memcheckpoint(){
00899 AMPI_MemCheckpoint();
00900 }
00901
00902 void mpi_comm_remote_size(int *comm, int *size, int *ierr){
00903 *ierr = AMPI_Comm_remote_size(*comm, size);
00904 }
00905
00906 void mpi_comm_remote_group(int *comm, int *group, int *ierr){
00907 *ierr = AMPI_Comm_remote_group(*comm, group);
00908 }
00909
00910 void mpi_intercomm_create(int *local_comm, int *local_leader, int *peer_comm, int *remote_leader, int *tag, int *newintercomm, int *ierr){
00911 *ierr = AMPI_Intercomm_create(*local_comm, *local_leader, *peer_comm, *remote_leader, *tag, newintercomm);
00912 }
00913
00914 void mpi_intercomm_merge(int *intercomm, int *high, int *newintracomm, int *ierr){
00915 *ierr = AMPI_Intercomm_merge(*intercomm, *high, newintracomm);
00916 }
00917
00918 void mpi_keyval_create(MPI_Copy_function *copy_fn, MPI_Delete_function *delete_fn, int *keyval, void* extra_state, int *ierr) {
00919 *ierr = AMPI_Keyval_create(copy_fn, delete_fn, keyval, extra_state);
00920 }
00921
00922 void mpi_keyval_free(int *keyval, int *ierr){
00923 *ierr = AMPI_Keyval_free(keyval);
00924 }
00925
00926 void mpi_attr_put(int *comm, int *keyval, void* attribute_val, int *ierr){
00927 *ierr = AMPI_Attr_put(*comm, *keyval, attribute_val);
00928 }
00929
00930 void mpi_attr_get(int *comm, int *keyval, void *attribute_val, int *flag, int *ierr){
00931 *ierr = AMPI_Attr_get(*comm, *keyval, attribute_val, flag);
00932 }
00933
00934 void mpi_attr_delete(int *comm, int *keyval, int *ierr) {
00935 *ierr = AMPI_Attr_delete(*comm, *keyval);
00936 }
00937
00938 void mpi_type_get_envelope(int *datatype, int *num_integers, int *num_addresses,
00939 int *num_datatypes, int *combiner, int *ierr){
00940 *ierr = AMPI_Type_get_envelope(*datatype, num_integers, num_addresses, num_datatypes, combiner);
00941 }
00942
00943 void mpi_type_get_contents(int *datatype, int *max_integers, int *max_addresses,
00944 int *max_datatypes, int array_of_integers[], int array_of_addresses[],
00945 int array_of_datatypes[], int *ierr){
00946 *ierr = AMPI_Type_get_contents(*datatype, *max_integers, *max_addresses, *max_datatypes, array_of_integers,
00947 array_of_addresses, array_of_datatypes);
00948 }
00949
00950
00951 void mpi_win_create(void *base, int *size, int *disp_unit,
00952 int *info, int *comm, MPI_Win *newwin, int *ierr) {
00953 *ierr = AMPI_Win_create(base, *size, *disp_unit, *info, *comm, newwin);
00954 }
00955
00956 void mpi_win_free(int *win, int *ierr) {
00957 *ierr = AMPI_Win_free(win);
00958 }
00959
00960 void mpi_win_delete_attr(int win, int *key, int *ierr){
00961 *ierr = AMPI_Win_delete_attr(win, *key);
00962 }
00963
00964 void mpi_win_get_group(int win, int *group, int *ierr){
00965 *ierr = AMPI_Win_get_group(win, group);
00966 }
00967
00968 void mpi_win_set_name(int win, char *name, int *ierr){
00969 *ierr = AMPI_Win_set_name(win, name);
00970 }
00971
00972 void mpi_win_get_name(int win, char *name, int *length, int *ierr){
00973 *ierr = AMPI_Win_get_name(win, name, length);
00974 }
00975
00976 void mpi_win_fence(int *assertion, int win, int *ierr){
00977 *ierr = AMPI_Win_fence(*assertion, win);
00978 }
00979
00980 void mpi_win_lock(int *lock_type, int *rank, int *assert, int win, int *ierr){
00981 *ierr = AMPI_Win_lock(*lock_type, *rank, *assert, win);
00982 }
00983
00984 void mpi_win_unlock(int *rank, int win, int *ierr){
00985 *ierr = AMPI_Win_unlock(*rank, win);
00986 }
00987
00988 void mpi_win_post(int *group, int *assertion, int win, int *ierr){
00989 *ierr = AMPI_Win_post(*group, *assertion, win);
00990 }
00991
00992 void mpi_win_wait(int win, int *ierr){
00993 *ierr = AMPI_Win_wait(win);
00994 }
00995
00996 void mpi_win_start(int *group, int *assertion, int win, int *ierr){
00997 *ierr = AMPI_Win_start(*group, *assertion, win);
00998 }
00999
01000 void mpi_win_complete(int win, int *ierr){
01001 *ierr = AMPI_Win_complete(win);
01002 }
01003
01004 void mpi_alloc_mem(int *size, int *info, void *baseptr, int *ierr){
01005 *ierr = AMPI_Alloc_mem(*size, *info, baseptr);
01006 }
01007
01008 void mpi_free_mem(void *base, int *ierr){
01009 *ierr = AMPI_Free_mem(base);
01010 }
01011
01012 void mpi_put(void *orgaddr, int *orgcnt, int *orgtype, int *rank,
01013 int *targdisp, int *targcnt, int *targtype, int win, int *ierr){
01014 *ierr = AMPI_Put(orgaddr, *orgcnt, *orgtype, *rank, *targdisp, *targcnt, *targtype, win);
01015 }
01016
01017 void mpi_get(void *orgaddr, int *orgcnt, int *orgtype, int *rank,
01018 int *targdisp, int *targcnt, int *targtype, int win, int *ierr){
01019 *ierr = AMPI_Get(orgaddr, *orgcnt, *orgtype, *rank, *targdisp, *targcnt, *targtype, win);
01020 }
01021
01022 void mpi_accumulate(void *orgaddr, int *orgcnt, int *orgtype, int *rank,
01023 int *targdisp, int *targcnt, int *targtype,
01024 int *opc, int win, int *ierr){
01025 MPI_Op op = GET_MPI_OP(*opc);
01026 *ierr = AMPI_Accumulate(orgaddr, *orgcnt, *orgtype, *rank, *targdisp, *targcnt, *targtype, op, win);
01027 }
01028
01029 void mpi_info_create(int* info, int* ierr){
01030 *ierr = MPI_Info_create(info);
01031 }
01032 void mpi_info_set(int* info, char *key, char *value, int* ierr){
01033 *ierr = MPI_Info_set(*info, key, value);
01034 }
01035 void mpi_info_delete(int* info, char* key, int* ierr){
01036 *ierr = MPI_Info_delete(*info, key);
01037 }
01038 void mpi_info_get(int* info, char *key, int *valuelen, char *value, int *flag, int* ierr){
01039 *ierr = MPI_Info_get(*info, key, *valuelen, value, flag);
01040 }
01041 void mpi_info_get_valuelen(int* info, char *key, int *valuelen, int *flag, int* ierr){
01042 *ierr = MPI_Info_get_valuelen(*info, key, valuelen, flag);
01043 }
01044 void mpi_info_get_nkeys(int* info, int *nkeys, int* ierr){
01045 *ierr = MPI_Info_get_nkeys(*info, nkeys);
01046 }
01047 void mpi_info_get_nthkey(int* info, int *n, char *key, int* ierr){
01048 *ierr = MPI_Info_get_nthkey(*info, *n, key);
01049 }
01050 void mpi_info_dup(int* info, int* newinfo, int* ierr){
01051 *ierr = MPI_Info_dup(*info, newinfo);
01052 }
01053 void mpi_info_free(int* info, int* ierr){
01054 *ierr = MPI_Info_free(info);
01055 }
01056
01057 void mpi_info_maxmemory(){
01058 CkPrintf("MaxMemory %ld\n", CmiMaxMemoryUsage());
01059 }
01060
01061 void mpi_info_memory(){
01062 CkPrintf("Memory %ld\n", CmiMemoryUsage());
01063 }
01064
01065 #define begintracebigsim FTN_NAME (BEGINTRACEBIGSIM , begintracebigsim)
01066 #define endtracebigsim FTN_NAME (ENDTRACEBIGSIM , endtracebigsim)
01067 void begintracebigsim(char* msg){
01068 beginTraceBigSim(msg);
01069 }
01070 void endtracebigsim(char* msg, char* param){
01071 endTraceBigSim(msg, param);
01072 }
01073
01074 }
01075