Commit 8bf8bfff authored by GILLES Sebastien's avatar GILLES Sebastien

#1248 Script integration: Hardcoded part removed.

parent 87572ba0
......@@ -65,31 +65,32 @@ class CheckMoReFEM:
"""
\param[in] morefem_path Absolute path that leads to the MoReFEM folder.
\param[in] build_configuration_file Build configuration file to use (the same as the one provided to scons command).
\param[in] cmake_build_dir Build directory in which the ninja command is called.
\param[in] target_list List of the executables to compile and the demo lua files to use agains them.
\param[in] do_create_reference If True, the goal is to build the reference case against which runs will be compared.
If False, each case is built and compared to the reference; if the former doesn't exist an error arises.
\param[in] scons_path Path to the scons executable.
\param[in] stdout_file File in which all standard outputs of programs will be redirected.
\param[in] stderr_file File in which all error outputs of programs will be redirected.
\param[in] mode "debug" or "release"
"""
def __init__(self, \
morefem_path, \
build_configuration_file, \
cmake_build_dir, \
mode, \
mpi_dir, \
target_list, \
log_file,
stdout_file,
stderr_file,
do_create_reference = False,
scons_path = "/Users/Shared/Software/Scons/bin/scons"):
do_create_reference = False):
self.__mode = mode
self.__morefem_path = morefem_path
self.__scons_path = scons_path
self.__build_configuration_file = build_configuration_file
self.__mpi_dir = mpi_dir
self.__cmake_build_dir = cmake_build_dir
self.__do_create_reference = do_create_reference
self.__stdout_file = stdout_file
self.__stderr_file = stderr_file
self.__build_directory = os.path.join(self.__morefem_path, "build_clang", "Sources")
self.__work_dir = os.path.join("/Volumes", \
"Data",
os.environ["USER"],
......@@ -135,16 +136,6 @@ class CheckMoReFEM:
def InitLogFile(self):
self.__field_list = {}
self.__field_list['COMPILER_DIRECTORY'] = 'clang'
self.__field_list['MODE'] = 'Debug'
self.__field_list['OPEN_MPI_INCL_DIR'] = "/Users/Shared/LibraryVersions/clang/Openmpi/include"
self.__mpidir = os.path.normpath(os.path.join(self.__field_list['OPEN_MPI_INCL_DIR'], '..'))
if os.path.exists(self.__log_file):
os.remove(self.__log_file)
......@@ -209,7 +200,7 @@ class CheckMoReFEM:
def __Compile(self, model_name, do_call_ensight_output):
os.chdir(os.path.join(self.__morefem_path, "build_clang"))
os.chdir(self.__cmake_build_dir)
cmd = ("ninja",
"-j",
......@@ -218,10 +209,10 @@ class CheckMoReFEM:
self.__PrintCmd(cmd)
scons_process = subprocess.Popen(cmd, shell=False, stdout=self.__stdout, stderr=self.__stderr)
scons_process.communicate()
ninja_process = subprocess.Popen(cmd, shell=False, stdout=self.__stdout, stderr=self.__stderr)
ninja_process.communicate()
if scons_process.returncode is not 0:
if ninja_process.returncode is not 0:
self.__log.write("\tCompilation failed!\n")
return False
else:
......@@ -238,7 +229,7 @@ class CheckMoReFEM:
def __SequentialRun(self, model_name, lua_file, do_call_ensight_output):
cmd = (os.path.join(self.__build_directory, model_name),
cmd = (os.path.join(self.__cmake_build_dir, "Sources", model_name),
"--input_parameters",
lua_file)
......@@ -261,7 +252,7 @@ class CheckMoReFEM:
def __EnsightOutput(self, model_name, lua_file):
cmd = (os.path.join(self.__build_directory, "{}EnsightOutput".format(model_name)),
cmd = (os.path.join(self.__cmake_build_dir, "Sources", "{}EnsightOutput".format(model_name)),
"--input_parameters",
lua_file)
......@@ -280,10 +271,10 @@ class CheckMoReFEM:
def __ParallelRun(self, model_name, lua_file, do_call_ensight_output, Nproc):
cmd = (os.path.join(self.__mpidir, "bin", "mpirun"),
cmd = (os.path.join(self.__mpi_dir, "bin", "mpirun"),
"-np",
str(Nproc),
os.path.join(self.__build_directory, model_name),
os.path.join(self.__cmake_build_dir, "Sources", model_name),
"--input_parameters",
lua_file)
......@@ -364,7 +355,7 @@ class CheckMoReFEM:
os.environ["USER"],
"MoReFEM",
is_reference_dir and "ReferenceModels" or "Tests",
self.__field_list['MODE'], \
self.__mode, \
model_name,
lua_filename)
......@@ -376,10 +367,14 @@ if __name__ == "__main__":
target_list = targets.TestAndModelTargetList()
morefem_path = os.path.join("/Users", os.environ['USER'], "Codes", "MoReFEM", "CoreLibrary")
cases = ('clang_debug', 'clang_release', 'gcc_debug', 'gcc_release', 'llvm-clang_debug')
cases = ('clang_debug', )# 'clang_release', 'clang_debug_macro', 'llvm-clang_debug')
cases = ('clang_debug', 'clang_release', 'gcc_debug', 'gcc_release', 'clang_debug_macro', 'llvm_clang_debug')
cases = ('clang_debug', )# 'clang_release', 'clang_debug_macro', 'llvm_clang_debug')
for case in cases:
......@@ -392,10 +387,19 @@ if __name__ == "__main__":
if os.path.exists(stderr):
os.remove(stderr)
compiler = case.split('_')[0]
mode = case.split('_')[-1]
assert(mode == "debug" or mode == "release")
assert(compiler == "clang" or compiler == "llvm-clang" or compiler == "gcc")
mpi_dir = "/Users/Shared/LibraryVersions/{}/Openmpi".format(compiler)
CheckMoReFEM(morefem_path,
os.path.join(morefem_path, "Sources", "build_configuration_{case}.py".format(case = case)),
target_list,
log_file,
stdout,
stderr)
os.path.join(morefem_path, "build_{}".format(case)),
mode,
mpi_dir,
target_list,
log_file,
stdout,
stderr)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment