Skip to content

Commit

Permalink
Fix issues 459, 460, 461
Browse files Browse the repository at this point in the history
configure_arguments is now populated in the database submitter

MPIVersion marks the name and version of MPI as "None" and "Unknown" if mpicc is not found

get_mpi_version is auto-generated so that the user running MTT has access to the file
  • Loading branch information
ribab committed Aug 4, 2016
1 parent e222ae1 commit 6c272be
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 27 deletions.
2 changes: 1 addition & 1 deletion pylib/Stages/Reporter/IUDatabase.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ def _submit_install(self, logger, lg, metadata, s, url, httpauth=None):
data['mpi_version'] = None

try:
data['configure_arguments'] = lg['configure_options']
data['configure_arguments'] = logger.getLog(lg['middleware'])['configure_options']
except KeyError:
data['configure_arguments'] = None

Expand Down
44 changes: 38 additions & 6 deletions pylib/Utilities/MPIVersion.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ def print_options(self, testDef, prefix):
def execute(self, log, testDef):

version_str = self.get_version_string(testDef)

if version_str is None:
log['name'] = 'None'
log['version'] = 'Unknown'
return

name = None
version = None
Expand Down Expand Up @@ -67,17 +72,44 @@ def execute(self, log, testDef):
return

def get_version_string(self, testDef):
cwd = os.getcwd()
os.chdir(os.path.dirname(os.path.realpath(sys.modules[self.__module__].__file__)))

if not os.path.isdir(os.path.join(os.getcwd(), "mttscratch")):
os.mkdir("mttscratch")
os.chdir("mttscratch")
fh = open("mpi_get_version.c", "w")
fh.write("""
/* This program is automatically generated by MPIVersion.py
* of MPI Testing Tool (MTT). Any changes you make here may
* get lost!
* Copyrights and licenses of this file are the same as for the MTT.
*/
#include <mpi.h>
#include <stdio.h>
int main(int argc, char **argv) {
MPI_Init(NULL, NULL);
char version[1000];
int resultlen;
MPI_Get_library_version(version, &resultlen);
printf("%s\\n", version);
return 0;
}""")
fh.close()
status, _, _ = testDef.execmd.execute('mpicc -o mpi_get_version mpi_get_version.c'.split(), testDef)
if 0 != status:
os.chdir(cwd)
if os.path.exists("mpi_get_version"): os.remove("mpi_get_version")
if os.path.exists("mpi_get_version.c"): os.remove("mpi_get_version.c")
os.chdir("..")
return None

status, stdout, _ = testDef.execmd.execute('./mpi_get_version'.split(), testDef)
if 0 != status:
os.chdir(cwd)
if os.path.exists("mpi_get_version"): os.remove("mpi_get_version")
if os.path.exists("mpi_get_version.c"): os.remove("mpi_get_version.c")
os.chdir("..")
return None

os.chdir(cwd)
return stdout
if os.path.exists("mpi_get_version"): os.remove("mpi_get_version")
if os.path.exists("mpi_get_version.c"): os.remove("mpi_get_version.c")
os.chdir("..")
return str(stdout)

20 changes: 0 additions & 20 deletions pylib/Utilities/mpi_get_version.c

This file was deleted.

0 comments on commit 6c272be

Please sign in to comment.