[MOAB-dev] r4809 - MOAB/trunk/src/parallel
kraftche at cae.wisc.edu
kraftche at cae.wisc.edu
Mon May 9 17:30:37 CDT 2011
Author: kraftche
Date: 2011-05-09 17:30:36 -0500 (Mon, 09 May 2011)
New Revision: 4809
Modified:
MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
MOAB/trunk/src/parallel/WriteHDF5Parallel.hpp
Log:
remove allgatherv when negotiating tags for parallel hdf5 write (replaced with two bcasts in the fast case, plus an unlikely gather and gatherv in the slow case)
Modified: MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp
===================================================================
--- MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp 2011-05-09 17:13:56 UTC (rev 4808)
+++ MOAB/trunk/src/parallel/WriteHDF5Parallel.cpp 2011-05-09 22:30:36 UTC (rev 4809)
@@ -103,7 +103,38 @@
}
#endif
+static int my_Gatherv( void* sendbuf,
+ int sendcount,
+ MPI_Datatype sendtype,
+ std::vector<unsigned char>& recvbuf,
+ std::vector<int>& recvcounts,
+ int root,
+ MPI_Comm comm )
+{
+ int nproc, rank, bytes, err;
+ MPI_Comm_size( comm, &nproc );
+ MPI_Comm_rank( comm, &rank );
+ MPI_Type_size( sendtype, &bytes );
+
+ recvcounts.resize( rank == root ? nproc : 0 );
+ err = MPI_Gather( &sendcount, 1, MPI_INT, &recvcounts[0], 1, MPI_INT, root, comm );
+ if (MPI_SUCCESS != err) return err;
+
+
+ std::vector<int> disp(recvcounts.size());
+ if (root == rank) {
+ disp[0] = 0;
+ for (int i = 1; i < nproc; ++i)
+ disp[i] = disp[i-1] + recvcounts[i-1];
+ recvbuf.resize( bytes * (disp.back() + recvcounts.back()) );
+ }
+
+ return MPI_Gatherv( sendbuf, sendcount, sendtype,
+ &recvbuf[0], &recvcounts[0], &disp[0],
+ sendtype, root, comm );
+}
+
// This function doesn't do anything useful. It's just a nice
// place to set a break point to determine why the reader fails.
static inline ErrorCode error( ErrorCode rval )
@@ -512,67 +543,30 @@
}
-static void set_bit( int position, unsigned char* bytes )
+ErrorCode WriteHDF5Parallel::check_serial_tag_data(
+ const std::vector<unsigned char>& buffer,
+ std::vector<TagDesc*>* missing,
More information about the moab-dev
mailing list