adjustments to patchfile required for marc2021/2022 spack packages

This commit is contained in:
d.mentock 2022-06-15 15:48:34 +02:00
parent 540eeb4a6d
commit 77fa2a1d93
3 changed files with 61 additions and 44 deletions

View File

@ -1,18 +1,22 @@
--- ---
+++ +++
@@ -119,6 +119,11 @@ if test "$MSCCOSIM_VERSION" = ""; then @@ -119,6 +119,15 @@ if test "$MSCCOSIM_VERSION" = ""; then
MSCCOSIM_VERSION="2020" MSCCOSIM_VERSION="2020"
fi fi
+# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler
+H5FC="$(h5fc -shlib -show)" +H5FC=$(h5fc -shlib -show)
+HDF5_LIB=${H5FC//ifort/} +if [[ "$H5FC" == *"$dir is"* ]]; then
+ H5FC=$(echo $(echo "$H5FC" | tail -n1) | sed -e "s/\-shlib/-fPIC -integer-size 64 -real-size 64 -qopenmp/g")
+ H5FC=${H5FC%-lmpifort*}
+fi
+HDF5_LIB=${H5FC//*"ifort"/}
+FCOMP="$H5FC" +FCOMP="$H5FC"
+ +
# AEM # AEM
if test "$MARCDLLOUTDIR" = ""; then if test "$MARCDLLOUTDIR" = ""; then
DLLOUTDIR="$MARC_LIB" DLLOUTDIR="$MARC_LIB"
@@ -439,7 +444,7 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then @@ -439,7 +448,7 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then
I8DEFINES= I8DEFINES=
I8CDEFINES= I8CDEFINES=
else else
@ -22,7 +26,7 @@
I8CDEFINES="-U_DOUBLE -D_SINGLE" I8CDEFINES="-U_DOUBLE -D_SINGLE"
fi fi
@@ -556,7 +561,7 @@ then @@ -556,7 +565,7 @@ then
PROFILE=" $PROFILE -pg" PROFILE=" $PROFILE -pg"
fi fi
@ -31,7 +35,7 @@
if test "$MTHREAD" = "OPENMP" if test "$MTHREAD" = "OPENMP"
then then
FORT_OPT=" $FORT_OPT -qopenmp" FORT_OPT=" $FORT_OPT -qopenmp"
@@ -569,7 +574,7 @@ else @@ -569,7 +578,7 @@ else
FORT_OPT=" $FORT_OPT -save -zero" FORT_OPT=" $FORT_OPT -save -zero"
fi fi
if test "$MARCHDF_HDF" = "HDF"; then if test "$MARCHDF_HDF" = "HDF"; then
@ -40,7 +44,7 @@
fi fi
FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \
@@ -583,6 +588,30 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ @@ -583,6 +592,30 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \
# for compiling free form f90 files. high opt, integer(4) # for compiling free form f90 files. high opt, integer(4)
FORTF90="$FCOMP -c -O3" FORTF90="$FCOMP -c -O3"
@ -71,7 +75,7 @@
if test "$MARCDEBUG" = "ON" if test "$MARCDEBUG" = "ON"
then then
FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \
@@ -739,7 +768,7 @@ SECLIBS="-L$MARC_LIB -llapi" @@ -739,7 +772,7 @@ SECLIBS="-L$MARC_LIB -llapi"
SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \ SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \
-L$MARC_MKL \ -L$MARC_MKL \
@ -80,7 +84,7 @@
SOLVERLIBS_DLL=${SOLVERLIBS} SOLVERLIBS_DLL=${SOLVERLIBS}
if test "$AEM_DLL" -eq 1 if test "$AEM_DLL" -eq 1
@@ -762,7 +791,7 @@ then @@ -762,7 +795,7 @@ then
OPENSSL=NONE OPENSSL=NONE
fi fi
@ -89,7 +93,7 @@
# Uncomment the following lines to turn on the trace and comment out the next 4 lines # Uncomment the following lines to turn on the trace and comment out the next 4 lines
# if test $MPITYPE = intelmpi # if test $MPITYPE = intelmpi
@@ -772,7 +801,7 @@ SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib" @@ -772,7 +805,7 @@ SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib"
# fi # fi
if test $MPITYPE = intelmpi if test $MPITYPE = intelmpi
then then

View File

@ -5,14 +5,18 @@
fi fi
+# DAMASK uses the HDF5 compiler wrapper around the Intel compiler +# DAMASK uses the HDF5 compiler wrapper around the Intel compiler
+H5FC="$(h5fc -shlib -show)" +H5FC=$(h5fc -shlib -show)
+HDF5_LIB=${H5FC//ifort/} +if [[ "$H5FC" == *"$dir is"* ]]; then
+ H5FC=$(echo $(echo "$H5FC" | tail -n1) | sed -e "s/\-shlib/-fPIC -integer-size 64 -real-size 64 -qopenmp/g")
+ H5FC=${H5FC%-lmpifort*}
+fi
+HDF5_LIB=${H5FC//*"ifort"/}
+FCOMP="$H5FC" +FCOMP="$H5FC"
+ +
# AEM # AEM
if test "$MARCDLLOUTDIR" = ""; then if test "$MARCDLLOUTDIR" = ""; then
DLLOUTDIR="$MARC_LIB" DLLOUTDIR="$MARC_LIB"
@@ -477,8 +482,8 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then @@ -477,8 +486,8 @@ if test "$MARC_INTEGER_SIZE" = "i4" ; then
I8DEFINES= I8DEFINES=
I8CDEFINES= I8CDEFINES=
else else
@ -22,7 +26,7 @@
I8CDEFINES="-U_DOUBLE -D_SINGLE" I8CDEFINES="-U_DOUBLE -D_SINGLE"
fi fi
@@ -594,7 +599,7 @@ then @@ -594,7 +605,7 @@ then
PROFILE=" $PROFILE -pg" PROFILE=" $PROFILE -pg"
fi fi
@ -31,7 +35,7 @@
if test "$MTHREAD" = "OPENMP" if test "$MTHREAD" = "OPENMP"
then then
FORT_OPT=" $FORT_OPT -qopenmp" FORT_OPT=" $FORT_OPT -qopenmp"
@@ -607,7 +612,7 @@ else @@ -607,7 +616,7 @@ else
FORT_OPT=" $FORT_OPT -save -zero" FORT_OPT=" $FORT_OPT -save -zero"
fi fi
if test "$MARCHDF_HDF" = "HDF"; then if test "$MARCHDF_HDF" = "HDF"; then
@ -40,7 +44,7 @@
fi fi
FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ FORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \
@@ -621,6 +626,29 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ @@ -621,6 +630,29 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \
# for compiling free form f90 files. high opt, integer(4) # for compiling free form f90 files. high opt, integer(4)
FORTF90="$FCOMP -c -O3" FORTF90="$FCOMP -c -O3"

View File

@ -10,17 +10,25 @@ _damask_root = str(Path(__file__).parents[3])
class Marc: class Marc:
"""Wrapper to run DAMASK with MSC Marc.""" """Wrapper to run DAMASK with MSC Marc."""
def __init__(self,marc_version=_marc_version,marc_root=_marc_root,damask_root=_damask_root): def __init__(self,
version: str = _marc_version,
marc_root: str = _marc_root,
damask_root: str = _damask_root):
""" """
Create a Marc solver object. Create a Marc solver object.
Parameters Parameters
---------- ----------
version : string version : str, optional
Marc version Marc version. Defaults to latest supported Marc version.
marc_root : str, optional
Marc root location. Defaults to /opt/msc.
damask_root : str, optional
DAMASK root location.
Default is autodected based on location of the Python library.
""" """
self.marc_version = marc_version self.marc_version = version
self.marc_root = Path(marc_root) self.marc_root = Path(marc_root)
self.damask_root = Path(damask_root) self.damask_root = Path(damask_root)
@ -44,9 +52,10 @@ class Marc:
return path_tools return path_tools
def submit_job(self, model, job, def submit_job(self, model: str, job: str,
compile = False, compile: bool = False,
optimization = ''): optimization: str = '',
env = None):
""" """
Assemble command line arguments and call Marc executable. Assemble command line arguments and call Marc executable.
@ -62,6 +71,8 @@ class Marc:
optimization : str, optional optimization : str, optional
Optimization level '' (-O0), 'l' (-O1), or 'h' (-O3). Optimization level '' (-O0), 'l' (-O1), or 'h' (-O3).
Defaults to ''. Defaults to ''.
env : dict, optional
Environment for execution.
""" """
usersub = (self.damask_root/'src/Marc/DAMASK_Marc').with_suffix('.f90' if compile else '.marc') usersub = (self.damask_root/'src/Marc/DAMASK_Marc').with_suffix('.f90' if compile else '.marc')
@ -73,18 +84,16 @@ class Marc:
cmd = f'{self.tools_path/script} -jid {model}_{job} -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no ' \ cmd = f'{self.tools_path/script} -jid {model}_{job} -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no ' \
+ (f'-u {usersub} -save y' if compile else f'-prog {usersub.with_suffix("")}') + (f'-u {usersub} -save y' if compile else f'-prog {usersub.with_suffix("")}')
print(cmd) print(cmd)
ret = subprocess.run(shlex.split(cmd),capture_output=True) ret = subprocess.run(shlex.split(cmd),capture_output=True,env=env)
try: if (m := re.search('Exit number ([0-9]+)',ret.stderr.decode())) is not None:
v = int(re.search('Exit number ([0-9]+)',ret.stderr.decode()).group(1)) if 3004 != (v := int(m.group(1))):
if 3004 != v:
print(ret.stderr.decode()) print(ret.stderr.decode())
print(ret.stdout.decode()) print(ret.stdout.decode())
raise RuntimeError(f'Marc simulation failed ({v})') raise RuntimeError(f'Marc simulation failed ({v})')
except (AttributeError,ValueError): else:
print(ret.stderr.decode()) print(ret.stderr.decode())
print(ret.stdout.decode()) print(ret.stdout.decode())
raise RuntimeError('Marc simulation failed (unknown return value)') raise RuntimeError('Marc simulation failed (unknown return value)')