- int retval = MPI_SUCCESS;
- int src = 0;
- smpi_mpi_request_t request;
-
- smpi_bench_end();
-
- retval = smpi_create_request(buf, count, datatype, src, dst, tag, comm, &request);
- if (NULL != request && MPI_SUCCESS == retval) {
- retval = smpi_mpi_isend(request);
- if (MPI_SUCCESS == retval) {
- smpi_mpi_wait(request, MPI_STATUS_IGNORE);
- }
- xbt_mallocator_release(smpi_global->request_mallocator, request);
- }
-
- smpi_bench_begin();
-
- return retval;
-}
-
-// FIXME: needs to return null in event of MPI_UNDEFINED color...
-int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *comm_out)
-{
- int retval = MPI_SUCCESS;
-
- int index, rank;
- smpi_mpi_request_t request;
- int colorkey[2];
- smpi_mpi_status_t status;
-
- smpi_bench_end();
-
- // FIXME: need to test parameters
-
- index = smpi_host_index();
- rank = comm->index_to_rank_map[index];
-
- if (0 == rank) {
- int *colors = xbt_new(int, comm->size);
- int *keys = xbt_new(int, comm->size);
- int i, j, k;
- smpi_mpi_communicator_t tempcomm = NULL;
- int colortmp;
- int keycount;
- int *keystmp = xbt_new(int, comm->size);
- int *rankstmp = xbt_new(int, comm->size);
- int tmpval;
- int indextmp;
-
- colors[0] = color;
- keys[0] = key;
-
- // FIXME: not efficient
- for (i = 1; i < comm->size; i++) {
- retval = smpi_create_request(colorkey, 2, MPI_INT, MPI_ANY_SOURCE, rank, MPI_ANY_TAG, comm, &request);
- smpi_mpi_irecv(request);
- smpi_mpi_wait(request, &status);
- xbt_mallocator_release(smpi_global->request_mallocator, request);
- colors[i] = colorkey[0];
- keys[i] = colorkey[1];
- }
-
- for (i = 0; i < comm->size; i++) {
- if (-1 == colors[i]) {
- continue;
- }
- colortmp = colors[i];
- keycount = 0;
- for (j = i; j < comm->size; j++) {
- if(colortmp == colors[j]) {
- colors[j] = -1;
- keystmp[keycount] = keys[j];
- rankstmp[keycount] = j;
- keycount++;
- }
- }
- if (0 < keycount) {
- // FIXME: yes, mock me, bubble sort...
- for (j = 0; j < keycount; j++) {
- for (k = keycount - 1; k > j; k--) {
- if (keystmp[k] < keystmp[k - 1]) {
- tmpval = keystmp[k];
- keystmp[k] = keystmp[k - 1];
- keystmp[k - 1] = tmpval;
-
- tmpval = rankstmp[k];
- rankstmp[k] = rankstmp[k - 1];
- rankstmp[k - 1] = tmpval;
- }
- }
- }
- tempcomm = xbt_new(s_smpi_mpi_communicator_t, 1);
- tempcomm->barrier_count = 0;
- tempcomm->barrier_mutex = SIMIX_mutex_init();
- tempcomm->barrier_cond = SIMIX_cond_init();
- tempcomm->rank_to_index_map = xbt_new(int, keycount);
- tempcomm->index_to_rank_map = xbt_new(int, smpi_global->host_count);
- for (j = 0; j < smpi_global->host_count; j++) {
- tempcomm->index_to_rank_map[j] = -1;
- }
- for (j = 0; j < keycount; j++) {
- indextmp = comm->rank_to_index_map[rankstmp[j]];
- tempcomm->rank_to_index_map[j] = indextmp;
- tempcomm->index_to_rank_map[indextmp] = j;
- }
- for (j = 0; j < keycount; j++) {
- retval = smpi_create_request(&j, 1, MPI_INT, 0, rankstmp[j], 0, comm, &request);
- request->data = tempcomm;
- smpi_mpi_isend(request);
- smpi_mpi_wait(request, &status);
- xbt_mallocator_release(smpi_global->request_mallocator, request);
- }
- }
- }
- } else {
- colorkey[0] = color;
- colorkey[1] = key;
- retval = smpi_create_request(colorkey, 2, MPI_INT, rank, 0, 0, comm, &request);
- smpi_mpi_isend(request);
- smpi_mpi_wait(request, &status);
- xbt_mallocator_release(smpi_global->request_mallocator, request);
- retval = smpi_create_request(colorkey, 1, MPI_INT, 0, rank, 0, comm, &request);
- smpi_mpi_irecv(request);
- smpi_mpi_wait(request, &status);
- comm_out = request->data;
- }
-
- smpi_bench_begin();
-
- return retval;
+ return PMPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
+}
+
+int MPI_Scan(void *sendbuf, void *recvbuf, int count,
+ MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+{
+ return PMPI_Scan(sendbuf, recvbuf, count, datatype, op, comm);
+}
+
+int MPI_Reduce_scatter(void *sendbuf, void *recvbuf, int *recvcounts,
+ MPI_Datatype datatype, MPI_Op op, MPI_Comm comm)
+{
+ return PMPI_Reduce_scatter(sendbuf, recvbuf, recvcounts, datatype, op, comm);
+}
+
+int MPI_Alltoall(void *sendbuf, int sendcount, MPI_Datatype sendtype,
+ void *recvbuf, int recvcount, MPI_Datatype recvtype,
+ MPI_Comm comm)
+{
+ return PMPI_Alltoall(sendbuf, sendcount, sendtype,
+ recvbuf, recvcount, recvtype,
+ comm);
+}
+
+int MPI_Alltoallv(void *sendbuf, int *sendcounts, int *senddisps,
+ MPI_Datatype sendtype, void *recvbuf, int *recvcounts,
+ int *recvdisps, MPI_Datatype recvtype, MPI_Comm comm)
+{
+ return PMPI_Alltoallv(sendbuf, sendcounts, senddisps, sendtype,
+ recvbuf, recvcounts, recvdisps, recvtype,
+ comm);
+}
+
+
+int MPI_Get_processor_name(char *name, int *resultlen)
+{
+ return PMPI_Get_processor_name(name, resultlen);
+}
+
+int MPI_Get_count(MPI_Status * status, MPI_Datatype datatype, int *count)
+{
+ return PMPI_Get_count(status, datatype, count);
+}
+
+int MPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
+ return PMPI_Pack_size(incount, datatype, comm, size);
+}
+
+int MPI_Cart_coords(MPI_Comm comm, int rank, int maxdims, int* coords) {
+ return PMPI_Cart_coords(comm, rank, maxdims, coords);
+}
+
+int MPI_Cart_create(MPI_Comm comm_old, int ndims, int* dims, int* periods, int reorder, MPI_Comm* comm_cart) {
+ return PMPI_Cart_create(comm_old, ndims, dims, periods, reorder, comm_cart);
+}
+
+int MPI_Cart_get(MPI_Comm comm, int maxdims, int* dims, int* periods, int* coords) {
+ return PMPI_Cart_get(comm, maxdims, dims, periods, coords);
+}
+
+int MPI_Cart_map(MPI_Comm comm_old, int ndims, int* dims, int* periods, int* newrank) {
+ return PMPI_Cart_map(comm_old, ndims, dims, periods, newrank);
+}
+
+int MPI_Cart_rank(MPI_Comm comm, int* coords, int* rank) {
+ return PMPI_Cart_rank(comm, coords, rank);
+}
+
+int MPI_Cart_shift(MPI_Comm comm, int direction, int displ, int* source, int* dest) {
+ return PMPI_Cart_shift(comm, direction, displ, source, dest);
+}
+
+int MPI_Cart_sub(MPI_Comm comm, int* remain_dims, MPI_Comm* comm_new) {
+ return PMPI_Cart_sub(comm, remain_dims, comm_new);
+}
+
+int MPI_Cartdim_get(MPI_Comm comm, int* ndims) {
+ return PMPI_Cartdim_get(comm, ndims);
+}
+
+int MPI_Graph_create(MPI_Comm comm_old, int nnodes, int* index, int* edges, int reorder, MPI_Comm* comm_graph) {
+ return PMPI_Graph_create(comm_old, nnodes, index, edges, reorder, comm_graph);
+}
+
+int MPI_Graph_get(MPI_Comm comm, int maxindex, int maxedges, int* index, int* edges) {
+ return PMPI_Graph_get(comm, maxindex, maxedges, index, edges);
+}
+
+int MPI_Graph_map(MPI_Comm comm_old, int nnodes, int* index, int* edges, int* newrank) {
+ return PMPI_Graph_map(comm_old, nnodes, index, edges, newrank);
+}
+
+int MPI_Graph_neighbors(MPI_Comm comm, int rank, int maxneighbors, int* neighbors) {
+ return PMPI_Graph_neighbors(comm, rank, maxneighbors, neighbors);
+}
+
+int MPI_Graph_neighbors_count(MPI_Comm comm, int rank, int* nneighbors) {
+ return PMPI_Graph_neighbors_count(comm, rank, nneighbors);
+}
+
+int MPI_Graphdims_get(MPI_Comm comm, int* nnodes, int* nedges) {
+ return PMPI_Graphdims_get(comm, nnodes, nedges);
+}
+
+int MPI_Topo_test(MPI_Comm comm, int* top_type) {
+ return PMPI_Topo_test(comm, top_type);
+}
+
+int MPI_Error_class(int errorcode, int* errorclass) {
+ return PMPI_Error_class(errorcode, errorclass);
+}
+
+int MPI_Errhandler_create(MPI_Handler_function* function, MPI_Errhandler* errhandler) {
+ return PMPI_Errhandler_create(function, errhandler);
+}
+
+int MPI_Errhandler_free(MPI_Errhandler* errhandler) {
+ return PMPI_Errhandler_free(errhandler);
+}
+
+int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler* errhandler) {
+ return PMPI_Errhandler_get(comm, errhandler);
+}
+
+int MPI_Error_string(int errorcode, char* string, int* resultlen) {
+ return PMPI_Error_string(errorcode, string, resultlen);
+}
+
+int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler) {
+ return PMPI_Errhandler_set(comm, errhandler);
+}
+
+int MPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* newtype) {
+ return PMPI_Type_contiguous(count, old_type, newtype);
+}
+
+int MPI_Cancel(MPI_Request* request) {
+ return PMPI_Cancel(request);
+}
+
+int MPI_Buffer_attach(void* buffer, int size) {
+ return PMPI_Buffer_attach(buffer, size);
+}
+
+int MPI_Buffer_detach(void* buffer, int* size) {
+ return PMPI_Buffer_detach(buffer, size);
+}
+
+int MPI_Testsome(int incount, MPI_Request* requests, int* outcount, int* indices, MPI_Status* statuses) {
+ return PMPI_Testsome(incount, requests, outcount, indices, statuses);
+}
+
+int MPI_Comm_test_inter(MPI_Comm comm, int* flag) {
+ return PMPI_Comm_test_inter(comm, flag);
+}
+
+int MPI_Unpack(void* inbuf, int insize, int* position, void* outbuf, int outcount, MPI_Datatype type, MPI_Comm comm) {
+ return PMPI_Unpack(inbuf, insize, position, outbuf, outcount, type, comm);
+}
+
+int MPI_Type_commit(MPI_Datatype* datatype) {
+ return PMPI_Type_commit(datatype);
+}
+
+int MPI_Type_hindexed(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
+ return PMPI_Type_hindexed(count, blocklens, indices, old_type, newtype);
+}
+
+int MPI_Type_hvector(int count, int blocklen, MPI_Aint stride, MPI_Datatype old_type, MPI_Datatype* newtype) {
+ return PMPI_Type_hvector(count, blocklen, stride, old_type, newtype);
+}
+
+int MPI_Type_indexed(int count, int* blocklens, int* indices, MPI_Datatype old_type, MPI_Datatype* newtype) {
+ return PMPI_Type_indexed(count, blocklens, indices, old_type, newtype);
+}
+
+int MPI_Type_struct(int count, int* blocklens, MPI_Aint* indices, MPI_Datatype* old_types, MPI_Datatype* newtype) {
+ return PMPI_Type_struct(count, blocklens, indices, old_types, newtype);
+}
+
+int MPI_Type_vector(int count, int blocklen, int stride, MPI_Datatype old_type, MPI_Datatype* newtype) {
+ return PMPI_Type_vector(count, blocklen, stride, old_type, newtype);
+}
+
+int MPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
+ return PMPI_Ssend(buf, count, datatype, dest, tag, comm);
+}
+
+int MPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Ssend_init(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm* comm_out) {
+ return PMPI_Intercomm_create(local_comm, local_leader, peer_comm, remote_leader, tag, comm_out);
+}
+
+int MPI_Intercomm_merge(MPI_Comm comm, int high, MPI_Comm* comm_out) {
+ return PMPI_Intercomm_merge(comm, high, comm_out);
+}
+
+int MPI_Bsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
+ return PMPI_Bsend(buf, count, datatype, dest, tag, comm);
+}
+
+int MPI_Bsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Bsend_init(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Ibsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Ibsend(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group* group) {
+ return PMPI_Comm_remote_group(comm, group);
+}
+
+int MPI_Comm_remote_size(MPI_Comm comm, int* size) {
+ return PMPI_Comm_remote_size(comm, size);
+}
+
+int MPI_Issend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Issend(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
+ return PMPI_Probe(source, tag, comm, status);
+}
+
+int MPI_Attr_delete(MPI_Comm comm, int keyval) {
+ return PMPI_Attr_delete(comm, keyval);
+}
+
+int MPI_Attr_get(MPI_Comm comm, int keyval, void* attr_value, int* flag) {
+ return PMPI_Attr_get(comm, keyval, attr_value, flag);
+}
+
+int MPI_Attr_put(MPI_Comm comm, int keyval, void* attr_value) {
+ return PMPI_Attr_put(comm, keyval, attr_value);
+}
+
+int MPI_Rsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm) {
+ return PMPI_Rsend(buf, count, datatype, dest, tag, comm);
+}
+
+int MPI_Rsend_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Rsend_init(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Irsend(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request) {
+ return PMPI_Irsend(buf, count, datatype, dest, tag, comm, request);
+}
+
+int MPI_Keyval_create(MPI_Copy_function* copy_fn, MPI_Delete_function* delete_fn, int* keyval, void* extra_state) {
+ return PMPI_Keyval_create(copy_fn, delete_fn, keyval, extra_state);
+}
+
+int MPI_Keyval_free(int* keyval) {
+ return PMPI_Keyval_free(keyval);
+}
+
+int MPI_Test_cancelled(MPI_Status* status, int* flag) {
+ return PMPI_Test_cancelled(status, flag);
+}
+
+int MPI_Pack(void* inbuf, int incount, MPI_Datatype type, void* outbuf, int outcount, int* position, MPI_Comm comm) {
+ return PMPI_Pack(inbuf, incount, type, outbuf, outcount, position, comm);
+}
+
+int MPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses) {
+ return PMPI_Testall(count, requests, flag, statuses);
+}
+
+int MPI_Get_elements(MPI_Status* status, MPI_Datatype datatype, int* elements) {
+ return PMPI_Get_elements(status, datatype, elements);
+}
+
+int MPI_Dims_create(int nnodes, int ndims, int* dims) {
+ return PMPI_Dims_create(nnodes, ndims, dims);
+}
+
+int MPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
+ return PMPI_Iprobe(source, tag, comm, flag, status);
+}
+
+int MPI_Initialized(int* flag) {
+ return PMPI_Initialized(flag);