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

tautges at mcs.anl.gov tautges at mcs.anl.gov
Wed Jun 18 15:51:42 CDT 2008


Author: tautges
Date: 2008-06-18 15:51:42 -0500 (Wed, 18 Jun 2008)
New Revision: 1912

Modified:
   MOAB/trunk/parallel/ReadParallel.cpp
   MOAB/trunk/parallel/pcomm_unit.cpp
Log:
Corrected a compile error in pcomm_unit.

Inserted a check in ReadParallel to compare # partition sets to # procs; currently don't support parallel read where former is less than the latter.

Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp	2008-06-18 19:17:45 UTC (rev 1911)
+++ MOAB/trunk/parallel/ReadParallel.cpp	2008-06-18 20:51:42 UTC (rev 1912)
@@ -209,13 +209,16 @@
   int tag_val, *tag_val_ptr = &tag_val;
   MBCore *impl = dynamic_cast<MBCore*>(mbImpl);
 
-  double act_times[10] = {0.0};
+  std::vector<double> act_times(pa_vec.size()+1);
   double stime = 0.0;
   if (cputime) stime = MPI_Wtime();
+  std::vector<int>::iterator vit;
+  int i;
+  act_times[0] = MPI_Wtime();
+  
+  for (i = 1, vit = pa_vec.begin();
+       vit != pa_vec.end(); vit++, i++) {
 
-  for (std::vector<int>::iterator vit = pa_vec.begin();
-       vit != pa_vec.end(); vit++) {
-
     MBErrorCode tmp_result = MB_SUCCESS;
     switch (*vit) {
 //==================
@@ -371,17 +374,16 @@
       RR(ostr.str().c_str());
     }
 
-    if (cputime) act_times[*vit] = MPI_Wtime() - 
-                     (*vit ? act_times[*vit - 1] : stime);
+    if (cputime) act_times[i] = MPI_Wtime();
   }
 
   if (cputime && 0 == mbImpl->proc_rank()) {
     std::cout << "Read times: ";
-    for (std::vector<int>::iterator vit = pa_vec.begin();
-         vit != pa_vec.end(); vit++) 
-      std::cout << act_times[*vit] << " ";
+    for (i = 1, vit = pa_vec.begin();
+         vit != pa_vec.end(); vit++, i++) 
+      std::cout << act_times[i] - act_times[i-1] << " ";
     std::cout << "(";
-    for (std::vector<int>::iterator vit = pa_vec.begin();
+    for (vit = pa_vec.begin();
          vit != pa_vec.end(); vit++) 
       std::cout << ParallelActionsNames[*vit] << "/";
     std::cout << ")" << std::endl;
@@ -428,6 +430,13 @@
   }
 
   if (distribute) {
+      // for now, require that number of partition sets be greater
+      // than number of procs
+    if (partition_sets.size() < (unsigned int) proc_sz) {
+      result = MB_FAILURE;
+      RR("Number of procs greater than number of partitions.");
+    }
+    
     MBRange tmp_sets;
       // distribute the partition sets
     unsigned int num_sets = partition_sets.size() / proc_sz;

Modified: MOAB/trunk/parallel/pcomm_unit.cpp
===================================================================
--- MOAB/trunk/parallel/pcomm_unit.cpp	2008-06-18 19:17:45 UTC (rev 1911)
+++ MOAB/trunk/parallel/pcomm_unit.cpp	2008-06-18 20:51:42 UTC (rev 1912)
@@ -71,7 +71,7 @@
   MBParallelComm pcomm( &moab );
   int size = 0;
   std::vector<unsigned char> buff;
-  rval = pcomm.pack_buffer( entities, false, true, false,
+  rval = pcomm.pack_buffer( entities, false, true, false, false,
                             -1, tmp_range, buff, size );
   CHECK_ERR(rval);
   




More information about the moab-dev mailing list