[MOAB-dev] r5514 - in MOAB/trunk: src/parallel test/parallel
tautges at mcs.anl.gov
tautges at mcs.anl.gov
Thu May 10 12:34:33 CDT 2012
Author: tautges
Date: 2012-05-10 12:34:33 -0500 (Thu, 10 May 2012)
New Revision: 5514
Modified:
MOAB/trunk/src/parallel/ParallelComm.cpp
MOAB/trunk/test/parallel/parallel_unit_tests.cpp
Log:
Add code to check reduce_tags case where source and dest tags are not the
same. Fix bug that case exposed. Thanks Lorenzo Botti for the bug report.
Passes make check in parallel.
Modified: MOAB/trunk/src/parallel/ParallelComm.cpp
===================================================================
--- MOAB/trunk/src/parallel/ParallelComm.cpp 2012-05-09 01:29:15 UTC (rev 5513)
+++ MOAB/trunk/src/parallel/ParallelComm.cpp 2012-05-10 17:34:33 UTC (rev 5514)
@@ -3491,6 +3491,10 @@
std::cerr << "Bitwise operations not allowed in tag reductions." << std::endl;
return MB_FAILURE;
}
+ else if (mpi_op != MPI_OP_NULL) {
+ std::cerr << "Unknown MPI operation type." << std::endl;
+ return MB_TYPE_OUT_OF_RANGE;
+ }
return MB_SUCCESS;
}
@@ -7046,6 +7050,7 @@
int tags_size, tagd_size;
DataType tags_type, tagd_type;
std::vector<unsigned char> vals;
+ std::vector<int> tags_sizes;
for (vits = src_tags.begin(), vitd = dst_tags.begin(); vits != src_tags.end(); vits++, vitd++) {
// checks on tag characteristics
result = mbImpl->tag_get_data_type(*vits, tags_type);
@@ -7062,6 +7067,8 @@
result = mbImpl->tag_get_default_value(*vits, &vals[0]);
RRA("Src tag must have default value.");
+ tags_sizes.push_back(tags_size);
+
// ok, those passed; now check whether dest tags, if specified, agree with src tags
if (*vits == *vitd) continue;
@@ -7121,7 +7128,19 @@
}
else
entities = entities_in;
-
+
+ // if the tags are different, copy the source to the dest tag locally
+ std::vector<Tag>::const_iterator vit = src_tags.begin(), vit2 = dst_tags.begin();
+ std::vector<int>::const_iterator vsizes = tags_sizes.begin();
+ for (; vit != src_tags.end(); vit++, vit2++, vsizes++) {
+ if (*vit == *vit2) continue;
+ vals.resize(entities.size()*(*vsizes));
+ result = mbImpl->tag_get_data(*vit, entities, &vals[0]);
+ RRA("Didn't get data properly.");
+ result = mbImpl->tag_set_data(*vit2, entities, &vals[0]);
+ RRA("Didn't set data properly.");
+ }
+
int dum_ack_buff;
More information about the moab-dev
mailing list