[MOAB-dev] commit/MOAB: danwu: Better logic to test whether gents has multiple sequences in ParallelComm::gather_data().
commits-noreply at bitbucket.org
commits-noreply at bitbucket.org
Tue Nov 5 09:44:40 CST 2013
1 new commit in MOAB:
https://bitbucket.org/fathomteam/moab/commits/9fa5719c4570/
Changeset: 9fa5719c4570
Branch: master
User: danwu
Date: 2013-11-05 16:44:20
Summary: Better logic to test whether gents has multiple sequences in ParallelComm::gather_data().
Affected #: 1 file
diff --git a/src/parallel/ParallelComm.cpp b/src/parallel/ParallelComm.cpp
index efc4fa1..ab29867 100644
--- a/src/parallel/ParallelComm.cpp
+++ b/src/parallel/ParallelComm.cpp
@@ -8762,15 +8762,22 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
MPI_Gatherv(senddata, sz_buffer, MPI_BYTE, recvbuf, &recvcnts[0], &displs[0], MPI_BYTE, 0, comm());
void* gvals = NULL;
- // If gents is contiguous, gathered values will be directly copied to its tag space
- if (gents.psize() == 1) {
+
+ // Test whether gents has multiple sequences
+ bool multiple_sequences = false;
+ if (gents.psize() > 1)
+ multiple_sequences = true;
+ else {
int count;
rval = mbImpl->tag_iterate(tag_handle, gents.begin(), gents.end(), count, gvals);
assert(NULL != gvals);
- assert(count == (int)gents.size());
+ assert(count > 0);
+ if ((size_t)count != gents.size())
+ multiple_sequences = true;
}
- // If gents is not contiguous, gathered values will be copied to a temp buffer first
- else if (gents.psize() > 1) {
+
+ // If gents has multiple sequences, create a temp buffer for gathered values
+ if (multiple_sequences) {
gvals = new (std::nothrow) char[gents.size() * bytes_per_tag];
assert(NULL != gvals);
}
@@ -8785,8 +8792,8 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
}
}
- // If gents is not contiguous, set tag data (stored in the temp buffer) on each sequence separately
- if (gents.psize() > 1) {
+ // If gents has multiple sequences, set tag data (stored in the temp buffer) on each sequence separately
+ if (multiple_sequences) {
Range::iterator iter = gents.begin();
size_t start_idx = 0;
while (iter != gents.end()) {
@@ -8802,7 +8809,7 @@ ErrorCode ParallelComm::post_irecv(std::vector<unsigned int>& shared_procs,
assert(start_idx == gents.size());
// Delete the temp buffer
- delete (char*)gvals;
+ delete[] (char*)gvals;
}
}
Repository URL: https://bitbucket.org/fathomteam/moab/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the moab-dev
mailing list