Skip to content

Commit

Permalink
Adds warning about using with MVAPICH
Browse files Browse the repository at this point in the history
  • Loading branch information
steiltre committed Oct 24, 2024
1 parent 1869500 commit 1e00535
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 11 deletions.
2 changes: 2 additions & 0 deletions include/ygm/comm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,8 @@ class comm {
private:
void comm_setup(MPI_Comm comm);

std::string mpi_library();

size_t pack_header(std::vector<std::byte> &packed, const int dest,
size_t size);

Expand Down
34 changes: 23 additions & 11 deletions include/ygm/detail/comm.ipp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,14 @@ inline comm::comm(MPI_Comm mcomm)
}

inline void comm::comm_setup(MPI_Comm c) {
// Warn about MVAPICH
if (mpi_library().substr(0, 8) == "MVAPICH2") {
cerr0() << "YGM::COMM WARNING: YGM hangs when run with MVAPICH2 on certain "
"machines. Use at "
"your own risk."
<< std::endl;
}

YGM_ASSERT_MPI(MPI_Comm_dup(c, &m_comm_async));
YGM_ASSERT_MPI(MPI_Comm_dup(c, &m_comm_barrier));
YGM_ASSERT_MPI(MPI_Comm_dup(c, &m_comm_other));
Expand All @@ -62,6 +70,20 @@ inline void comm::comm_setup(MPI_Comm c) {
}
}

inline std::string comm::mpi_library() {
// Find MPI implementation details
char version[MPI_MAX_LIBRARY_VERSION_STRING];
int version_len;
MPI_Get_library_version(version, &version_len);

// Trim MPI details to implementation and version
std::string version_string(version, version_len);
std::string delimiters{',', '\n'};
auto end = version_string.find_first_of(delimiters);

return version_string.substr(0, end);
}

inline void comm::welcome(std::ostream &os) {
static bool already_printed = false;
if (already_printed) return;
Expand All @@ -80,17 +102,7 @@ inline void comm::welcome(std::ostream &os) {
<< "RANKS_PER_NODE = " << m_layout.local_size() << "\n"
<< "NUM_NODES = " << m_layout.node_size() << "\n";

// Find MPI implementation details
char version[MPI_MAX_LIBRARY_VERSION_STRING];
int version_len;
MPI_Get_library_version(version, &version_len);

// Trim MPI details to implementation and version
std::string version_string(version, version_len);
std::string delimiters{',', '\n'};
auto end = version_string.find_first_of(delimiters);

sstr << "MPI_LIBRARY = " << version_string.substr(0, end) << "\n";
sstr << "MPI_LIBRARY = " << mpi_library() << "\n";
sstr << "YGM_VERSION = " << ygm_version << "\n";

config.print(sstr);
Expand Down

0 comments on commit 1e00535

Please sign in to comment.