Merge commit 'v3.0.0-alpha3-22-gc0958a934'
This commit is contained in:
commit
6bbfef3c33
|
@ -207,7 +207,7 @@ J2_plasticBehavior:
|
||||||
stage: fortran
|
stage: fortran
|
||||||
script:
|
script:
|
||||||
- module load $IntelMarc $HDF5Marc $MSC
|
- module load $IntelMarc $HDF5Marc $MSC
|
||||||
- J2_plasticBehavior/test.py
|
- MSC_VERSION=2020 J2_plasticBehavior/test.py
|
||||||
except:
|
except:
|
||||||
- master
|
- master
|
||||||
- release
|
- release
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# "set"-syntax needed only for tcsh (but works with bash and zsh)
|
|
||||||
set OMP_NUM_THREADS = 4
|
|
||||||
|
|
||||||
set MSC_ROOT = /opt/msc
|
|
||||||
set MSC_VERSION = 2020
|
|
|
@ -19,17 +19,9 @@ fi
|
||||||
|
|
||||||
DAMASK_ROOT=$(canonicalPath "$ENV_ROOT/../")
|
DAMASK_ROOT=$(canonicalPath "$ENV_ROOT/../")
|
||||||
|
|
||||||
|
|
||||||
# shorthand command to change to DAMASK_ROOT directory
|
# shorthand command to change to DAMASK_ROOT directory
|
||||||
eval "function DAMASK_root() { cd $DAMASK_ROOT; }"
|
eval "function DAMASK_root() { cd $DAMASK_ROOT; }"
|
||||||
|
|
||||||
# defining set() allows to source the same file for tcsh and bash, with and without space around =
|
|
||||||
set() {
|
|
||||||
export $1$2$3
|
|
||||||
}
|
|
||||||
source $ENV_ROOT/CONFIG
|
|
||||||
unset -f set
|
|
||||||
|
|
||||||
# add BRANCH if DAMASK_ROOT is a git repository
|
# add BRANCH if DAMASK_ROOT is a git repository
|
||||||
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
||||||
|
|
||||||
|
@ -86,9 +78,6 @@ if [ ! -z "$PS1" ]; then
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OMP_NUM_THREADS
|
|
||||||
export MSC_ROOT
|
|
||||||
export MSC_VERSION
|
|
||||||
export DAMASK_ROOT
|
export DAMASK_ROOT
|
||||||
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
|
|
|
@ -12,16 +12,6 @@ function blink {
|
||||||
ENV_ROOT=$(canonicalPath "${0:a:h}")
|
ENV_ROOT=$(canonicalPath "${0:a:h}")
|
||||||
DAMASK_ROOT=$(canonicalPath "${0:a:h}'/..")
|
DAMASK_ROOT=$(canonicalPath "${0:a:h}'/..")
|
||||||
|
|
||||||
# shorthand command to change to DAMASK_ROOT directory
|
|
||||||
eval "function DAMASK_root() { cd $DAMASK_ROOT; }"
|
|
||||||
|
|
||||||
# defining set() allows to source the same file for tcsh and zsh, with and without space around =
|
|
||||||
set() {
|
|
||||||
export $1$2$3
|
|
||||||
}
|
|
||||||
source $ENV_ROOT/CONFIG
|
|
||||||
unset -f set
|
|
||||||
|
|
||||||
# add BRANCH if DAMASK_ROOT is a git repository
|
# add BRANCH if DAMASK_ROOT is a git repository
|
||||||
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
cd $DAMASK_ROOT >/dev/null; BRANCH=$(git branch 2>/dev/null| grep -E '^\* '); cd - >/dev/null
|
||||||
|
|
||||||
|
@ -80,9 +70,6 @@ if [ ! -z "$PS1" ]; then
|
||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export OMP_NUM_THREADS
|
|
||||||
export MSC_ROOT
|
|
||||||
export MSC_VERSION
|
|
||||||
export DAMASK_ROOT
|
export DAMASK_ROOT
|
||||||
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
export PYTHONPATH=$DAMASK_ROOT/python:$PYTHONPATH
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Normal exit status is 0.
|
# Normal exit status is 0.
|
||||||
#
|
#
|
||||||
|
|
||||||
DIR=%INSTALLDIR%/marc%VERSION%
|
DIR=%INSTALLDIR%/marc2020
|
||||||
|
|
||||||
if test $MARCDIR1
|
if test $MARCDIR1
|
||||||
then
|
then
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Normal exit status is 0.
|
# Normal exit status is 0.
|
||||||
#
|
#
|
||||||
|
|
||||||
DIR=%INSTALLDIR%/marc%VERSION%
|
DIR=%INSTALLDIR%/marc2020
|
||||||
|
|
||||||
if test $MARCDIR1
|
if test $MARCDIR1
|
||||||
then
|
then
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
# Normal exit status is 0.
|
# Normal exit status is 0.
|
||||||
#
|
#
|
||||||
|
|
||||||
DIR=%INSTALLDIR%/marc%VERSION%
|
DIR=%INSTALLDIR%/marc2020
|
||||||
|
|
||||||
if test $MARCDIR1
|
if test $MARCDIR1
|
||||||
then
|
then
|
||||||
|
|
|
@ -5,23 +5,36 @@ import glob
|
||||||
import argparse
|
import argparse
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
msc_version = os.environ['MSC_VERSION']
|
import damask
|
||||||
msc_root = Path(os.environ['MSC_ROOT'])
|
|
||||||
damask_root = Path(os.environ['DAMASK_ROOT'])
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
description='Apply DAMASK modification to MSC.Marc/Mentat',
|
||||||
epilog = f'MSC_ROOT={msc_root} and MSC_VERSION={msc_version} (from {damask_root}/env/CONFIG)')
|
prog = Path(__file__).name,
|
||||||
|
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
|
||||||
|
|
||||||
parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
|
parser.add_argument('--editor', dest='editor', metavar='string', default='vi',
|
||||||
help='Name of the editor for MSC.Mentat (executable)')
|
help='Name of the editor for MSC.Mentat (executable)')
|
||||||
|
parser.add_argument('--msc-root', dest='msc_root', metavar='string',
|
||||||
|
default=damask.solver._marc._msc_root,
|
||||||
|
help='MSC.Marc/Mentat root directory')
|
||||||
|
parser.add_argument('--msc-version', dest='msc_version', metavar='string',
|
||||||
|
default=damask.solver._marc._msc_version,
|
||||||
|
help='MSC.Marc/Mentat version')
|
||||||
|
parser.add_argument('--damask-root', dest='damask_root', type=float, metavar = 'float',
|
||||||
|
default=damask.solver._marc._damask_root,
|
||||||
|
help='DAMASK root directory')
|
||||||
|
|
||||||
|
|
||||||
|
args = parser.parse_args()
|
||||||
|
msc_root = Path(args.msc_root)
|
||||||
|
damask_root = Path(args.damask_root)
|
||||||
|
msc_version = args.msc_version
|
||||||
|
|
||||||
def copy_and_replace(in_file,dst):
|
def copy_and_replace(in_file,dst):
|
||||||
with open(in_file) as f:
|
with open(in_file) as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
content = content.replace('%INSTALLDIR%',str(msc_root))
|
content = content.replace('%INSTALLDIR%',str(msc_root))
|
||||||
content = content.replace('%VERSION%', msc_version)
|
content = content.replace('%EDITOR%', args.editor)
|
||||||
content = content.replace('%EDITOR%', parser.parse_args().editor)
|
|
||||||
with open(dst/Path(in_file).name,'w') as f:
|
with open(dst/Path(in_file).name,'w') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
import subprocess
|
import subprocess
|
||||||
import shlex
|
import shlex
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
_msc_version = 2020
|
||||||
|
_msc_root = '/opt/msc'
|
||||||
|
_damask_root = str(Path(__file__).parents[3])
|
||||||
|
|
||||||
class Marc:
|
class Marc:
|
||||||
"""Wrapper to run DAMASK with MSCMarc."""
|
"""Wrapper to run DAMASK with MSCMarc."""
|
||||||
|
|
||||||
def __init__(self,version=os.environ['MSC_VERSION']):
|
def __init__(self,msc_version=_msc_version,msc_root=_msc_root,damask_root=_damask_root):
|
||||||
"""
|
"""
|
||||||
Create a Marc solver object.
|
Create a Marc solver object.
|
||||||
|
|
||||||
|
@ -17,13 +20,14 @@ class Marc:
|
||||||
Marc version
|
Marc version
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self.solver = 'Marc'
|
self.msc_version = msc_version
|
||||||
self.version = version
|
self.msc_root = Path(msc_root)
|
||||||
|
self.damask_root = Path(damask_root)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def library_path(self):
|
def library_path(self):
|
||||||
|
|
||||||
path_lib = Path(f'{os.environ["MSC_ROOT"]}/mentat{self.version}/shlib/linux64')
|
path_lib = self.msc_root/f'mentat{self.msc_version}/shlib/linux64'
|
||||||
if not path_lib.is_dir():
|
if not path_lib.is_dir():
|
||||||
raise FileNotFoundError(f'library path "{path_lib}" not found')
|
raise FileNotFoundError(f'library path "{path_lib}" not found')
|
||||||
|
|
||||||
|
@ -33,7 +37,7 @@ class Marc:
|
||||||
@property
|
@property
|
||||||
def tools_path(self):
|
def tools_path(self):
|
||||||
|
|
||||||
path_tools = Path(f'{os.environ["MSC_ROOT"]}/marc{self.version}/tools')
|
path_tools = self.msc_root/f'marc{self.msc_version}/tools'
|
||||||
if not path_tools.is_dir():
|
if not path_tools.is_dir():
|
||||||
raise FileNotFoundError(f'tools path "{path_tools}" not found')
|
raise FileNotFoundError(f'tools path "{path_tools}" not found')
|
||||||
|
|
||||||
|
@ -44,7 +48,7 @@ class Marc:
|
||||||
compile = False,
|
compile = False,
|
||||||
optimization = ''):
|
optimization = ''):
|
||||||
|
|
||||||
usersub = Path(os.environ['DAMASK_ROOT'])/'src/DAMASK_Marc'
|
usersub = self.damask_root/'src/DAMASK_Marc'
|
||||||
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
|
||||||
if not usersub.is_file():
|
if not usersub.is_file():
|
||||||
raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found')
|
raise FileNotFoundError(f'subroutine ({"source" if compile else "binary"}) "{usersub}" not found')
|
||||||
|
|
|
@ -84,13 +84,13 @@ subroutine parallelization_init
|
||||||
|
|
||||||
!$ call get_environment_variable(name='OMP_NUM_THREADS',value=NumThreadsString,STATUS=got_env)
|
!$ call get_environment_variable(name='OMP_NUM_THREADS',value=NumThreadsString,STATUS=got_env)
|
||||||
!$ if(got_env /= 0) then
|
!$ if(got_env /= 0) then
|
||||||
!$ print*, 'Could not determine value of $OMP_NUM_THREADS'
|
!$ print*, 'Could not get $OMP_NUM_THREADS, using default'
|
||||||
!$ OMP_NUM_THREADS = 1_pI32
|
!$ OMP_NUM_THREADS = 4_pI32
|
||||||
!$ else
|
!$ else
|
||||||
!$ read(NumThreadsString,'(i6)') OMP_NUM_THREADS
|
!$ read(NumThreadsString,'(i6)') OMP_NUM_THREADS
|
||||||
!$ if (OMP_NUM_THREADS < 1_pI32) then
|
!$ if (OMP_NUM_THREADS < 1_pI32) then
|
||||||
!$ print*, 'Invalid OMP_NUM_THREADS: '//trim(NumThreadsString)
|
!$ print*, 'Invalid OMP_NUM_THREADS: "'//trim(NumThreadsString)//'", using default'
|
||||||
!$ OMP_NUM_THREADS = 1_pI32
|
!$ OMP_NUM_THREADS = 4_pI32
|
||||||
!$ endif
|
!$ endif
|
||||||
!$ endif
|
!$ endif
|
||||||
!$ print'(a,i2)', ' OMP_NUM_THREADS: ',OMP_NUM_THREADS
|
!$ print'(a,i2)', ' OMP_NUM_THREADS: ',OMP_NUM_THREADS
|
||||||
|
|
Loading…
Reference in New Issue