29 m_log << fixed <<
"=================================================" << endl;
33 m_log <<
"=================================================" << endl;
36 MLong oldAllocBytes = oldAllocatedBytes;
37 MLong allocMax = allocBytes - oldAllocatedBytes;
39 MPI_Allreduce(MPI_IN_PLACE, &allocBytes, 1, MPI_LONG, MPI_SUM, comm, AT_,
"MPI_IN_PLACE",
"allocBytes");
40 MPI_Allreduce(MPI_IN_PLACE, &oldAllocBytes, 1, MPI_LONG, MPI_SUM, comm, AT_,
"MPI_IN_PLACE",
"oldAllocBytes");
41 MPI_Allreduce(MPI_IN_PLACE, &allocMax, 1, MPI_LONG, MPI_MAX, comm, AT_,
"MPI_IN_PLACE",
"oldAllocBytes");
45 cerr <<
"=== " <<
getMemorySize(allocBytes - oldAllocBytes) <<
" globally allocated by " << solverName
46 <<
". Total global memory: " <<
getMemorySize(allocBytes) <<
". ===" << endl;
47 cerr <<
"=== " <<
getMemorySize(allocMax) <<
" maximum globally allocated by " << solverName <<
". ===" << endl;
55 if((
MFloat)noBytes / (1024 * 1024) < 1.0) {
57 sprintf(buffer,
"%6.2f", tmp);
58 size << buffer <<
" KB";
59 }
else if(((
MFloat)noBytes / (1024 * 1024 * 1024)) > 1.0) {
61 sprintf(buffer,
"%6.2f", tmp);
62 size << buffer <<
" GB";
65 sprintf(buffer,
"%6.2f", tmp);
66 size << buffer <<
" MB";
MString getMemorySize(MLong noBytes)
Returns memory size in KB, MB or GB.
void printAllocatedMemory(const MLong oldAllocatedBytes, const MString &solverName, const MPI_Comm comm)
Prints currently allocated memory.
MInt globalNoDomains()
Return global number of domains.
MInt globalDomainId()
Return global domain id.
std::basic_string< char > MString
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