[MOAB-dev] r3852 - MOAB/trunk/src/io
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Wed May 5 17:01:03 CDT 2010
Author: kraftche
Date: 2010-05-05 17:01:03 -0500 (Wed, 05 May 2010)
New Revision: 3852
Modified:
MOAB/trunk/src/io/IODebugTrack.cpp
MOAB/trunk/src/io/IODebugTrack.hpp
Log:
fix bug: don't make MPI calls if MPI is not initialized
Modified: MOAB/trunk/src/io/IODebugTrack.cpp
===================================================================
--- MOAB/trunk/src/io/IODebugTrack.cpp 2010-05-05 22:00:33 UTC (rev 3851)
+++ MOAB/trunk/src/io/IODebugTrack.cpp 2010-05-05 22:01:03 UTC (rev 3852)
@@ -36,10 +36,15 @@
ostr(std::cerr),
maxSize(table_size)
{
+ mpiRank = 0;
+ haveMPI = false;
#ifdef USE_MPI
- MPI_Comm_rank( MPI_COMM_WORLD, &mpiRank );
-#else
- mpiRank = 0;
+ int have_init = 0;
+ MPI_Initialized(&have_init);
+ if (have_init) {
+ haveMPI = true;
+ MPI_Comm_rank( MPI_COMM_WORLD, &mpiRank );
+ }
#endif
}
@@ -112,7 +117,7 @@
void IODebugTrack::all_reduce()
{
#ifdef USE_MPI
- if (!enableOutput)
+ if (!enableOutput || !haveMPI)
return;
int commsize;
Modified: MOAB/trunk/src/io/IODebugTrack.hpp
===================================================================
--- MOAB/trunk/src/io/IODebugTrack.hpp 2010-05-05 22:00:33 UTC (rev 3851)
+++ MOAB/trunk/src/io/IODebugTrack.hpp 2010-05-05 22:01:03 UTC (rev 3852)
@@ -30,6 +30,7 @@
std::ostream& ostr;
unsigned long maxSize;
int mpiRank;
+ bool haveMPI;
void record_io( DRange data );
More information about the moab-dev
mailing list