adjustments to patchfile required for marc2021/2022 spack packages
This commit is contained in:
parent
540eeb4a6d
commit
77fa2a1d93
|
@ -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"
|
||||
fi
|
||||
|
||||
|
||||
+# DAMASK uses the HDF5 compiler wrapper around the Intel compiler
|
||||
+H5FC="$(h5fc -shlib -show)"
|
||||
+HDF5_LIB=${H5FC//ifort/}
|
||||
+H5FC=$(h5fc -shlib -show)
|
||||
+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"
|
||||
+
|
||||
# AEM
|
||||
if test "$MARCDLLOUTDIR" = ""; then
|
||||
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=
|
||||
I8CDEFINES=
|
||||
else
|
||||
|
@ -21,29 +25,29 @@
|
|||
I8DEFINES="-DI64"
|
||||
I8CDEFINES="-U_DOUBLE -D_SINGLE"
|
||||
fi
|
||||
|
||||
@@ -556,7 +561,7 @@ then
|
||||
|
||||
@@ -556,7 +565,7 @@ then
|
||||
PROFILE=" $PROFILE -pg"
|
||||
fi
|
||||
|
||||
|
||||
-FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB -fp-model source"
|
||||
+FORT_OPT="-c -implicitnone -stand f18 -standard-semantics -assume nostd_mod_proc_name -safe_cray_ptr -mp1 -WB -fp-model source"
|
||||
if test "$MTHREAD" = "OPENMP"
|
||||
then
|
||||
FORT_OPT=" $FORT_OPT -qopenmp"
|
||||
@@ -569,7 +574,7 @@ else
|
||||
@@ -569,7 +578,7 @@ else
|
||||
FORT_OPT=" $FORT_OPT -save -zero"
|
||||
fi
|
||||
if test "$MARCHDF_HDF" = "HDF"; then
|
||||
- FORT_OPT="$FORT_OPT -DMARCHDF_HDF=$MARCHDF_HDF $HDF_INCLUDE"
|
||||
+ FORT_OPT="$FORT_OPT -DMARCHDF=$MARCHDF_HDF"
|
||||
fi
|
||||
|
||||
|
||||
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)
|
||||
FORTF90="$FCOMP -c -O3"
|
||||
|
||||
|
||||
+# determine DAMASK version
|
||||
+if test -n "$DAMASK_USER"; then
|
||||
+ DAMASKROOT=`dirname $DAMASK_USER`/..
|
||||
|
@ -71,30 +75,30 @@
|
|||
if test "$MARCDEBUG" = "ON"
|
||||
then
|
||||
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} \
|
||||
-L$MARC_MKL \
|
||||
- $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF_LIBS $SOLVER2LIBS"
|
||||
+ $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF5_LIB $SOLVER2LIBS"
|
||||
|
||||
|
||||
SOLVERLIBS_DLL=${SOLVERLIBS}
|
||||
if test "$AEM_DLL" -eq 1
|
||||
@@ -762,7 +791,7 @@ then
|
||||
@@ -762,7 +795,7 @@ then
|
||||
OPENSSL=NONE
|
||||
fi
|
||||
|
||||
|
||||
-SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib"
|
||||
+SYSLIBS=" $OPENMP -lpthread -cxxlib"
|
||||
|
||||
|
||||
# Uncomment the following lines to turn on the trace and comment out the next 4 lines
|
||||
# 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
|
||||
if test $MPITYPE = intelmpi
|
||||
then
|
||||
- SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -shared-intel -cxxlib"
|
||||
+ SYSLIBS="-L${MPI_ROOT}/lib/release -lmpi -L${MPI_ROOT}/lib -lmpifort -lrt $OPENMP -threads -lpthread -cxxlib"
|
||||
fi
|
||||
|
||||
|
||||
if test "$ZLIB" = "ZLIB"; then
|
||||
|
|
|
@ -5,14 +5,18 @@
|
|||
fi
|
||||
|
||||
+# DAMASK uses the HDF5 compiler wrapper around the Intel compiler
|
||||
+H5FC="$(h5fc -shlib -show)"
|
||||
+HDF5_LIB=${H5FC//ifort/}
|
||||
+H5FC=$(h5fc -shlib -show)
|
||||
+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"
|
||||
+
|
||||
# AEM
|
||||
if test "$MARCDLLOUTDIR" = ""; then
|
||||
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=
|
||||
I8CDEFINES=
|
||||
else
|
||||
|
@ -22,7 +26,7 @@
|
|||
I8CDEFINES="-U_DOUBLE -D_SINGLE"
|
||||
fi
|
||||
|
||||
@@ -594,7 +599,7 @@ then
|
||||
@@ -594,7 +605,7 @@ then
|
||||
PROFILE=" $PROFILE -pg"
|
||||
fi
|
||||
|
||||
|
@ -31,7 +35,7 @@
|
|||
if test "$MTHREAD" = "OPENMP"
|
||||
then
|
||||
FORT_OPT=" $FORT_OPT -qopenmp"
|
||||
@@ -607,7 +612,7 @@ else
|
||||
@@ -607,7 +616,7 @@ else
|
||||
FORT_OPT=" $FORT_OPT -save -zero"
|
||||
fi
|
||||
if test "$MARCHDF_HDF" = "HDF"; then
|
||||
|
@ -40,10 +44,10 @@
|
|||
fi
|
||||
|
||||
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)
|
||||
FORTF90="$FCOMP -c -O3"
|
||||
|
||||
|
||||
+# determine DAMASK version
|
||||
+if test -n "$DAMASK_USER"; then
|
||||
+ DAMASKROOT=`dirname $DAMASK_USER`/..
|
||||
|
@ -71,12 +75,12 @@
|
|||
then
|
||||
FORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \
|
||||
@@ -778,7 +806,7 @@ SECLIBS="-L$MARC_LIB -llapi"
|
||||
|
||||
|
||||
SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} \
|
||||
-L$MARC_MKL \
|
||||
- $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF_LIBS $SOLVER2LIBS"
|
||||
+ $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a $KDTREE2_LIB/libkdtree2.a $MARC_LIB/libtetmeshinterface.a $MARC_LIB/libcaefatigueinterface.a -L$MARC_LIB -lmkl_blacs_intelmpi_ilp64 -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core -liomp5 -ltetmesh -lmeshgems -lmg-tetra -lmeshgems_stubs $HDF5_LIB $SOLVER2LIBS"
|
||||
|
||||
|
||||
SOLVERLIBS_DLL=${SOLVERLIBS}
|
||||
if test "$AEM_DLL" -eq 1
|
||||
@@ -802,7 +830,7 @@ then
|
||||
|
@ -85,7 +89,7 @@
|
|||
|
||||
-SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB"
|
||||
+SYSLIBS=" $OPENMP -lpthread -cxxlib $MARC_RPC_LIB"
|
||||
|
||||
|
||||
# Uncomment the following lines to turn on the trace and comment out the next 4 lines
|
||||
# if test $MPITYPE = intelmpi
|
||||
@@ -812,7 +840,7 @@ SYSLIBS=" $OPENMP -lpthread -shared-intel -cxxlib $MARC_RPC_LIB"
|
||||
|
|
|
@ -10,18 +10,26 @@ _damask_root = str(Path(__file__).parents[3])
|
|||
class 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.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
version : string
|
||||
Marc version
|
||||
version : str, optional
|
||||
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_root = Path(marc_root)
|
||||
self.marc_version = version
|
||||
self.marc_root = Path(marc_root)
|
||||
self.damask_root = Path(damask_root)
|
||||
|
||||
@property
|
||||
|
@ -44,9 +52,10 @@ class Marc:
|
|||
return path_tools
|
||||
|
||||
|
||||
def submit_job(self, model, job,
|
||||
compile = False,
|
||||
optimization = ''):
|
||||
def submit_job(self, model: str, job: str,
|
||||
compile: bool = False,
|
||||
optimization: str = '',
|
||||
env = None):
|
||||
"""
|
||||
Assemble command line arguments and call Marc executable.
|
||||
|
||||
|
@ -62,6 +71,8 @@ class Marc:
|
|||
optimization : str, optional
|
||||
Optimization level '' (-O0), 'l' (-O1), or 'h' (-O3).
|
||||
Defaults to ''.
|
||||
env : dict, optional
|
||||
Environment for execution.
|
||||
|
||||
"""
|
||||
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 ' \
|
||||
+ (f'-u {usersub} -save y' if compile else f'-prog {usersub.with_suffix("")}')
|
||||
|
||||
print(cmd)
|
||||
|
||||
ret = subprocess.run(shlex.split(cmd),capture_output=True)
|
||||
ret = subprocess.run(shlex.split(cmd),capture_output=True,env=env)
|
||||
|
||||
try:
|
||||
v = int(re.search('Exit number ([0-9]+)',ret.stderr.decode()).group(1))
|
||||
if 3004 != v:
|
||||
if (m := re.search('Exit number ([0-9]+)',ret.stderr.decode())) is not None:
|
||||
if 3004 != (v := int(m.group(1))):
|
||||
print(ret.stderr.decode())
|
||||
print(ret.stdout.decode())
|
||||
raise RuntimeError(f'Marc simulation failed ({v})')
|
||||
except (AttributeError,ValueError):
|
||||
else:
|
||||
print(ret.stderr.decode())
|
||||
print(ret.stdout.decode())
|
||||
raise RuntimeError('Marc simulation failed (unknown return value)')
|
||||
|
|
Loading…
Reference in New Issue