3 int MPI_Init(int *argc, char ***argv)
17 // right now this just exits the current node, should send abort signal to all
18 // hosts in the communicator;
19 int MPI_Abort(MPI_Comm comm, int errorcode)
25 int MPI_Comm_size(MPI_Comm comm, int *size)
27 int retval = MPI_SUCCESS;
32 retval = MPI_ERR_COMM;
33 } else if (NULL == size) {
44 int MPI_Comm_rank(MPI_Comm comm, int *rank)
46 int retval = MPI_SUCCESS;
51 retval = MPI_ERR_COMM;
52 } else if (NULL == rank) {
55 *rank = smpi_mpi_comm_rank_self(comm);
63 int MPI_Type_size(MPI_Datatype datatype, size_t *size)
65 int retval = MPI_SUCCESS;
69 if (NULL == datatype) {
70 retval = MPI_ERR_TYPE;
71 } else if (NULL == size) {
74 *size = datatype->size;
82 int MPI_Barrier(MPI_Comm comm)
84 int retval = MPI_SUCCESS;
89 retval = MPI_ERR_COMM;
91 retval = smpi_mpi_barrier(comm);
99 int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request *request)
101 int retval = MPI_SUCCESS;
106 dst = smpi_mpi_comm_rank_self(comm);
107 if (NULL == request) {
108 retval = MPI_ERR_ARG;
110 retval = smpi_create_request(buf, count, datatype, src, dst, tag, comm, request);
111 if (NULL != *request && MPI_SUCCESS == retval) {
112 retval = smpi_mpi_irecv(*request);
121 int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status *status)
123 int retval = MPI_SUCCESS;
125 smpi_mpi_request_t request;
129 dst = smpi_mpi_comm_rank_self(comm);
130 retval = smpi_create_request(buf, count, datatype, src, dst, tag, comm, &request);
132 if (NULL != request && MPI_SUCCESS == retval) {
133 retval = smpi_mpi_irecv(request);
134 if (MPI_SUCCESS == retval) {
135 retval = smpi_mpi_wait(request, status);
137 xbt_mallocator_release(smpi_global->request_mallocator, request);
145 int MPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request *request)
147 int retval = MPI_SUCCESS;
152 src = smpi_mpi_comm_rank_self(comm);
153 if (NULL == request) {
154 retval = MPI_ERR_ARG;
156 retval = smpi_create_request(buf, count, datatype, src, dst, tag, comm, request);
157 if (NULL != *request && MPI_SUCCESS == retval) {
158 retval = smpi_mpi_isend(*request);
167 int MPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
169 int retval = MPI_SUCCESS;
171 smpi_mpi_request_t request;
175 src = smpi_mpi_comm_rank_self(comm);
176 retval = smpi_create_request(buf, count, datatype, src, dst, tag, comm, &request);
177 if (NULL != request && MPI_SUCCESS == retval) {
178 retval = smpi_mpi_isend(request);
179 if (MPI_SUCCESS == retval) {
180 smpi_mpi_wait(request, MPI_STATUS_IGNORE);
182 xbt_mallocator_release(smpi_global->request_mallocator, request);