Skip to content
Snippets Groups Projects

Draft: Fortran Support

2 files
+ 24
16
Compare changes
  • Side-by-side
  • Inline

Files

+ 19
11
@@ -20,20 +20,20 @@ def must_filter(line, process):
@@ -20,20 +20,20 @@ def must_filter(line, process):
class V18(AbstractTool):
class V18(AbstractTool):
def identify(self):
def identify(self):
return "MUST v1.9.2 wrapper"
return "MUST v1.11.0 wrapper"
def ensure_image(self):
def ensure_image(self):
AbstractTool.ensure_image(self, "-x must")
AbstractTool.ensure_image(self, "-x must")
def build(self, rootdir, cached=True):
def build(self, rootdir, cached=True):
if cached and os.path.exists("/MBB-builds/MUST192/bin/mustrun"):
if cached and os.path.exists("/MBB-builds/MUST1_11_0/bin/mustrun"):
os.environ['PATH'] = os.environ['PATH'] + \
os.environ['PATH'] = os.environ['PATH'] + \
":/MBB-builds/MUST192/bin/"
":/MBB-builds/MUST1_11_0/bin/"
os.environ['OMPI_CC'] = "clang-14"
os.environ['OMPI_CC'] = "clang-19"
return
return
# MUST sometimes fails when reinstalling over the same dir
# MUST sometimes fails when reinstalling over the same dir
subprocess.run(f"rm -rf /MBB-builds/MUST192", shell=True, check=True)
subprocess.run(f"rm -rf /MBB-builds/MUST1_11_0", shell=True, check=True)
# Build it
# Build it
here = os.getcwd() # Save where we were
here = os.getcwd() # Save where we were
@@ -41,14 +41,13 @@ class V18(AbstractTool):
@@ -41,14 +41,13 @@ class V18(AbstractTool):
f"rm -rf /tmp/build-must ; mkdir /tmp/build-must", shell=True, check=True)
f"rm -rf /tmp/build-must ; mkdir /tmp/build-must", shell=True, check=True)
os.chdir("/tmp/build-must")
os.chdir("/tmp/build-must")
subprocess.run(
subprocess.run(
f"wget https://hpc.rwth-aachen.de/must/files/MUST-v1.9.2.tar.gz", shell=True, check=True)
f"wget https://hpc.rwth-aachen.de/must/files/MUST-v1.11.0.tar.gz", shell=True, check=True)
subprocess.run(f"tar xfz MUST-*.tar.gz", shell=True, check=True)
subprocess.run(f"tar xfz MUST-*.tar.gz", shell=True, check=True)
subprocess.run(f"mkdir -p /tmp/build-must/build",
subprocess.run(f"mkdir -p /tmp/build-must/build",
shell=True, check=True)
shell=True, check=True)
os.chdir("/tmp/build-must/build")
os.chdir("/tmp/build-must/build")
subprocess.run(f"CC=$(which gcc) CXX=$(which gcc++) cmake ../MUST-v1.9.2 -DCMAKE_INSTALL_PREFIX=/MBB-builds/MUST192 -DCMAKE_BUILD_TYPE=Release -DENABLE_FORTRAN=OFF -DENABLE_TYPEART=On", shell=True, check=True)
subprocess.run(f"CC=$(which gcc) CXX=$(which gcc++) FC=$(which gfortran) cmake ../MUST-v1.11.0 -DCMAKE_INSTALL_PREFIX=/MBB-builds/MUST1_11_0 -DCMAKE_BUILD_TYPE=Release -DENABLE_FORTRAN=ON -DENABLE_TYPEART=On", shell=True, check=True)
# subprocess.run(f"CC=$(which clang) CXX=$(which clang++) cmake ../MUST-v1.9.2 -DCMAKE_INSTALL_PREFIX=/MBB-builds/MUST192 -DCMAKE_BUILD_TYPE=Release -DENABLE_FORTRAN=OFF -DENABLE_TYPEART=On", shell=True, check=True)
subprocess.run(f"make -j$(nproc) install VERBOSE=1",
subprocess.run(f"make -j$(nproc) install VERBOSE=1",
shell=True, check=True)
shell=True, check=True)
subprocess.run(
subprocess.run(
@@ -59,22 +58,31 @@ class V18(AbstractTool):
@@ -59,22 +58,31 @@ class V18(AbstractTool):
os.chdir(here)
os.chdir(here)
def setup(self):
def setup(self):
os.environ['PATH'] = os.environ['PATH'] + ":/MBB-builds/MUST192/bin/"
os.environ['PATH'] = os.environ['PATH'] + ":/MBB-builds/MUST1_11_0/bin/"
os.environ['OMPI_ALLOW_RUN_AS_ROOT'] = "1"
os.environ['OMPI_ALLOW_RUN_AS_ROOT'] = "1"
os.environ['OMPI_ALLOW_RUN_AS_ROOT_CONFIRM'] = "1"
os.environ['OMPI_ALLOW_RUN_AS_ROOT_CONFIRM'] = "1"
def run(self, execcmd, filename, binary, id, number, timeout, batchinfo, loglevel=logging.INFO):
def run(self, execcmd, filename, binary, id, number, timeout, batchinfo, loglevel=logging.INFO):
cachefile = f'{binary}_{id}'
cachefile = f'{binary}_{id}'
 
print(filename)
 
if filename.endswith(".c"):
 
lang_args = "--must:language c --must:typeart"
 
else:
 
# Switch to --must:language fortran when MUST supports Fortran 2008. Until then: Workaround using MPICH and --must:language C (Internal C API call)
 
lang_args = "--must:language c"
 
execcmd = re.sub(
execcmd = re.sub(
"mpirun", "mustrun --must:distributed --must:typeart --must:output json", execcmd)
"mpirun", f"mustrun --must:distributed {lang_args} --must:output json", execcmd)
execcmd = re.sub('\${EXE}', f'./{binary}', execcmd)
execcmd = re.sub('\${EXE}', f'./{binary}', execcmd)
execcmd = re.sub('\$zero_buffer', "", execcmd)
execcmd = re.sub('\$zero_buffer', "", execcmd)
execcmd = re.sub('\$infty_buffer', "", execcmd)
execcmd = re.sub('\$infty_buffer', "", execcmd)
with tempfile.TemporaryDirectory() as tmpdirname:
with tempfile.TemporaryDirectory() as tmpdirname:
 
_, file_ext = os.path.splitext(filename)
 
compiler = "typeart-mpicc" if file_ext == ".c" else "mpif90 -ffree-line-length-0 -ffixed-line-length-0"
ran = self.run_cmd(
ran = self.run_cmd(
buildcmd=f"typeart-mpicc -g -fPIC {filename} -o {tmpdirname}/{binary} -L/MBB-builds/MUST192/lib -lpnmpi",
buildcmd=f"{compiler} -g -fPIC {filename} -o {tmpdirname}/{binary} -L/MBB-builds/MUST1_11_0/lib -lpnmpi",
execcmd=execcmd,
execcmd=execcmd,
cachefile=cachefile,
cachefile=cachefile,
filename=filename,
filename=filename,
Loading