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

Include MPI version and vendor info in LAMMPS help message #1806

Merged
merged 2 commits into from
Dec 12, 2019
Merged
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
35 changes: 21 additions & 14 deletions src/info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -354,20 +354,8 @@ void Info::command(int narg, char **arg)
}

if (flags & COMM) {
int major,minor,len;
#if (defined(MPI_VERSION) && (MPI_VERSION > 2)) || defined(MPI_STUBS)
char version[MPI_MAX_LIBRARY_VERSION_STRING];
MPI_Get_library_version(version,&len);
#else
char version[] = "Undetected MPI implementation";
len = strlen(version);
#endif

MPI_Get_version(&major,&minor);
if (len > 80) {
char *ptr = strchr(version+80,'\n');
if (ptr) *ptr = '\0';
}
int major,minor;
const char *version = get_mpi_info(major,minor);

fprintf(out,"\nCommunication information:\n");
fprintf(out,"MPI library level: MPI v%d.%d\n",major,minor);
Expand Down Expand Up @@ -1209,6 +1197,25 @@ const char *Info::get_openmp_info()
#endif
}

const char *Info::get_mpi_info(int &major, int &minor)
{
int len;
#if (defined(MPI_VERSION) && (MPI_VERSION > 2)) || defined(MPI_STUBS)
static char version[MPI_MAX_LIBRARY_VERSION_STRING];
MPI_Get_library_version(version,&len);
#else
static char version[] = "Undetected MPI implementation";
len = strlen(version);
#endif

MPI_Get_version(&major,&minor);
if (len > 80) {
char *ptr = strchr(version+80,'\n');
if (ptr) *ptr = '\0';
}
return version;
}

const char *Info::get_cxx_info()
{
#if __cplusplus > 201703L
Expand Down
1 change: 1 addition & 0 deletions src/info.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Info : protected Pointers {
static char *get_os_info();
static char *get_compiler_info();
static const char *get_openmp_info();
static const char *get_mpi_info(int &, int &);
static const char *get_cxx_info();

char **get_variable_names(int &num);
Expand Down
8 changes: 6 additions & 2 deletions src/lammps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1271,14 +1271,18 @@ void LAMMPS::print_config(FILE *fp)
const char *pkg;
int ncword, ncline = 0;

char *infobuf = Info::get_os_info();
const char *infobuf = Info::get_os_info();
fprintf(fp,"OS: %s\n\n",infobuf);
delete[] infobuf;

infobuf = Info::get_compiler_info();
fprintf(fp,"Compiler: %s with %s\n",infobuf,Info::get_openmp_info());
delete[] infobuf;
fprintf(fp,"C++ standard: %s\n\n",Info::get_cxx_info());
fprintf(fp,"C++ standard: %s\n",Info::get_cxx_info());

int major,minor;
infobuf = Info::get_mpi_info(major,minor);
fprintf(fp,"MPI v%d.%d: %s\n\n",major,minor,infobuf);

fputs("Active compile time flags:\n\n",fp);
if (Info::has_gzip_support()) fputs("-DLAMMPS_GZIP\n",fp);
Expand Down