[MOAB-dev] r1479 - MOAB/trunk/parallel

tautges at mcs.anl.gov tautges at mcs.anl.gov
Wed Dec 19 14:38:29 CST 2007


Author: tautges
Date: 2007-12-19 14:38:26 -0600 (Wed, 19 Dec 2007)
New Revision: 1479

Modified:
   MOAB/trunk/parallel/ReadParallel.cpp
Log:
Adding some error reporting and some code to cut the partition in half if running on one processor.  Helps profile the code on a single processor.


Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp	2007-12-19 17:59:01 UTC (rev 1478)
+++ MOAB/trunk/parallel/ReadParallel.cpp	2007-12-19 20:38:26 UTC (rev 1479)
@@ -266,10 +266,13 @@
         return MB_FAILURE;
     }
 
-    if (MB_SUCCESS != tmp_result) {
+    if (MB_SUCCESS != tmp_result &&
+        (*vit != PA_BROADCAST || mbImpl->proc_size() != 1)) {
       result = tmp_result;
       std::ostringstream ostr;
       ostr << "Failed in step " << ParallelActionsNames[*vit] << std::endl;
+      std::string tmp_str;
+      if (MB_SUCCESS == mbImpl->get_last_error(tmp_str)) ostr << tmp_str << std::endl;
       RR(ostr.str().c_str());
     }
   }
@@ -296,6 +299,7 @@
 
   int proc_sz = mbImpl->proc_size();
   int proc_rk = mbImpl->proc_rank();
+  unsigned int num_partsets = partition_sets.size();
 
   if (!ptag_vals.empty()) {
       // values input, get sets with those values
@@ -320,6 +324,9 @@
     int num_sets = partition_sets.size() / proc_sz, orig_numsets = num_sets;
     if (proc_rk < partition_sets.size() % proc_sz) num_sets++;
 
+      // cut them in half if we're on one proc
+    if (proc_sz == 1 && num_partsets == num_sets) num_sets /= 2;
+    
     for (int i = 0; i < num_sets; i++) 
       tmp_sets.insert(partition_sets[i*proc_sz + proc_rk]);
 
@@ -373,11 +380,13 @@
   }
 
     // delete sets, then ents
-  result = mbImpl->delete_entities(deletable_sets);
+  if (!deletable_sets.empty())
+    result = mbImpl->delete_entities(deletable_sets);
   RR("Failure deleting sets in delete_nonlocal_entities.");
 
   deletable_ents = deletable_ents.subtract(deletable_sets);
-  result = mbImpl->delete_entities(deletable_ents);
+  if (!deletable_ents.empty())
+    result = mbImpl->delete_entities(deletable_ents);
   RR("Failure deleting entities in delete_nonlocal_entities.");
 
 //  if (debug)




More information about the moab-dev mailing list