[MOAB-dev] r1919 - in MOAB/trunk: parallel tools/mbcoupler
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Mon Jun 23 22:07:22 CDT 2008
Author: tautges
Date: 2008-06-23 22:07:22 -0500 (Mon, 23 Jun 2008)
New Revision: 1919
Modified:
MOAB/trunk/parallel/ReadParallel.cpp
MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
Log:
Bug fixes for reading multiple files on a parallel read. Also move
MPI_Finalize in the coupler test so it isn't called if one task has an
error; prevents deadlock.
Modified: MOAB/trunk/parallel/ReadParallel.cpp
===================================================================
--- MOAB/trunk/parallel/ReadParallel.cpp 2008-06-24 01:21:00 UTC (rev 1918)
+++ MOAB/trunk/parallel/ReadParallel.cpp 2008-06-24 03:07:22 UTC (rev 1919)
@@ -227,6 +227,7 @@
std::vector<int>::iterator vit;
int i, j;
act_times[0] = MPI_Wtime();
+ MBRange all_ents, all_ents2;
for (i = 1, vit = pa_vec.begin();
vit != pa_vec.end(); vit++, i++) {
@@ -238,12 +239,14 @@
for (j = 0; j < num_files; j++) {
if (debug)
std::cout << "Reading file " << file_names[j] << std::endl;
-
+
+ MBEntityHandle new_file_set;
+
reader = impl->reader_writer_set()->
get_file_extension_reader( file_names[j] );
if (reader)
{
- tmp_result = reader->load_file( file_names[j], file_set, opts,
+ tmp_result = reader->load_file( file_names[j], new_file_set, opts,
material_set_list, num_material_sets );
delete reader;
}
@@ -256,7 +259,7 @@
reader = iter->make_reader( mbImpl );
if (NULL != reader)
{
- tmp_result = reader->load_file( file_names[j], file_set, opts,
+ tmp_result = reader->load_file( file_names[j], new_file_set, opts,
material_set_list, num_material_sets );
delete reader;
if (MB_SUCCESS == tmp_result)
@@ -266,7 +269,21 @@
}
if (MB_SUCCESS != tmp_result) break;
+
+ // accumulate all the entities
+ tmp_result = mbImpl->get_entities_by_handle(new_file_set, all_ents2);
+ if (MB_SUCCESS != tmp_result) break;
+ all_ents.merge(all_ents2);
}
+
+ // make a new set for the parallel read, if necessary,
+ // and put ents in that
+ if (0 == file_set) {
+ tmp_result = mbImpl->create_meshset(MESHSET_SET, file_set);
+ if (MB_SUCCESS != tmp_result) break;
+ }
+ tmp_result = mbImpl->add_entities(file_set, all_ents);
+ if (MB_SUCCESS != tmp_result) break;
// mark the file set
other_sets = 0;
Modified: MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp
===================================================================
--- MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp 2008-06-24 01:21:00 UTC (rev 1918)
+++ MOAB/trunk/tools/mbcoupler/mbcoupler_test.cpp 2008-06-24 03:07:22 UTC (rev 1919)
@@ -61,11 +61,9 @@
MBEntityHandle file_set = 0;
result = rp.load_file(&filenames[0], filenames.size(), file_set,
FileOptions(opts.c_str()), NULL, 0);
-
- err = MPI_Finalize();
-
if (MB_SUCCESS == result) {
std::cout << "Success." << std::endl;
+ err = MPI_Finalize();
return 0;
}
else {
More information about the moab-dev
mailing list