Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/mvapich warning #270

Open
wants to merge 3 commits into
base: v0.7-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
const auto mpi_details = mpi_library();
if (mpi_details.find("MVAPICH2") != mpi_details.npos) {
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