MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
mpioverride.cpp
Go to the documentation of this file.
1// Copyright (C) 2024 The m-AIA AUTHORS
2//
3// This file is part of m-AIA (https://git.rwth-aachen.de/aia/m-AIA/m-AIA)
4//
5// SPDX-License-Identifier: LGPL-3.0-only
6
7#include "mpioverride.h"
8#include <map>
9#include "IO/infoout.h"
10#include "UTIL/functions.h"
11#include "globalvariables.h"
12
13// TO USE THIS FUNCTIONALITY, ENABLE MAIA_MPI_DEBUG IN CONFIG.H //
14// You can find details and instructions about the wrapper functions
15// in the corresponding header file.
16
17// Allow the use of MPI functions marked deprecated in mpioverride.h in the MPI wrapper functions
18#pragma GCC diagnostic push
19#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
20
21using namespace std;
22
23// keeps track of the number of MPI communicators
24map<MPI_Comm, MInt> mpi_dbg_lst{};
26
27//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
28//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29// Helper functions
30//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
31//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32
42MInt getCommId(const MPI_Comm comm) {
43 // Check for nullptr-communicator
44 if(comm == MPI_COMM_NULL) {
45 return -1;
46 }
47
48 MInt id;
49 // search communicator in mapping
50 auto it = mpi_dbg_lst.find(comm);
51 // If communicator cannot be found, it is the world communicator
52 if(it == mpi_dbg_lst.end()) {
53 // mTerm (1, AT_, "Error: Communicator not found.");
54 id = 0;
55 } else {
56 id = it->second;
57 }
58
59 return id;
60}
61
71MString return2string(const MInt returncode) {
72 MString returnString;
73 switch(returncode) {
74 case MPI_SUCCESS:
75 returnString = "MPI_SUCCESS";
76 break;
77 case MPI_ERR_COMM:
78 returnString = "MPI_ERR_COMM";
79 break;
80 case MPI_ERR_GROUP:
81 returnString = "MPI_ERR_GROUP";
82 break;
83 case MPI_ERR_INTERN:
84 returnString = "MPI_ERR_INTERN";
85 break;
86 case MPI_ERR_ARG:
87 returnString = "MPI_ERR_ARG";
88 break;
89 case MPI_ERR_COUNT:
90 returnString = "MPI_ERR_COUNT";
91 break;
92 case MPI_ERR_TYPE:
93 returnString = "MPI_ERR_TYPE";
94 break;
95 case MPI_ERR_TAG:
96 returnString = "MPI_ERR_TAG";
97 break;
98 case MPI_ERR_RANK:
99 returnString = "MPI_ERR_RANK";
100 break;
101 case MPI_ERR_REQUEST:
102 returnString = "MPI_ERR_REQUEST";
103 break;
104 case MPI_ERR_IN_STATUS:
105 returnString = "MPI_ERR_IN_STATUS";
106 break;
107 case MPI_ERR_BUFFER:
108 returnString = "MPI_ERR_BUFFER";
109 break;
110 case MPI_ERR_OP:
111 returnString = "MPI_ERR_OP";
112 break;
113 case MPI_ERR_ROOT:
114 returnString = "MPI_ERR_ROOT";
115 break;
116 case MPI_ERR_OTHER:
117 returnString = "MPI_ERR_OTHER";
118 break;
119 case MPI_ERR_INFO:
120 returnString = "MPI_ERR_INFO";
121 break;
122 case MPI_ERR_INFO_KEY:
123 returnString = "MPI_ERR_INFO_KEY";
124 break;
125 case MPI_ERR_INFO_VALUE:
126 returnString = "MPI_ERR_INFO_VALUE";
127 break;
128 case MPI_ERR_TRUNCATE:
129 returnString = "MPI_ERR_TRUNCATE: Message truncated on receive. Receive buffer too small for message.";
130 break;
131 default:
132 returnString = "UNKNOWN";
133 }
134
135 return returnString;
136}
137
148void debugResult(const MInt result, const MInt returncodes[], const MInt len) {
149 MBool found = false;
150
151 // If returncode in list of admissible returncodes, print it
152 for(MInt cnt = 0; cnt < len; cnt++) {
153 if(result == returncodes[cnt]) {
154 m_log << " - execution code: ";
155 m_log << return2string(result) << endl;
156 found = true;
157 }
158 }
159
160 // If returncode unknown or not in list of admissible returncodes,
161 // print unknown
162 if(!found) {
163 m_log << " - execution code: UNKNOWN" << endl;
164 }
165}
166
181void raiseMPIerror(const MInt result, const MString& mpiFunction, const MInt returncodes[], const MInt len,
182 const MString& name, const MString& customString) {
183 const MString errorMsg =
184 "MPI error: " + mpiFunction + " called from '" + name + customString + "' returned error code: ";
185 // MInt cnt = 1; // MPI_SUCCESS always first one, check only unsuccessful ones
186 MBool found = false;
187
188 char error_string[256];
189 int length_of_error_string;
190 MPI_Error_string(result, error_string, &length_of_error_string);
191 std::cerr << "error string " << error_string << std::endl;
192
193 // If returncode in list of admissible returncodes, terminate with
194 // the corresponding error
195 for(MInt cnt = 1; cnt < len; cnt++) {
196 if(result == returncodes[cnt]) {
197 TERMM(1, errorMsg + return2string(result));
198 found = true;
199 }
200 }
201
202 // If returncode unknown or not in list of admissible returncodes,
203 // terminate with error unknown
204 if(!found) {
205 TERMM(1, errorMsg + "UNKNOWN Error. MPI Error is " + error_string);
206 }
207}
208
209
211MString mpiTypeName(MPI_Datatype datatype) {
212 char name[128];
213 int namelen;
214 MPI_Type_get_name(datatype, name, &namelen);
215 return std::string(name);
216}
217
218
219//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
220//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
221// Wrapper functions
222//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
223//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
224
226
228
229// ----------------------------------------------------------------------------
230// MPI Communicator functions
231// ----------------------------------------------------------------------------
232
249int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm* newcomm, const MString& name, const MString& varname) {
250#ifdef MAIA_MPI_DEBUG
251 m_log << " + MPI_Comm_create called from function " << name << endl;
252 m_log << " - variable name: " << varname << endl;
253 m_log << " - communicator id: " << getCommId(comm) << endl;
254#endif
255
256 int result = MPI_Comm_create(comm, group, newcomm);
257 // Note: do not change error handling for Paraview, at the moment this results in "MPI_ERR_COMM:
258 // invalid communicator" erros when loading multisolver grids (with inactive ranks for a solver)
259#ifndef PVPLUGIN
260 if(comm != MPI_COMM_NULL) {
261 // Set error handling for new communicator
262 MPI_Comm_set_errhandler(*newcomm, MPI_ERRORS_RETURN);
263 }
264#endif
265
266 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_GROUP};
267
268#ifdef MAIA_MPI_DEBUG
269 // Debug output
270 debugResult(result, returncodes, 3);
271
272 const MBool isNullComm = (*newcomm == MPI_COMM_NULL);
273 if(result == MPI_SUCCESS && !isNullComm) {
274 mpi_dbg_lst.insert(pair<MPI_Comm, MInt>(*newcomm, ++mpi_dbg_cnt));
275 }
276
277 m_log << " - new communicator id: " << getCommId(*newcomm) << endl;
278 m_log << " - total number of comms.: " << mpi_dbg_lst.size() << endl;
279#endif
280
281 // Check return code
282 if(result != MPI_SUCCESS) {
283 const MString customString = "' for variable '" + varname;
284 raiseMPIerror(result, "MPI_Comm_create", returncodes, 3, name, customString);
285 }
286
287 return result;
288}
289
307int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm* newcomm, const MString& name, const MString& varname) {
308#ifdef MAIA_MPI_DEBUG
309 m_log << " + MPI_Comm_split called from function " << name << endl;
310 m_log << " - variable name: " << varname << endl;
311 m_log << " - communicator id: " << getCommId(comm) << endl;
312#endif
313
314 int result = MPI_Comm_split(comm, color, key, newcomm);
315
316 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_INTERN};
317
318#ifdef MAIA_MPI_DEBUG
319 // Debug output
320 debugResult(result, returncodes, 3);
321
322 m_log << " - new communicator id: " << getCommId(*newcomm) << endl;
323 m_log << " - total number of comms.: " << mpi_dbg_lst.size() << endl;
324#endif
325
326 // Check return code
327 if(result != MPI_SUCCESS) {
328 const MString customString = "' for variable '" + varname;
329 raiseMPIerror(result, "MPI_Comm_split", returncodes, 3, name, customString);
330 }
331
332 return result;
333}
334
349int MPI_Comm_free(MPI_Comm* comm, const MString& name, const MString& varname) {
350#ifdef MAIA_MPI_DEBUG
351 m_log << " + MPI_Comm_free called from " << name << endl;
352 m_log << " - variable name: " << varname << endl;
353
354 // search communicator in mapping
355 map<MPI_Comm, MInt>::iterator it = mpi_dbg_lst.find(*comm);
356 if(it == mpi_dbg_lst.end()) {
357 TERMM(1, "Error: Communicator to free not found.");
358 }
359
360 MInt id = it->second;
361 mpi_dbg_lst.erase(it);
362
363 m_log << " - communicator id: " << id << endl;
364 m_log << " - total number of comms.: " << mpi_dbg_lst.size() << endl;
365#endif
366
367 int result = MPI_Comm_free(comm);
368
369 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
370
371#ifdef MAIA_MPI_DEBUG
372 // Debug output
373 debugResult(result, returncodes, 3);
374#endif
375
376 // Check return code
377 if(result != MPI_SUCCESS) {
378 const MString customString = "' for variable '" + varname;
379 raiseMPIerror(result, "MPI_Comm_free", returncodes, 3, name, customString);
380 }
381
382 return result;
383}
384
398int MPI_Comm_group(MPI_Comm comm, MPI_Group* group, const MString& name, const MString& varname) {
399#ifdef MAIA_MPI_DEBUG
400 m_log << " + MPI_Comm_group called from " << name << endl;
401 m_log << " - variable name: " << varname << endl;
402 m_log << " - communicator id: " << getCommId(comm) << endl;
403#endif
404
405 int result = MPI_Comm_group(comm, group);
406
407 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
408
409#ifdef MAIA_MPI_DEBUG
410 // Debug output
411 debugResult(result, returncodes, 3);
412#endif
413
414 // Check return code
415 if(result != MPI_SUCCESS) {
416 const MString customString = "' for variable '" + varname;
417 raiseMPIerror(result, "MPI_Comm_group", returncodes, 3, name, customString);
418 }
419
420 return result;
421}
422
423// ----------------------------------------------------------------------------
424// Point-to-point communication
425// ----------------------------------------------------------------------------
426
427
440int MPI_Send(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, const MString& name,
441 const MString& varname) {
442#ifdef MAIA_MPI_DEBUG
443 m_log << " + MPI_Send called from " << name << endl;
444 m_log << " - variable name / type: " << varname << " / " << mpiTypeName(datatype) << endl;
445 m_log << " - communicator id: " << getCommId(comm) << endl;
446 m_log << " - destination / tag: " << dest << " / " << tag << endl;
447#endif
448
449 startDlbIdleTimer(name);
450 int result = MPI_Send(buf, count, datatype, dest, tag, comm);
451 stopDlbIdleTimer(name);
452
453 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_TAG, MPI_ERR_ARG};
454
455#ifdef MAIA_MPI_DEBUG
456 // Debug output
457 debugResult(result, returncodes, 6);
458#endif
459
460 // Check return code
461 if(result != MPI_SUCCESS) {
462 const MString customString = "' for variable '" + varname;
463 raiseMPIerror(result, "MPI_Send", returncodes, 6, name, customString);
464 }
465
466 return result;
467}
468
481int MPI_Isend(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request,
482 const MString& name, const MString& varname) {
483#ifdef MAIA_MPI_DEBUG
484 m_log << " + MPI_Isend called from " << name << endl;
485 m_log << " - variable name / type: " << varname << " / " << mpiTypeName(datatype) << endl;
486 m_log << " - communicator id: " << getCommId(comm) << endl;
487 m_log << " - destination / tag: " << dest << " / " << tag << endl;
488#endif
489
490 startDlbIdleTimer(name);
491 int result = MPI_Isend(buf, count, datatype, dest, tag, comm, request);
492 stopDlbIdleTimer(name);
493
494 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE,
495 MPI_ERR_TAG, MPI_ERR_RANK, MPI_ERR_INTERN};
496
497#ifdef MAIA_MPI_DEBUG
498 // Debug output
499 debugResult(result, returncodes, 7);
500#endif
501
502 // Check return code
503 if(result != MPI_SUCCESS) {
504 const MString customString = "' for variable '" + varname;
505 raiseMPIerror(result, "MPI_Isend", returncodes, 7, name, customString);
506 }
507
508 return result;
509}
510
523int MPI_Issend(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
524 MPI_Request* request, const MString& name, const MString& varname) {
525#ifdef MAIA_MPI_DEBUG
526 m_log << " + MPI_Issend called from " << name << endl;
527 m_log << " - variable name / type: " << varname << " / " << mpiTypeName(datatype) << endl;
528 m_log << " - communicator id: " << getCommId(comm) << endl;
529 m_log << " - destination / tag: " << dest << " / " << tag << endl;
530#endif
531
532 startDlbIdleTimer(name);
533 int result = MPI_Issend(buf, count, datatype, dest, tag, comm, request);
534 stopDlbIdleTimer(name);
535
536 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE,
537 MPI_ERR_TAG, MPI_ERR_RANK, MPI_ERR_INTERN};
538
539#ifdef MAIA_MPI_DEBUG
540 // Debug output
541 debugResult(result, returncodes, 7);
542#endif
543
544 // Check return code
545 if(result != MPI_SUCCESS) {
546 const MString customString = "' for variable '" + varname;
547 raiseMPIerror(result, "MPI_Issend", returncodes, 7, name, customString);
548 }
549
550 return result;
551}
552
565int MPI_Recv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status* status,
566 const MString& name, const MString& varname) {
567#ifdef MAIA_MPI_DEBUG
568 m_log << " + MPI_Recv called from " << name << endl;
569 m_log << " - variable name / type: " << varname << " / " << mpiTypeName(datatype) << endl;
570 m_log << " - communicator id: " << getCommId(comm) << endl;
571 m_log << " - source / tag: " << source << " / " << tag << endl;
572#endif
573
574 startDlbIdleTimer(name);
575 int result = MPI_Recv(buf, count, datatype, source, tag, comm, status);
576 stopDlbIdleTimer(name);
577
578 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_TAG, MPI_ERR_RANK};
579
580#ifdef MAIA_MPI_DEBUG
581 // Debug output
582 debugResult(result, returncodes, 6);
583#endif
584
585 // Check return code
586 if(result != MPI_SUCCESS) {
587 const MString customString = "' for variable '" + varname;
588 raiseMPIerror(result, "MPI_Recv", returncodes, 6, name, customString);
589 }
590
591 return result;
592}
593
606int MPI_Irecv(void* buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request* request,
607 const MString& name, const MString& varname) {
608#ifdef MAIA_MPI_DEBUG
609 m_log << " + MPI_Irecv called from " << name << endl;
610 m_log << " - variable name / type: " << varname << " / " << mpiTypeName(datatype) << endl;
611 m_log << " - communicator id: " << getCommId(comm) << endl;
612 m_log << " - source / tag: " << source << " / " << tag << endl;
613#endif
614
615 startDlbIdleTimer(name);
616 int result = MPI_Irecv(buf, count, datatype, source, tag, comm, request);
617 stopDlbIdleTimer(name);
618
619 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE,
620 MPI_ERR_TAG, MPI_ERR_RANK, MPI_ERR_INTERN};
621
622#ifdef MAIA_MPI_DEBUG
623 // Debug output
624 debugResult(result, returncodes, 7);
625#endif
626
627 // Check return code
628 if(result != MPI_SUCCESS) {
629 const MString customString = "' for variable '" + varname;
630 raiseMPIerror(result, "MPI_Irecv", returncodes, 7, name, customString);
631 }
632
633 return result;
634}
635
648int MPI_Send_init(const void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm,
649 MPI_Request* request, const MString& name, const MString& varname) {
650#ifdef MAIA_MPI_DEBUG
651 m_log << " + MPI_Send_init called from " << name << endl;
652 m_log << " - variable name: " << varname << endl;
653 m_log << " - communicator id: " << getCommId(comm) << endl;
654#endif
655
656 startDlbIdleTimer(name);
657 int result = MPI_Send_init(buf, count, datatype, dest, tag, comm, request);
658 stopDlbIdleTimer(name);
659
660 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE,
661 MPI_ERR_TAG, MPI_ERR_RANK, MPI_ERR_INTERN};
662
663#ifdef MAIA_MPI_DEBUG
664 // Debug output
665 debugResult(result, returncodes, 7);
666#endif
667
668 // Check return code
669 if(result != MPI_SUCCESS) {
670 const MString customString = "' for variable '" + varname;
671 raiseMPIerror(result, "MPI_Send_init", returncodes, 7, name, customString);
672 }
673
674 return result;
675}
676
689int MPI_Recv_init(void* buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request* request,
690 const MString& name, const MString& varname) {
691#ifdef MAIA_MPI_DEBUG
692 m_log << " + MPI_Recv_init called from " << name << endl;
693 m_log << " - variable name: " << varname << endl;
694 m_log << " - communicator id: " << getCommId(comm) << endl;
695#endif
696
697 startDlbIdleTimer(name);
698 int result = MPI_Recv_init(buf, count, datatype, dest, tag, comm, request);
699 stopDlbIdleTimer(name);
700
701 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE,
702 MPI_ERR_TAG, MPI_ERR_RANK, MPI_ERR_INTERN};
703
704#ifdef MAIA_MPI_DEBUG
705 // Debug output
706 debugResult(result, returncodes, 7);
707#endif
708
709 // Check return code
710 if(result != MPI_SUCCESS) {
711 const MString customString = "' for variable '" + varname;
712 raiseMPIerror(result, "MPI_Recv_init", returncodes, 7, name, customString);
713 }
714
715 return result;
716}
717
718// ----------------------------------------------------------------------------
719// Wait / Test
720// ----------------------------------------------------------------------------
721
722
732int MPI_Wait(MPI_Request* request, MPI_Status* status, const MString& name) {
733#ifdef MAIA_MPI_DEBUG
734 m_log << " + MPI_Wait called from " << name << endl;
735#endif
736
737 startDlbIdleTimer(name);
738 int result = MPI_Wait(request, status);
739 stopDlbIdleTimer(name);
740
741 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST, MPI_ERR_ARG};
742
743#ifdef MAIA_MPI_DEBUG
744 // Debug output
745 debugResult(result, returncodes, 3);
746#endif
747
748 // Check return code
749 if(result != MPI_SUCCESS) {
750 const MString customString;
751 raiseMPIerror(result, "MPI_Wait", returncodes, 3, name, customString);
752 }
753
754 return result;
755}
756
766int MPI_Waitall(int count, MPI_Request* request, MPI_Status* status, const MString& name) {
767#ifdef MAIA_MPI_DEBUG
768 m_log << " + MPI_Waitall called from " << name << endl;
769#endif
770
771 startDlbIdleTimer(name);
772 int result = MPI_Waitall(count, request, status);
773 stopDlbIdleTimer(name);
774
775 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST, MPI_ERR_ARG, MPI_ERR_IN_STATUS};
776
777#ifdef MAIA_MPI_DEBUG
778 // Debug output
779 debugResult(result, returncodes, 4);
780#endif
781
782 // Check return code
783 if(result != MPI_SUCCESS) {
784 const MString customString;
785 raiseMPIerror(result, "MPI_Waitall", returncodes, 4, name, customString);
786 }
787
788 return result;
789}
790
791
801int MPI_Waitsome(int incount, MPI_Request array_of_requests[], int* outcount, int array_of_indices[],
802 MPI_Status array_of_statuses[], const MString& name) {
803#ifdef MAIA_MPI_DEBUG
804 m_log << " + MPI_Waitsome called from " << name << endl;
805#endif
806
807 startDlbIdleTimer(name);
808 int result = MPI_Waitsome(incount, array_of_requests, outcount, array_of_indices, array_of_statuses);
809 stopDlbIdleTimer(name);
810
811 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST, MPI_ERR_ARG, MPI_ERR_IN_STATUS};
812
813#ifdef MAIA_MPI_DEBUG
814 // Debug output
815 debugResult(result, returncodes, 4);
816#endif
817
818 // Check return code
819 if(result != MPI_SUCCESS) {
820 const MString customString;
821 raiseMPIerror(result, "MPI_Waitsome", returncodes, 4, name, customString);
822 }
823
824 return result;
825}
826
836int MPI_Test(MPI_Request* request, int* flag, MPI_Status* status, const MString& name) {
837#ifdef MAIA_MPI_DEBUG
838 m_log << " + MPI_Test called from " << name << endl;
839#endif
840
841 startDlbIdleTimer(name);
842 int result = MPI_Test(request, flag, status);
843 stopDlbIdleTimer(name);
844
845 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST, MPI_ERR_ARG};
846
847#ifdef MAIA_MPI_DEBUG
848 // Debug output
849 debugResult(result, returncodes, 3);
850#endif
851
852 // Check return code
853 if(result != MPI_SUCCESS) {
854 const MString customString;
855 raiseMPIerror(result, "MPI_Test", returncodes, 3, name, customString);
856 }
857
858 return result;
859}
860
861// ----------------------------------------------------------------------------
862// Collectives
863// ----------------------------------------------------------------------------
864
874int MPI_Barrier(MPI_Comm comm, const MString& name) {
875#ifdef MAIA_MPI_DEBUG
876 m_log << " + MPI_Barrier called from " << name << endl;
877 m_log << " - communicator id: " << getCommId(comm) << endl;
878#endif
879
880 startDlbIdleTimer(name);
881 int result = MPI_Barrier(comm);
882 stopDlbIdleTimer(name);
883
884 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM};
885
886#ifdef MAIA_MPI_DEBUG
887 // Debug output
888 debugResult(result, returncodes, 2);
889#endif
890
891 // Check return code
892 if(result != MPI_SUCCESS) {
893 const MString customString;
894 raiseMPIerror(result, "MPI_Barrier", returncodes, 2, name, customString);
895 }
896
897 return result;
898}
899
900
912int MPI_Reduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm,
913 const MString& name, const MString& sndvarname, const MString& rcvvarname) {
914#ifdef MAIA_MPI_DEBUG
915 m_log << " + MPI_Reduce called from " << name << endl;
916 m_log << " - snd variable name: " << sndvarname << endl;
917 m_log << " - rcv variable name: " << rcvvarname << endl;
918 m_log << " - communicator id: " << getCommId(comm) << endl;
919#endif
920
921 startDlbIdleTimer(name);
922 int result = MPI_Reduce(sendbuf, recvbuf, count, datatype, op, root, comm);
923 stopDlbIdleTimer(name);
924
925 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
926
927#ifdef MAIA_MPI_DEBUG
928 // Debug output
929 debugResult(result, returncodes, 5);
930#endif
931
932 // Check return code
933 if(result != MPI_SUCCESS) {
934 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
935 raiseMPIerror(result, "MPI_Reduce", returncodes, 5, name, customString);
936 }
937
938 return result;
939}
940
952int MPI_Allreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
953 const MString& name, const MString& sndvarname, const MString& rcvvarname) {
954#ifdef MAIA_MPI_DEBUG
955 m_log << " + MPI_Allreduce called from " << name << endl;
956 m_log << " - snd variable name: " << sndvarname << endl;
957 m_log << " - rcv variable name: " << rcvvarname << endl;
958 m_log << " - communicator id: " << getCommId(comm) << endl;
959#endif
960
961 startDlbIdleTimer(name);
962 int result = MPI_Allreduce(sendbuf, recvbuf, count, datatype, op, comm);
963 stopDlbIdleTimer(name);
964
965 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER, MPI_ERR_OP};
966
967#ifdef MAIA_MPI_DEBUG
968 // Debug output
969 debugResult(result, returncodes, 6);
970#endif
971
972 // Check return code
973 if(result != MPI_SUCCESS) {
974 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
975 raiseMPIerror(result, "MPI_Allreduce", returncodes, 6, name, customString);
976 }
977
978 return result;
979}
980
981
993int MPI_Iallreduce(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
994 MPI_Request* request, const MString& name, const MString& sndvarname, const MString& rcvvarname) {
995#ifdef MAIA_MPI_DEBUG
996 m_log << " + MPI_Iallreduce called from " << name << endl;
997 m_log << " - snd variable name: " << sndvarname << endl;
998 m_log << " - rcv variable name: " << rcvvarname << endl;
999 m_log << " - communicator id: " << getCommId(comm) << endl;
1000#endif
1001
1002 startDlbIdleTimer(name);
1003 int result = MPI_Iallreduce(sendbuf, recvbuf, count, datatype, op, comm, request);
1004 stopDlbIdleTimer(name);
1005
1006 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER, MPI_ERR_OP};
1007
1008#ifdef MAIA_MPI_DEBUG
1009 // Debug output
1010 debugResult(result, returncodes, 6);
1011#endif
1012
1013 // Check return code
1014 if(result != MPI_SUCCESS) {
1015 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1016 raiseMPIerror(result, "MPI_Iallreduce", returncodes, 6, name, customString);
1017 }
1018
1019 return result;
1020}
1021
1033int MPI_Scatter(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1034 MPI_Datatype recvtype, int root, MPI_Comm comm, const MString& name, const MString& sndvarname,
1035 const MString& rcvvarname) {
1036#ifdef MAIA_MPI_DEBUG
1037 m_log << " + MPI_Scatter called from " << name << endl;
1038 m_log << " - snd variable name: " << sndvarname << endl;
1039 m_log << " - rcv variable name: " << rcvvarname << endl;
1040 m_log << " - communicator id: " << getCommId(comm) << endl;
1041#endif
1042
1043 startDlbIdleTimer(name);
1044 int result = MPI_Scatter(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
1045 stopDlbIdleTimer(name);
1046
1047 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1048
1049#ifdef MAIA_MPI_DEBUG
1050 // Debug output
1051 debugResult(result, returncodes, 5);
1052#endif
1053
1054 // Check return code
1055 if(result != MPI_SUCCESS) {
1056 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1057 raiseMPIerror(result, "MPI_Scatter", returncodes, 5, name, customString);
1058 }
1059
1060 return result;
1061}
1062
1074int MPI_Scatterv(const void* sendbuf, const int sendcount[], const int displs[], MPI_Datatype sendtype, void* recvbuf,
1075 int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, const MString& name,
1076 const MString& sndvarname, const MString& rcvvarname) {
1077#ifdef MAIA_MPI_DEBUG
1078 m_log << " + MPI_Scatter called from " << name << endl;
1079 m_log << " - snd variable name: " << sndvarname << endl;
1080 m_log << " - rcv variable name: " << rcvvarname << endl;
1081 m_log << " - communicator id: " << getCommId(comm) << endl;
1082#endif
1083
1084 startDlbIdleTimer(name);
1085 int result = MPI_Scatterv(sendbuf, sendcount, displs, sendtype, recvbuf, recvcount, recvtype, root, comm);
1086 stopDlbIdleTimer(name);
1087
1088 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1089
1090#ifdef MAIA_MPI_DEBUG
1091 // Debug output
1092 debugResult(result, returncodes, 5);
1093#endif
1094
1095 // Check return code
1096 if(result != MPI_SUCCESS) {
1097 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1098 raiseMPIerror(result, "MPI_Scatter", returncodes, 5, name, customString);
1099 }
1100
1101 return result;
1102}
1103
1114int MPI_Bcast(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString& name,
1115 const MString& varname) {
1116#ifdef MAIA_MPI_DEBUG
1117 m_log << " + MPI_Bcast called from " << name << endl;
1118 m_log << " - variable name: " << varname << endl;
1119 m_log << " - communicator id: " << getCommId(comm) << endl;
1120#endif
1121
1122 startDlbIdleTimer(name);
1123 int result = MPI_Bcast(buffer, count, datatype, root, comm);
1124 stopDlbIdleTimer(name);
1125
1126 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER, MPI_ERR_ROOT};
1127
1128#ifdef MAIA_MPI_DEBUG
1129 // Debug output
1130 debugResult(result, returncodes, 6);
1131#endif
1132
1133 // Check return code
1134 if(result != MPI_SUCCESS) {
1135 const MString customString = "' for variable '" + varname;
1136 raiseMPIerror(result, "MPI_Bcast", returncodes, 6, name, customString);
1137 }
1138
1139 return result;
1140}
1141
1152int MPI_Ibcast(void* buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, MPI_Request* request,
1153 const MString& name, const MString& varname) {
1154#ifdef MAIA_MPI_DEBUG
1155 m_log << " + MPI_Ibcast called from " << name << endl;
1156 m_log << " - variable name: " << varname << endl;
1157 m_log << " - communicator id: " << getCommId(comm) << endl;
1158#endif
1159
1160 startDlbIdleTimer(name);
1161 int result = MPI_Ibcast(buffer, count, datatype, root, comm, request);
1162 stopDlbIdleTimer(name);
1163
1164 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER, MPI_ERR_ROOT};
1165
1166#ifdef MAIA_MPI_DEBUG
1167 // Debug output
1168 debugResult(result, returncodes, 6);
1169#endif
1170
1171 // Check return code
1172 if(result != MPI_SUCCESS) {
1173 const MString customString = "' for variable '" + varname;
1174 raiseMPIerror(result, "MPI_Ibcast", returncodes, 6, name, customString);
1175 }
1176
1177 return result;
1178}
1179
1191int MPI_Gather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1192 MPI_Datatype recvtype, int root, MPI_Comm comm, const MString& name, const MString& sndvarname,
1193 const MString& rcvvarname) {
1194#ifdef MAIA_MPI_DEBUG
1195 m_log << " + MPI_Gather called from " << name << endl;
1196 m_log << " - snd variable name: " << sndvarname << endl;
1197 m_log << " - rcv variable name: " << rcvvarname << endl;
1198 m_log << " - communicator id: " << getCommId(comm) << endl;
1199#endif
1200
1201 startDlbIdleTimer(name);
1202 int result = MPI_Gather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm);
1203 stopDlbIdleTimer(name);
1204
1205 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1206
1207#ifdef MAIA_MPI_DEBUG
1208 // Debug output
1209 debugResult(result, returncodes, 5);
1210#endif
1211
1212 // Check return code
1213 if(result != MPI_SUCCESS) {
1214 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1215 raiseMPIerror(result, "MPI_Gather", returncodes, 5, name, customString);
1216 }
1217
1218 return result;
1219}
1220
1232int MPI_Gatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int recvcounts[],
1233 const int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm, const MString& name,
1234 const MString& sndvarname, const MString& rcvvarname) {
1235#ifdef MAIA_MPI_DEBUG
1236 m_log << " + MPI_Gatherv called from " << name << endl;
1237 m_log << " - snd variable name: " << sndvarname << endl;
1238 m_log << " - rcv variable name: " << rcvvarname << endl;
1239 m_log << " - communicator id: " << getCommId(comm) << endl;
1240#endif
1241
1242 startDlbIdleTimer(name);
1243 int result = MPI_Gatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm);
1244 stopDlbIdleTimer(name);
1245
1246 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1247
1248#ifdef MAIA_MPI_DEBUG
1249 // Debug output
1250 debugResult(result, returncodes, 4);
1251#endif
1252
1253 // Check return code
1254 if(result != MPI_SUCCESS) {
1255 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1256 raiseMPIerror(result, "MPI_Gatherv", returncodes, 4, name, customString);
1257 }
1258
1259
1260 return result;
1261}
1262
1274int MPI_Allgather(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1275 MPI_Datatype recvtype, MPI_Comm comm, const MString& name, const MString& sndvarname,
1276 const MString& rcvvarname) {
1277#ifdef MAIA_MPI_DEBUG
1278 m_log << " + MPI_Allgather called from " << name << endl;
1279 m_log << " - snd variable name: " << sndvarname << endl;
1280 m_log << " - rcv variable name: " << rcvvarname << endl;
1281 m_log << " - communicator id: " << getCommId(comm) << endl;
1282#endif
1283
1284 startDlbIdleTimer(name);
1285 int result = MPI_Allgather(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
1286 stopDlbIdleTimer(name);
1287
1288 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1289
1290#ifdef MAIA_MPI_DEBUG
1291 // Debug output
1292 debugResult(result, returncodes, 5);
1293#endif
1294
1295 // Check return code
1296 if(result != MPI_SUCCESS) {
1297 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1298 raiseMPIerror(result, "MPI_Allgather", returncodes, 5, name, customString);
1299 }
1300
1301 return result;
1302}
1303
1315int MPI_Allgatherv(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, const int recvcounts[],
1316 const int displs[], MPI_Datatype recvtype, MPI_Comm comm, const MString& name,
1317 const MString& sndvarname, const MString& rcvvarname) {
1318#ifdef MAIA_MPI_DEBUG
1319 m_log << " + MPI_Allgatherv called from " << name << endl;
1320 m_log << " - snd variable name: " << sndvarname << endl;
1321 m_log << " - rcv variable name: " << rcvvarname << endl;
1322 m_log << " - communicator id: " << getCommId(comm) << endl;
1323#endif
1324
1325 startDlbIdleTimer(name);
1326 int result = MPI_Allgatherv(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm);
1327 stopDlbIdleTimer(name);
1328
1329 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1330
1331#ifdef MAIA_MPI_DEBUG
1332 // Debug output
1333 debugResult(result, returncodes, 4);
1334#endif
1335
1336 // Check return code
1337 if(result != MPI_SUCCESS) {
1338 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1339 raiseMPIerror(result, "MPI_Allgatherv", returncodes, 4, name, customString);
1340 }
1341
1342 return result;
1343}
1344
1356int MPI_Alltoall(const void* sendbuf, int sendcount, MPI_Datatype sendtype, void* recvbuf, int recvcount,
1357 MPI_Datatype recvtype, MPI_Comm comm, const MString& name, const MString& sndvarname,
1358 const MString& rcvvarname) {
1359#ifdef MAIA_MPI_DEBUG
1360 m_log << " + MPI_Alltoall called from " << name << endl;
1361 m_log << " - snd variable name: " << sndvarname << endl;
1362 m_log << " - rcv variable name: " << rcvvarname << endl;
1363 m_log << " - communicator id: " << getCommId(comm) << endl;
1364#endif
1365
1366 startDlbIdleTimer(name);
1367 int result = MPI_Alltoall(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm);
1368 stopDlbIdleTimer(name);
1369
1370 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COMM, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1371
1372#ifdef MAIA_MPI_DEBUG
1373 // Debug output
1374 debugResult(result, returncodes, 5);
1375#endif
1376
1377 // Check return code
1378 if(result != MPI_SUCCESS) {
1379 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1380 raiseMPIerror(result, "MPI_Alltoall", returncodes, 5, name, customString);
1381 }
1382
1383 return result;
1384}
1385
1397int MPI_Alltoallv(const void* sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype,
1398 void* recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype, MPI_Comm comm,
1399 const MString& name, const MString& sndvarname, const MString& rcvvarname) {
1400#ifdef MAIA_MPI_DEBUG
1401 m_log << " + MPI_Alltoallv called from " << name << endl;
1402 m_log << " - snd variable name: " << sndvarname << endl;
1403 m_log << " - rcv variable name: " << rcvvarname << endl;
1404 m_log << " - communicator id: " << getCommId(comm) << endl;
1405#endif
1406
1407 startDlbIdleTimer(name);
1408 int result = MPI_Alltoallv(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm);
1409 stopDlbIdleTimer(name);
1410
1411 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1412
1413#ifdef MAIA_MPI_DEBUG
1414 // Debug output
1415 debugResult(result, returncodes, 5);
1416#endif
1417
1418 // Check return code
1419 if(result != MPI_SUCCESS) {
1420 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1421 raiseMPIerror(result, "MPI_Alltoallv", returncodes, 5, name, customString);
1422 }
1423
1424 return result;
1425}
1426
1427
1439int MPI_Exscan(const void* sendbuf, void* recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm,
1440 const MString& name, const MString& sndvarname, const MString& rcvvarname) {
1441#ifdef MAIA_MPI_DEBUG
1442 m_log << " + MPI_Exscan called from " << name << endl;
1443 m_log << " - snd variable name: " << sndvarname << endl;
1444 m_log << " - rcv variable name: " << rcvvarname << endl;
1445 m_log << " - communicator id: " << getCommId(comm) << endl;
1446#endif
1447
1448 startDlbIdleTimer(name);
1449 int result = MPI_Exscan(sendbuf, recvbuf, count, datatype, op, comm);
1450 stopDlbIdleTimer(name);
1451
1452 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_COUNT, MPI_ERR_TYPE, MPI_ERR_BUFFER};
1453
1454#ifdef MAIA_MPI_DEBUG
1455 // Debug output
1456 debugResult(result, returncodes, 5);
1457#endif
1458
1459 // Check return code
1460 if(result != MPI_SUCCESS) {
1461 const MString customString = "' for sent variable '" + sndvarname + "' for received variable '" + rcvvarname;
1462 raiseMPIerror(result, "MPI_Exscan", returncodes, 5, name, customString);
1463 }
1464
1465 return result;
1466}
1467
1468// ----------------------------------------------------------------------------
1469// Derived Datatypes
1470// ----------------------------------------------------------------------------
1471
1481int MPI_Type_commit(MPI_Datatype* datatype, const MString& name) {
1482#ifdef MAIA_MPI_DEBUG
1483 m_log << " + MPI_Type_commit called from " << name << endl;
1484#endif
1485
1486 int result = MPI_Type_commit(datatype);
1487
1488 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE};
1489
1490#ifdef MAIA_MPI_DEBUG
1491 // Debug output
1492 debugResult(result, returncodes, 2);
1493#endif
1494
1495 // Check return code
1496 if(result != MPI_SUCCESS) {
1497 const MString customString;
1498 raiseMPIerror(result, "MPI_Type_commit", returncodes, 2, name, customString);
1499 }
1500
1501 return result;
1502}
1503
1513int MPI_Type_free(MPI_Datatype* datatype, const MString& name) {
1514#ifdef MAIA_MPI_DEBUG
1515 m_log << " + MPI_Type_free called from " << name << endl;
1516#endif
1517
1518 int result = MPI_Type_free(datatype);
1519
1520 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE, MPI_ERR_ARG};
1521
1522#ifdef MAIA_MPI_DEBUG
1523 // Debug output
1524 debugResult(result, returncodes, 3);
1525#endif
1526
1527 // Check return code
1528 if(result != MPI_SUCCESS) {
1529 const MString customString;
1530 raiseMPIerror(result, "MPI_Type_free", returncodes, 3, name, customString);
1531 }
1532
1533 return result;
1534}
1535
1545int MPI_Type_create_hindexed(int count, const int array_of_solverlengths[], const MPI_Aint array_of_displacements[],
1546 MPI_Datatype oldtype, MPI_Datatype* newtype, const MString& name) {
1547#ifdef MAIA_MPI_DEBUG
1548 m_log << " + MPI_Type_create_hindexed called from " << name << endl;
1549#endif
1550
1551 int result = MPI_Type_create_hindexed(count, array_of_solverlengths, array_of_displacements, oldtype, newtype);
1552
1553 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE, MPI_ERR_ARG};
1554
1555#ifdef MAIA_MPI_DEBUG
1556 // Debug output
1557 debugResult(result, returncodes, 3);
1558#endif
1559
1560 // Check return code
1561 if(result != MPI_SUCCESS) {
1562 const MString customString;
1563 raiseMPIerror(result, "MPI_Type_create_hindexed", returncodes, 3, name, customString);
1564 }
1565
1566 return result;
1567}
1568
1578int MPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype* new_type_p, const MString& name) {
1579#ifdef MAIA_MPI_DEBUG
1580 m_log << " + MPI_Type_contiguous from " << name << endl;
1581#endif
1582
1583 int result = MPI_Type_contiguous(count, old_type, new_type_p);
1584
1585 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE, MPI_ERR_COUNT, MPI_ERR_INTERN};
1586
1587#ifdef MAIA_MPI_DEBUG
1588 // Debug output
1589 debugResult(result, returncodes, 4);
1590#endif
1591
1592 // Check return code
1593 if(result != MPI_SUCCESS) {
1594 const MString customString;
1595 raiseMPIerror(result, "MPI_Type_contiguous", returncodes, 4, name, customString);
1596 }
1597
1598 return result;
1599}
1600
1601
1602// ----------------------------------------------------------------------------
1603// MPI Group
1604// ----------------------------------------------------------------------------
1605
1615int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group* newgroup, const MString& name) {
1616#ifdef MAIA_MPI_DEBUG
1617 m_log << " + MPI_Group_incl called from " << name << endl;
1618#endif
1619
1620 startDlbIdleTimer(name);
1621 int result = MPI_Group_incl(group, n, ranks, newgroup);
1622 stopDlbIdleTimer(name);
1623
1624 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_GROUP, MPI_ERR_ARG, MPI_ERR_INTERN, MPI_ERR_RANK};
1625
1626#ifdef MAIA_MPI_DEBUG
1627 // Debug output
1628 debugResult(result, returncodes, 5);
1629#endif
1630
1631 // Check return code
1632 if(result != MPI_SUCCESS) {
1633 const MString customString;
1634 raiseMPIerror(result, "MPI_Group_incl", returncodes, 5, name, customString);
1635 }
1636
1637 return result;
1638}
1639
1649int MPI_Group_free(MPI_Group* group, const MString& name) {
1650#ifdef MAIA_MPI_DEBUG
1651 m_log << " + MPI_Group_free called from " << name << endl;
1652#endif
1653
1654 startDlbIdleTimer(name);
1655 int result = MPI_Group_free(group);
1656 stopDlbIdleTimer(name);
1657
1658 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_ARG};
1659
1660#ifdef MAIA_MPI_DEBUG
1661 // Debug output
1662 debugResult(result, returncodes, 2);
1663#endif
1664
1665 // Check return code
1666 if(result != MPI_SUCCESS) {
1667 const MString customString;
1668 raiseMPIerror(result, "MPI_Group_free", returncodes, 2, name, customString);
1669 }
1670
1671 return result;
1672}
1673
1674
1675// ----------------------------------------------------------------------------
1676// MISC
1677// ----------------------------------------------------------------------------
1687int MPI_Start(MPI_Request* request, const MString& name) {
1688#ifdef MAIA_MPI_DEBUG
1689 m_log << " + MPI_Start called from " << name << endl;
1690#endif
1691
1692 startDlbIdleTimer(name);
1693 int result = MPI_Start(request);
1694 stopDlbIdleTimer(name);
1695
1696 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST};
1697
1698#ifdef MAIA_MPI_DEBUG
1699 // Debug output
1700 debugResult(result, returncodes, 2);
1701#endif
1702
1703 // Check return code
1704 if(result != MPI_SUCCESS) {
1705 const MString customString;
1706 raiseMPIerror(result, "MPI_Start", returncodes, 2, name, customString);
1707 }
1708
1709 return result;
1710}
1711
1721int MPI_Startall(int count, MPI_Request array_of_requests[], const MString& name) {
1722#ifdef MAIA_MPI_DEBUG
1723 m_log << " + MPI_Startall called from " << name << endl;
1724#endif
1725
1726 startDlbIdleTimer(name);
1727 int result = MPI_Startall(count, array_of_requests);
1728 stopDlbIdleTimer(name);
1729
1730 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_REQUEST, MPI_ERR_ARG};
1731
1732#ifdef MAIA_MPI_DEBUG
1733 // Debug output
1734 debugResult(result, returncodes, 3);
1735#endif
1736
1737 // Check return code
1738 if(result != MPI_SUCCESS) {
1739 const MString customString;
1740 raiseMPIerror(result, "MPI_Startall", returncodes, 3, name, customString);
1741 }
1742
1743 return result;
1744}
1745
1755int MPI_Get_count(const MPI_Status* status, MPI_Datatype datatype, int* count, const MString& name) {
1756#ifdef MAIA_MPI_DEBUG
1757 m_log << " + MPI_Get_count called from " << name << endl;
1758#endif
1759
1760 startDlbIdleTimer(name);
1761 int result = MPI_Get_count(status, datatype, count);
1762 stopDlbIdleTimer(name);
1763
1764 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE};
1765
1766#ifdef MAIA_MPI_DEBUG
1767 // Debug output
1768 debugResult(result, returncodes, 2);
1769#endif
1770
1771 // Check return code
1772 if(result != MPI_SUCCESS) {
1773 const MString customString;
1774 raiseMPIerror(result, "MPI_Get_count", returncodes, 2, name, customString);
1775 }
1776
1777 return result;
1778}
1779
1789int MPI_Get_address(const void* location, MPI_Aint* address, const MString& name) {
1790#ifdef MAIA_MPI_DEBUG
1791 m_log << " + MPI_Get_address called from " << name << endl;
1792#endif
1793
1794 startDlbIdleTimer(name);
1795 int result = MPI_Get_address(location, address);
1796 stopDlbIdleTimer(name);
1797
1798 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
1799
1800#ifdef MAIA_MPI_DEBUG
1801 // Debug output
1802 debugResult(result, returncodes, 2);
1803#endif
1804
1805 // Check return code
1806 if(result != MPI_SUCCESS) {
1807 const MString customString;
1808 raiseMPIerror(result, "MPI_Get_address", returncodes, 2, name, customString);
1809 }
1810
1811 return result;
1812}
1813
1823int MPI_Abort(MPI_Comm comm, int errorcode, const MString& name) {
1824#ifdef MAIA_MPI_DEBUG
1825 m_log << " + MPI_Abort called from " << name << endl;
1826#endif
1827
1828 startDlbIdleTimer(name);
1829 int result = MPI_Abort(comm, errorcode);
1830 stopDlbIdleTimer(name);
1831
1832 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
1833
1834#ifdef MAIA_MPI_DEBUG
1835 // Debug output
1836 debugResult(result, returncodes, 2);
1837#endif
1838
1839 // Check return code
1840 if(result != MPI_SUCCESS) {
1841 const MString customString;
1842 raiseMPIerror(result, "MPI_Abort", returncodes, 2, name, customString);
1843 }
1844
1845 return result;
1846}
1847
1857int MPI_Request_free(MPI_Request* request, const MString& name) {
1858#ifdef MAIA_MPI_DEBUG
1859 m_log << " + MPI_Request_free called from " << name << endl;
1860#endif
1861
1862 startDlbIdleTimer(name);
1863 int result = MPI_Request_free(request);
1864 stopDlbIdleTimer(name);
1865
1866 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
1867
1868#ifdef MAIA_MPI_DEBUG
1869 // Debug output
1870 debugResult(result, returncodes, 2);
1871#endif
1872
1873 // Check return code
1874 if(result != MPI_SUCCESS) {
1875 const MString customString;
1876 raiseMPIerror(result, "MPI_Request_free", returncodes, 2, name, customString);
1877 }
1878
1879 return result;
1880}
1881
1891int MPI_Cancel(MPI_Request* request, const MString& name) {
1892#ifdef MAIA_MPI_DEBUG
1893 m_log << " + MPI_Cancel called from " << name << endl;
1894#endif
1895
1896 startDlbIdleTimer(name);
1897 int result = MPI_Cancel(request);
1898 stopDlbIdleTimer(name);
1899
1900 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
1901
1902#ifdef MAIA_MPI_DEBUG
1903 // Debug output
1904 debugResult(result, returncodes, 2);
1905#endif
1906
1907 // Check return code
1908 if(result != MPI_SUCCESS) {
1909 const MString customString;
1910 raiseMPIerror(result, "MPI_Cancel", returncodes, 2, name, customString);
1911 }
1912
1913 return result;
1914}
1915
1925int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status* status, const MString& name) {
1926#ifdef MAIA_MPI_DEBUG
1927 m_log << " + MPI_Get_count called from " << name << endl;
1928#endif
1929
1930 startDlbIdleTimer(name);
1931 int result = MPI_Probe(source, tag, comm, status);
1932 stopDlbIdleTimer(name);
1933
1934 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE};
1935
1936#ifdef MAIA_MPI_DEBUG
1937 // Debug output
1938 debugResult(result, returncodes, 2);
1939#endif
1940
1941 // Check return code
1942 if(result != MPI_SUCCESS) {
1943 const MString customString;
1944 raiseMPIerror(result, "MPI_Probe", returncodes, 2, name, customString);
1945 }
1946
1947 return result;
1948}
1949
1959int MPI_Iprobe(int source, int tag, MPI_Comm comm, int* flag, MPI_Status* status, const MString& name) {
1960#ifdef MAIA_MPI_DEBUG
1961 m_log << " + MPI_Get_count called from " << name << endl;
1962#endif
1963
1964 startDlbIdleTimer(name);
1965 int result = MPI_Iprobe(source, tag, comm, flag, status);
1966 stopDlbIdleTimer(name);
1967
1968 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_TYPE};
1969
1970#ifdef MAIA_MPI_DEBUG
1971 // Debug output
1972 debugResult(result, returncodes, 2);
1973#endif
1974
1975 // Check return code
1976 if(result != MPI_SUCCESS) {
1977 const MString customString;
1978 raiseMPIerror(result, "MPI_Iprobe", returncodes, 2, name, customString);
1979 }
1980
1981 return result;
1982}
1983
1984// ----------------------------------------------------------------------------
1985// MPI Info
1986// ----------------------------------------------------------------------------
1996int MPI_Info_create(MPI_Info* info, const MString& name) {
1997#ifdef MAIA_MPI_DEBUG
1998 m_log << " + MPI_Info_create called from " << name << endl;
1999#endif
2000
2001 startDlbIdleTimer(name);
2002 int result = MPI_Info_create(info);
2003 stopDlbIdleTimer(name);
2004
2005 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
2006
2007#ifdef MAIA_MPI_DEBUG
2008 // Debug output
2009 debugResult(result, returncodes, 2);
2010#endif
2011
2012 // Check return code
2013 if(result != MPI_SUCCESS) {
2014 const MString customString;
2015 raiseMPIerror(result, "MPI_Info_create", returncodes, 2, name, customString);
2016 }
2017
2018 return result;
2019}
2020
2030int MPI_Info_free(MPI_Info* info, const MString& name) {
2031#ifdef MAIA_MPI_DEBUG
2032 m_log << " + MPI_Info_free called from " << name << endl;
2033#endif
2034
2035 startDlbIdleTimer(name);
2036 int result = MPI_Info_free(info);
2037 stopDlbIdleTimer(name);
2038
2039 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER, MPI_ERR_INFO};
2040
2041#ifdef MAIA_MPI_DEBUG
2042 // Debug output
2043 debugResult(result, returncodes, 3);
2044#endif
2045
2046 // Check return code
2047 if(result != MPI_SUCCESS) {
2048 const MString customString;
2049 raiseMPIerror(result, "MPI_Info_free", returncodes, 3, name, customString);
2050 }
2051
2052 return result;
2053}
2054
2064int MPI_Info_get(MPI_Info info, const char* key, int valuelen, char* value, int* flag, const MString& name) {
2065#ifdef MAIA_MPI_DEBUG
2066 m_log << " + MPI_Info_get called from " << name << endl;
2067#endif
2068
2069 startDlbIdleTimer(name);
2070 int result = MPI_Info_get(info, key, valuelen, value, flag);
2071 stopDlbIdleTimer(name);
2072
2073 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER, MPI_ERR_INFO_KEY, MPI_ERR_ARG, MPI_ERR_INFO_VALUE};
2074
2075#ifdef MAIA_MPI_DEBUG
2076 // Debug output
2077 debugResult(result, returncodes, 5);
2078#endif
2079
2080 // Check return code
2081 if(result != MPI_SUCCESS) {
2082 const MString customString;
2083 raiseMPIerror(result, "MPI_Info_get", returncodes, 5, name, customString);
2084 }
2085
2086 return result;
2087}
2088
2098int MPI_Info_get_nthkey(MPI_Info info, int n, char* key, const MString& name) {
2099#ifdef MAIA_MPI_DEBUG
2100 m_log << " + MPI_Info_get_nthkey called from " << name << endl;
2101#endif
2102
2103 startDlbIdleTimer(name);
2104 int result = MPI_Info_get_nthkey(info, n, key);
2105 stopDlbIdleTimer(name);
2106
2107 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER, MPI_ERR_ARG};
2108
2109#ifdef MAIA_MPI_DEBUG
2110 // Debug output
2111 debugResult(result, returncodes, 3);
2112#endif
2113
2114 // Check return code
2115 if(result != MPI_SUCCESS) {
2116 const MString customString;
2117 raiseMPIerror(result, "MPI_Info_get_nthkey", returncodes, 3, name, customString);
2118 }
2119
2120 return result;
2121}
2122
2132int MPI_Info_get_nkeys(MPI_Info info, int* nkeys, const MString& name) {
2133#ifdef MAIA_MPI_DEBUG
2134 m_log << " + MPI_Info_get_nkeys called from " << name << endl;
2135#endif
2136
2137 startDlbIdleTimer(name);
2138 int result = MPI_Info_get_nkeys(info, nkeys);
2139 stopDlbIdleTimer(name);
2140
2141 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER};
2142
2143#ifdef MAIA_MPI_DEBUG
2144 // Debug output
2145 debugResult(result, returncodes, 2);
2146#endif
2147
2148 // Check return code
2149 if(result != MPI_SUCCESS) {
2150 const MString customString;
2151 raiseMPIerror(result, "MPI_Info_get_nkeys", returncodes, 2, name, customString);
2152 }
2153
2154 return result;
2155}
2156
2166int MPI_Info_get_valuelen(MPI_Info info, const char* key, int* valuelen, int* flag, const MString& name) {
2167#ifdef MAIA_MPI_DEBUG
2168 m_log << " + MPI_Info_get_valuelen called from " << name << endl;
2169#endif
2170
2171 startDlbIdleTimer(name);
2172 int result = MPI_Info_get_valuelen(info, key, valuelen, flag);
2173 stopDlbIdleTimer(name);
2174
2175 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_OTHER, MPI_ERR_INFO_KEY};
2176
2177#ifdef MAIA_MPI_DEBUG
2178 // Debug output
2179 debugResult(result, returncodes, 3);
2180#endif
2181
2182 // Check return code
2183 if(result != MPI_SUCCESS) {
2184 const MString customString;
2185 raiseMPIerror(result, "MPI_Info_get_valuelen", returncodes, 3, name, customString);
2186 }
2187
2188 return result;
2189}
2190
2191// ----------------------------------------------------------------------------
2192// MPI File
2193// ----------------------------------------------------------------------------
2203int MPI_File_open(MPI_Comm comm, const char* filename, int amode, MPI_Info info, MPI_File* mpi_fh,
2204 const MString& name) {
2205#ifdef MAIA_MPI_DEBUG
2206 m_log << " + MPI_File_open called from " << name << endl;
2207 m_log << " - communicator id: " << getCommId(comm) << endl;
2208#endif
2209
2210 startDlbIdleTimer(name);
2211 int result = MPI_File_open(comm, filename, amode, info, mpi_fh);
2212 stopDlbIdleTimer(name);
2213
2214 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
2215
2216#ifdef MAIA_MPI_DEBUG
2217 // Debug output
2218 debugResult(result, returncodes, 3);
2219#endif
2220
2221 // Check return code
2222 if(result != MPI_SUCCESS) {
2223 const MString customString;
2224 raiseMPIerror(result, "MPI_File_open", returncodes, 3, name, customString);
2225 }
2226
2227 return result;
2228}
2229
2239int MPI_File_seek(MPI_File mpi_fh, MPI_Offset offset, int whence, const MString& name) {
2240#ifdef MAIA_MPI_DEBUG
2241 m_log << " + MPI_File_seek called from " << name << endl;
2242#endif
2243
2244 startDlbIdleTimer(name);
2245 int result = MPI_File_seek(mpi_fh, offset, whence);
2246 stopDlbIdleTimer(name);
2247
2248 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
2249
2250#ifdef MAIA_MPI_DEBUG
2251 // Debug output
2252 debugResult(result, returncodes, 3);
2253#endif
2254
2255 // Check return code
2256 if(result != MPI_SUCCESS) {
2257 const MString customString;
2258 raiseMPIerror(result, "MPI_File_seek", returncodes, 3, name, customString);
2259 }
2260
2261 return result;
2262}
2263
2273int MPI_File_close(MPI_File* mpi_fh, const MString& name) {
2274#ifdef MAIA_MPI_DEBUG
2275 m_log << " + MPI_File_close called from " << name << endl;
2276#endif
2277
2278 startDlbIdleTimer(name);
2279 int result = MPI_File_close(mpi_fh);
2280 stopDlbIdleTimer(name);
2281
2282 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
2283
2284#ifdef MAIA_MPI_DEBUG
2285 // Debug output
2286 debugResult(result, returncodes, 3);
2287#endif
2288
2289 // Check return code
2290 if(result != MPI_SUCCESS) {
2291 const MString customString;
2292 raiseMPIerror(result, "MPI_File_close", returncodes, 3, name, customString);
2293 }
2294
2295 return result;
2296}
2297
2307int MPI_File_write_shared(MPI_File mpi_fh, const void* buf, int count, MPI_Datatype datatype, MPI_Status* status,
2308 const MString& name) {
2309#ifdef MAIA_MPI_DEBUG
2310 m_log << " + MPI_File_write_shared called from " << name << endl;
2311#endif
2312
2313 startDlbIdleTimer(name);
2314 int result = MPI_File_write_shared(mpi_fh, buf, count, datatype, status);
2315 stopDlbIdleTimer(name);
2316
2317 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
2318
2319#ifdef MAIA_MPI_DEBUG
2320 // Debug output
2321 debugResult(result, returncodes, 3);
2322#endif
2323
2324 // Check return code
2325 if(result != MPI_SUCCESS) {
2326 const MString customString;
2327 raiseMPIerror(result, "MPI_File_write_shared", returncodes, 3, name, customString);
2328 }
2329
2330 return result;
2331}
2332
2342int MPI_File_iwrite_shared(MPI_File mpi_fh, const void* buf, int count, MPI_Datatype datatype, MPI_Request* request,
2343 const MString& name) {
2344#ifdef MAIA_MPI_DEBUG
2345 m_log << " + MPI_File_iwrite_shared called from " << name << endl;
2346#endif
2347
2348 startDlbIdleTimer(name);
2349 int result = MPI_File_iwrite_shared(mpi_fh, buf, count, datatype, request);
2350 stopDlbIdleTimer(name);
2351
2352 const MInt returncodes[] = {MPI_SUCCESS, MPI_ERR_COMM, MPI_ERR_ARG};
2353
2354#ifdef MAIA_MPI_DEBUG
2355 // Debug output
2356 debugResult(result, returncodes, 3);
2357#endif
2358
2359 // Check return code
2360 if(result != MPI_SUCCESS) {
2361 const MString customString;
2362 raiseMPIerror(result, "MPI_File_iwrite_shared", returncodes, 3, name, customString);
2363 }
2364
2365 return result;
2366}
2367
2368// Enable compiler flag "-Wdeprecated-declarations" again
2369#pragma GCC diagnostic pop
void stopIdleStartLoadTimer(const MString &name)
Stop the currently running idle timer and start the corresponding load timer.
Definition: dlbtimer.h:423
void stopLoadStartIdleTimer(const MString &name)
Stop the currently running load timer and start the corresponding idle timer.
Definition: dlbtimer.h:408
const MString & location
Definition: functions.h:37
InfoOutFile m_log
int32_t MInt
Definition: maiatypes.h:62
std::basic_string< char > MString
Definition: maiatypes.h:55
bool MBool
Definition: maiatypes.h:58
MInt id
Definition: maiatypes.h:71
int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Status *status, const MString &name, const MString &varname)
same as MPI_Recv
int MPI_File_iwrite_shared(MPI_File mpi_fh, const void *buf, int count, MPI_Datatype datatype, MPI_Request *request, const MString &name)
same as MPI_File_iwrite_shared
int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Isend
int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value, int *flag, const MString &name)
same as MPI_Info_get
int MPI_Send_init(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Send_init
int MPI_Barrier(MPI_Comm comm, const MString &name)
same as MPI_Barrier
int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allgatherv
int MPI_File_seek(MPI_File mpi_fh, MPI_Offset offset, int whence, const MString &name)
same as MPI_File_seek
int MPI_Scatterv(const void *sendbuf, const int sendcount[], const int displs[], MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Scatterv
int MPI_Waitsome(int incount, MPI_Request array_of_requests[], int *outcount, int array_of_indices[], MPI_Status array_of_statuses[], const MString &name)
same as MPI_Waitsome
int MPI_Get_count(const MPI_Status *status, MPI_Datatype datatype, int *count, const MString &name)
same as MPI_Get_count
int MPI_Info_free(MPI_Info *info, const MString &name)
same as MPI_Info_free
int MPI_Type_commit(MPI_Datatype *datatype, const MString &name)
same as MPI_Type_commit
MInt getCommId(const MPI_Comm comm)
Determine communicator ID.
Definition: mpioverride.cpp:42
int MPI_Comm_free(MPI_Comm *comm, const MString &name, const MString &varname)
same as MPI_Comm_free, but updates the number of MPI communicators
int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Irecv
int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Recv_init
int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm, const MString &name, const MString &varname)
same as MPI_Comm_create, but updates the number of MPI communicators
int MPI_Abort(MPI_Comm comm, int errorcode, const MString &name)
same as MPI_Abort
int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Issend
int MPI_File_open(MPI_Comm comm, const char *filename, int amode, MPI_Info info, MPI_File *mpi_fh, const MString &name)
same as MPI_File_open
int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *newgroup, const MString &name)
same as MPI_Group_incl
MString return2string(const MInt returncode)
Convert returncode to string.
Definition: mpioverride.cpp:71
int MPI_Type_free(MPI_Datatype *datatype, const MString &name)
same as MPI_Type_free
void raiseMPIerror(const MInt result, const MString &mpiFunction, const MInt returncodes[], const MInt len, const MString &name, const MString &customString)
Raise and error and terminate if MPI returns an errorcode.
int MPI_Comm_group(MPI_Comm comm, MPI_Group *group, const MString &name, const MString &varname)
same as MPI_Comm_group
int MPI_Info_get_valuelen(MPI_Info info, const char *key, int *valuelen, int *flag, const MString &name)
same as MPI_Info_get_valuelen
MInt mpi_dbg_cnt
Definition: mpioverride.cpp:25
void debugResult(const MInt result, const MInt returncodes[], const MInt len)
Print debug output in m_log.
int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &varname)
same as MPI_Ibcast
int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Scatter
int MPI_Cancel(MPI_Request *request, const MString &name)
same as MPI_cancel
int MPI_Wait(MPI_Request *request, MPI_Status *status, const MString &name)
same as MPI_Wait
int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int displs[], MPI_Datatype recvtype, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Gatherv
int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Exscan
map< MPI_Comm, MInt > mpi_dbg_lst
Definition: mpioverride.cpp:24
int MPI_Waitall(int count, MPI_Request *request, MPI_Status *status, const MString &name)
same as MPI_Waitall
int MPI_Type_contiguous(int count, MPI_Datatype old_type, MPI_Datatype *new_type_p, const MString &name)
same as MPI_Type_contiguous
int MPI_Start(MPI_Request *request, const MString &name)
same as MPI_Start
int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, MPI_Request *request, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Iallreduce
int MPI_Type_create_hindexed(int count, const int array_of_solverlengths[], const MPI_Aint array_of_displacements[], MPI_Datatype oldtype, MPI_Datatype *newtype, const MString &name)
same as MPI_Type_create_hindexed
int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Reduce
int MPI_File_close(MPI_File *mpi_fh, const MString &name)
same as MPI_File_close
int MPI_Info_create(MPI_Info *info, const MString &name)
same as MPI_Info_create
int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status, const MString &name)
same as MPI_Test
int MPI_Get_address(const void *location, MPI_Aint *address, const MString &name)
same as MPI_Get_address
int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allreduce
int MPI_Info_get_nthkey(MPI_Info info, int n, char *key, const MString &name)
same as MPI_Info_get_nthkey
int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Alltoall
int MPI_Request_free(MPI_Request *request, const MString &name)
same as MPI_Request_free
int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm, const MString &name, const MString &varname)
same as MPI_Comm_split, but updates the number of MPI communicators
void startDlbIdleTimer(const MString &name)
MString mpiTypeName(MPI_Datatype datatype)
Return the name of the given MPI datatype.
int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag, MPI_Status *status, const MString &name)
Iprobe MPI to get status without actually receiving the message.
int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Bcast
int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status, const MString &name)
probe MPI to get status without actually receiving the message
void stopDlbIdleTimer(const MString &name)
int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Gather
int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Allgather
int MPI_File_write_shared(MPI_File mpi_fh, const void *buf, int count, MPI_Datatype datatype, MPI_Status *status, const MString &name)
same as MPI_File_write_shared
int MPI_Info_get_nkeys(MPI_Info info, int *nkeys, const MString &name)
same as MPI_Info_get_nkeys
int MPI_Group_free(MPI_Group *group, const MString &name)
same as MPI_Group_free
int MPI_Alltoallv(const void *sendbuf, const int sendcounts[], const int sdispls[], MPI_Datatype sendtype, void *recvbuf, const int recvcounts[], const int rdispls[], MPI_Datatype recvtype, MPI_Comm comm, const MString &name, const MString &sndvarname, const MString &rcvvarname)
same as MPI_Alltoallv
int MPI_Startall(int count, MPI_Request array_of_requests[], const MString &name)
same as MPI_Startall
int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int tag, MPI_Comm comm, const MString &name, const MString &varname)
same as MPI_Send
DlbTimerController g_dlbTimerController