[MOAB-dev] r2081 - MOAB/trunk/parallel
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Tue Sep 23 13:22:32 CDT 2008
Author: tautges
Date: 2008-09-23 13:22:32 -0500 (Tue, 23 Sep 2008)
New Revision: 2081
Modified:
MOAB/trunk/parallel/ReadParallel.cpp
MOAB/trunk/parallel/mbparallelcomm_test.cpp
Log:
Fixed dumb error assigning partition sets to processors in blocks.
Report total # hexes over all procs in mbparallelcomm_test.
Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp 2008-09-23 17:13:30 UTC (rev 2080)
+++ MOAB/trunk/parallel/ReadParallel.cpp 2008-09-23 18:22:32 UTC (rev 2081)
@@ -459,13 +459,18 @@
// distribute the partition sets
unsigned int tot_sets = myPcomm->partition_sets().size();
unsigned int num_sets = myPcomm->partition_sets().size() / proc_sz;
- if (proc_rk < (int) (myPcomm->partition_sets().size() % proc_sz)) num_sets++;
+ unsigned int num_leftover = myPcomm->partition_sets().size() % proc_sz;
+ int begin_set = 0;
+ if (proc_rk < (int) num_leftover) {
+ num_sets++;
+ begin_set = num_sets * proc_rk;
+ }
+ else
+ begin_set = proc_rk * num_sets + num_leftover;
+
- for (unsigned int i = 0; i < num_sets; i++) {
-// tmp_sets.insert(myPcomm->partition_sets()[i*proc_sz + proc_rk]);
- if (num_sets*proc_rk+i < tot_sets)
- tmp_sets.insert(myPcomm->partition_sets()[num_sets*proc_rk+i]);
- }
+ for (unsigned int i = 0; i < num_sets; i++)
+ tmp_sets.insert(myPcomm->partition_sets()[begin_set+i]);
myPcomm->partition_sets().swap(tmp_sets);
}
Modified: MOAB/trunk/parallel/mbparallelcomm_test.cpp
===================================================================
--- MOAB/trunk/parallel/mbparallelcomm_test.cpp 2008-09-23 17:13:30 UTC (rev 2080)
+++ MOAB/trunk/parallel/mbparallelcomm_test.cpp 2008-09-23 18:22:32 UTC (rev 2081)
@@ -451,7 +451,15 @@
// report # regions owned by this proc
std::cout << "Proc " << rank << " owns " << part_ents.size()
<< " 3d entities." << std::endl;
+
+ // get total # regions over all procs
+ int num_local = part_ents.size(), num_total;
+ int failure = MPI_Reduce(&num_local, &num_total, 1,
+ MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
+ if (0 == rank)
+ std::cout << "Total # owned regions = " << num_total << std::endl;
+
return result;
}
More information about the moab-dev
mailing list