+ request->match = MPI_REQUEST_NULL;
+ request->flags = flags;
+ if(request->size <= EAGER_LIMIT) {
+ request->ack = MPI_REQUEST_NULL;
+ } else {
+ request->ack = xbt_new(s_smpi_mpi_request_t, 1);
+ request->ack->buf = NULL;
+ request->ack->size = 0;
+ request->ack->src = dst;
+ request->ack->dst = src;
+ request->ack->tag = RDV_TAG;
+ request->ack->comm = comm;
+ request->ack->rdv = NULL;
+ request->ack->pair = NULL;
+ request->ack->complete = 0;
+ request->ack->match = MPI_REQUEST_NULL;
+ request->ack->flags = NON_PERSISTENT | ((request->flags & RECV) == RECV ? SEND : RECV);
+ smpi_mpi_start(request->ack);
+ }
+ return request;
+}
+
+/* MPI Low level calls */
+MPI_Request smpi_mpi_send_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
+ MPI_Request request = build_request(buf, count, datatype, smpi_comm_rank(comm), dst, tag, comm, PERSISTENT | SEND);
+
+ return request;
+}
+
+MPI_Request smpi_mpi_recv_init(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
+ MPI_Request request = build_request(buf, count, datatype, src, smpi_comm_rank(comm), tag, comm, PERSISTENT | RECV);
+
+ return request;
+}
+
+void smpi_mpi_start(MPI_Request request) {
+ xbt_assert0(request->complete == 0, "Cannot start a non-finished communication");
+ if(request->size > EAGER_LIMIT) {
+ print_request("RDV ack", request->ack);
+ smpi_mpi_wait(&request->ack, MPI_STATUS_IGNORE);
+ }
+ if((request->flags & RECV) == RECV) {
+ smpi_process_post_recv(request);
+ print_request("New recv", request);
+ request->pair = SIMIX_network_irecv(request->rdv, request->buf, &request->size);
+ } else {
+ smpi_process_post_send(request->comm, request); // FIXME
+ print_request("New send", request);
+ request->pair = SIMIX_network_isend(request->rdv, request->size, -1.0, request->buf, request->size, NULL);
+ }
+}
+
+void smpi_mpi_startall(int count, MPI_Request* requests) {
+ int i;
+
+ for(i = 0; i < count; i++) {
+ smpi_mpi_start(requests[i]);
+ }
+}
+
+void smpi_mpi_request_free(MPI_Request* request) {
+ xbt_free(*request);
+ *request = MPI_REQUEST_NULL;
+}
+
+MPI_Request smpi_isend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
+ MPI_Request request = build_request(buf, count, datatype, smpi_comm_rank(comm), dst, tag, comm, NON_PERSISTENT | SEND);
+
+ return request;
+}
+
+MPI_Request smpi_mpi_isend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
+ MPI_Request request = smpi_isend_init(buf, count, datatype, dst, tag, comm);
+
+ smpi_mpi_start(request);
+ return request;
+}
+
+MPI_Request smpi_irecv_init(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm) {
+ MPI_Request request = build_request(buf, count, datatype, src, smpi_comm_rank(comm), tag, comm, NON_PERSISTENT | RECV);
+