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;
93 * This function starts a request returned by init functions such as
94 * MPI_Send_init(), MPI_Ssend_init (see above), and friends.
95 * They should already have performed sanity checks.
97 int PMPI_Start(MPI_Request * request)
102 if (request == nullptr || *request == MPI_REQUEST_NULL) {
103 retval = MPI_ERR_REQUEST;
105 MPI_Request req = *request;
106 int my_proc_id = (req->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1;
107 TRACE_smpi_comm_in(my_proc_id, __func__,
108 new simgrid::instr::Pt2PtTIData("Start", req->dst(),
111 simgrid::smpi::Datatype::encode(req->type())));
112 if (not TRACE_smpi_view_internals() && req->flags() & MPI_REQ_SEND)
113 TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
117 if (not TRACE_smpi_view_internals() && req->flags() & MPI_REQ_RECV)
118 TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
119 retval = MPI_SUCCESS;
120 TRACE_smpi_comm_out(my_proc_id);
126 int PMPI_Startall(int count, MPI_Request * requests)
130 if (requests == nullptr) {
131 retval = MPI_ERR_ARG;
133 retval = MPI_SUCCESS;
134 for (int i = 0; i < count; i++) {
135 if(requests[i] == MPI_REQUEST_NULL) {
136 retval = MPI_ERR_REQUEST;
139 if(retval != MPI_ERR_REQUEST) {
140 int my_proc_id = simgrid::s4u::this_actor::get_pid();
141 TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("Startall"));
142 MPI_Request req = MPI_REQUEST_NULL;
143 if (not TRACE_smpi_view_internals())
144 for (int i = 0; i < count; i++) {
146 if (req->flags() & MPI_REQ_SEND)
147 TRACE_smpi_send(my_proc_id, my_proc_id, getPid(req->comm(), req->dst()), req->tag(), req->size());
150 simgrid::smpi::Request::startall(count, requests);
152 if (not TRACE_smpi_view_internals())
153 for (int i = 0; i < count; i++) {
155 if (req->flags() & MPI_REQ_RECV)
156 TRACE_smpi_recv(getPid(req->comm(), req->src()), my_proc_id, req->tag());
158 TRACE_smpi_comm_out(my_proc_id);
165 int PMPI_Request_free(MPI_Request * request)
170 if (*request == MPI_REQUEST_NULL) {
171 retval = MPI_ERR_ARG;
173 simgrid::smpi::Request::unref(request);
174 retval = MPI_SUCCESS;
180 int PMPI_Irecv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Request * request)
186 if (request == nullptr) {
187 retval = MPI_ERR_ARG;
188 } else if (comm == MPI_COMM_NULL) {
189 retval = MPI_ERR_COMM;
190 } else if (src == MPI_PROC_NULL) {
191 *request = MPI_REQUEST_NULL;
192 retval = MPI_SUCCESS;
193 } else if (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0)){
194 retval = MPI_ERR_RANK;
195 } else if ((count < 0) || (buf==nullptr && count > 0)) {
196 retval = MPI_ERR_COUNT;
197 } else if (not datatype->is_valid()) {
198 retval = MPI_ERR_TYPE;
199 } else if(tag<0 && tag != MPI_ANY_TAG){
200 retval = MPI_ERR_TAG;
203 int my_proc_id = simgrid::s4u::this_actor::get_pid();
205 TRACE_smpi_comm_in(my_proc_id, __func__,
206 new simgrid::instr::Pt2PtTIData("Irecv", src,
207 datatype->is_replayable() ? count : count * datatype->size(),
208 tag, simgrid::smpi::Datatype::encode(datatype)));
210 *request = simgrid::smpi::Request::irecv(buf, count, datatype, src, tag, comm);
211 retval = MPI_SUCCESS;
213 TRACE_smpi_comm_out(my_proc_id);
217 if (retval != MPI_SUCCESS && request != nullptr)
218 *request = MPI_REQUEST_NULL;
223 int PMPI_Isend(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request * request)
228 if (request == nullptr) {
229 retval = MPI_ERR_ARG;
230 } else if (comm == MPI_COMM_NULL) {
231 retval = MPI_ERR_COMM;
232 } else if (dst == MPI_PROC_NULL) {
233 *request = MPI_REQUEST_NULL;
234 retval = MPI_SUCCESS;
235 } else if (dst >= comm->group()->size() || dst <0){
236 retval = MPI_ERR_RANK;
237 } else if ((count < 0) || (buf==nullptr && count > 0)) {
238 retval = MPI_ERR_COUNT;
239 } else if (not datatype->is_valid()) {
240 retval = MPI_ERR_TYPE;
241 } else if(tag<0 && tag != MPI_ANY_TAG){
242 retval = MPI_ERR_TAG;
244 int my_proc_id = simgrid::s4u::this_actor::get_pid();
245 int trace_dst = getPid(comm, dst);
246 TRACE_smpi_comm_in(my_proc_id, __func__,
247 new simgrid::instr::Pt2PtTIData("Isend", dst,
248 datatype->is_replayable() ? count : count * datatype->size(),
249 tag, simgrid::smpi::Datatype::encode(datatype)));
251 TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
253 *request = simgrid::smpi::Request::isend(buf, count, datatype, dst, tag, comm);
254 retval = MPI_SUCCESS;
256 TRACE_smpi_comm_out(my_proc_id);
260 if (retval != MPI_SUCCESS && request!=nullptr)
261 *request = MPI_REQUEST_NULL;
265 int PMPI_Issend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm, MPI_Request* request)
270 if (request == nullptr) {
271 retval = MPI_ERR_ARG;
272 } else if (comm == MPI_COMM_NULL) {
273 retval = MPI_ERR_COMM;
274 } else if (dst == MPI_PROC_NULL) {
275 *request = MPI_REQUEST_NULL;
276 retval = MPI_SUCCESS;
277 } else if (dst >= comm->group()->size() || dst <0){
278 retval = MPI_ERR_RANK;
279 } else if ((count < 0)|| (buf==nullptr && count > 0)) {
280 retval = MPI_ERR_COUNT;
281 } else if (not datatype->is_valid()) {
282 retval = MPI_ERR_TYPE;
283 } else if(tag<0 && tag != MPI_ANY_TAG){
284 retval = MPI_ERR_TAG;
286 int my_proc_id = simgrid::s4u::this_actor::get_pid();
287 int trace_dst = getPid(comm, dst);
288 TRACE_smpi_comm_in(my_proc_id, __func__,
289 new simgrid::instr::Pt2PtTIData("ISsend", dst,
290 datatype->is_replayable() ? count : count * datatype->size(),
291 tag, simgrid::smpi::Datatype::encode(datatype)));
292 TRACE_smpi_send(my_proc_id, my_proc_id, trace_dst, tag, count * datatype->size());
294 *request = simgrid::smpi::Request::issend(buf, count, datatype, dst, tag, comm);
295 retval = MPI_SUCCESS;
297 TRACE_smpi_comm_out(my_proc_id);
301 if (retval != MPI_SUCCESS && request!=nullptr)
302 *request = MPI_REQUEST_NULL;
306 int PMPI_Recv(void *buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status * status)
311 if (comm == MPI_COMM_NULL) {
312 retval = MPI_ERR_COMM;
313 } else if (src == MPI_PROC_NULL) {
314 if(status != MPI_STATUS_IGNORE){
315 simgrid::smpi::Status::empty(status);
316 status->MPI_SOURCE = MPI_PROC_NULL;
318 retval = MPI_SUCCESS;
319 } else if (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0)){
320 retval = MPI_ERR_RANK;
321 } else if ((count < 0) || (buf==nullptr && count > 0)) {
322 retval = MPI_ERR_COUNT;
323 } else if (not datatype->is_valid()) {
324 retval = MPI_ERR_TYPE;
325 } else if(tag<0 && tag != MPI_ANY_TAG){
326 retval = MPI_ERR_TAG;
328 int my_proc_id = simgrid::s4u::this_actor::get_pid();
329 TRACE_smpi_comm_in(my_proc_id, __func__,
330 new simgrid::instr::Pt2PtTIData("recv", src,
331 datatype->is_replayable() ? count : count * datatype->size(),
332 tag, simgrid::smpi::Datatype::encode(datatype)));
334 simgrid::smpi::Request::recv(buf, count, datatype, src, tag, comm, status);
335 retval = MPI_SUCCESS;
337 // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
338 if (status != MPI_STATUS_IGNORE) {
339 int src_traced = getPid(comm, status->MPI_SOURCE);
340 if (not TRACE_smpi_view_internals()) {
341 TRACE_smpi_recv(src_traced, my_proc_id, tag);
344 TRACE_smpi_comm_out(my_proc_id);
351 int PMPI_Send(void *buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm)
357 if (comm == MPI_COMM_NULL) {
358 retval = MPI_ERR_COMM;
359 } else if (dst == MPI_PROC_NULL) {
360 retval = MPI_SUCCESS;
361 } else if (dst >= comm->group()->size() || dst <0){
362 retval = MPI_ERR_RANK;
363 } else if ((count < 0) || (buf == nullptr && count > 0)) {
364 retval = MPI_ERR_COUNT;
365 } else if (not datatype->is_valid()) {
366 retval = MPI_ERR_TYPE;
367 } else if(tag < 0 && tag != MPI_ANY_TAG){
368 retval = MPI_ERR_TAG;
370 int my_proc_id = simgrid::s4u::this_actor::get_pid();
371 int dst_traced = getPid(comm, dst);
372 TRACE_smpi_comm_in(my_proc_id, __func__,
373 new simgrid::instr::Pt2PtTIData("send", dst,
374 datatype->is_replayable() ? count : count * datatype->size(),
375 tag, simgrid::smpi::Datatype::encode(datatype)));
376 if (not TRACE_smpi_view_internals()) {
377 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
380 simgrid::smpi::Request::send(buf, count, datatype, dst, tag, comm);
381 retval = MPI_SUCCESS;
383 TRACE_smpi_comm_out(my_proc_id);
390 int PMPI_Ssend(void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm) {
395 if (comm == MPI_COMM_NULL) {
396 retval = MPI_ERR_COMM;
397 } else if (dst == MPI_PROC_NULL) {
398 retval = MPI_SUCCESS;
399 } else if (dst >= comm->group()->size() || dst <0){
400 retval = MPI_ERR_RANK;
401 } else if ((count < 0) || (buf==nullptr && count > 0)) {
402 retval = MPI_ERR_COUNT;
403 } else if (not datatype->is_valid()) {
404 retval = MPI_ERR_TYPE;
405 } else if(tag<0 && tag != MPI_ANY_TAG){
406 retval = MPI_ERR_TAG;
408 int my_proc_id = simgrid::s4u::this_actor::get_pid();
409 int dst_traced = getPid(comm, dst);
410 TRACE_smpi_comm_in(my_proc_id, __func__,
411 new simgrid::instr::Pt2PtTIData("Ssend", dst,
412 datatype->is_replayable() ? count : count * datatype->size(),
413 tag, simgrid::smpi::Datatype::encode(datatype)));
414 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, tag, count * datatype->size());
416 simgrid::smpi::Request::ssend(buf, count, datatype, dst, tag, comm);
417 retval = MPI_SUCCESS;
419 TRACE_smpi_comm_out(my_proc_id);
426 int PMPI_Sendrecv(void* sendbuf, int sendcount, MPI_Datatype sendtype, int dst, int sendtag, void* recvbuf,
427 int recvcount, MPI_Datatype recvtype, int src, int recvtag, MPI_Comm comm, MPI_Status* status)
433 if (comm == MPI_COMM_NULL) {
434 retval = MPI_ERR_COMM;
435 } else if (not sendtype->is_valid() || not recvtype->is_valid()) {
436 retval = MPI_ERR_TYPE;
437 } else if (src == MPI_PROC_NULL) {
438 if(status!=MPI_STATUS_IGNORE){
439 simgrid::smpi::Status::empty(status);
440 status->MPI_SOURCE = MPI_PROC_NULL;
442 if(dst != MPI_PROC_NULL)
443 simgrid::smpi::Request::send(sendbuf, sendcount, sendtype, dst, sendtag, comm);
444 retval = MPI_SUCCESS;
445 }else if (dst == MPI_PROC_NULL){
446 simgrid::smpi::Request::recv(recvbuf, recvcount, recvtype, src, recvtag, comm, status);
447 retval = MPI_SUCCESS;
448 }else if (dst >= comm->group()->size() || dst <0 ||
449 (src!=MPI_ANY_SOURCE && (src >= comm->group()->size() || src <0))){
450 retval = MPI_ERR_RANK;
451 } else if ((sendcount < 0 || recvcount<0) ||
452 (sendbuf==nullptr && sendcount > 0) || (recvbuf==nullptr && recvcount>0)) {
453 retval = MPI_ERR_COUNT;
454 } else if((sendtag<0 && sendtag != MPI_ANY_TAG)||(recvtag<0 && recvtag != MPI_ANY_TAG)){
455 retval = MPI_ERR_TAG;
457 int my_proc_id = simgrid::s4u::this_actor::get_pid();
458 int dst_traced = getPid(comm, dst);
459 int src_traced = getPid(comm, src);
461 // FIXME: Hack the way to trace this one
462 std::vector<int>* dst_hack = new std::vector<int>;
463 std::vector<int>* src_hack = new std::vector<int>;
464 dst_hack->push_back(dst_traced);
465 src_hack->push_back(src_traced);
466 TRACE_smpi_comm_in(my_proc_id, __func__,
467 new simgrid::instr::VarCollTIData(
468 "sendRecv", -1, sendtype->is_replayable() ? sendcount : sendcount * sendtype->size(),
469 dst_hack, recvtype->is_replayable() ? recvcount : recvcount * recvtype->size(), src_hack,
470 simgrid::smpi::Datatype::encode(sendtype), simgrid::smpi::Datatype::encode(recvtype)));
472 TRACE_smpi_send(my_proc_id, my_proc_id, dst_traced, sendtag, sendcount * sendtype->size());
474 simgrid::smpi::Request::sendrecv(sendbuf, sendcount, sendtype, dst, sendtag, recvbuf, recvcount, recvtype, src,
475 recvtag, comm, status);
476 retval = MPI_SUCCESS;
478 TRACE_smpi_recv(src_traced, my_proc_id, recvtag);
479 TRACE_smpi_comm_out(my_proc_id);
486 int PMPI_Sendrecv_replace(void* buf, int count, MPI_Datatype datatype, int dst, int sendtag, int src, int recvtag,
487 MPI_Comm comm, MPI_Status* status)
490 if (not datatype->is_valid()) {
492 } else if (count < 0) {
493 return MPI_ERR_COUNT;
495 int size = datatype->get_extent() * count;
496 void* recvbuf = xbt_new0(char, size);
497 retval = MPI_Sendrecv(buf, count, datatype, dst, sendtag, recvbuf, count, datatype, src, recvtag, comm, status);
498 if(retval==MPI_SUCCESS){
499 simgrid::smpi::Datatype::copy(recvbuf, count, datatype, buf, count, datatype);
507 int PMPI_Test(MPI_Request * request, int *flag, MPI_Status * status)
511 if (request == nullptr || flag == nullptr) {
512 retval = MPI_ERR_ARG;
513 } else if (*request == MPI_REQUEST_NULL) {
514 if (status != MPI_STATUS_IGNORE){
516 simgrid::smpi::Status::empty(status);
518 retval = MPI_SUCCESS;
520 int my_proc_id = ((*request)->comm() != MPI_COMM_NULL) ? simgrid::s4u::this_actor::get_pid() : -1;
522 TRACE_smpi_testing_in(my_proc_id);
524 *flag = simgrid::smpi::Request::test(request,status);
526 TRACE_smpi_testing_out(my_proc_id);
527 retval = MPI_SUCCESS;
533 int PMPI_Testany(int count, MPI_Request requests[], int *index, int *flag, MPI_Status * status)
538 if (index == nullptr || flag == nullptr) {
539 retval = MPI_ERR_ARG;
541 *flag = simgrid::smpi::Request::testany(count, requests, index, status);
542 retval = MPI_SUCCESS;
548 int PMPI_Testall(int count, MPI_Request* requests, int* flag, MPI_Status* statuses)
553 if (flag == nullptr) {
554 retval = MPI_ERR_ARG;
556 *flag = simgrid::smpi::Request::testall(count, requests, statuses);
557 retval = MPI_SUCCESS;
563 int PMPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status) {
567 if (comm == MPI_COMM_NULL) {
568 retval = MPI_ERR_COMM;
569 } else if (source == MPI_PROC_NULL) {
570 if (status != MPI_STATUS_IGNORE){
571 simgrid::smpi::Status::empty(status);
572 status->MPI_SOURCE = MPI_PROC_NULL;
574 retval = MPI_SUCCESS;
576 simgrid::smpi::Request::probe(source, tag, comm, status);
577 retval = MPI_SUCCESS;
583 int PMPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status) {
587 if (flag == nullptr) {
588 retval = MPI_ERR_ARG;
589 } else if (comm == MPI_COMM_NULL) {
590 retval = MPI_ERR_COMM;
591 } else if (source == MPI_PROC_NULL) {
593 if (status != MPI_STATUS_IGNORE){
594 simgrid::smpi::Status::empty(status);
595 status->MPI_SOURCE = MPI_PROC_NULL;
597 retval = MPI_SUCCESS;
599 simgrid::smpi::Request::iprobe(source, tag, comm, flag, status);
600 retval = MPI_SUCCESS;
606 // TODO: cheinrich: Move declaration to other file? Rename this function - it's used for PMPI_Wait*?
607 static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status);
608 static void trace_smpi_recv_helper(MPI_Request* request, MPI_Status* status)
610 MPI_Request req = *request;
611 if (req != MPI_REQUEST_NULL) { // Received requests become null
612 int src_traced = req->src();
613 // the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
614 int dst_traced = req->dst();
615 if (req->flags() & MPI_REQ_RECV) { // Is this request a wait for RECV?
616 if (src_traced == MPI_ANY_SOURCE)
617 src_traced = (status != MPI_STATUSES_IGNORE) ? req->comm()->group()->rank(status->MPI_SOURCE) : req->src();
618 TRACE_smpi_recv(src_traced, dst_traced, req->tag());
623 int PMPI_Wait(MPI_Request * request, MPI_Status * status)
629 simgrid::smpi::Status::empty(status);
631 if (request == nullptr) {
632 retval = MPI_ERR_ARG;
633 } else if (*request == MPI_REQUEST_NULL) {
634 retval = MPI_SUCCESS;
636 int my_proc_id = (*request)->comm() != MPI_COMM_NULL
637 ? simgrid::s4u::this_actor::get_pid()
638 : -1; // TODO: cheinrich: Check if this correct or if it should be MPI_UNDEFINED
640 TRACE_smpi_comm_in(my_proc_id, __func__, new simgrid::instr::NoOpTIData("wait"));
642 simgrid::smpi::Request::wait(request, status);
643 retval = MPI_SUCCESS;
645 //the src may not have been known at the beginning of the recv (MPI_ANY_SOURCE)
646 TRACE_smpi_comm_out(my_proc_id);
647 trace_smpi_recv_helper(request, status);
654 int PMPI_Waitany(int count, MPI_Request requests[], int *index, MPI_Status * status)
656 if (index == nullptr)
664 int rank_traced = simgrid::s4u::this_actor::get_pid(); // FIXME: In PMPI_Wait, we check if the comm is null?
665 TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAny", static_cast<double>(count)));
667 *index = simgrid::smpi::Request::waitany(count, requests, status);
669 if(*index!=MPI_UNDEFINED){
670 trace_smpi_recv_helper(&requests[*index], status);
671 TRACE_smpi_comm_out(rank_traced);
678 int PMPI_Waitall(int count, MPI_Request requests[], MPI_Status status[])
682 int rank_traced = simgrid::s4u::this_actor::get_pid(); // FIXME: In PMPI_Wait, we check if the comm is null?
683 TRACE_smpi_comm_in(rank_traced, __func__, new simgrid::instr::CpuTIData("waitAll", static_cast<double>(count)));
685 int retval = simgrid::smpi::Request::waitall(count, requests, status);
687 for (int i = 0; i < count; i++) {
688 trace_smpi_recv_helper(&requests[i], &status[i]);
690 TRACE_smpi_comm_out(rank_traced);
696 int PMPI_Waitsome(int incount, MPI_Request requests[], int *outcount, int *indices, MPI_Status status[])
701 if (outcount == nullptr) {
702 retval = MPI_ERR_ARG;
704 *outcount = simgrid::smpi::Request::waitsome(incount, requests, indices, status);
705 retval = MPI_SUCCESS;
711 int PMPI_Testsome(int incount, MPI_Request requests[], int* outcount, int* indices, MPI_Status status[])
716 if (outcount == nullptr) {
717 retval = MPI_ERR_ARG;
719 *outcount = simgrid::smpi::Request::testsome(incount, requests, indices, status);
720 retval = MPI_SUCCESS;
726 int PMPI_Cancel(MPI_Request* request)
731 if (*request == MPI_REQUEST_NULL) {
732 retval = MPI_ERR_REQUEST;
734 (*request)->cancel();
735 retval = MPI_SUCCESS;
741 int PMPI_Test_cancelled(MPI_Status* status, int* flag){
742 if(status==MPI_STATUS_IGNORE){
746 *flag=simgrid::smpi::Status::cancelled(status);
750 MPI_Request PMPI_Request_f2c(MPI_Fint request){
751 return static_cast<MPI_Request>(simgrid::smpi::Request::f2c(request));
754 MPI_Fint PMPI_Request_c2f(MPI_Request request) {
755 return request->c2f();