29 MPI_Init(&argc, &argv);
41 std::string tabS =
"";
42 for (
int i = 0; i < nt; i++)
44 std::ostringstream oss;
45 oss << tabS <<
"------- MpiStatus --------" << std::endl << std::endl;
47 oss << tabS <<
"MPI Size = " << d_mpiSize << std::endl;
48 oss << tabS <<
"MPI Rank = " << d_mpiRank << std::endl;
49 oss << tabS <<
"MPI Enabled = " << d_mpiEnabled << std::endl;
50 oss << tabS << std::endl;
56 if (mpistatus_p !=
nullptr)
71 if (mpistatus_p ==
nullptr)
79 if (mpistatus_p ==
nullptr)
87 if (mpistatus_p ==
nullptr)
95 if (mpistatus_p ==
nullptr)
98 return mpistatus_p->
d_comm;
103 if (mpistatus_p ==
nullptr)
110 if (numThreads > 0) {
111 std::cout <<
"Number of threads numThreads is already initialized.\n";
113 numThreads = nThreads;
118 numThreads = std::thread::hardware_concurrency();
util::parallel::MpiStatus * mpistatus_p
bool isMpiEnabled()
Function to check if MPI is enabled.
void initMpiStatus()
Initializes MpiStatus struct.
unsigned int getNThreads()
Get number of threads to be used by taskflow.
void initNThreads(unsigned int nThreads=std::thread::hardware_concurrency())
Initializes MpiStatus struct.
const MpiStatus * getMpiStatus()
Returns pointer to MpiStatus struct.
void initMpi(int argc=0, char *argv[]=nullptr)
Initializes MPI and also creates MpiStatus struct.
int mpiSize()
Get size (number) of processors.
int mpiRank()
get rank (id) of this processor
MPI_Comm mpiComm()
Get MPI comm.
Struct that stores MPI-related information.
int d_mpiRank
Rank (id) of this processor.
bool d_mpiEnabled
Specifies if MPI is enabled (yes if code executed with more than one processor)
int d_mpiSize
Size (number) of processors.
std::string printStr(int nt=0, int lvl=0) const
Returns the string containing printable information about the object.