Skip to content

Commit

Permalink
Merge pull request #1479 from ye-luo/fix-summit-MPI
Browse files Browse the repository at this point in the history
Solve Summit MPI message size limit issue
  • Loading branch information
ye-luo authored Mar 25, 2019
2 parents 99bb3f9 + 217c8d2 commit 831ebd4
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/spline/einspline_util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <OhmmsData/FileUtility.h>
#include <io/hdf_archive.h>
#include <einspline/multi_bspline_copy.h>
#include <limits>

namespace qmcplusplus
{
Expand Down Expand Up @@ -61,9 +62,15 @@ namespace qmcplusplus
std::vector<int> counts(offset.size()-1,0);
for(size_t ib=0; ib<counts.size(); ib++)
counts[ib] = offset[ib+1] - offset[ib];
if( buffer->coefs_size / ncol > (1<<20) )
const size_t coef_type_bytes = sizeof(typename bspline_engine_traits<ENGT>::value_type);
if( buffer->coefs_size*coef_type_bytes > std::numeric_limits<int>::max() )
{
// Some MPI libraries have problems when message sizes exceed range of integer (2^31-1)
// Perform the gatherv in columns to reduce risk
const size_t xs = buffer->x_stride;
if( xs*coef_type_bytes >= std::numeric_limits<int>::max() )
app_warning() << "Large single message even after splitting by the number of grid points in x direction! "
<< "Some MPI libraries may not work!" << std::endl;
const size_t nx = buffer->coefs_size / xs;
const int nrow = buffer->coefs_size / (ncol*nx);
MPI_Datatype columntype = mpi::construct_column_type(buffer->coefs, nrow, ncol);
Expand Down

0 comments on commit 831ebd4

Please sign in to comment.