1 /* Copyright (c) 2007-2018. The SimGrid Team. All rights reserved. */
3 /* This program is free software; you can redistribute it and/or modify it
4 * under the terms of the license (GNU LGPL) which comes with this package. */
7 #include "smpi_comm.hpp"
8 #include "smpi_datatype.hpp"
9 #include "smpi_process.hpp"
10 #include "smpi_request.hpp"
12 XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(smpi_pmpi);
14 static int getPid(MPI_Comm, int);
15 static int getPid(MPI_Comm comm, int id)
17 simgrid::s4u::ActorPtr actor = comm->group()->actor(id);
18 return (actor == nullptr) ? MPI_UNDEFINED : actor->get_pid();
21 /* PMPI User level calls */
23 int PMPI_Send_init(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
28 if (request == nullptr) {
30 } else if (comm == MPI_COMM_NULL) {
31 retval = MPI_ERR_COMM;
32 } else if (not datatype->is_valid()) {
33 retval = MPI_ERR_TYPE;
34 } else if (dst == MPI_PROC_NULL) {
37 *request = simgrid::smpi::Request::send_init(buf, count, datatype, dst, tag, comm);
41 if (retval != MPI_SUCCESS && request != nullptr)
42 *request = MPI_REQUEST_NULL;
46 int PMPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
51 if (request == nullptr) {
53 } else if (comm == MPI_COMM_NULL) {
54 retval = MPI_ERR_COMM;
55 } else if (not datatype->is_valid()) {
56 retval = MPI_ERR_TYPE;
57 } else if (src == MPI_PROC_NULL) {
60 *request = simgrid::smpi::Request::recv_init(buf, count, datatype, src, tag, comm);
64 if (retval != MPI_SUCCESS && request != nullptr)
65 *request = MPI_REQUEST_NULL;
69 int PMPI_Ssend_init(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
74 if (request == nullptr) {
76 } else if (comm == MPI_COMM_NULL) {
77 retval = MPI_ERR_COMM;
78 } else if (not datatype->is_valid()) {
79 retval = MPI_ERR_TYPE;
80 } else if (dst == MPI_PROC_NULL) {
83 *request = simgrid::smpi::Request::ssend_init(buf, count, datatype, dst, tag, comm);
87 if (retval != MPI_SUCCESS && request != nullptr)
88 *request = MPI_REQUEST_NULL;
92 int PMPI_Start(MPI_Request * request)
97 if (request == nullptr || *request == MPI_REQUEST_NULL) {
98 retval = MPI_ERR_REQUEST;
100 MPI_Request req = *request;
101 int my_proc_id = (req->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1;
102 TRACE_smpi_comm_in(my_proc_id, __func__,
103 new simgrid::instr::Pt2PtTIData("Start", req->dst(),
106 simgrid::smpi::Datatype::encode(req->type())));
107 if (not TRACE_smpi_view_internals() && req->flags() & SEND)
108 TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
112 if (not TRACE_smpi_view_internals() && req->flags() & RECV)
113 TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
114 retval = MPI_SUCCESS;
115 TRACE_smpi_comm_out(my_proc_id);
121 int PMPI_Startall(int count, MPI_Request * requests)
125 if (requests == nullptr) {
126 retval = MPI_ERR_ARG;
128 retval = MPI_SUCCESS;
129 for (int i = 0; i < count; i++) {
130 if(requests[i] == MPI_REQUEST_NULL) {
131 retval = MPI_ERR_REQUEST;
134 if(retval != MPI_ERR_REQUEST) {
135 int my_proc_id = simgrid::s4u::this_actor::get_pid();
136 TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Startall"));
137 MPI_Request req = MPI_REQUEST_NULL;
138 if (not TRACE_smpi_view_internals())
139 for (int i = 0; i < count; i++) {
141 if (req->flags() & SEND)
142 TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
145 simgrid::smpi::Request::startall(count, requests);
147 if (not TRACE_smpi_view_internals())
148 for (int i = 0; i < count; i++) {
150 if (req->flags() & RECV)
151 TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
153 TRACE_smpi_comm_out(my_proc_id);
160 int PMPI_Request_free(MPI_Request * request)
165 if (*request == MPI_REQUEST_NULL) {
166 retval = MPI_ERR_ARG;
168 simgrid::smpi::Request::unref(request);
169 retval = MPI_SUCCESS;
175 int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
181 if (request == nullptr) {
182 retval = MPI_ERR_ARG;
183 } else if (comm == MPI_COMM_NULL) {
184 retval = MPI_ERR_COMM;
185 } else if (src == MPI_PROC_NULL) {
186 *request = MPI_REQUEST_NULL;
187 retval = MPI_SUCCESS;
188 } else if (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0)){
189 retval = MPI_ERR_RANK;
190 } else if ((count < 0) || (buf==nullptr && count > 0)) {
191 retval = MPI_ERR_COUNT;
192 } else if (not datatype->is_valid()) {
193 retval = MPI_ERR_TYPE;
194 } else if(tag<0 && tag != MPI_ANY_TAG){
195 retval = MPI_ERR_TAG;
198 int my_proc_id = simgrid::s4u::this_actor::get_pid();
200 TRACE_smpi_comm_in(my_proc_id, __func__,
201 new simgrid::instr::Pt2PtTIData("Irecv", src,
202 datatype->is_replayable() ? count : count * datatype->size(),
203 tag, simgrid::smpi::Datatype::encode(datatype)));
205 *request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm);
206 retval = MPI_SUCCESS;
208 TRACE_smpi_comm_out(my_proc_id);
212 if (retval != MPI_SUCCESS && request != nullptr)
213 *request = MPI_REQUEST_NULL;
218 int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
223 if (request == nullptr) {
224 retval = MPI_ERR_ARG;
225 } else if (comm == MPI_COMM_NULL) {
226 retval = MPI_ERR_COMM;
227 } else if (dst == MPI_PROC_NULL) {
228 *request = MPI_REQUEST_NULL;
229 retval = MPI_SUCCESS;
230 } else if (dst >= comm->group()->size() || dst <0){
231 retval = MPI_ERR_RANK;
232 } else if ((count < 0) || (buf==nullptr && count > 0)) {
233 retval = MPI_ERR_COUNT;
234 } else if (not datatype->is_valid()) {
235 retval = MPI_ERR_TYPE;
236 } else if(tag<0 && tag != MPI_ANY_TAG){
237 retval = MPI_ERR_TAG;
239 int my_proc_id = simgrid::s4u::this_actor::get_pid();
240 int trace_dst = getPid(comm, dst);
241 TRACE_smpi_comm_in(my_proc_id, __func__,
242 new simgrid::instr::Pt2PtTIData("Isend", dst,
243 datatype->is_replayable() ? count : count * datatype->size(),
244 tag, simgrid::smpi::Datatype::encode(datatype)));
246 TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
248 *request = simgrid::smpi::Request::isend(buf, count, datatype, dst, tag, comm);
249 retval = MPI_SUCCESS;
251 TRACE_smpi_comm_out(my_proc_id);
255 if (retval != MPI_SUCCESS && request!=nullptr)
256 *request = MPI_REQUEST_NULL;
260 int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
265 if (request == nullptr) {
266 retval = MPI_ERR_ARG;
267 } else if (comm == MPI_COMM_NULL) {
268 retval = MPI_ERR_COMM;
269 } else if (dst == MPI_PROC_NULL) {
270 *request = MPI_REQUEST_NULL;
271 retval = MPI_SUCCESS;
272 } else if (dst >= comm->group()->size() || dst <0){
273 retval = MPI_ERR_RANK;
274 } else if ((count < 0)|| (buf==nullptr && count > 0)) {
275 retval = MPI_ERR_COUNT;
276 } else if (not datatype->is_valid()) {
277 retval = MPI_ERR_TYPE;
278 } else if(tag<0 && tag != MPI_ANY_TAG){
279 retval = MPI_ERR_TAG;
281 int my_proc_id = simgrid::s4u::this_actor::get_pid();
282 int trace_dst = getPid(comm, dst);
283 TRACE_smpi_comm_in(my_proc_id, __func__,
284 new simgrid::instr::Pt2PtTIData("ISsend", dst,
285 datatype->is_replayable() ? count : count * datatype->size(),
286 tag, simgrid::smpi::Datatype::encode(datatype)));
287 TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
289 *request = simgrid::smpi::Request::issend(buf, count, datatype, dst, tag, comm);
290 retval = MPI_SUCCESS;
292 TRACE_smpi_comm_out(my_proc_id);
296 if (retval != MPI_SUCCESS && request!=nullptr)
297 *request = MPI_REQUEST_NULL;
301 int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
306 if (comm == MPI_COMM_NULL) {
307 retval = MPI_ERR_COMM;
308 } else if (src == MPI_PROC_NULL) {
309 simgrid::smpi::Status::empty(status);
310 status->MPI_SOURCE = MPI_PROC_NULL;
311 retval = MPI_SUCCESS;
312 } else if (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0)){
313 retval = MPI_ERR_RANK;
314 } else if ((count < 0) || (buf==nullptr && count > 0)) {
315 retval = MPI_ERR_COUNT;
316 } else if (not datatype->is_valid()) {
317 retval = MPI_ERR_TYPE;
318 } else if(tag<0 && tag != MPI_ANY_TAG){
319 retval = MPI_ERR_TAG;
321 int my_proc_id = simgrid::s4u::this_actor::get_pid();
322 TRACE_smpi_comm_in(my_proc_id, __func__,
323 new simgrid::instr::Pt2PtTIData("recv", src,
324 datatype->is_replayable() ? count : count * datatype->size(),
325 tag, simgrid::smpi::Datatype::encode(datatype)));
327 simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
328 retval = MPI_SUCCESS;
330 // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
331 if (status != MPI_STATUS_IGNORE) {
332 int src_traced = getPid(comm, status->MPI_SOURCE);
333 if (not TRACE_smpi_view_internals()) {
334 TRACE_smpi_recv(src_traced, my_proc_id, tag);
337 TRACE_smpi_comm_out(my_proc_id);
344 int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
350 if (comm == MPI_COMM_NULL) {
351 retval = MPI_ERR_COMM;
352 } else if (dst == MPI_PROC_NULL) {
353 retval = MPI_SUCCESS;
354 } else if (dst >= comm->group()->size() || dst <0){
355 retval = MPI_ERR_RANK;
356 } else if ((count < 0) || (buf == nullptr && count > 0)) {
357 retval = MPI_ERR_COUNT;
358 } else if (not datatype->is_valid()) {
359 retval = MPI_ERR_TYPE;
360 } else if(tag < 0 && tag != MPI_ANY_TAG){
361 retval = MPI_ERR_TAG;
363 int my_proc_id = simgrid::s4u::this_actor::get_pid();
364 int dst_traced = getPid(comm, dst);
365 TRACE_smpi_comm_in(my_proc_id, __func__,
366 new simgrid::instr::Pt2PtTIData("send", dst,
367 datatype->is_replayable() ? count : count * datatype->size(),
368 tag, simgrid::smpi::Datatype::encode(datatype)));
369 if (not TRACE_smpi_view_internals()) {
370 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
373 simgrid::smpi::Request::send(buf, count, datatype, dst, tag, comm);
374 retval = MPI_SUCCESS;
376 TRACE_smpi_comm_out(my_proc_id);
383 int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
388 if (comm == MPI_COMM_NULL) {
389 retval = MPI_ERR_COMM;
390 } else if (dst == MPI_PROC_NULL) {
391 retval = MPI_SUCCESS;
392 } else if (dst >= comm->group()->size() || dst <0){
393 retval = MPI_ERR_RANK;
394 } else if ((count < 0) || (buf==nullptr && count > 0)) {
395 retval = MPI_ERR_COUNT;
396 } else if (not datatype->is_valid()) {
397 retval = MPI_ERR_TYPE;
398 } else if(tag<0 && tag != MPI_ANY_TAG){
399 retval = MPI_ERR_TAG;
401 int my_proc_id = simgrid::s4u::this_actor::get_pid();
402 int dst_traced = getPid(comm, dst);
403 TRACE_smpi_comm_in(my_proc_id, __func__,
404 new simgrid::instr::Pt2PtTIData("Ssend", dst,
405 datatype->is_replayable() ? count : count * datatype->size(),
406 tag, simgrid::smpi::Datatype::encode(datatype)));
407 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
409 simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
410 retval = MPI_SUCCESS;
412 TRACE_smpi_comm_out(my_proc_id);
419 int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf,
420 int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status)
426 if (comm == MPI_COMM_NULL) {
427 retval = MPI_ERR_COMM;
428 } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
429 retval = MPI_ERR_TYPE;
430 } else if (src == MPI_PROC_NULL) {
431 if(status!=MPI_STATUS_IGNORE){
432 simgrid::smpi::Status::empty(status);
433 status->MPI_SOURCE = MPI_PROC_NULL;
435 if(dst != MPI_PROC_NULL)
436 simgrid::smpi::Request::send(sendbuf, sendcount, sendtype, dst, sendtag, comm);
437 retval = MPI_SUCCESS;
438 }else if (dst == MPI_PROC_NULL){
439 simgrid::smpi::Request::recv(recvbuf, recvcount, recvtype, src, recvtag, comm, status);
440 retval = MPI_SUCCESS;
441 }else if (dst >= comm->group()->size() || dst <0 ||
442 (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0))){
443 retval = MPI_ERR_RANK;
444 } else if ((sendcount < 0 || recvcount<0) ||
445 (sendbuf==nullptr && sendcount > 0) || (recvbuf==nullptr && recvcount>0)) {
446 retval = MPI_ERR_COUNT;
447 } else if((sendtag<0 && sendtag != MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
448 retval = MPI_ERR_TAG;
450 int my_proc_id = simgrid::s4u::this_actor::get_pid();
451 int dst_traced = getPid(comm, dst);
452 int src_traced = getPid(comm, src);
454 // FIXME: Hack the way to trace this one
455 std::vector<int>* dst_hack = new std::vector<int>;
456 std::vector<int>* src_hack = new std::vector<int>;
457 dst_hack->push_back(dst_traced);
458 src_hack->push_back(src_traced);
459 TRACE_smpi_comm_in(my_proc_id, __func__,
460 new simgrid::instr::VarCollTIData(
461 "sendRecv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
462 dst_hack, recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), src_hack,
463 simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
465 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, sendtag, sendcount * sendtype->size());
467 simgrid::smpi::Request::sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src,
468 recvtag, comm, status);
469 retval = MPI_SUCCESS;
471 TRACE_smpi_recv(src_traced, my_proc_id, recvtag);
472 TRACE_smpi_comm_out(my_proc_id);
479 int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
480 MPI_Comm comm, MPI_Status* status)
483 if (not datatype->is_valid()) {
485 } else if (count < 0) {
486 return MPI_ERR_COUNT;
488 int size = datatype->get_extent() * count;
489 void* recvbuf = xbt_new0(char, size);
490 retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
491 if(retval==MPI_SUCCESS){
492 simgrid::smpi::Datatype::copy(recvbuf, count, datatype, buf, count, datatype);
500 int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
504 if (request == nullptr || flag == nullptr) {
505 retval = MPI_ERR_ARG;
506 } else if (*request == MPI_REQUEST_NULL) {
508 simgrid::smpi::Status::empty(status);
509 retval = MPI_SUCCESS;
511 int my_proc_id = ((*request)->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1;
513 TRACE_smpi_testing_in(my_proc_id);
515 *flag = simgrid::smpi::Request::test(request,status);
517 TRACE_smpi_testing_out(my_proc_id);
518 retval = MPI_SUCCESS;
524 int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
529 if (index == nullptr || flag == nullptr) {
530 retval = MPI_ERR_ARG;
532 *flag = simgrid::smpi::Request::testany(count, requests, index, status);
533 retval = MPI_SUCCESS;
539 int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses)
544 if (flag == nullptr) {
545 retval = MPI_ERR_ARG;
547 *flag = simgrid::smpi::Request::testall(count, requests, statuses);
548 retval = MPI_SUCCESS;
554 int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
558 if (status == nullptr) {
559 retval = MPI_ERR_ARG;
560 } else if (comm == MPI_COMM_NULL) {
561 retval = MPI_ERR_COMM;
562 } else if (source == MPI_PROC_NULL) {
563 simgrid::smpi::Status::empty(status);
564 status->MPI_SOURCE = MPI_PROC_NULL;
565 retval = MPI_SUCCESS;
567 simgrid::smpi::Request::probe(source, tag, comm, status);
568 retval = MPI_SUCCESS;
574 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
578 if (flag == nullptr) {
579 retval = MPI_ERR_ARG;
580 } else if (comm == MPI_COMM_NULL) {
581 retval = MPI_ERR_COMM;
582 } else if (source == MPI_PROC_NULL) {
584 simgrid::smpi::Status::empty(status);
585 status->MPI_SOURCE = MPI_PROC_NULL;
586 retval = MPI_SUCCESS;
588 simgrid::smpi::Request::iprobe(source, tag, comm, flag, status);
589 retval = MPI_SUCCESS;
595 // TODO: cheinrich: Move declaration to other file? Rename this function - it's used for PMPI_Wait*?
596 static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status);
597 static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status)
599 MPI_Request req = *request;
600 if (req != MPI_REQUEST_NULL) { // Received requests become null
601 int src_traced = req->src();
602 // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
603 int dst_traced = req->dst();
604 if (req->flags() & RECV) { // Is this request a wait for RECV?
605 if (src_traced == MPI_ANY_SOURCE)
606 src_traced = (status != MPI_STATUSES_IGNORE) ? req->comm()->group()->rank(status->MPI_SOURCE) : req->src();
607 TRACE_smpi_recv(src_traced, dst_traced, req->tag());
612 int PMPI_Wait(MPI_Request * request, MPI_Status * status)
618 simgrid::smpi::Status::empty(status);
620 if (request == nullptr) {
621 retval = MPI_ERR_ARG;
622 } else if (*request == MPI_REQUEST_NULL) {
623 retval = MPI_SUCCESS;
625 int my_proc_id = (*request)->comm() != MPI_COMM_NULL
626 ? simgrid::s4u::this_actor::get_pid()
627 : -1; // TODO: cheinrich: Check if this correct or if it should be MPI_UNDEFINED
629 TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("wait"));
631 simgrid::smpi::Request::wait(request, status);
632 retval = MPI_SUCCESS;
634 //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
635 TRACE_smpi_comm_out(my_proc_id);
636 trace_smpi_recv_helper(request, status);
643 int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
645 if (index == nullptr)
653 int rank_traced = simgrid::s4u::this_actor::get_pid(); // FIXME: In PMPI_Wait, we check if the comm is null?
654 TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAny", static_cast<double>(count)));
656 *index = simgrid::smpi::Request::waitany(count, requests, status);
658 if(*index!=MPI_UNDEFINED){
659 trace_smpi_recv_helper(&requests[*index], status);
660 TRACE_smpi_comm_out(rank_traced);
667 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
671 int rank_traced = simgrid::s4u::this_actor::get_pid(); // FIXME: In PMPI_Wait, we check if the comm is null?
672 TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAll", static_cast<double>(count)));
674 int retval = simgrid::smpi::Request::waitall(count, requests, status);
676 for (int i = 0; i < count; i++) {
677 trace_smpi_recv_helper(&requests[i], &status[i]);
679 TRACE_smpi_comm_out(rank_traced);
685 int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
690 if (outcount == nullptr) {
691 retval = MPI_ERR_ARG;
693 *outcount = simgrid::smpi::Request::waitsome(incount, requests, indices, status);
694 retval = MPI_SUCCESS;
700 int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[])
705 if (outcount == nullptr) {
706 retval = MPI_ERR_ARG;
708 *outcount = simgrid::smpi::Request::testsome(incount, requests, indices, status);
709 retval = MPI_SUCCESS;
715 int PMPI_Cancel(MPI_Request* request)
720 if (*request == MPI_REQUEST_NULL) {
721 retval = MPI_ERR_REQUEST;
723 (*request)->cancel();
724 retval = MPI_SUCCESS;
730 int PMPI_Test_cancelled(MPI_Status* status, int* flag){
731 if(status==MPI_STATUS_IGNORE){
735 *flag=simgrid::smpi::Status::cancelled(status);
739 MPI_Request PMPI_Request_f2c(MPI_Fint request){
740 return static_cast<MPI_Request>(simgrid::smpi::Request::f2c(request));
743 MPI_Fint PMPI_Request_c2f(MPI_Request request) {
744 return request->c2f();