diff --git a/.gitignore b/.gitignore index c5b6e9866..a15b81a7f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,5 +4,6 @@ *.exe *.bak *~ +bin PRIVATE build diff --git a/CONFIG b/CONFIG new file mode 100644 index 000000000..9be3a95fb --- /dev/null +++ b/CONFIG @@ -0,0 +1,11 @@ +# "set"-syntax needed only for tcsh (but works with bash and zsh) +# DAMASK_ROOT will be expanded + +set DAMASK_BIN = ${DAMASK_ROOT}/bin + +set DAMASK_NUM_THREADS = 4 + +set MSC_ROOT = /opt/MSC +set MARC_VERSION = 2015 + +set ABAQUS_VERSION = 6.14-5 diff --git a/DAMASK_env.csh b/DAMASK_env.csh index 584f3f127..81d4de421 100644 --- a/DAMASK_env.csh +++ b/DAMASK_env.csh @@ -1,26 +1,65 @@ # sets up an environment for DAMASK on tcsh # usage: source DAMASK_env.csh -set MAGIG=($_) -set FILENAME=`readlink -f $called[2]` -set LOCATION = `dirname $FILENAME` -setenv DAMASK_ROOT ${LOCATION} -setenv DAMASK_NUM_THREADS 2 -# disable output in case of scp -if($?prompt) then - echo - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de - echo - echo Preparing environment ... - echo "DAMASK_ROOT=$DAMASK_ROOT" - echo "DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" + +set CALLED=($_) +set DIRNAME=`dirname $CALLED[2]` +set DAMASK_ROOT=`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" $DIRNAME` + +source $DAMASK_ROOT/CONFIG + +# if DAMASK_BIN is present and not in $PATH, add it +if ( $?DAMASK_BIN) then + set MATCH=`echo :${PATH}: | grep ${DAMASK_BIN}:` + if ( "x$MATCH" == "x" ) then + set PATH=${DAMASK_BIN}:${PATH} + endif endif -ulimit -s unlimited -ulimit -c 0 -ulimit -v unlimited -ulimit -m unlimited -setenv DAMASK_BIN ${DAMASK_ROOT}/bin -setenv PATH ${PATH}:${DAMASK_BIN} -setenv PYTHONPATH ${PYTHONPATH}:${DAMASK_ROOT}/lib -setenv LD_LIBRARY_PATH ${LD_LIBRARY_PATH} + +set SOLVER=`which DAMASK_spectral` +set PROCESSING=`which postResults` +if ( "x$DAMASK_NUM_THREADS" == "x" ) then + set DAMASK_NUM_THREADS=1 +endif + +# according to http://software.intel.com/en-us/forums/topic/501500 +# this seems to make sense for the stack size +if ( `which free` != "free: Command not found." ) then + set freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` + set heap=` expr $freeMem / 2` + set stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` + # http://superuser.com/questions/220059/what-parameters-has-ulimit + limit datasize $heap # maximum heap size (kB) + limit stacksize $stack # maximum stack size (kB) +endif +if ( `limit | grep memoryuse` != "" ) then + limit memoryuse unlimited # maximum physical memory size +endif +if ( `limit | grep vmemoryuse` != "" ) then + limit vmemoryuse unlimited # maximum virtual memory size +endif + +# disable output in case of scp +if ( $?prompt ) then + echo '' + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf + echo https://damask.mpie.de + echo + echo Using environment with ... + echo "DAMASK $DAMASK_ROOT" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" + echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" + if ( $?PETSC_DIR) then + echo "PETSc location $PETSC_DIR" + endif + if ( $?MSC_ROOT) then + echo "MSC.Marc/Mentat $MSC_ROOT" + endif + echo + echo `limit datasize` + echo `limit stacksize` +endif + +setenv DAMASK_NUM_THREADS $DAMASK_NUM_THREADS +setenv PYTHONPATH $DAMASK_ROOT/lib:$PYTHONPATH diff --git a/DAMASK_env.sh b/DAMASK_env.sh index 535708ed4..fa3171c48 100644 --- a/DAMASK_env.sh +++ b/DAMASK_env.sh @@ -1,77 +1,100 @@ # sets up an environment for DAMASK on bash # usage: source DAMASK_env.sh + if [ "$OSTYPE" == "linux-gnu" ] || [ "$OSTYPE" == 'linux' ]; then - DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "`dirname $BASH_SOURCE`") + DAMASK_ROOT=$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$(dirname $BASH_SOURCE)") else - [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="`pwd`/" - STAT=$(stat "`dirname $BASE$BASH_SOURCE`") + [[ "${BASH_SOURCE::1}" == "/" ]] && BASE="" || BASE="$(pwd)/" + STAT=$(stat "$(dirname $BASE$BASH_SOURCE)") DAMASK_ROOT=${STAT##* } fi -[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf +# shorthand command to change to DAMASK_ROOT directory +eval "function damask() { cd $DAMASK_ROOT; }" -# if DAMASK_BIN is present and not in $PATH, add it -if [[ "x$DAMASK_BIN" != "x" && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then +# defining set() allows to source the same file for tcsh and bash, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG +unset -f set + +# add DAMASK_BIN if present but not yet in $PATH +if [[ "x$DAMASK_BIN" != "x" && ! $(echo ":$PATH:" | grep $DAMASK_BIN:) ]]; then export PATH=$DAMASK_BIN:$PATH fi -SOLVER=`which DAMASK_spectral 2>/dev/null` +SOLVER=$(which DAMASK_spectral 2>/dev/null) if [ "x$SOLVER" == "x" ]; then SOLVER='Not found!' fi -PROCESSING=`which postResults 2>/dev/null` +PROCESSING=$(which postResults 2>/dev/null) if [ "x$PROCESSING" == "x" ]; then PROCESSING='Not found!' fi +if [ "x$DAMASK_NUM_THREADS" == "x" ]; then + DAMASK_NUM_THREADS=1 +fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -FREE=`which free 2>/dev/null` +FREE=$(which free 2>/dev/null) if [ "x$FREE" != "x" ]; then - freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - heap=`expr $freeMem / 2` - stack=`expr $freeMem / $DAMASK_NUM_THREADS / 2` - + freeMem=$(free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}') # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -s $stack 2>/dev/null # maximum stack size (kB) - ulimit -d $heap 2>/dev/null # maximum heap size (kB) + ulimit -d $(expr $freeMem / 2) 2>/dev/null # maximum heap size (kB) + ulimit -s $(expr $freeMem / $DAMASK_NUM_THREADS / 2) 2>/dev/null # maximum stack size (kB) fi -ulimit -c 2000 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size # disable output in case of scp if [ ! -z "$PS1" ]; then echo - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf + echo https://damask.mpie.de echo echo Using environment with ... echo "DAMASK $DAMASK_ROOT" - [[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER" - [[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" - [[ `python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR"` == $PETSC_DIR ]] \ - || echo " ~~> "`python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR"` + [[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \ + || echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") fi - [[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH" echo "MSC.Marc/Mentat $MSC_ROOT" echo - echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc - echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc + echo -n "heap size " + [[ "$(ulimit -d)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -d) )); \ + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") + echo -n "stack size " + [[ "$(ulimit -s)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -s) )); \ + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN; do unset "${var}" done -for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do +for var in DAMASK MSC; do unset "${var}_ROOT" done - +for var in ABAQUS MARC; do + unset "${var}_VERSION" +done diff --git a/DAMASK_env.zsh b/DAMASK_env.zsh index b4b2d6953..dbb781894 100644 --- a/DAMASK_env.zsh +++ b/DAMASK_env.zsh @@ -1,74 +1,88 @@ -# sets up an environment for DAMASK on bash -# usage: source DAMASK_env.sh +# sets up an environment for DAMASK on zsh +# usage: source DAMASK_env.zsh -if [ "$OSTYPE" = "linux-gnu" ] || [ "$OSTYPE" = 'linux' ]; then - DAMASK_ROOT=$(readlink -f "`dirname ${(%):-%N}`") -else - print 'Not done yet' -fi +DAMASK_ROOT=${0:a:h} -[[ -f $HOME/.damask/damask.conf ]] && source $HOME/.damask/damask.conf || source /etc/damask.conf +# shorthand command to change to DAMASK_ROOT directory +eval "function damask() { cd $DAMASK_ROOT; }" -# if DAMASK_BIN is present and not in $PATH, add it -#if [[ [[ "x$DAMASK_BIN" != "x" ]] && ! `echo ":$PATH:" | grep $DAMASK_BIN:` ]]; then +# defining set() allows to source the same file for tcsh and zsh, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG +unset -f set + +# add DAMASK_BIN if present but not yet in $PATH +MATCH=`echo ":$PATH:" | grep $DAMASK_BIN:` +if [[ ( "x$DAMASK_BIN" != "x" ) && ( "x$MATCH" = "x" ) ]]; then export PATH=$DAMASK_BIN:$PATH -#fi +fi SOLVER=`which DAMASK_spectral 2>/dev/null` -if [ "x$SOLVER" = "x" ]; then - export SOLVER='Not found!' -fi PROCESSING=`which postResults 2>/dev/null` -if [ "x$PROCESSING" = "x" ]; then - export PROCESSING='Not found!' +if [ "x$DAMASK_NUM_THREADS" = "x" ]; then + DAMASK_NUM_THREADS=1 fi # according to http://software.intel.com/en-us/forums/topic/501500 # this seems to make sense for the stack size -FREE=`which free 2>/dev/null` -if [ "x$FREE" != "x" ]; then +if [ "`which free 2>/dev/null`" != "free not found" ]; then freeMem=`free -k | grep -E '(Mem|Speicher):' | awk '{print $4;}'` - heap=`expr $freeMem / 2` - stack=`expr $freeMem / 2` # http://superuser.com/questions/220059/what-parameters-has-ulimit - ulimit -s $stack 2>/dev/null # maximum stack size (kB) - ulimit -d $heap 2>/dev/null # maximum heap size (kB) + #ulimit -d `expr $freeMem / 2` 2>/dev/null # maximum heap size (kB) + ulimit -s `expr $freeMem / $DAMASK_NUM_THREADS / 2` 2>/dev/null # maximum stack size (kB) fi -ulimit -c 2000 2>/dev/null # core file size (512-byte blocks) ulimit -v unlimited 2>/dev/null # maximum virtual memory size ulimit -m unlimited 2>/dev/null # maximum physical memory size # disable output in case of scp if [ ! -z "$PS1" ]; then echo - echo Düsseldorf Advanced Materials Simulation Kit - DAMASK - echo Max-Planck-Institut für Eisenforschung, Düsseldorf - echo http://damask.mpie.de + echo Düsseldorf Advanced Materials Simulation Kit --- DAMASK + echo Max-Planck-Institut für Eisenforschung GmbH, Düsseldorf + echo https://damask.mpie.de echo - echo Using environment with ... + echo "Using environment with ..." echo "DAMASK $DAMASK_ROOT" - [[ "x$SOLVER" != "x" ]] && echo "Spectral Solver $SOLVER" - [[ "x$PROCESSING" != "x" ]] && echo "Post Processing $PROCESSING" + echo "Spectral Solver $SOLVER" + echo "Post Processing $PROCESSING" echo "Multithreading DAMASK_NUM_THREADS=$DAMASK_NUM_THREADS" if [ "x$PETSC_DIR" != "x" ]; then echo "PETSc location $PETSC_DIR" - [[ `readlink -f $PETSC_DIR` == $PETSC_DIR ]] || echo " ~~> "`readlink -f $PETSC_DIR` + [[ $(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") == $PETSC_DIR ]] \ + || echo " ~~> "$(python -c "import os,sys; print(os.path.realpath(os.path.expanduser(sys.argv[1])))" "$PETSC_DIR") fi - [[ "x$PETSC_ARCH" != "x" ]] && echo "PETSc architecture $PETSC_ARCH" echo "MSC.Marc/Mentat $MSC_ROOT" echo - echo -n "heap size/MiB "; echo "`ulimit -d`/1024" | bc - echo -n "stack size/MiB "; echo "`ulimit -s`/1024" | bc + echo -n "heap size " + [[ "$(ulimit -d)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -d) )); \ + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") + echo -n "stack size " + [[ "$(ulimit -s)" == "unlimited" ]] \ + && echo "unlimited" \ + || echo $(python -c \ + "import math; \ + size=$(( 1024*$(ulimit -s) )); \ + print('{:.4g} {}'.format(size / (1 << ((int(math.log(size,2) / 10) if size else 0) * 10)), \ + ['bytes','KiB','MiB','GiB','TiB','EiB','ZiB'][int(math.log(size,2) / 10) if size else 0]))") fi export DAMASK_NUM_THREADS export PYTHONPATH=$DAMASK_ROOT/lib:$PYTHONPATH -for var in BASE STAT SOLVER PROCESSING FREE; do +for var in BASE STAT SOLVER PROCESSING FREE DAMASK_BIN MATCH; do unset "${var}" done -for var in DAMASK IMKL ACML LAPACK MSC FFTW HDF5; do +for var in DAMASK MSC; do unset "${var}_ROOT" done - +for var in ABAQUS MARC; do + unset "${var}_VERSION" +done diff --git a/Makefile b/Makefile index 9721b7722..e0e29181f 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,7 @@ SHELL = /bin/sh # Makefile for the installation of DAMASK ######################################################################################## .PHONY: all -all: spectral FEM - +all: spectral FEM marc spectral: build/spectral @(cd build/spectral; make --no-print-directory -ws all install VERBOSE=1;) @@ -24,9 +23,29 @@ FEM: build/FEM build/FEM: build @mkdir build @(cd build/FEM; cmake -Wno-dev -DCMAKE_BUILD_TYPE=RELEASE -DDAMASK_SOLVER=FEM ../..;) +.PHONY: spectral +spectral: + $(MAKE) DAMASK_spectral.exe -C code + +.PHONY: FEM +FEM: + $(MAKE) DAMASK_FEM.exe -C code + +.PHONY: marc +marc: + @./installation/mods_MarcMentat/apply_DAMASK_modifications.sh ${MAKEFLAGS} + + +.PHONY: tidy +tidy: + @$(MAKE) tidy -C code >/dev/null .PHONY: clean clean: - rm -rvf build # standard build directory - rm -rvf testing # for testing build (testing script in PRIVATE) - rm -rvf bin # default binary store location + @$(MAKE) cleanDAMASK -C code >/dev/null + +.PHONY: install +install: + @./installation/symlink_Code.py ${MAKEFLAGS} + @./installation/symlink_Processing.py ${MAKEFLAGS} + diff --git a/VERSION b/VERSION index 2f31eda87..2aa809898 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -v2.0.0-262-gbd1beb4 +v2.0.1-357-g38471c1 diff --git a/code/Makefile b/code/Makefile new file mode 100644 index 000000000..49ce9c50e --- /dev/null +++ b/code/Makefile @@ -0,0 +1,740 @@ +SHELL = /bin/sh +######################################################################################## +# Makefile to compile the Material subroutine for BVP solution using spectral method +######################################################################################## +# Be sure to remove all files compiled with different options by using "make clean" +######################################################################################## +# OPTIONS = standard (alternative): meaning +#------------------------------------------------------------- +# F90 = ifort (gfortran): compiler type, choose Intel or GNU +# FCOMPILERNAME = name of the compiler executable (if not the same as the type), e.g. using mpich-g90 instead of ifort +# PORTABLE = TRUE (FALSE): decision, if executable is optimized for the machine on which it was built. +# OPTIMIZATION = DEFENSIVE (OFF,AGGRESSIVE,ULTRA): Optimization mode: O2, O0, O3 + further options for most files, O3 + further options for all files +# OPENMP = TRUE (FALSE): OpenMP multiprocessor support +# PREFIX = arbitrary prefix (before FCOMPILERNAME) +# OPTION = arbitrary option (just before file to compile) +# SUFFIX = arbitrary suffix (after file to compile) +# STANDARD_CHECK = checking for Fortran 2008, compiler dependend +######################################################################################## +# including PETSc files. PETSC_ARCH is loaded from these files. +DAMASKVERSION :=$(shell cat ../VERSION) + +include ${PETSC_DIR}/lib/petsc/conf/variables +include ${PETSC_DIR}/lib/petsc/conf/rules + +INCLUDE_DIRS := $(PETSC_FC_INCLUDES) -DPETSc +LIBRARIES := $(PETSC_WITH_EXTERNAL_LIB) +FCOMPILERNAME ?= $(FC) +CCOMPILERNAME ?= $(CC) +LINKERNAME ?= $(FLINKER) + +# MPI compiler wrappers will tell if they are pointing to ifort or gfortran +COMPILEROUT :=$(shell $(FC) -show) +# search in FC or COMPILEROUT for gfortran/ifort if not defined +ifeq ($(strip $(F90)),) + F90 :=$(findstring gfortran,$(FC) $(COMPILEROUT)) +endif +ifeq ($(strip $(F90)),) + F90 :=$(findstring ifort,$(FC) $(COMPILEROUT)) +endif + +OPENMP ?= ON +OPTIMIZATION ?= DEFENSIVE + +ifeq "$(OPTIMIZATION)" "OFF" +OPTI := OFF +MAXOPTI := OFF +endif +ifeq "$(OPTIMIZATION)" "DEFENSIVE" +OPTI := DEFENSIVE +MAXOPTI := DEFENSIVE +endif +ifeq "$(OPTIMIZATION)" "AGGRESSIVE" +OPTI := AGGRESSIVE +MAXOPTI := DEFENSIVE +endif +ifeq "$(OPTIMIZATION)" "ULTRA" +OPTI := AGGRESSIVE +MAXOPTI := AGGRESSIVE +endif + +ifndef OPTI +OPTI := DEFENSIVE +MAXOPTI := DEFENSIVE +endif + +# settings for shared memory multicore support +ifeq "$(OPENMP)" "ON" +OPENMP_FLAG_ifort =-qopenmp -parallel +OPENMP_FLAG_gfortran =-fopenmp +endif + +ifdef STANDARD_CHECK +STANDARD_CHECK_ifort =$(STANDARD_CHECK) +STANDARD_CHECK_gfortran =$(STANDARD_CHECK) +endif + +STANDARD_CHECK_ifort ?=-stand f08 -standard-semantics +STANDARD_CHECK_gfortran ?=-std=f2008ts -pedantic-errors + +#-pedantic: more strict on standard, enables some warnings +# -pedantic-errors: like pedantic, but errors instead of warnings +OPTIMIZATION_OFF_ifort :=-O0 -no-ip +OPTIMIZATION_OFF_gfortran :=-O0 +OPTIMIZATION_DEFENSIVE_ifort :=-O2 +OPTIMIZATION_DEFENSIVE_gfortran :=-O2 +OPTIMIZATION_AGGRESSIVE_ifort :=-ipo -O3 -no-prec-div -fp-model fast=2 -xHost #-fast = -ipo, -O3, -no-prec-div, -static, -fp-model fast=2, and -xHost +OPTIMIZATION_AGGRESSIVE_gfortran :=-O3 -ffast-math -funroll-loops -ftree-vectorize + + +LINK_OPTIONS_ifort :=-shared-intel +COMPILE_OPTIONS_ifort :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ + -fpp\ + -ftz\ + -assume byterecl,fpe_summary\ + -diag-disable 5268\ + -warn declarations\ + -warn general\ + -warn usage\ + -warn interfaces\ + -warn ignore_loc\ + -warn alignments\ + -warn unused + +################################################################################################### +#COMPILE SWITCHES +#-shared-intel: Link against shared Intel libraries instead of static ones +#-fpp: preprocessor +#-ftz: flush unterflow to zero, automatically set if O<0,1,2,3> >0 +#-assume byterecl record length is given in bytes (also set by -standard-semantics) +# fpe_summary print list of floating point exceptions occured during execution +#-fimplicit-none: assume "implicit-none" even if not present in source +#-diag-disable: disables warnings, where +# warning ID 5268: the text exceeds right hand column allowed on the line (we have only comments there) +#-warn: enables warnings, where +# declarations: any undeclared names (alternative name: -implicitnone) +# general: warning messages and informational messages are issued by the compiler +# usage: questionable programming practices +# interfaces: checks the interfaces of all SUBROUTINEs called and FUNCTIONs invoked in your compilation against an external set of interface blocks +# ignore_loc: %LOC is stripped from an actual argument +# alignments: data that is not naturally aligned +# unused: declared variables that are never used +# stderrors: warnings about Fortran standard violations are changed to errors (STANDARD_CHECK) +# +################################################################################################### +#MORE OPTIONS FOR DEBUGGING DURING COMPILATION +#-warn: enables warnings, where +# truncated_source: Determines whether warnings occur when source exceeds the maximum column width in fixed-format files. (too many warnings because we have comments beyond character 132) +# uncalled: Determines whether warnings occur when a statement function is never called +# all: +# -name as_is: case sensitive Fortran! + +DEBUG_OPTIONS_ifort :=-g\ + -traceback\ + -gen-interfaces\ + -fp-stack-check\ + -fp-model strict\ + -check bounds,format,output_conversion,pointers,uninit\ + -ftrapuv\ + -fpe-all0\ + -warn errors\ + -warn stderrors\ + -debug-parameters all + +################################################################################################### +#COMPILE SWITCHES FOR RUNTIME DEBUGGING +#-g: Generate symbolic debugging information in the object file +#-traceback: Generate extra information in the object file to provide source file traceback information when a severe error occurs at run time. +#-gen-interfaces: Generate an interface block for each routine. http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/ +#-fp-stack-check: Generate extra code after every function call to ensure that the floating-point (FP) stack is in the expected state. +#-ftrapuv Trap uninitalized variables +#-check: checks at runtime, where +# bounds: check if an array index is too small (<1) or too large! +# format: Checking for the data type of an item being formatted for output. +# output_conversion: Checking for the fit of data items within a designated format descriptor field. +# pointers: Checking for certain disassociated or uninitialized pointers or unallocated allocatable objects. +# uninit: Checking for uninitialized variables. +#-fpe-all0 capture all floating-point exceptions, sets -ftz automatically +#-warn: enables warnings, where +# errors: warnings are changed to errors +# stderrors: warnings about Fortran standard violations are changed to errors +# information on http://software.intel.com/en-us/articles/determining-root-cause-of-sigsegv-or-sigbus-errors/ +################################################################################################### +#MORE OPTIONS FOR RUNTIME DEBUGGING +#-heap-arrays: should not be done for OpenMP, but set "ulimit -s unlimited" on shell. Probably it helps also to unlimit other limits +#-check: checks at runtime, where +# arg_temp_created: will cause a lot of warnings because we create a bunch of temporary arrays (performance?) +# stack: +LINK_OPTIONS_gfortran :=-Wl,-undefined,dynamic_lookup +COMPILE_OPTIONS_gfortran :=-DDAMASKVERSION=\"${DAMASKVERSION}\"\ + -xf95-cpp-input\ + -ffree-line-length-132\ + -fimplicit-none\ + -fmodule-private\ + -Wall\ + -Wextra\ + -Wcharacter-truncation\ + -Wunderflow\ + -Wsuggest-attribute=pure\ + -Wsuggest-attribute=noreturn\ + -Wconversion-extra\ + -Wimplicit-procedure\ + -Wno-unused-parameter +#-ffpe-summary=all only for newer gfortran +################################################################################################### +#COMPILE SWITCHES +#-shared +#-Wl,-undefined,dynamic_lookup:ensure to link against dynamic libraries +#-xf95-cpp-input: preprocessor +#-ffree-line-length-132: restrict line length to the standard 132 characters +#-ffpe-summary: print summary of floating point exeptions (‘invalid’, ‘zero’, ‘overflow’, ‘underflow’, ‘inexact’ and ‘denormal’) +#-fimplicit-none: assume "implicit-none" even if not present in source +#-fmodule-private: assume "private" even if not present in source +#-Wcharacter-truncation: warn if character expressions (strings) are truncated +#-Wunderflow: produce a warning when numerical constant expressions are encountered, which yield an UNDERFLOW during compilation +#-Wsuggest-attribute=pure: +#-Wsuggest-attribute=noreturn: +#-Wconversion-extra +#-Wimplicit-procedure +#-Wall: sets the following Fortran options: +# -Waliasing: warn about possible aliasing of dummy arguments. Specifically, it warns if the same actual argument is associated with a dummy argument with "INTENT(IN)" and a dummy argument with "INTENT(OUT)" in a call with an explicit interface. +# -Wampersand: checks if a character expression is continued proberly by an ampersand at the end of the line and at the beginning of the new line +# -Warray-bounds: checks if array reference is out of bounds at compile time. use -fcheck-bounds to also check during runtime +# -Wconversion: warn about implicit conversions between different type +# -Wsurprising: warn when "suspicious" code constructs are encountered. While technically legal these usually indicate that an error has been made. +# -Wc-binding-type: +# -Wintrinsics-std: only standard intrisics are available, e.g. "call flush(6)" will cause an error +# -Wno-tabs: do not allow tabs in source +# -Wintrinsic-shadow: warn if a user-defined procedure or module procedure has the same name as an intrinsic +# -Wline-truncation: +# -Wtarget-lifetime: +# -Wreal-q-constant: warn about real-literal-constants with 'q' exponent-letter +# -Wunused: a number of unused-xxx warnings +# these are general (non -Fortran options) implied by -Wall +# -Waddress +# -Warray-bounds (only with -O2) +# -Wc++11-compat +# -Wchar-subscripts +# -Wcomment +# -Wformat +# -Wmaybe-uninitialized +# -Wnonnull +# -Wparentheses +# -Wpointer-sign +# -Wreorder +# -Wreturn-type +# -Wsequence-point +# -Wstrict-aliasing +# -Wstrict-overflow=1 +# -Wswitch +# -Wtrigraphs +# -Wuninitialized +# -Wunknown-pragmas +# -Wunused-function +# -Wunused-label +# -Wunused-value +# -Wunused-variable +# -Wvolatile-register-var +#-Wextra: sets the following Fortran options: +# -Wunuses-parameter: +# -Wcompare-reals: +# these are general (non -Fortran options) implied by -Wextra +# -Wclobbered +# -Wempty-body +# -Wignored-qualifiers +# -Wmissing-field-initializers +# -Woverride-init +# -Wsign-compare +# -Wtype-limits +# -Wuninitialized +# -Wunused-but-set-parameter (only with -Wunused or -Wall) +# -Wno-globals + +################################################################################################### +#MORE OPTIONS FOR DEBUGGING DURING COMPILATION +#-Warray-temporarieswarnings: because we have many temporary arrays (performance issue?): +#-Wimplicit-interface: no interfaces for lapack routines +#-Wunsafe-loop-optimizations: warn if the loop cannot be optimized due to nontrivial assumptions. +#-Wstrict-overflow: + +DEBUG_OPTIONS_gfortran :=-g \ + -fbacktrace \ + -fdump-core \ + -fcheck=all \ + -ffpe-trap=invalid,zero,overflow + +################################################################################################### +#COMPILE SWITCHES FOR RUNTIME DEBUGGING +#-ffpe-trap=invalid,\ stop execution if floating point exception is detected (NaN is silent) +# zero,\ +# overflow +#-fcheck=all: sets the following Fortran options: +#array-temps +#bounds +#do +#mem +#pointer +#recursion +################################################################################################### +#MORE OPTIONS FOR RUNTIME DEBUGGING +#-ffpe-trap=precision,\ +# denormal, \ +# underflow + +ifeq "$(DEBUG)" "ON" +COMPILE_OPTIONS_$(F90) +=$(DEBUG_OPTIONS_$(F90)) +LINK_OPTIONS_$(F90) +=$(DEBUG_OPTIONS_$(F90)) +endif +LINK_OPTIONS_$(F90) += $(OPTIMIZATION_$(MAXOPTI)_$(F90)) + +PRECISION_ifort :=-real-size 64 -integer-size 32 -DFLOAT=8 -DINT=4 +#-real-size 32: set precision to one of those 32/64/128 (= 4/8/16 bytes) for standard real (=8 for pReal) +#-integer-size 16: set precision to one of those 16/32/64 (= 2/4/8 bytes) for standard integer (=4 for pInt) +PRECISION_gfortran :=-fdefault-real-8 -fdefault-double-8 -DFLOAT=8 -DINT=4 +#-fdefault-real-8: set precision to 8 bytes for standard real (=8 for pReal). Will set size of double to 16 bytes as long as -fdefault-double-8 is not set +#-fdefault-double-8: set precision to 8 bytes for double real, would be 16 bytes because -fdefault-real-8 is used +#-fdefault-integer-8: Use it to set precision to 8 bytes for integer, don't use it for the standard case of pInt=4 (there is no -fdefault-integer-4) + +################################################################################################### +COMPILE =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(OPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) +COMPILE_MAXOPTI =$(OPENMP_FLAG_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) $(COMPILE_OPTIONS_$(F90)) $(INCLUDE_DIRS) $(PRECISION_$(F90)) +################################################################################################### +SOURCE_FILES = \ + source_thermal_dissipation.o \ + source_thermal_externalheat.o \ + source_damage_isoBrittle.o \ + source_damage_isoDuctile.o \ + source_damage_anisoBrittle.o \ + source_damage_anisoDuctile.o \ + source_vacancy_phenoplasticity.o \ + source_vacancy_irradiation.o \ + source_vacancy_thermalfluc.o + +KINEMATICS_FILES = \ + kinematics_cleavage_opening.o \ + kinematics_slipplane_opening.o \ + kinematics_thermal_expansion.o \ + kinematics_vacancy_strain.o \ + kinematics_hydrogen_strain.o + +PLASTIC_FILES = \ + plastic_dislotwin.o \ + plastic_disloUCLA.o \ + plastic_isotropic.o \ + plastic_phenopowerlaw.o \ + plastic_titanmod.o \ + plastic_nonlocal.o \ + plastic_none.o \ + plastic_phenoplus.o + +THERMAL_FILES = \ + thermal_isothermal.o \ + thermal_adiabatic.o \ + thermal_conduction.o + +DAMAGE_FILES = \ + damage_none.o \ + damage_local.o \ + damage_nonlocal.o + +VACANCYFLUX_FILES = \ + vacancyflux_isoconc.o \ + vacancyflux_isochempot.o \ + vacancyflux_cahnhilliard.o + +POROSITY_FILES = \ + porosity_none.o \ + porosity_phasefield.o + +HYDROGENFLUX_FILES = \ + hydrogenflux_isoconc.o \ + hydrogenflux_cahnhilliard.o + +HOMOGENIZATION_FILES = \ + homogenization_RGC.o \ + homogenization_isostrain.o \ + homogenization_none.o + +##################### +# Spectral Solver +##################### +DAMASK_spectral.exe: IGNORE := \# +DAMASK_spectral.exe: COMPILE += -DSpectral +DAMASK_spectral.exe: COMPILE_MAXOPTI += -DSpectral +DAMASK_spectral.exe: MESHNAME := mesh.f90 +DAMASK_spectral.exe: INTERFACENAME := spectral_interface.f90 + +DAMASK_spectral.o: IGNORE := \# +DAMASK_spectral.o: COMPILE += -DSpectral +DAMASK_spectral.o: COMPILE_MAXOPTI += -DSpectral +DAMASK_spectral.o: MESHNAME := mesh.f90 +DAMASK_spectral.o: INTERFACENAME := spectral_interface.f90 + + +SPECTRAL_SOLVER_FILES = spectral_mech_AL.o spectral_mech_Basic.o spectral_mech_Polarisation.o \ + spectral_thermal.o spectral_damage.o + +SPECTRAL_FILES = C_routines.o \ + system_routines.o \ + prec.o \ + DAMASK_interface.o \ + IO.o \ + numerics.o \ + debug.o \ + math.o \ + FEsolving.o \ + mesh.o \ + material.o \ + lattice.o \ + $(SOURCE_FILES) \ + $(KINEMATICS_FILES) \ + $(PLASTIC_FILES) \ + constitutive.o \ + crystallite.o \ + $(THERMAL_FILES) \ + $(DAMAGE_FILES) \ + $(VACANCYFLUX_FILES) \ + $(HYDROGENFLUX_FILES) \ + $(POROSITY_FILES) \ + $(HOMOGENIZATION_FILES) homogenization.o \ + CPFEM2.o \ + spectral_utilities.o \ + $(SPECTRAL_SOLVER_FILES) + +DAMASK_spectral.exe: DAMASK_spectral.o + $(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ + -o DAMASK_spectral.exe DAMASK_spectral.o \ + $(SPECTRAL_FILES) $(LIBRARIES) $(SUFFIX) + + +DAMASK_spectral.o: DAMASK_spectral.f90 \ + $(SPECTRAL_SOLVER_FILES) + $(PREFIX) $(FCOMPILERNAME) $(COMPILE_MAXOPTI) -c DAMASK_spectral.f90 $(SUFFIX) + +spectral_mech_AL.o: spectral_mech_AL.f90 \ + spectral_utilities.o + +spectral_mech_Polarisation.o: spectral_mech_Polarisation.f90 \ + spectral_utilities.o + +spectral_mech_Basic.o: spectral_mech_Basic.f90 \ + spectral_utilities.o + +spectral_thermal.o: spectral_thermal.f90 \ + spectral_utilities.o + +spectral_damage.o: spectral_damage.f90 \ + spectral_utilities.o + +spectral_utilities.o: spectral_utilities.f90 \ + CPFEM2.o + +##################### +# FEM Solver +##################### +VPATH := ../private/FEM/code +DAMASK_FEM.exe: COMPILE += -DFEM +DAMASK_FEM.exe: COMPILE_MAXOPTI += -DFEM +DAMASK_FEM.exe: MESHNAME := ../private/FEM/code/meshFEM.f90 +DAMASK_FEM.exe: INTERFACENAME := ../private/FEM/code/DAMASK_FEM_interface.f90 +DAMASK_FEM.exe: INCLUDE_DIRS += -I./ + +FEM_SOLVER_FILES = FEM_mech.o FEM_thermal.o FEM_damage.o FEM_vacancyflux.o FEM_porosity.o FEM_hydrogenflux.o + +FEM_FILES = prec.o \ + DAMASK_interface.o \ + FEZoo.o \ + IO.o \ + numerics.o \ + debug.o \ + math.o \ + FEsolving.o \ + mesh.o \ + material.o \ + lattice.o \ + $(SOURCE_FILES) \ + $(KINEMATICS_FILES) \ + $(PLASTIC_FILES) \ + constitutive.o \ + crystallite.o \ + $(THERMAL_FILES) \ + $(DAMAGE_FILES) \ + $(VACANCYFLUX_FILES) \ + $(HYDROGENFLUX_FILES) \ + $(POROSITY_FILES) \ + $(HOMOGENIZATION_FILES) homogenization.o \ + CPFEM.o \ + FEM_utilities.o \ + $(FEM_SOLVER_FILES) + +DAMASK_FEM.exe: DAMASK_FEM_driver.o + $(PREFIX) $(LINKERNAME) $(OPENMP_FLAG_$(F90)) $(LINK_OPTIONS_$(F90)) $(STANDARD_CHECK_$(F90)) $(OPTIMIZATION_$(MAXOPTI)_$(F90)) \ + -o DAMASK_FEM.exe DAMASK_FEM_driver.o \ + $(FEM_FILES) $(LIBRARIES) $(SUFFIX) + +DAMASK_FEM_driver.o: DAMASK_FEM_driver.f90 $(FEM_SOLVER_FILES) + $(PREFIX) $(FCOMPILERNAME) $(COMPILE_MAXOPTI) -c ../private/FEM/code/DAMASK_FEM_driver.f90 $(SUFFIX) + +FEM_mech.o: FEM_mech.f90 \ + FEM_utilities.o + +FEM_thermal.o: FEM_thermal.f90 \ + FEM_utilities.o + +FEM_damage.o: FEM_damage.f90 \ + FEM_utilities.o + +FEM_vacancyflux.o: FEM_vacancyflux.f90 \ + FEM_utilities.o + +FEM_porosity.o: FEM_porosity.f90 \ + FEM_utilities.o + +FEM_hydrogenflux.o: FEM_hydrogenflux.f90 \ + FEM_utilities.o + +FEM_utilities.o: FEM_utilities.f90 \ + CPFEM.o + +FEZoo.o: $(wildcard FEZoo.f90) \ + IO.o + $(IGNORE) $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c ../private/FEM/code/FEZoo.f90 $(SUFFIX) + touch FEZoo.o + +CPFEM.o: CPFEM.f90 \ + homogenization.o + +CPFEM2.o: CPFEM2.f90 \ + homogenization.o + +homogenization.o: homogenization.f90 \ + $(THERMAL_FILES) \ + $(DAMAGE_FILES) \ + $(VACANCYFLUX_FILES) \ + $(POROSITY_FILES) \ + $(HYDROGENFLUX_FILES) \ + $(HOMOGENIZATION_FILES) + +thermal_isothermal.o: thermal_isothermal.f90 \ + crystallite.o + +thermal_adiabatic.o: thermal_adiabatic.f90 \ + crystallite.o + +thermal_conduction.o: thermal_conduction.f90 \ + crystallite.o + +damage_none.o: damage_none.f90 \ + crystallite.o + +damage_local.o: damage_local.f90 \ + crystallite.o + +damage_nonlocal.o: damage_nonlocal.f90 \ + crystallite.o + +thermal_conduction.o: thermal_conduction.f90 \ + crystallite.o + +vacancyflux_isoconc.o: vacancyflux_isoconc.f90 \ + crystallite.o + +vacancyflux_isochempot.o: vacancyflux_isochempot.f90 \ + crystallite.o + +vacancyflux_cahnhilliard.o: vacancyflux_cahnhilliard.f90 \ + crystallite.o + +porosity_none.o: porosity_none.f90 \ + crystallite.o + +porosity_phasefield.o: porosity_phasefield.f90 \ + crystallite.o + +hydrogenflux_isoconc.o: hydrogenflux_isoconc.f90 \ + crystallite.o + +hydrogenflux_cahnhilliard.o: hydrogenflux_cahnhilliard.f90 \ + crystallite.o + +homogenization_RGC.o: homogenization_RGC.f90 \ + crystallite.o + +homogenization_isostrain.o: homogenization_isostrain.f90 \ + crystallite.o + +homogenization_none.o: homogenization_none.f90 \ + crystallite.o + +crystallite.o: crystallite.f90 \ + constitutive.o + +constitutive.o: constitutive.f90 \ + $(SOURCE_FILES) \ + $(KINEMATICS_FILES) \ + $(PLASTIC_FILES) + +source_thermal_dissipation.o: source_thermal_dissipation.f90 \ + lattice.o + +source_thermal_externalheat.o: source_thermal_externalheat.f90 \ + lattice.o + +source_damage_isoBrittle.o: source_damage_isoBrittle.f90 \ + lattice.o + +source_damage_isoDuctile.o: source_damage_isoDuctile.f90 \ + lattice.o + +source_damage_anisoBrittle.o: source_damage_anisoBrittle.f90 \ + lattice.o + +source_damage_anisoDuctile.o: source_damage_anisoDuctile.f90 \ + lattice.o + +source_vacancy_phenoplasticity.o: source_vacancy_phenoplasticity.f90 \ + lattice.o + +source_vacancy_irradiation.o: source_vacancy_irradiation.f90 \ + lattice.o + +source_vacancy_thermalfluc.o: source_vacancy_thermalfluc.f90 \ + lattice.o + +kinematics_cleavage_opening.o: kinematics_cleavage_opening.f90 \ + lattice.o + +kinematics_slipplane_opening.o: kinematics_slipplane_opening.f90 \ + lattice.o + +kinematics_thermal_expansion.o: kinematics_thermal_expansion.f90 \ + lattice.o + +kinematics_vacancy_strain.o: kinematics_vacancy_strain.f90 \ + lattice.o + +kinematics_hydrogen_strain.o: kinematics_hydrogen_strain.f90 \ + lattice.o + +plastic_nonlocal.o: plastic_nonlocal.f90 \ + lattice.o + +plastic_titanmod.o: plastic_titanmod.f90 \ + lattice.o + +plastic_disloUCLA.o: plastic_disloUCLA.f90 \ + lattice.o + +plastic_dislotwin.o: plastic_dislotwin.f90 \ + lattice.o + +plastic_phenopowerlaw.o: plastic_phenopowerlaw.f90 \ + lattice.o + +plastic_phenoplus.o: plastic_phenoplus.f90 \ + lattice.o + +plastic_isotropic.o: plastic_isotropic.f90 \ + lattice.o + +plastic_none.o: plastic_none.f90 \ + lattice.o +ifeq "$(F90)" "gfortran" +lattice.o: lattice.f90 \ + material.o + $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -ffree-line-length-240 -c lattice.f90 $(SUFFIX) +# long lines for interaction matrix +else +lattice.o: lattice.f90 \ + material.o +endif + +material.o: material.f90 \ + mesh.o + +mesh.o: mesh.f90 \ + $(wildcard meshFEM.f90) \ + FEsolving.o \ + math.o \ + FEZoo.o + $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $(MESHNAME) -o mesh.o $(SUFFIX) + +FEsolving.o: FEsolving.f90 \ + debug.o + +math.o: math.f90 \ + debug.o + +debug.o: debug.f90 \ + numerics.o + +numerics.o: numerics.f90 \ + IO.o + +IO.o: IO.f90 \ + DAMASK_interface.o + +DAMASK_interface.o: spectral_interface.f90 \ + $(wildcard DAMASK_FEM_interface.f90) \ + prec.o + $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $(INTERFACENAME) -o DAMASK_interface.o $(SUFFIX) + +ifeq "$(F90)" "gfortran" +prec.o: prec.f90 \ + system_routines.o + $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c prec.f90 -fno-range-check -fall-intrinsics -fno-fast-math $(SUFFIX) +# fno-range-check: Disable range checking on results of simplification of constant expressions during compilation +# --> allows the definition of DAMASK_NaN +#-fall-intrinsics: all intrinsic procedures (including the GNU-specific extensions) are accepted. -Wintrinsics-std will be ignored +# and no user-defined procedure with the same name as any intrinsic will be called except when it is explicitly declared external +# --> allows the use of 'isnan' +#-fno-fast-math: +# --> otherwise, when setting -ffast-math, isnan always evaluates to false (I would call it a bug) +else + +prec.o: prec.f90 \ + system_routines.o +endif + +system_routines.o: system_routines.f90 \ + C_routines.o + +C_routines.o: C_routines.c + + +%.o : %.f90 + $(PREFIX) $(FCOMPILERNAME) $(COMPILE) -c $< $(SUFFIX) + +%.o : %.c + $(CCOMPILERNAME) -c $< + +.PHONY: tidy +tidy: + @rm -rf *.o + @rm -rf *.mod + @rm -rf *.optrpt + @rm -rf *.inst.f90 # for instrumentation + @rm -rf *.pomp.f90 # for instrumentation + @rm -rf *.pp.f90 # for instrumentation + @rm -rf *.pdb # for instrumentation + @rm -rf *.opari.inc # for instrumentation + +.PHONY: cleanDAMASK +cleanDAMASK: + @rm -rf *.exe + @rm -rf *.marc + @rm -rf *.o + @rm -rf *.mod + @rm -rf *.optrpt + @rm -rf *.inst.f90 # for instrumentation + @rm -rf *.pomp.f90 # for instrumentation + @rm -rf *.pp.f90 # for instrumentation + @rm -rf *.pdb # for instrumentation + @rm -rf *.opari.inc # for instrumentation + +.PHONY: help +help: + F90="$(F90)" + FCOMPILERNAME="$(FCOMPILERNAME)" + COMPILEROUT="$(COMPILEROUT)" + diff --git a/config/Phase_Phenopowerlaw_BCC-Ferrite.config b/config/Phase_Phenopowerlaw_BCC-Ferrite.config deleted file mode 100644 index 7344ef455..000000000 --- a/config/Phase_Phenopowerlaw_BCC-Ferrite.config +++ /dev/null @@ -1,35 +0,0 @@ -# Tasan et.al. 2015 Acta Materalia -# Tasan et.al. 2015 International Journal of Plasticity -# Diehl et.al. 2015 Meccanica -[BCC_Ferrite] -elasticity hooke -plasticity phenopowerlaw - -lattice_structure bcc -Nslip 12 12 # per family -Ntwin 0 # per family -c11 233.3e9 -c12 135.5e9 -c44 118.0e9 -gdot0_slip 0.001 -n_slip 20 -tau0_slip 95.e6 97.e6 0 0 # per family, optimization long simplex 109 -tausat_slip 222.e6 412.7e6 0 0 # per family, optimization long simplex 109 -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31.0e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 -h0_slipslip 1000.0e6 # opti -h0_twinslip 0 -h0_twintwin 0 -interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -w0_slip 2.0 # opti -atol_resistance 1 -(output) totalshear diff --git a/examples/AbaqusStandard/numerics.config b/examples/AbaqusStandard/numerics.config index 723bc3934..47091bf7f 100644 --- a/examples/AbaqusStandard/numerics.config +++ b/examples/AbaqusStandard/numerics.config @@ -1,2 +1 @@ -fixed_seed 144921823 -analyticJaco 0 +fixed_seed 1697667030 diff --git a/config/Crystallite_All.config b/examples/ConfigFiles/Crystallite_All.config similarity index 100% rename from config/Crystallite_All.config rename to examples/ConfigFiles/Crystallite_All.config diff --git a/config/Crystallite_None.config b/examples/ConfigFiles/Crystallite_None.config similarity index 100% rename from config/Crystallite_None.config rename to examples/ConfigFiles/Crystallite_None.config diff --git a/config/Crystallite_aLittleSomething.config b/examples/ConfigFiles/Crystallite_aLittleSomething.config similarity index 100% rename from config/Crystallite_aLittleSomething.config rename to examples/ConfigFiles/Crystallite_aLittleSomething.config diff --git a/config/Homogenization_Damage_NonLocal.config b/examples/ConfigFiles/Homogenization_Damage_NonLocal.config similarity index 100% rename from config/Homogenization_Damage_NonLocal.config rename to examples/ConfigFiles/Homogenization_Damage_NonLocal.config diff --git a/config/Homogenization_HydrogenFlux_CahnHilliard.config b/examples/ConfigFiles/Homogenization_HydrogenFlux_CahnHilliard.config similarity index 100% rename from config/Homogenization_HydrogenFlux_CahnHilliard.config rename to examples/ConfigFiles/Homogenization_HydrogenFlux_CahnHilliard.config diff --git a/config/Homogenization_Isostrain_Parallel3.config b/examples/ConfigFiles/Homogenization_Isostrain_Parallel3.config similarity index 100% rename from config/Homogenization_Isostrain_Parallel3.config rename to examples/ConfigFiles/Homogenization_Isostrain_Parallel3.config diff --git a/config/Homogenization_Isostrain_SX.config b/examples/ConfigFiles/Homogenization_Isostrain_SX.config similarity index 100% rename from config/Homogenization_Isostrain_SX.config rename to examples/ConfigFiles/Homogenization_Isostrain_SX.config diff --git a/config/Homogenization_Isostrain_Taylor2.config b/examples/ConfigFiles/Homogenization_Isostrain_Taylor2.config similarity index 100% rename from config/Homogenization_Isostrain_Taylor2.config rename to examples/ConfigFiles/Homogenization_Isostrain_Taylor2.config diff --git a/config/Homogenization_None_Dummy.config b/examples/ConfigFiles/Homogenization_None_Dummy.config similarity index 100% rename from config/Homogenization_None_Dummy.config rename to examples/ConfigFiles/Homogenization_None_Dummy.config diff --git a/config/Homogenization_Porosity_PhaseField.config b/examples/ConfigFiles/Homogenization_Porosity_PhaseField.config similarity index 100% rename from config/Homogenization_Porosity_PhaseField.config rename to examples/ConfigFiles/Homogenization_Porosity_PhaseField.config diff --git a/config/Homogenization_RGC_8Grains.config b/examples/ConfigFiles/Homogenization_RGC_8Grains.config similarity index 100% rename from config/Homogenization_RGC_8Grains.config rename to examples/ConfigFiles/Homogenization_RGC_8Grains.config diff --git a/config/Homogenization_Thermal_Conduction.config b/examples/ConfigFiles/Homogenization_Thermal_Conduction.config similarity index 100% rename from config/Homogenization_Thermal_Conduction.config rename to examples/ConfigFiles/Homogenization_Thermal_Conduction.config diff --git a/config/Homogenization_VacancyFlux_CahnHilliard.config b/examples/ConfigFiles/Homogenization_VacancyFlux_CahnHilliard.config similarity index 100% rename from config/Homogenization_VacancyFlux_CahnHilliard.config rename to examples/ConfigFiles/Homogenization_VacancyFlux_CahnHilliard.config diff --git a/config/Homogenization_multiField.config b/examples/ConfigFiles/Homogenization_multiField.config similarity index 100% rename from config/Homogenization_multiField.config rename to examples/ConfigFiles/Homogenization_multiField.config diff --git a/config/Kinematics_Hydrogen_Strain.config b/examples/ConfigFiles/Kinematics_Hydrogen_Strain.config similarity index 100% rename from config/Kinematics_Hydrogen_Strain.config rename to examples/ConfigFiles/Kinematics_Hydrogen_Strain.config diff --git a/config/Kinematics_Thermal_Expansion.config b/examples/ConfigFiles/Kinematics_Thermal_Expansion.config similarity index 100% rename from config/Kinematics_Thermal_Expansion.config rename to examples/ConfigFiles/Kinematics_Thermal_Expansion.config diff --git a/config/Kinematics_Vacancy_Strain.config b/examples/ConfigFiles/Kinematics_Vacancy_Strain.config similarity index 100% rename from config/Kinematics_Vacancy_Strain.config rename to examples/ConfigFiles/Kinematics_Vacancy_Strain.config diff --git a/config/Microstructure_DP_Steel.config b/examples/ConfigFiles/Microstructure_DP_Steel.config similarity index 100% rename from config/Microstructure_DP_Steel.config rename to examples/ConfigFiles/Microstructure_DP_Steel.config diff --git a/config/Microstructure_ElementHomogeneous.config b/examples/ConfigFiles/Microstructure_ElementHomogeneous.config similarity index 100% rename from config/Microstructure_ElementHomogeneous.config rename to examples/ConfigFiles/Microstructure_ElementHomogeneous.config diff --git a/config/Phase_Damage.config b/examples/ConfigFiles/Phase_Damage.config similarity index 100% rename from config/Phase_Damage.config rename to examples/ConfigFiles/Phase_Damage.config diff --git a/config/Phase_DisloUCLA_Tungsten.config b/examples/ConfigFiles/Phase_DisloUCLA_Tungsten.config similarity index 100% rename from config/Phase_DisloUCLA_Tungsten.config rename to examples/ConfigFiles/Phase_DisloUCLA_Tungsten.config diff --git a/config/Phase_Dislotwin_TWIP-Steel-FeMnC.config b/examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config similarity index 100% rename from config/Phase_Dislotwin_TWIP-Steel-FeMnC.config rename to examples/ConfigFiles/Phase_Dislotwin_TWIP-Steel-FeMnC.config diff --git a/config/Phase_Dislotwin_Tungsten.config b/examples/ConfigFiles/Phase_Dislotwin_Tungsten.config similarity index 100% rename from config/Phase_Dislotwin_Tungsten.config rename to examples/ConfigFiles/Phase_Dislotwin_Tungsten.config diff --git a/config/Phase_Hydrogen.config b/examples/ConfigFiles/Phase_Hydrogen.config similarity index 100% rename from config/Phase_Hydrogen.config rename to examples/ConfigFiles/Phase_Hydrogen.config diff --git a/config/Phase_Isotropic_AluminumIsotropic.config b/examples/ConfigFiles/Phase_Isotropic_AluminumIsotropic.config similarity index 100% rename from config/Phase_Isotropic_AluminumIsotropic.config rename to examples/ConfigFiles/Phase_Isotropic_AluminumIsotropic.config diff --git a/config/Phase_None_IsotropicVolumePreservation.config b/examples/ConfigFiles/Phase_None_IsotropicVolumePreservation.config similarity index 100% rename from config/Phase_None_IsotropicVolumePreservation.config rename to examples/ConfigFiles/Phase_None_IsotropicVolumePreservation.config diff --git a/config/Phase_None_Orthorombic.config b/examples/ConfigFiles/Phase_None_Orthorombic.config similarity index 100% rename from config/Phase_None_Orthorombic.config rename to examples/ConfigFiles/Phase_None_Orthorombic.config diff --git a/config/Phase_Nonlocal_Aluminum.config b/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config similarity index 83% rename from config/Phase_Nonlocal_Aluminum.config rename to examples/ConfigFiles/Phase_Nonlocal_Aluminum.config index b805f09be..6406a47c0 100644 --- a/config/Phase_Nonlocal_Aluminum.config +++ b/examples/ConfigFiles/Phase_Nonlocal_Aluminum.config @@ -8,32 +8,20 @@ plasticity nonlocal (output) rho_edge (output) rho_screw (output) rho_sgl -(output) rho_sgl_edge (output) rho_sgl_edge_pos (output) rho_sgl_edge_neg -(output) rho_sgl_screw (output) rho_sgl_screw_pos (output) rho_sgl_screw_neg -(output) rho_sgl_mobile -(output) rho_sgl_edge_mobile (output) rho_sgl_edge_pos_mobile (output) rho_sgl_edge_neg_mobile -(output) rho_sgl_screw_mobile (output) rho_sgl_screw_pos_mobile (output) rho_sgl_screw_neg_mobile -(output) rho_sgl_immobile -(output) rho_sgl_edge_immobile (output) rho_sgl_edge_pos_immobile (output) rho_sgl_edge_neg_immobile -(output) rho_sgl_screw_immobile (output) rho_sgl_screw_pos_immobile (output) rho_sgl_screw_neg_immobile -(output) rho_dip (output) rho_dip_edge (output) rho_dip_screw -(output) excess_rho -(output) excess_rho_edge -(output) excess_rho_screw (output) rho_forest (output) delta (output) delta_sgl @@ -47,10 +35,8 @@ plasticity nonlocal (output) rho_dot_sgl (output) rho_dot_sgl_mobile (output) rho_dot_dip -(output) rho_dot_gen (output) rho_dot_gen_edge (output) rho_dot_gen_screw -(output) rho_dot_sgl2dip (output) rho_dot_sgl2dip_edge (output) rho_dot_sgl2dip_screw (output) rho_dot_ann_ath @@ -66,24 +52,6 @@ plasticity nonlocal (output) velocity_edge_neg (output) velocity_screw_pos (output) velocity_screw_neg -(output) slipdirection.x -(output) slipdirection.y -(output) slipdirection.z -(output) slipnormal.x -(output) slipnormal.y -(output) slipnormal.z -(output) fluxDensity_edge_pos.x -(output) fluxDensity_edge_pos.y -(output) fluxDensity_edge_pos.z -(output) fluxDensity_edge_neg.x -(output) fluxDensity_edge_neg.y -(output) fluxDensity_edge_neg.z -(output) fluxDensity_screw_pos.x -(output) fluxDensity_screw_pos.y -(output) fluxDensity_screw_pos.z -(output) fluxDensity_screw_neg.x -(output) fluxDensity_screw_neg.y -(output) fluxDensity_screw_neg.z (output) maximumDipoleHeight_edge (output) maximumDipoleHeight_screw (output) accumulated_shear diff --git a/examples/ConfigFiles/Phase_Nonlocal_Nickel.config b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config new file mode 100644 index 000000000..3420b4246 --- /dev/null +++ b/examples/ConfigFiles/Phase_Nonlocal_Nickel.config @@ -0,0 +1,74 @@ +[Ni_nonlocal] + +elasticity hooke +plasticity nonlocal +/nonlocal/ + +(output) rho +(output) rho_sgl_mobile +(output) rho_sgl_immobile +(output) rho_sgl_edge_pos +(output) rho_sgl_edge_neg +(output) rho_sgl_screw_pos +(output) rho_sgl_screw_neg +(output) rho_dip_edge +(output) rho_dip_screw +(output) rho_forest +(output) accumulatedshear +(output) shearrate +(output) resolvedstress +(output) resistance +(output) velocity_edge_pos +(output) rho_dot_gen +(output) rho_dot_sgl2dip_edge +(output) rho_dot_sgl2dip_screw +(output) rho_dot_ann_ath +(output) rho_dot_ann_the_edge +(output) rho_dot_ann_the_screw +(output) rho_dot_edgejogs +(output) rho_dot_flux_edge +(output) rho_dot_flux_screw + +lattice_structure fcc +Nslip 12 # number of slip systems per family +c11 246.5e9 +c12 147.3e9 +c44 124.7e9 +burgers 2.48e-10 0 0 0 # Burgers vector in m +rhoSglEdgePos0 6e10 # Initial positive edge single dislocation density in m/m**3 +rhoSglEdgeNeg0 6e10 # Initial negative edge single dislocation density in m/m**3 +rhoSglScrewPos0 6e10 # Initial positive screw single dislocation density in m/m**3 +rhoSglScrewNeg0 6e10 # Initial negative screw single dislocation density in m/m**3 +rhoDipEdge0 0 # Initial edge dipole dislocation density in m/m**3 +rhoDipScrew0 0 # Initial screw dipole dislocation density in m/m**3 +rhoSglScatter 0 +minimumDipoleHeightEdge 2.6e-9 # 3.0e-9 # minimum distance for stable edge dipoles in m +minimumDipoleHeightScrew 12.0e-9 # 50e-9 # minimum distance for stable screw dipoles in m +lambda0 45 # 33 # prefactor for mean free path +edgeMultiplication 0.1 +randomMultiplication 0 +atomicVolume 1.2e-29 +selfdiffusionPrefactor 1.9e-4 # Gottstein p.168 # prefactor for self-diffusion coefficient +selfdiffusionEnergy 5.1e-19 # Gottstein p.168 # activation energy self-diffusion +solidSolutionEnergy 1.8e-19 # activation energy of solid solution particles in J +solidSolutionConcentration 5e-7 # 1e-7 +solidSolutionSize 1.0 +peierlsStressEdge 1e5 # Peierls stress for edges in Pa (per slip family) +peierlsStressScrew 1e5 # Peierls stress for screws in Pa (per slip family) +doublekinkWidth 10 # width of double kinks in multiples of burgers vector length b +viscosity 1e-3 # viscosity for dislocation glide in Pa s +p 1 # exponent for thermal barrier profile +q 1 # exponent for thermal barrier profile +attackFrequency 50e9 # attack frequency in Hz +surfaceTransmissivity 1.0 # transmissivity of free surfaces for dislocation flux +grainBoundaryTransmissivity 0.0 +aTol_rho 1e100 # absolute tolerance for dislocation density in m/m**3 +aTol_shear 1e10 # absolute tolerance for dislocation density in m/m**3 +significantRho 1e8 # dislocation density considered relevant in m/m**3 +significantN 1 +shortRangeStressCorrection 0 +CFLfactor 1.1 # safety factor for CFL flux check (numerical parameter) +r 1 +interaction_SlipSlip 0 0 0.625 0.07 0.137 0.122 # Dislocation interaction coefficient +linetension 0.8 +edgejog 0.01 # 0.2 diff --git a/config/Phase_Phenopowerlaw_Aluminum.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config similarity index 52% rename from config/Phase_Phenopowerlaw_Aluminum.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config index 8fa58557a..63ec8f3c8 100644 --- a/config/Phase_Phenopowerlaw_Aluminum.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_Aluminum.config @@ -7,11 +7,6 @@ plasticity phenopowerlaw (output) resolvedstress_slip (output) accumulated_shear_slip (output) totalshear -(output) resistance_twin -(output) shearrate_twin -(output) resolvedstress_twin -(output) accumulated_shear_twin -(output) totalvolfrac_twin lattice_structure fcc Nslip 12 # per family @@ -26,19 +21,6 @@ n_slip 20 tau0_slip 31e6 # per family tausat_slip 63e6 # per family a_slip 2.25 -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 h0_slipslip 75e6 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 -interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 atol_resistance 1 diff --git a/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config new file mode 100644 index 000000000..6efd84f65 --- /dev/null +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Ferrite.config @@ -0,0 +1,25 @@ +# Tasan et.al. 2015 Acta Materalia +# Tasan et.al. 2015 International Journal of Plasticity +# Diehl et.al. 2015 Meccanica +[BCC-Ferrite] + +elasticity hooke +plasticity phenopowerlaw + +lattice_structure bcc +Nslip 12 12 # per family +Ntwin 0 # per family +c11 233.3e9 +c12 135.5e9 +c44 118.0e9 +gdot0_slip 0.001 +n_slip 20 +tau0_slip 95.e6 97.e6 # per family, optimization long simplex 109 +tausat_slip 222.e6 412.7e6 # per family, optimization long simplex 109 +h0_slipslip 1000.0e6 +interaction_slipslip 1 1 1.4 1.4 1.4 1.4 +interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 +w0_slip 2.0 +(output) totalshear diff --git a/config/Phase_Phenopowerlaw_BCC-Martensite.config b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config similarity index 50% rename from config/Phase_Phenopowerlaw_BCC-Martensite.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config index b9960d325..89ae0339b 100644 --- a/config/Phase_Phenopowerlaw_BCC-Martensite.config +++ b/examples/ConfigFiles/Phase_Phenopowerlaw_BCC-Martensite.config @@ -1,34 +1,25 @@ # Tasan et.al. 2015 Acta Materalia # Tasan et.al. 2015 International Journal of Plasticity # Diehl et.al. 2015 Meccanica -[BCC_Martensite] -plasticity phenopowerlaw +[BCC-Martensite] + elasticity hooke +plasticity phenopowerlaw + lattice_structure bcc -Nslip 12 12 # per family -Ntwin 0 # per family +Nslip 12 12 # per family +Ntwin 0 # per family c11 417.4e9 c12 242.4e9 c44 211.1e9 gdot0_slip 0.001 n_slip 20 -tau0_slip 405.8e6 456.7e6 0 0 # per family -tausat_slip 872.9e6 971.2e6 0 0 # per family -gdot0_twin 0.001 -n_twin 20 -tau0_twin 31.0e6 # per family -s_pr 0 # push-up factor for slip saturation due to twinning -twin_b 0 -twin_c 0 -twin_d 0 -twin_e 0 +tau0_slip 405.8e6 456.7e6 # per family +tausat_slip 872.9e6 971.2e6 # per family h0_slipslip 563.0e9 -h0_twinslip 0 -h0_twintwin 0 interaction_slipslip 1 1 1.4 1.4 1.4 1.4 interaction_sliptwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twinslip 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 interaction_twintwin 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 w0_slip 2.0 -atol_resistance 1 (output) totalshear diff --git a/config/Phase_Phenopowerlaw_Gold.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config similarity index 100% rename from config/Phase_Phenopowerlaw_Gold.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Gold.config diff --git a/config/Phase_Phenopowerlaw_Magnesium.config b/examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config similarity index 100% rename from config/Phase_Phenopowerlaw_Magnesium.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_Magnesium.config diff --git a/config/Phase_Phenopowerlaw_cpTi-alpha.config b/examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config similarity index 100% rename from config/Phase_Phenopowerlaw_cpTi-alpha.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_cpTi-alpha.config diff --git a/config/Phase_Phenopowerlaw_multiField.config b/examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config similarity index 100% rename from config/Phase_Phenopowerlaw_multiField.config rename to examples/ConfigFiles/Phase_Phenopowerlaw_multiField.config diff --git a/config/Phase_Porosity.config b/examples/ConfigFiles/Phase_Porosity.config similarity index 100% rename from config/Phase_Porosity.config rename to examples/ConfigFiles/Phase_Porosity.config diff --git a/config/Phase_Thermal.config b/examples/ConfigFiles/Phase_Thermal.config similarity index 100% rename from config/Phase_Thermal.config rename to examples/ConfigFiles/Phase_Thermal.config diff --git a/config/Phase_Vacancy.config b/examples/ConfigFiles/Phase_Vacancy.config similarity index 100% rename from config/Phase_Vacancy.config rename to examples/ConfigFiles/Phase_Vacancy.config diff --git a/config/Source_Damage_IsoBrittle.config b/examples/ConfigFiles/Source_Damage_IsoBrittle.config similarity index 100% rename from config/Source_Damage_IsoBrittle.config rename to examples/ConfigFiles/Source_Damage_IsoBrittle.config diff --git a/config/Source_Thermal_Dissipation.config b/examples/ConfigFiles/Source_Thermal_Dissipation.config similarity index 100% rename from config/Source_Thermal_Dissipation.config rename to examples/ConfigFiles/Source_Thermal_Dissipation.config diff --git a/config/Source_Vacancy_Irradiation.config b/examples/ConfigFiles/Source_Vacancy_Irradiation.config similarity index 100% rename from config/Source_Vacancy_Irradiation.config rename to examples/ConfigFiles/Source_Vacancy_Irradiation.config diff --git a/config/Source_Vacancy_PhenoPlasticity.config b/examples/ConfigFiles/Source_Vacancy_PhenoPlasticity.config similarity index 100% rename from config/Source_Vacancy_PhenoPlasticity.config rename to examples/ConfigFiles/Source_Vacancy_PhenoPlasticity.config diff --git a/config/Texture_FiberExample.config b/examples/ConfigFiles/Texture_FiberExample.config similarity index 100% rename from config/Texture_FiberExample.config rename to examples/ConfigFiles/Texture_FiberExample.config diff --git a/config/Texture_Gauss_001.config b/examples/ConfigFiles/Texture_Gauss_001.config similarity index 100% rename from config/Texture_Gauss_001.config rename to examples/ConfigFiles/Texture_Gauss_001.config diff --git a/config/Texture_Gauss_101.config b/examples/ConfigFiles/Texture_Gauss_101.config similarity index 100% rename from config/Texture_Gauss_101.config rename to examples/ConfigFiles/Texture_Gauss_101.config diff --git a/config/Texture_Gauss_111.config b/examples/ConfigFiles/Texture_Gauss_111.config similarity index 100% rename from config/Texture_Gauss_111.config rename to examples/ConfigFiles/Texture_Gauss_111.config diff --git a/config/Texture_Gauss_123.config b/examples/ConfigFiles/Texture_Gauss_123.config similarity index 100% rename from config/Texture_Gauss_123.config rename to examples/ConfigFiles/Texture_Gauss_123.config diff --git a/config/Texture_RandomSingleCrystals.config b/examples/ConfigFiles/Texture_RandomSingleCrystals.config similarity index 100% rename from config/Texture_RandomSingleCrystals.config rename to examples/ConfigFiles/Texture_RandomSingleCrystals.config diff --git a/config/Texture_Rolling.config b/examples/ConfigFiles/Texture_Rolling.config similarity index 100% rename from config/Texture_Rolling.config rename to examples/ConfigFiles/Texture_Rolling.config diff --git a/config/debug.config b/examples/ConfigFiles/debug.config similarity index 100% rename from config/debug.config rename to examples/ConfigFiles/debug.config diff --git a/config/material.config b/examples/ConfigFiles/material.config similarity index 100% rename from config/material.config rename to examples/ConfigFiles/material.config diff --git a/config/numerics.config b/examples/ConfigFiles/numerics.config similarity index 98% rename from config/numerics.config rename to examples/ConfigFiles/numerics.config index 85e3592b4..580b58e57 100644 --- a/config/numerics.config +++ b/examples/ConfigFiles/numerics.config @@ -8,7 +8,6 @@ pert_Fg 1.0e-7 # deformation gradient perturbation for g pert_method 1 # perturbation method (1 = forward, 2 = backward or 3 = central) integrator 1 # integration method (1 = Fixed Point Iteration, 2 = Euler, 3 = Adaptive Euler, 4 = classical 4th order Runge-Kutta, 5 = 5th order Runge-Kutta Cash-Karp) integratorStiffness 1 # integration method used for stiffness (1 = Fixed Point Iteration, 2 = Euler, 3 = Adaptive Euler, 4 = classical 4th order Runge-Kutta, 5 = 5th order Runge-Kutta Cash-Karp) -analyticJaco 1 # use analytic Jacobian or perturbation (0 = perturbations, 1 = analytic) unitlength 1 # physical length of one computational length unit usepingpong 1 # use the ping pong (collect <-> calc) scheme (always off for Abaqus exp, must be on for Spectral Solver) diff --git a/config/rollingTexture.linearODF b/examples/ConfigFiles/rollingTexture.linearODF similarity index 100% rename from config/rollingTexture.linearODF rename to examples/ConfigFiles/rollingTexture.linearODF diff --git a/installation/compile_CoreModule.py b/installation/compile_CoreModule.py deleted file mode 100755 index 8772c4cd6..000000000 --- a/installation/compile_CoreModule.py +++ /dev/null @@ -1,139 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 no BOM -*- - -import os,sys,glob,subprocess,shlex -from damask import Environment -from damask import version as DAMASKVERSION - -# compiles fortran code for Python -scriptID = '$Id$' - -damaskEnv = Environment() -baseDir = damaskEnv.relPath('installation/') -codeDir = damaskEnv.relPath('code/') - -keywords=['IMKL_ROOT','ACML_ROOT','LAPACK_ROOT','FFTW_ROOT','F90'] -options={} - -#--- getting options from damask.conf or, if not present, from envinronment ----------------------- -for option in keywords: - try: - value = damaskEnv.options[option] - except: - value = os.getenv(option) - if value is None: value = '' # env not set - options[option]=value - -#--- overwrite default options with keyword=value pair from argument list to mimic make behavior -- -for i, arg in enumerate(sys.argv): - for option in keywords: - if arg.startswith(option): - options[option] = sys.argv[i][len(option)+1:] - -#--- check for valid compiler and set options ----------------------------------------------------- -compilers = ['ifort','gfortran'] -if options['F90'] not in compilers: - sys.exit('compiler "F90" (in installation/options or as Shell variable) has to be one out of: %s'%(', '.join(compilers))) - -compiler = { - 'gfortran': '--fcompiler=gnu95 --f90flags="-fPIC -fno-range-check -xf95-cpp-input -std=f2008 -fall-intrinsics'+\ - ' -fdefault-real-8 -fdefault-double-8"', - 'ifort': '--fcompiler=intelem --f90flags="-fPIC -fpp -stand f08 -diag-disable 5268 -assume byterecl'+\ - ' -real-size 64 -integer-size 32 -shared-intel"', - }[options['F90']] - -#--- option not depending on compiler ------------------------------------------------------------- -compileOptions = ' -DSpectral -DFLOAT=8 -DINT=4 -I%s/lib -DDAMASKVERSION=\\\\\"\\\"%s\\\\\"\\\"'%(damaskEnv.rootDir(),DAMASKVERSION) - -#--- this saves the path of libraries to core.so, hence it is known during runtime ---------------- -if options['F90'] == 'gfortran': - # solved error: Undefined symbols for architecture x86_64: "_PyArg_ParseTupleAndKeywords" - # as found on https://lists.macosforge.org/pipermail/macports-dev/2013-May/022735.html - LDFLAGS = '-shared -Wl,-undefined,dynamic_lookup' -else: - # some f2py versions/configurations compile with openMP, so linking against openMP is needed - # to prevent errors during loading of core module - LDFLAGS = ' -openmp -Wl' - -#--- run path of for fftw during runtime ---------------------------------------------------------- -LDFLAGS += ',-rpath,%s/lib,-rpath,%s/lib64'%(options['FFTW_ROOT'],options['FFTW_ROOT']) - -# see http://cens.ioc.ee/pipermail/f2py-users/2003-December/000621.html -if options['IMKL_ROOT']: - if options['F90'] == 'gfortran': - arch = 'gf' - elif options['F90'] == 'ifort': - arch = 'intel' - lib_lapack = '-L%s/lib/intel64 -lmkl_%s_lp64 -lmkl_core -lmkl_sequential -lm'\ - %(options['IMKL_ROOT'],arch) - LDFLAGS +=',-rpath,%s/lib/intel64'%(options['IMKL_ROOT']) -elif options['ACML_ROOT'] != '': - lib_lapack = '-L%s/%s64/lib -lacml'%(options['ACML_ROOT'],options['F90']) - LDFLAGS +=',-rpath,%s/%s64/lib'%(options['ACML_ROOT'],options['F90']) -elif options['LAPACK_ROOT'] != '': - lib_lapack = '-L%s/lib -L%s/lib64 -llapack'%(options['LAPACK_ROOT'],options['LAPACK_ROOT']) - LDFLAGS +=',-rpath,%s/lib,-rpath,%s/lib64'%(options['LAPACK_ROOT'],options['LAPACK_ROOT']) - -#-------------------------------------------------------------------------------------------------- -# f2py does not (yet) support setting of special flags for the linker, hence they must be set via -# environment variable ---------------------------------------------------------------------------- -my_env = os.environ -my_env["LDFLAGS"] = LDFLAGS - -#--- delete old file ------------------------------------------------------------------------------ -try: - os.remove(os.path.join(damaskEnv.relPath('lib/damask'),'core.so')) -except OSError, e: - print ("Error when deleting: %s - %s." % (e.filename,e.strerror)) - - -# The following command is used to compile the fortran files and make the functions defined -# in damask.core.pyf available for python in the module core.so -# It uses the fortran wrapper f2py that is included in the numpy package to construct the -# module core.so out of the fortran code in the f90 files -# For the generation of the pyf file use the following lines: -########################################################################### -#'f2py -h damask.core.pyf' +\ -#' --overwrite-signature --no-lower prec.f90 DAMASK_spectral_interface.f90 math.f90 mesh.f90,...' - ########################################################################### -os.chdir(codeDir) -cmd = 'f2py damask.core.pyf' +\ - ' -c --no-lower %s'%(compiler) +\ - compileOptions+\ - ' prec.f90'+\ - ' spectral_interface.f90'+\ - ' IO.f90'+\ - ' libs.f90'+\ - ' numerics.f90'+\ - ' debug.f90'+\ - ' math.f90'+\ - ' FEsolving.f90'+\ - ' mesh.f90'+\ - ' core_quit.f90'+\ - ' -L%s/lib -lfftw3'%(options['FFTW_ROOT'])+\ - ' %s'%lib_lapack - -print('Executing: '+cmd) -try: - subprocess.call(shlex.split(cmd),env=my_env) -except subprocess.CalledProcessError: - print('build failed') -except OSError: - print ('f2py not found') - -try: - os.rename(os.path.join(codeDir,'core.so'),\ - os.path.join(damaskEnv.relPath('lib/damask'),'core.so')) -except: - pass - -modules = glob.glob('*.mod') -for module in modules: - print 'removing', module - os.remove(module) - -#--- check if compilation of core module was successful ------------------------------------------- -try: - with open(damaskEnv.relPath('lib/damask/core.so')) as f: pass -except IOError as e: - print '*********\n* core.so not found, compilation of core modules was not successful\n*********' diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_lmp b/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_lmp deleted file mode 100644 index f9744338b..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_lmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2011/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2011/Marc_tools/include_linux64 deleted file mode 100644 index ecbea3033..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/include_linux64 +++ /dev/null @@ -1,704 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# -# select MPITYPE based upon what is installed - MPITYPE=none -if test -d $MARC_INTELMPI -then - MPITYPE=intelmpi -fi -if test -d $MARC_HPMPI -then - MPITYPE=hpmpi -fi - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi -# uncomment one of the definitions of MPITYPE below to -# explicitly choose the type of MPI to use -#MPITYPE=none -#MPITYPE=hpmpi -#MPITYPE=intelmpi - -MPI_DEFAULT=hpmpi -MPI_OTHER=intelmpi - -INTELMPI_VERSION=HYDRA - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T" - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra " - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -BCSGPUSOLVER=NONE -#BCSGPUSOLVER=BCSGPU - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -SOLVERFLAGS= -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU" -fi - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS="-real-size 64 -integer-size 32" - I8DEFINES="-DFLOAT=8 -DINT=4" - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8 -real-size 64 -integer-size 64" - I8DEFINES="-DI64 -DFLOAT=8 -DINT=8" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= - -FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP -DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP - DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2011 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - - -FORTRANMUMPS="$FCOMP -c -fpp -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/bcsgpusolver/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_13 -DLOWERCASE_ -I${MARC_SOURCE}/bcsgpusolver/bcslib_cuda/include " -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a -L/usr/local/cuda/lib -lcudart -lcublas -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2011/Marc_tools/include_linux64.original b/installation/mods_MarcMentat/2011/Marc_tools/include_linux64.original deleted file mode 100644 index c93974f56..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/include_linux64.original +++ /dev/null @@ -1,641 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# -# select MPITYPE based upon what is installed - MPITYPE=none -if test -d $MARC_INTELMPI -then - MPITYPE=intelmpi -fi -if test -d $MARC_HPMPI -then - MPITYPE=hpmpi -fi - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi -# uncomment one of the definitions of MPITYPE below to -# explicitly choose the type of MPI to use -#MPITYPE=none -#MPITYPE=hpmpi -#MPITYPE=intelmpi - -MPI_DEFAULT=hpmpi -MPI_OTHER=intelmpi - -INTELMPI_VERSION=HYDRA - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T" - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra " - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -BCSGPUSOLVER=NONE -#BCSGPUSOLVER=BCSGPU - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -SOLVERFLAGS= -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU" -fi - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS= - I8DEFINES= - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8" - I8DEFINES="-DI64" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL" - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL" -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= - -FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/bcssolver/common -I$MARC_SOURCE/mumpssolver/include $I8FFLAGS -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - - -FORTRANMUMPS="$FCOMP -c -fpp -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/bcsgpusolver/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_13 -DLOWERCASE_ -I${MARC_SOURCE}/bcsgpusolver/bcslib_cuda/include " -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/bcsgpusolver/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a -L/usr/local/cuda/lib -lcudart -lcublas -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask b/installation/mods_MarcMentat/2011/Marc_tools/run_damask deleted file mode 100644 index 7c58c5326..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask +++ /dev/null @@ -1,3624 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2011/Marc_tools/run_damask_h deleted file mode 100644 index 3f24d83d6..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_h +++ /dev/null @@ -1,3625 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2011/Marc_tools/run_damask_hmp deleted file mode 100644 index de1ef519a..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_hmp +++ /dev/null @@ -1,3624 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2011/Marc_tools/run_damask_l deleted file mode 100644 index 6afe0819d..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_l +++ /dev/null @@ -1,3624 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2011/Marc_tools/run_damask_lmp deleted file mode 100644 index d9f23dc7b..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_lmp +++ /dev/null @@ -1,3624 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2011/Marc_tools/run_damask_mp deleted file mode 100644 index 8a0ed187e..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_damask_mp +++ /dev/null @@ -1,3625 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usernoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Marc_tools/run_marc.original b/installation/mods_MarcMentat/2011/Marc_tools/run_marc.original deleted file mode 100644 index 53ad826f1..000000000 --- a/installation/mods_MarcMentat/2011/Marc_tools/run_marc.original +++ /dev/null @@ -1,3675 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersubname= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-nsolver -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - - - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$usersubname" - then - if test ! -f $usersubname - then - error="$error -user subroutine file $usersubname not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# - - if test "$user" - then -# program=$user.marc - program=$DIRJOB/`$BASENAME $user .f`.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$DIRJOB/`$BASENAME $user .f`.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - touch $jid.hosts - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi -# /bin/rm $jid.hosts 2> /dev/null - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test ${basefile##*.} = f - then - ln -sf "$user.f" "$usersub" - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/edit_window b/installation/mods_MarcMentat/2011/Mentat_bin/edit_window deleted file mode 100644 index afc8e2b39..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/edit_window +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. The default window is an -# xterm, and the default editor is vi. These may be customized. - -if [ "`uname`" = "SunOS" ]; then - dir=/usr/openwin/bin -else - dir=/usr/bin/X11 -fi - -# $dir/xterm -T "vi $*" -n "vi $*" -e vi $* -%EDITOR% $* \ No newline at end of file diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/edit_window.org b/installation/mods_MarcMentat/2011/Mentat_bin/edit_window.org deleted file mode 100644 index d6138d5c8..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/edit_window.org +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. The default window is an -# xterm, and the default editor is vi. These may be customized. - -if [ "`uname`" = "SunOS" ]; then - dir=/usr/openwin/bin -else - dir=/usr/bin/X11 -fi - -$dir/xterm -T "vi $*" -n "vi $*" -e vi $* diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit1.org b/installation/mods_MarcMentat/2011/Mentat_bin/submit1.org deleted file mode 100644 index 8a57636be..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit1.org +++ /dev/null @@ -1,156 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=/home/f.roters/msc/marc2011 -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then - srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit4 b/installation/mods_MarcMentat/2011/Mentat_bin/submit4 deleted file mode 100644 index 1843d75cf..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit4 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit5 b/installation/mods_MarcMentat/2011/Mentat_bin/submit5 deleted file mode 100644 index 7c83ee735..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit5 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit6 b/installation/mods_MarcMentat/2011/Mentat_bin/submit6 deleted file mode 100644 index c37857b6e..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit6 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit7 b/installation/mods_MarcMentat/2011/Mentat_bin/submit7 deleted file mode 100644 index e02560352..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit7 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_h" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit8 b/installation/mods_MarcMentat/2011/Mentat_bin/submit8 deleted file mode 100644 index 7c83ee735..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit8 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/submit9 b/installation/mods_MarcMentat/2011/Mentat_bin/submit9 deleted file mode 100644 index 924f725b1..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_bin/submit9 +++ /dev/null @@ -1,157 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_l" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms b/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms deleted file mode 100644 index adb27171f..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms +++ /dev/null @@ -1,2867 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - -#ifndef QT_MENTAT -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.f90" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -#ifndef QT_MENTAT -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 10 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads)" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 8 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - } - } - } - } - - button { - position 1 +12 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 16 6 - text "ADV. JOB SUBM." - popmenu job_submit_adv_pm - } - - button { - position +16 = - size 16 6 - text "DAMASK" - popmenu damask - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - - label { - position 1 5 - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 14 - nvisible 14 - texts "DEFAULT" -#if 0 - "2011" -#endif - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2011" -#endif - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2011" -#endif - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2011" -#endif - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "DCOM" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu damask { - -#ifdef QT_MENTAT - text "DAMASK.MPIE.DE" -#endif - - group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "DAMASK.MPIE.DE" - } -#endif - - label { - position 1 6 - size 13 6 - text "Optimzation" - border_width 1 - border_color black - } - - label { - position +13 = - size 20 6 - text "write Input" - border_width 1 - border_color black - } - - label { - position +18 = - size 30 6 - text "do not write Inp." - border_width 1 - border_color black - } - - label { - position -32 +6 - size 12 6 - text "O2 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 4 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 4 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O1 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 5 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 5 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O0 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 6 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 6 *monitor_job" - } - - label { - position -29 +8 - size 9 6 - text "O2" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 7 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 7 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O1" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 8 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 8 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O0" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 9 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 9 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "CANCEL" - } -} - - - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } -#endif - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } - - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -#ifndef QT_MENTAT -popmenu job_user_source_pm { - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 26 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +27 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 100 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - -group job_ddm_generator_gr { - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - -group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - -#ifdef QT_MENTAT -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 56 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - toggle { - position = +4 - size 30 4 - text "COARSE GRAPH" - toggle "*job_option ddm_graph:coarse" - true_command "*job_option ddm_graph:coarse" - false_command "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - toggle { - position = +4 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } -#ifdef QT_MENTAT - label { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - } -#else - button { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - command "*job_param ddm_elem_weight_coeff" - } -#endif - text { - position = +4 - size 30 4 - display "job_param_value_ddm_elem_weight_coeff" - command "*job_param ddm_elem_weight_coeff" - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +57 - size 32 8 - text "OK" - } -#else - frame { - position 0 +57 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - -#ifndef QT_MENTAT -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - -group job_ddm_direction_gr { - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - -group job_ddm_sort_point_gr { - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - -group job_ddm_sort_point_meth_gr { - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - -group job_ddm_preprocessor_gr { - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - -#ifndef QT_MENTAT -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } -} - -#ifndef QT_MENTAT -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - -group job_run_solver_ddm_opts_gr { - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - -group job_solver_multi_procs_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - -group job_solver_multi_procs_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - -group job_nsolver_procs_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - -group job_solver_multi_threads_mfront_sparse_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - -group job_pardiso_multi_threads_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - -group job_parallel_env_network_gr { - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - -group job_parallel_env_network_ddm_gr { - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - -#ifndef QT_MENTAT -popmenu marc_integer_size_pm { - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - -group marc_integer_size_gr { - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms.org b/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms.org deleted file mode 100644 index 1f4ec6ecd..000000000 --- a/installation/mods_MarcMentat/2011/Mentat_menus/job_run.ms.org +++ /dev/null @@ -1,2664 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - -#ifndef QT_MENTAT -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.F" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -#ifndef QT_MENTAT -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 10 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads)" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 8 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - } - } - } - } - - button { - position 1 +12 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 32 6 - text "ADVANCED JOB SUBMISSION" - popmenu job_submit_adv_pm - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - - label { - position 1 5 - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 14 - nvisible 14 - texts "DEFAULT" -#if 0 - "2011" -#endif - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2011" -#endif - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2011" -#endif - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2011" -#endif - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "DCOM" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } -#endif - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } - - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -#ifndef QT_MENTAT -popmenu job_user_source_pm { - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 26 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +27 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 100 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - -group job_ddm_generator_gr { - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - -group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - -#ifdef QT_MENTAT -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 56 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - toggle { - position = +4 - size 30 4 - text "COARSE GRAPH" - toggle "*job_option ddm_graph:coarse" - true_command "*job_option ddm_graph:coarse" - false_command "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - toggle { - position = +4 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } -#ifdef QT_MENTAT - label { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - } -#else - button { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - command "*job_param ddm_elem_weight_coeff" - } -#endif - text { - position = +4 - size 30 4 - display "job_param_value_ddm_elem_weight_coeff" - command "*job_param ddm_elem_weight_coeff" - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +57 - size 32 8 - text "OK" - } -#else - frame { - position 0 +57 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - -#ifndef QT_MENTAT -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - -group job_ddm_direction_gr { - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - -group job_ddm_sort_point_gr { - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - -group job_ddm_sort_point_meth_gr { - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - -group job_ddm_preprocessor_gr { - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - -#ifndef QT_MENTAT -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } -} - -#ifndef QT_MENTAT -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - -group job_run_solver_ddm_opts_gr { - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - -group job_solver_multi_procs_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - -group job_solver_multi_procs_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - -group job_nsolver_procs_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - -group job_solver_multi_threads_mfront_sparse_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - -group job_pardiso_multi_threads_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - -group job_parallel_env_network_gr { - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - -group job_parallel_env_network_ddm_gr { - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - -#ifndef QT_MENTAT -popmenu marc_integer_size_pm { - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - -group marc_integer_size_gr { - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask b/installation/mods_MarcMentat/2012/Marc_tools/comp_damask deleted file mode 100644 index 2d144b8a4..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_h b/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_h deleted file mode 100644 index 01464f095..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_h +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_hmp b/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_hmp deleted file mode 100644 index 36ced6543..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_hmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_l b/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_l deleted file mode 100644 index 31b5cd175..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_l +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_mp b/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_mp deleted file mode 100644 index 986d9ae04..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_mp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_user.original b/installation/mods_MarcMentat/2012/Marc_tools/comp_user.original deleted file mode 100644 index 8679bb041..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/comp_user.original +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user.f on host `hostname`" -echo "program: $program" - $FORTRAN $user.f || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$user.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS || \ - { - echo "$0: link failed for $user.o on host `hostname`" - exit 1 - } - /bin/rm $userobj diff --git a/installation/mods_MarcMentat/2012/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2012/Marc_tools/include_linux64 deleted file mode 100644 index 0292ffae7..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/include_linux64 +++ /dev/null @@ -1,703 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# - - -MPI_DEFAULT=intelmpi -MPI_OTHER=hpmpi - -MPITYPE=$MPI_DEFAULT - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi - - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -#BCSGPUSOLVER=NONE -BCSGPUSOLVER=BCSGPU - -SOLVERFLAGS= -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU -DCUDA" - BCS_DIR=bcsgpusolver - export PATH=$MARC_CUDA/bin:$MARC_CUDA/nvvm:$PATH - export LD_LIBRARY_PATH=$MARC_CUDA/lib64:$LD_LIBRARY_PATH -else - BCS_DIR=bcssolver -fi -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T,y1" -# Below line is moved in run_marc file -# export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - INTELMPI_VERSION=HYDRA - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -genvall -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra -genvall" - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS="-real-size 64 -integer-size 32" - I8DEFINES="-DFLOAT=8 -DINT=4" - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8 -real-size 64 -integer-size 64" - I8DEFINES="-DI64 -DFLOAT=8 -DINT=8" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= - -FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP -DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP - DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2012 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - - -FORTRANMUMPS="$FCOMP -c -fpp -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_20 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_cuda/include -I${MARC_CUDA}/include -I$MARC_SOURCE/mdsrc $I8DEFINES -Xcompiler -fvisibility=hidden -Xcompiler -fPIC $I8DEFINES " -NVCCLIB="ar rvl" -NVCCLD=gcc -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a " - MARCCUDALIBS1="-L${MARC_LIB}/cuda_dummy -lmarccuda " - MARCCUDALIBS2="-L${MARC_LIB}/cuda -lmarccuda " - MARCCUDALIBS=$MARCCUDALIBS1 - CUDALIBS="-L$MARC_CUDA/lib64 -lcudart -lcublas -L/usr/lib64 -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2012/Marc_tools/include_linux64.original b/installation/mods_MarcMentat/2012/Marc_tools/include_linux64.original deleted file mode 100644 index 2e7c07e24..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/include_linux64.original +++ /dev/null @@ -1,641 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# - - -MPI_DEFAULT=intelmpi -MPI_OTHER=hpmpi - -MPITYPE=$MPI_DEFAULT - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi - - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -#BCSGPUSOLVER=NONE -BCSGPUSOLVER=BCSGPU - -SOLVERFLAGS= -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU -DCUDA" - BCS_DIR=bcsgpusolver - export PATH=$MARC_CUDA/bin:$MARC_CUDA/nvvm:$PATH - export LD_LIBRARY_PATH=$MARC_CUDA/lib64:$LD_LIBRARY_PATH -else - BCS_DIR=bcssolver -fi -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T,y1" -# Below line is moved in run_marc file -# export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - INTELMPI_VERSION=HYDRA - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -genvall -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra -genvall" - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS= - I8DEFINES= - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8" - I8DEFINES="-DI64" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS" -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= - -FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - - -FORTRANMUMPS="$FCOMP -c -fpp -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_20 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_cuda/include -I${MARC_CUDA}/include -I$MARC_SOURCE/mdsrc $I8DEFINES -Xcompiler -fvisibility=hidden -Xcompiler -fPIC $I8DEFINES " -NVCCLIB="ar rvl" -NVCCLD=gcc -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a " - MARCCUDALIBS1="-L${MARC_LIB}/cuda_dummy -lmarccuda " - MARCCUDALIBS2="-L${MARC_LIB}/cuda -lmarccuda " - MARCCUDALIBS=$MARCCUDALIBS1 - CUDALIBS="-L$MARC_CUDA/lib64 -lcudart -lcublas -L/usr/lib64 -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask b/installation/mods_MarcMentat/2012/Marc_tools/run_damask deleted file mode 100644 index 789ce4215..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2012/Marc_tools/run_damask_h deleted file mode 100644 index d7f3e4ead..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_h +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2012/Marc_tools/run_damask_hmp deleted file mode 100644 index 1d71a2944..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_hmp +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2012/Marc_tools/run_damask_l deleted file mode 100644 index 1f59b49ce..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_l +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2012/Marc_tools/run_damask_lmp deleted file mode 100644 index 10b141e01..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_lmp +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2012/Marc_tools/run_damask_mp deleted file mode 100644 index 9cb386a7d..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_damask_mp +++ /dev/null @@ -1,3690 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Marc_tools/run_marc.original b/installation/mods_MarcMentat/2012/Marc_tools/run_marc.original deleted file mode 100644 index 2141711e3..000000000 --- a/installation/mods_MarcMentat/2012/Marc_tools/run_marc.original +++ /dev/null @@ -1,3732 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersubname= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -# Linux 64 + HPMPI, Below code is taken from include_linux64 - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$usersubname" - then - if test ! -f $usersubname - then - error="$error -user subroutine file $usersubname not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# - - if test "$user" - then -# program=$user.marc - program=$DIRJOB/`$BASENAME $user .f`.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$DIRJOB/`$BASENAME $user .f`.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test ${basefile##*.} = f - then - ln -sf "$user.f" "$usersub" - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/edit_window b/installation/mods_MarcMentat/2012/Mentat_bin/edit_window deleted file mode 100644 index afc8e2b39..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/edit_window +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. The default window is an -# xterm, and the default editor is vi. These may be customized. - -if [ "`uname`" = "SunOS" ]; then - dir=/usr/openwin/bin -else - dir=/usr/bin/X11 -fi - -# $dir/xterm -T "vi $*" -n "vi $*" -e vi $* -%EDITOR% $* \ No newline at end of file diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/edit_window.org b/installation/mods_MarcMentat/2012/Mentat_bin/edit_window.org deleted file mode 100644 index d6138d5c8..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/edit_window.org +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. The default window is an -# xterm, and the default editor is vi. These may be customized. - -if [ "`uname`" = "SunOS" ]; then - dir=/usr/openwin/bin -else - dir=/usr/bin/X11 -fi - -$dir/xterm -T "vi $*" -n "vi $*" -e vi $* diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill5 b/installation/mods_MarcMentat/2012/Mentat_bin/kill5 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/kill5 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill6 b/installation/mods_MarcMentat/2012/Mentat_bin/kill6 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/kill6 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill7 b/installation/mods_MarcMentat/2012/Mentat_bin/kill7 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/kill7 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill8 b/installation/mods_MarcMentat/2012/Mentat_bin/kill8 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/kill8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill9 b/installation/mods_MarcMentat/2012/Mentat_bin/kill9 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/kill9 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit1.org b/installation/mods_MarcMentat/2012/Mentat_bin/submit1.org deleted file mode 100644 index 61276a7fa..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit1.org +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=/msc/marc2012 -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then - srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit4 b/installation/mods_MarcMentat/2012/Mentat_bin/submit4 deleted file mode 100644 index dda98f475..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit4 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit5 b/installation/mods_MarcMentat/2012/Mentat_bin/submit5 deleted file mode 100644 index 1f96942d2..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit5 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_mp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit6 b/installation/mods_MarcMentat/2012/Mentat_bin/submit6 deleted file mode 100644 index a9a74f4f3..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit6 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit7 b/installation/mods_MarcMentat/2012/Mentat_bin/submit7 deleted file mode 100644 index edbc1701c..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit7 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_h" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit8 b/installation/mods_MarcMentat/2012/Mentat_bin/submit8 deleted file mode 100644 index 872125981..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit8 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/submit9 b/installation/mods_MarcMentat/2012/Mentat_bin/submit9 deleted file mode 100644 index 44a4865fb..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_bin/submit9 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_l" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms b/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms deleted file mode 100644 index daf207061..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms +++ /dev/null @@ -1,2942 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - -#ifndef QT_MENTAT -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.f90" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -#ifndef QT_MENTAT -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 14 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION/\{GPU}" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads, \ - and(job_solver_mfront_sparse,\ - job_nonsym_off,\ - *job_option solver_use_gpu:on))" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 12 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - - display { - position = +4 - size 23 4 - display job_solver_gpu - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } - } - } - } - } - - button { - position 1 +16 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 16 6 - text "ADV. JOB SUBM." - popmenu job_submit_adv_pm - } - - button { - position +16 = - size 16 6 - text "DAMASK" - popmenu damask - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 113 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - - label { - position 1 5 - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 15 - nvisible 15 - texts "DEFAULT" -#if 0 - "2012" -#endif - "2011" - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2012" -#endif - "job_input_version_2011" - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2012" -#endif - "*job_option version:2011" - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2012" -#endif - "job_allows_input_version_2011" - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "DCOM" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu damask { - -#ifdef QT_MENTAT - text "DAMASK.MPIE.DE" -#endif - - group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "DAMASK.MPIE.DE" - } -#endif - - label { - position 1 6 - size 13 6 - text "Optimzation" - border_width 1 - border_color black - } - - label { - position +13 = - size 20 6 - text "write Input" - border_width 1 - border_color black - } - - label { - position +18 = - size 30 6 - text "do not write Inp." - border_width 1 - border_color black - } - - label { - position -32 +6 - size 12 6 - text "O2 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 4 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 4 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O1 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 5 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 5 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O0 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 6 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 6 *monitor_job" - } - - label { - position -29 +8 - size 9 6 - text "O2" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 7 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 7 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O1" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 8 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 8 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O0" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 9 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 9 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "CANCEL" - } -} - - - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT - - text { - position 1 5 - size 84 74 - multiline - readonly - display "job_exit_msg" - } - -#endif - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -#ifndef QT_MENTAT -popmenu job_user_source_pm { - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION/\{GPU}" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION/GPU" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 35 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +36 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - -group job_ddm_generator_gr { - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - -group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - -#ifdef QT_MENTAT -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 56 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - toggle { - position = +4 - size 30 4 - text "COARSE GRAPH" - toggle "*job_option ddm_graph:coarse" - true_command "*job_option ddm_graph:coarse" - false_command "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - toggle { - position = +4 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } -#ifdef QT_MENTAT - label { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - } -#else - button { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - command "*job_param ddm_elem_weight_coeff" - } -#endif - text { - position = +4 - size 30 4 - display "job_param_value_ddm_elem_weight_coeff" - command "*job_param ddm_elem_weight_coeff" - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +57 - size 32 8 - text "OK" - } -#else - frame { - position 0 +57 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - -#ifndef QT_MENTAT -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - -group job_ddm_direction_gr { - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - -group job_ddm_sort_point_gr { - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - -group job_ddm_sort_point_meth_gr { - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - -group job_ddm_preprocessor_gr { - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - -#ifndef QT_MENTAT -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } - - frame { - position 1 +9 - size 46 8 - group job_solver_gpu_gr - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } -} - -#ifndef QT_MENTAT -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - -group job_run_solver_ddm_opts_gr { - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - -group job_solver_multi_procs_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - -group job_solver_multi_procs_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - -group job_nsolver_procs_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - -group job_solver_multi_threads_mfront_sparse_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - -group job_solver_gpu_gr { - toggle { - position 0 0 - size 30 4 - text "USE \{GPU(s)}" - toggle "*job_option solver_use_gpu:on" - true_command "*job_option solver_use_gpu:on" - false_command "*job_option solver_use_gpu:off" - help job_solver_gpu - } - - label { - position +2 +4 - size 16 4 - text "\{GPU} SELECTION" - border_width 1 - border_color black - visible "*job_option solver_use_gpu:on" - } - - roller { - position +16 = - size 12 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - rollers "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - visible "*job_option solver_use_gpu:on" - help job_solver_gpu - } - - text { - position +12 = - size 16 4 - display job_solver_gpus - command "*clear_job_solver_gpus *job_solver_gpus" - visible "and(*job_option solver_use_gpu:on,*job_option solver_gpus:user)" - } -} - -group job_solver_multi_threads_pardiso_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - -group job_pardiso_multi_threads_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - -group job_parallel_env_network_gr { - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - -group job_parallel_env_network_ddm_gr { - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - -#ifndef QT_MENTAT -popmenu marc_integer_size_pm { - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - -group marc_integer_size_gr { - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms.org b/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms.org deleted file mode 100644 index 7a7418765..000000000 --- a/installation/mods_MarcMentat/2012/Mentat_menus/job_run.ms.org +++ /dev/null @@ -1,2739 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - -#ifndef QT_MENTAT -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.F" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -#ifndef QT_MENTAT -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 14 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION/\{GPU}" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads, \ - and(job_solver_mfront_sparse,\ - job_nonsym_off,\ - *job_option solver_use_gpu:on))" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 12 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - - display { - position = +4 - size 23 4 - display job_solver_gpu - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } - } - } - } - } - - button { - position 1 +16 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 32 6 - text "ADVANCED JOB SUBMISSION" - popmenu job_submit_adv_pm - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 113 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - - label { - position 1 5 - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 15 - nvisible 15 - texts "DEFAULT" -#if 0 - "2012" -#endif - "2011" - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2012" -#endif - "job_input_version_2011" - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2012" -#endif - "*job_option version:2011" - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2012" -#endif - "job_allows_input_version_2011" - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "DCOM" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT - - text { - position 1 5 - size 84 74 - multiline - readonly - display "job_exit_msg" - } - -#endif - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -#ifndef QT_MENTAT -popmenu job_user_source_pm { - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION/\{GPU}" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION/GPU" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 35 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +36 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - -group job_ddm_generator_gr { - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - -group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - -#ifdef QT_MENTAT -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 56 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - toggle { - position = +4 - size 30 4 - text "COARSE GRAPH" - toggle "*job_option ddm_graph:coarse" - true_command "*job_option ddm_graph:coarse" - false_command "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - toggle { - position = +4 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } -#ifdef QT_MENTAT - label { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - } -#else - button { - position 1 +5 - size 30 4 - text "ELEMENT WEIGHT COEFFICIENT" - command "*job_param ddm_elem_weight_coeff" - } -#endif - text { - position = +4 - size 30 4 - display "job_param_value_ddm_elem_weight_coeff" - command "*job_param ddm_elem_weight_coeff" - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +57 - size 32 8 - text "OK" - } -#else - frame { - position 0 +57 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - -#ifndef QT_MENTAT -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - -group job_ddm_direction_gr { - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - -group job_ddm_sort_point_gr { - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - -#ifndef QT_MENTAT -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - -group job_ddm_sort_point_meth_gr { - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - -group job_ddm_preprocessor_gr { - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - -#ifndef QT_MENTAT -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } - - frame { - position 1 +9 - size 46 8 - group job_solver_gpu_gr - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } -} - -#ifndef QT_MENTAT -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - -group job_run_solver_ddm_opts_gr { - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - -group job_solver_multi_procs_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - -group job_solver_multi_procs_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - -group job_nsolver_procs_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - -group job_solver_multi_threads_mfront_sparse_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - -group job_solver_gpu_gr { - toggle { - position 0 0 - size 30 4 - text "USE \{GPU(s)}" - toggle "*job_option solver_use_gpu:on" - true_command "*job_option solver_use_gpu:on" - false_command "*job_option solver_use_gpu:off" - help job_solver_gpu - } - - label { - position +2 +4 - size 16 4 - text "\{GPU} SELECTION" - border_width 1 - border_color black - visible "*job_option solver_use_gpu:on" - } - - roller { - position +16 = - size 12 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - rollers "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - visible "*job_option solver_use_gpu:on" - help job_solver_gpu - } - - text { - position +12 = - size 16 4 - display job_solver_gpus - command "*clear_job_solver_gpus *job_solver_gpus" - visible "and(*job_option solver_use_gpu:on,*job_option solver_gpus:user)" - } -} - -group job_solver_multi_threads_pardiso_parallel_off_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - -group job_solver_multi_threads_pardiso_parallel_on_gr { - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - -group job_pardiso_multi_threads_ddm_automatic_gr { - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - -group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - -group job_parallel_env_network_gr { - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - -group job_parallel_env_network_ddm_gr { - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - -#ifndef QT_MENTAT -popmenu marc_integer_size_pm { - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - -group marc_integer_size_gr { - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask deleted file mode 100644 index 2d144b8a4..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_h b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_h deleted file mode 100644 index 01464f095..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_h +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_hmp b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_hmp deleted file mode 100644 index 36ced6543..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_hmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_l b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_l deleted file mode 100644 index 31b5cd175..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_l +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_lmp b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_lmp deleted file mode 100644 index 8a0c1255d..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_lmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRANLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_mp b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_mp deleted file mode 100644 index 986d9ae04..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_damask_mp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_user.original b/installation/mods_MarcMentat/2013.1/Marc_tools/comp_user.original deleted file mode 100644 index 8679bb041..000000000 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/comp_user.original +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user.f on host `hostname`" -echo "program: $program" - $FORTRAN $user.f || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$user.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS || \ - { - echo "$0: link failed for $user.o on host `hostname`" - exit 1 - } - /bin/rm $userobj diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill4 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill4 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill4 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill5 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill5 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill5 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill6 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill6 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill6 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill7 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill7 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill7 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill8 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill8 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill9 b/installation/mods_MarcMentat/2013.1/Mentat_bin/kill9 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/kill9 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask deleted file mode 100644 index 2d144b8a4..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_h b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_h deleted file mode 100644 index 01464f095..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_h +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_hmp b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_hmp deleted file mode 100644 index 36ced6543..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_hmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_l b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_l deleted file mode 100644 index 31b5cd175..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_l +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_lmp b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_lmp deleted file mode 100644 index 8a0c1255d..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_lmp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRANLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_mp b/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_mp deleted file mode 100644 index 986d9ae04..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_damask_mp +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -usernoext=$user -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` -usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - -# add BLAS options for linking - BLAS="%BLAS%" - -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user on host `hostname`" -echo "program: $program" - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$usernoext.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $BLAS \ - $SYSLIBS || \ - { - echo "$0: link failed for $usernoext.o on host `hostname`" - exit 1 - } - /bin/rm $userobj - /bin/rm $DIRJOB/*.mod diff --git a/installation/mods_MarcMentat/2013/Marc_tools/comp_user.original b/installation/mods_MarcMentat/2013/Marc_tools/comp_user.original deleted file mode 100644 index 8679bb041..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/comp_user.original +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user.f on host `hostname`" -echo "program: $program" - $FORTRAN $user.f || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$user.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS || \ - { - echo "$0: link failed for $user.o on host `hostname`" - exit 1 - } - /bin/rm $userobj diff --git a/installation/mods_MarcMentat/2013/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2013/Marc_tools/include_linux64 deleted file mode 100644 index 9af09e049..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/include_linux64 +++ /dev/null @@ -1,709 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# - - -MPI_DEFAULT=intelmpi -MPI_OTHER=hpmpi - -MPITYPE=$MPI_DEFAULT - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi - - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -#BCSGPUSOLVER=NONE -BCSGPUSOLVER=BCSGPU - -SOLVERFLAGS= -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU -DCUDA" - BCS_DIR=bcsgpusolver - export PATH=$MARC_CUDA/bin:$MARC_CUDA/nvvm:$PATH - export LD_LIBRARY_PATH=$MARC_CUDA/lib64:$LD_LIBRARY_PATH -else - BCS_DIR=bcssolver -fi -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T,y1" -# Below line is moved in run_marc file -# export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - INTELMPI_VERSION=HYDRA - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -genvall -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra -genvall" - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -MARCCODECOV= -#MARCCODECOV="ON" - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS="-real-size 64 -integer-size 32" - I8DEFINES="-DFLOAT=8 -DINT=4" - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8 -real-size 64 -integer-size 64" - I8DEFINES="-DI64 -DFLOAT=8 -DINT=8" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource $METIS" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= -if test "$MARCCODECOV" = "ON" -then -PROFILE="-prof-gen=srcpos" -fi - -FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP -DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3; removed -save for calls with openMP - DFORTLOW="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRAN="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGH="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - -FORTRANMUMPS="$FCOMP -fpp -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O1 -fp-model precise $FDEFINES -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_20 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_cuda/include -I${MARC_CUDA}/include -I$MARC_SOURCE/mdsrc $I8DEFINES -Xcompiler -fvisibility=hidden -Xcompiler -fPIC $I8DEFINES " -NVCCLIB="ar rvl" -NVCCLD=icc -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a " - MARCCUDALIBS1="-L${MARC_LIB}/cuda_dummy -lmarccuda " - MARCCUDALIBS2="-L${MARC_LIB}/cuda -lmarccuda " - MARCCUDALIBS=$MARCCUDALIBS1 - CUDALIBS="-L$MARC_CUDA/lib64 -lcudart -lcublas -L/usr/lib64 -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2013/Marc_tools/include_linux64.original b/installation/mods_MarcMentat/2013/Marc_tools/include_linux64.original deleted file mode 100644 index eed3d07db..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/include_linux64.original +++ /dev/null @@ -1,647 +0,0 @@ -# -# General definitions for the Marc 2011 version -# -# EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) -# -# Linux RedHat 5.4 -# -# 64 bit MPI version -# -# Intel(R) Fortran Compiler -# Version 12.0.4 -# -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE -# -# To check the O/S level, type: -# uname -a -# -# Distributed parallel MPI libraries: -# 1) HP MPI 2.3 -# To check the mpi version, type: -# mpirun -version -# 2) Intel MPI 4.0.1.007 -# To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 -# -# To check the Compiler level, type using the compiler -# installation path: -# ifort -V -# icc -V -# -# REMARKS : This file contains the definitions of variables used during -# compilation loading and use of the MARC programmes . The -# current machine type is identified by means of the variable -# MACHINE , defined below. -# -# -# MPI_ROOT: root directory in which mpi shared libraries, etc. are located -# DIRJOB : directory in which spawned jobs should look for Marc input -# MPI_ARCH: system architecture -# MPI_EPATH: path where executable resides -# - -REVISION="VERSION, BUILD" -HOSTNAME=`hostname` - -# find available memory in Mbyte on the machine -# can be set explicitly -MEMLIMIT=`free -m | awk '/Mem:/ {print $2}'` - -# set _OEM_NASTRAN to 1 for MD Nastran build -# override _OEM_NASTRAN setting with MARC_MD_NASTRAN environment variable -_OEM_NASTRAN="${MARC_MD_NASTRAN:-0}" - -# uncomment the following line for an autoforge build -#AUTOFORGE=1 -AUTOFORGE=0 -export AUTOFORGE - -# integer size -if test "$MARC_INTEGER_SIZE" = "" ; then - INTEGER_PATH= -else - INTEGER_PATH=/$MARC_INTEGER_SIZE -fi - -FCOMP=ifort - -# -# settings for Metis -# -METIS="-I$METIS_SOURCE" -METISLIBS="$MARC_LIB/metis.a " - -# -# settings for MPI -# -# RCP and RSH are used for parallel network runs -# replace with similar commands like rsh if needed -RCP=/usr/bin/scp -RSH=/usr/bin/ssh -# - - -MPI_DEFAULT=intelmpi -MPI_OTHER=hpmpi - -MPITYPE=$MPI_DEFAULT - -if test $AUTOFORGE -then - if test $AUTOFORGE = 1 - then - MPITYPE=none - fi -fi - - -# overrule MPITYPE setting with environmental variable MARC_MPITYPE -if test $MARC_MPITYPE -then - MPITYPE=$MARC_MPITYPE -fi - -# always set MPITYPE to none for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - MPITYPE=none -fi - -# Edit following lines to build with GPGPU version of BCS Solver for -# NVIDIA platforms -#BCSGPUSOLVER=NONE -BCSGPUSOLVER=BCSGPU - -SOLVERFLAGS= -if test "$BCSGPUSOLVER" = BCSGPU -then - SOLVERFLAGS="$SOLVERFLAGS -DBCSGPU -DCUDA" - BCS_DIR=bcsgpusolver - export PATH=$MARC_CUDA/bin:$MARC_CUDA/nvvm:$PATH - export LD_LIBRARY_PATH=$MARC_CUDA/lib64:$LD_LIBRARY_PATH -else - BCS_DIR=bcssolver -fi -# -# settings for MPI -# -DDM= -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - FCOMPMPI=mpif90 - export MPI_ROOT=$MARC_HPMPI - export MPI_REMSH=$RSH - export MPI_F77=$FCOMP - ARCHITECTURE=linux_amd64 - DDM="-I$MPI_ROOT/include/64 -DDDM -DHPMPI" - MPI_CLEAN= - export MPI_EPATH=$MARC_BIN - export LD_LIBRARY_PATH=$MPI_ROOT/lib/$ARCHITECTURE:$MARC_LIB:$MARC_LIB_SHARED:$LD_LIBRARY_PATH - export MPIHPSPECIAL="-e MPI_FLAGS=E,T,y1" -# Below line is moved in run_marc file -# export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - export MPIHPSPECIAL="$MPIHPSPECIAL -e BINDIR=$MARC_BIN" - if test -n "$MSC_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e MSC_LICENSE_FILE=$MSC_LICENSE_FILE" - fi - if test -n "$LM_LICENSE_FILE" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LM_LICENSE_FILE=$LM_LICENSE_FILE" - fi - export MPIHPSPECIAL="$MPIHPSPECIAL -e MPI_LIC_CHECKER=$MPI_ROOT/bin/licensing/amd64_s8/lichk.x" - RUN_JOB2="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -f " - RUN_JOB1="$MPI_ROOT/bin/mpirun ${MPIRUNOPTIONS} -prot -w $MPIHPSPECIAL -np " - RUN_JOB0= - fi - if test $MPITYPE = intelmpi - then - INTELMPI_VERSION=HYDRA - FCOMPMPI=mpiifort - MPI_ROOT=$MARC_INTELMPI - DDM="-I${MPI_ROOT}/include64 -DDDM" - PATH=$MPI_ROOT/bin64:$PATH - export PATH - LD_LIBRARY_PATH=$MPI_ROOT/lib64:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - if test $INTELMPI_VERSION = HYDRA - then - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec.hydra -genvall -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec.hydra -genvall" - else - RUN_JOB1="${MPI_ROOT}/bin64/mpiexec -n " - RUN_JOB2="${MPI_ROOT}/bin64/mpiexec -configfile " - fi - RUN_JOB0= - MPI_CLEAN= - MPI_EPATH=$MARC_BIN - MPIR_HOME=$MPI_ROOT - MPICH_F77=$FCOMP - MPICH_F77LINKER=$FCOMP - export MPI_ROOT MPI_EPATH MPIR_HOME MPICH_F77 MPICH_F77LINKER - I_MPI_PIN_DOMAIN=node - export I_MPI_PIN_DOMAIN - fi -else - MPI_ROOT=$MARC_DUMMYMPI - export MPI_ROOT=$MARC_DUMMYMPI - DDM="-I$MPI_ROOT/include" -fi - -# -# variables for the "maintain" script -# - -MACHINENAME=LINUX -MACHINE64BIT=yes -MACHINE=Linux_EM64T -DEV=/dev/tape -GETLOG="whoami" -CLEAR="clear" -MY_UNAME=`uname -a` - -# Edit following 2 lines to build with VKI Solver -#VKISOLVER=VKI -VKISOLVER=NONE - -# Edit following 2 lines to build with CASI Solver -CASISOLVER=CASI -#CASISOLVER=NONE - -# Edit following 2 lines to build with MF2 Solver -MF2SOLVER=NONE -#MF2SOLVER=SERIAL -#MF2SOLVER=MF2PARALLEL - -# Edit following lines to build with Intel(c) Multithreaded solver (PARDISO) -#INTELSOLVER=NONE -INTELSOLVER=PARDISO - -# Edit following lines to build with MUMPS -if test "$MARC_INTEGER_SIZE" = "i4" ; then - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -else - #MUMPSSOLVER=NONE - MUMPSSOLVER=MUMPS -fi - -# Edit following 2 lines to build MARC dynamic shared library -MARC_DLL=MARC_DLL -#MARC_DLL=NONE - -# always set VKISOLVER, CASISOLVER, BCSGPUSOLVER, and MARC_DLL to NONE for MD Nastran -if test "$_OEM_NASTRAN" -ne 0 -then - VKISOLVER=NONE - CASISOLVER=NONE - MF2SOLVER=NONE - INTELSOLVER=NONE - MUMPSSOLVER=NONE - BCSGPUSOLVER=NONE - MARC_DLL=NONE -fi - -# -# define Fortran and C compile syntax -# -if test "$VKISOLVER" = VKI -then - SOLVERFLAGS="$SOLVERFLAGS -DVKI" -fi - -if test "$CASISOLVER" = CASI -then - SOLVERFLAGS="$SOLVERFLAGS -DCASI" -fi - -if test "$MF2SOLVER" = MF2PARALLEL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2PARALLEL" -fi -if test "$MF2SOLVER" = MF2SERIAL -then - SOLVERFLAGS="$SOLVERFLAGS -DMF2SERIAL" -fi - -if test "$INTELSOLVER" = PARDISO -then - SOLVERFLAGS="$SOLVERFLAGS -DPARDISO" -fi - -if test "$MUMPSSOLVER" = MUMPS -then - SOLVERFLAGS="$SOLVERFLAGS -DMUMPS" -fi - - -if test "$MARC_DLL" = MARC_DLL -then - SOLVERFLAGS="$SOLVERFLAGS -DMARC_DLL" -fi - -LINK_OPT= -DEBUG_OPT= -C_DEBUG_OPT= - -#Uncomment following line to build Marc in debuggable mode -MARCDEBUG= -#MARCDEBUG="ON" - -if test "$MARCDEBUG" = "ON" -then - LINK_OPT="-debug -traceback" - DEBUG_OPT="-debug -traceback" - C_DEBUG_OPT="-debug -traceback" -fi - - -MARCCHECK= -#MARCCHECK="ON" -if test "$MARCCHECK" = "ON" -then - DEBUG_OPT="$DEBUG_OPT -fpe0 -fp-stack-check -check all -ftrapuv " - C_DEBUG_OPT="$C_DEBUG_OPT -fp-stack-check -check-uninit -Wformat -ftrapuv " -fi - -MARCCODECOV= -#MARCCODECOV="ON" - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - I8FFLAGS= - I8DEFINES= - I8CDEFINES= - I8CASIDEFS= -else - I8FFLAGS="-i8" - I8DEFINES="-DI64" - I8CDEFINES="-U_DOUBLE -D_SINGLE" - I8CASIDEFS="-DCASI_64BIT_INT=1" -fi - - -CDEFINES= -FDEFINES= - -if test "$_OEM_NASTRAN" -ne 0 -then - CDEFINES="$CDEFINES -D_OEM_NASTRAN" - FDEFINES="$FDEFINES -D_OEM_NASTRAN" -fi - -FDEFINES="$FDEFINES -D_IMPLICITNONE" - -if test "$_OEM_NASTRAN" -eq 0 -then - FDEFINES="$FDEFINES -DOPENMP -DMKL" -fi - -# -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" -CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" - -CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource $METIS" -if test "$_OEM_NASTRAN" -ne 0 -then - CINCL="$CINCL -I../../include" -fi - -CC="icc -c -O1 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -CCLOW="icc -c -O0 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -CCHIGH="icc -c -O3 $I8DEFINES -DLinux -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - -if test "$MARCDEBUG" = "ON" -then - CC="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - CCLOW="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " - CCHIGH="icc -c -DLinux $I8DEFINES -DLINUX -DLinux_intel $CDEFINES $CINCL $SOLVERFLAGS " -fi - -LOAD_CC="icc -O1 -DLinux -DLINUX -DLinux_intel" -CCT="$CC" -CCTLOW="$CCLOW" -CCTHIGH="$CCHIGH" - -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" - -#PROFILE="-Mprof=func" -#PROFILE="-Mprof=lines" -#PROFILE="-Mprof=func,mpi" -PROFILE= -if test "$MARCCODECOV" = "ON" -then -PROFILE="-prof-gen=srcpos" -fi - -FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" -FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" - -if test "$MARCDEBUG" = "ON" -then - FORTLOW="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTRAN="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTHIGH="$FCOMP -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" - FORTNA="$FCOMP -c -assume byterecl -safe_cray_ptr -save -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" -fi - -FORTLOWT="$FORTLOW" -FORTRANT="$FORTRAN" -FORTHIGHT="$FORTHIGH" - -FORTRANMNF="$FCOMP -c $FDEFINES " -CCMNF="icc -c -O1 -DLinux -DLINUX -DLinux_intel -Dport2egcs -I$MARC_SOURCE/marctoadams/mnf/include -D_LARGEFILE64_SOURCE" - -FORTRANMUMPS="$FCOMP -fpp -c -assume byterecl -safe_cray_ptr $PROFILE -save -zero -mp1 -WB -fno-alias -O1 -fp-model precise $FDEFINES -D_IMPLICITNONE $I8FFLAGS $I8DEFINES $DDM -I$MARC_SOURCE/mumpssolver/include -Dintel_ -DALLOW_NON_INIT -Dmetis -nofor_main" -CCMUMPS="icc -c -DAdd_ -Dmetis -I$MARC_SOURCE/mumpssolver/include" - - -BCSCC="icc -c -O3 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_csrc $CDEFINES $CINCL" -NVCC="nvcc -c -O3 -arch sm_20 -DLOWERCASE_ -I${MARC_SOURCE}/${BCS_DIR}/bcslib_cuda/include -I${MARC_CUDA}/include -I$MARC_SOURCE/mdsrc $I8DEFINES -Xcompiler -fvisibility=hidden -Xcompiler -fPIC $I8DEFINES " -NVCCLIB="ar rvl" -NVCCLD=icc -BCSFORTLOW="$FORTLOW -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTRAN="$FORTRAN -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORTHIGH="$FORTHIGH -I${MARC_SOURCE}/${BCS_DIR}/common" -BCSFORT90HIGH="$BCSFORTHIGH" -if test "$MARCDEBUG" = "ON" -then - BCSFORTRAN=$BCSFORTLOW - BCSFORTHIGH=$BCSFORTLOW - BCSFORT90HIGH=$BCSFORTLOW -fi - -if test $MPITYPE != none -then - if test $MPITYPE = hpmpi - then - LOAD="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin/$FCOMPMPI ${LOADOPTIONS} -L$MPI_ROOT/lib/$ARCHITECTURE $PROFILE $LINK_OPT -o " - fi -# Uncomment the following lines to turn on the tracer and commnet out the next 5 lines -# if test $MPITYPE = intelmpi -# then -# INCLUDEMPI="-I$MPI_ROOT/include64 -I$VT_ROOT/include" -# LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $INCLUDEMPI -g -t=log $LINK_OPT -o " -# fi - if test $MPITYPE = intelmpi - then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - fi -else - LOAD="$FCOMP $LINK_OPT -o " - LOADT="$FCOMP $LINK_OPT -o " -fi - -if test "$MARC_DLL" = MARC_DLL -then - FORTLOW="$FORTLOW -fpp -fPIC" - FORTRAN="$FORTRAN -fpp -fPIC" - FORTHIGH="$FORTHIGH -fpp -fPIC" - FORTRANMNF="$FORTRANMNF -fpp -fPIC" - CC="$CC -fPIC" - CCMNF="$CCMNF -fPIC" - CC_CASI="$CC_CASI -fPIC" - CCLOW_CASI="$CCLOW_CASI -fPIC" - CCHIGH_CASI="$CCHIGH_CASI -fPIC" - LINK_EXE_MARC="-L$MARC_LIB -lmarc -L$MARC_LIB_SHARED -lguide -lpthread" - LINK_MARC_DLL="-shared -fPIC" - LOAD_DLL=$LOAD - LOADT_DLL=$LOADT - EXT_DLL="so" -fi - - -XLIBS="-L/usr/X11/lib -lX11 " - -# -# define archive and ranlib syntax -# - -ARC="ar rvl" -ARD="ar dvl" -ARX="ar xl" -RAN="" - -# -# choose which libraries you want to use ( e.g. blas ) -# - -if test "$VKISOLVER" = VKI -then - VKISOLVERLIBS="$MARC_LIB/vkisolver.a" -else - VKISOLVERLIBS= -fi - -if test "$CASISOLVER" = CASI -then - CASISOLVERLIBS="$MARC_LIB/casilib.a" -else - CASISOLVERLIBS= -fi - -MF2SOLVERLIBS= -if test "$MF2SOLVER" = MF2PARALLEL -then - MF2SOLVERLIBS="$MARC_LIB/mf2parallel/libseq.a \ - $MARC_LIB/mf2parallel/libsym.a \ - $MARC_LIB/mf2parallel/libmet.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libmf2.a \ - $MARC_LIB/mf2parallel/libgauss.a \ - $MARC_LIB/mf2parallel/libnum.a \ - $MARC_LIB/mf2parallel/libutl.a \ - $MARC_LIB/mf2parallel/libr8.a \ - $MARC_LIB/mf2parallel/libz.a " -fi - -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - -if test "$MUMPSSOLVER" = MUMPS -then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - if test $MPITYPE = none - then - MUMPSSOLVERLIBS2= - echo hello > /dev/null - fi - if test $MPITYPE = intelmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a" - fi - fi - if test $MPITYPE = hpmpi - then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a" - else - MUMPSSOLVERLIBS2="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a" - fi - fi -else - MUMPSSOLVERLIBS= - MUMPSSOLVERLIBS2= -fi - -if test "$BCSGPUSOLVER" = BCSGPU -then - BCSSOLVERLIBS="${MARC_LIB}/bcsgpulib.a " - MARCCUDALIBS1="-L${MARC_LIB}/cuda_dummy -lmarccuda " - MARCCUDALIBS2="-L${MARC_LIB}/cuda -lmarccuda " - MARCCUDALIBS=$MARCCUDALIBS1 - CUDALIBS="-L$MARC_CUDA/lib64 -lcudart -lcublas -L/usr/lib64 -lcuda " -else - BCSSOLVERLIBS="${MARC_LIB}/bcslib.a " -fi - -if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB=$MARC_MKL/libmkl_intel_lp64.a -else - MKLLIB=$MARC_MKL/libmkl_intel_ilp64.a -fi - -SECLIBS="-L$MARC_LIB -llapi" - -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MUMPSSOLVERLIBS2} ${MF2SOLVERLIBS} \ - -Wl,--start-group $MKLLIB $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group \ - $MARC_MKL/libguide.a \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " -SOLVERLIBS_DLL=${SOLVERLIBS} - -MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" -MRCLIBSPAR="$MARC_LIB/clib.a" -STUBS="$MARC_LIB/stubs.a " -MNFLIBS="$MARC_LIB/libmnf.a" -MDUSER="$MARC_LIB/md_user.a" - - -OPENMP="-openmp" - -SYSLIBS=" $OPENMP -lpthread " - -# Uncomment the following lines to turn on the trace and comment out the next 4 lines -# if test $MPITYPE = intelmpi -# then -# SYSLIBS="-L${VT_ROOT}/lib -lVT -ldwarf -lelf -lm -lpthread \ -# -L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt" -# fi -if test $MPITYPE = intelmpi -then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -lpthread" -fi - -SYSLIBSPAR=" " - -MARC_DLL_CODES="runmarc.f" - - -BLAS_SRC="dzero.f icopy.f izero.f" -if test "$_OEM_NASTRAN" -ne 0 -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - BLAS_SRC="$BLAS_SRC dsctr.f zsctr.f dzasum.f daxpyi.f zaxpyi.f dgthr.f zgthr.f" - else - BLAS_SRC="ALL" - fi -fi - -LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ - omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ - elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ - cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" -if test "$MARC_INTEGER_SIZE" = "i8" ; then - LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" -fi -LOW_OPT_CODES_CASI="" - -HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ - dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " - - -HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" - -MAXNUM=1000000 diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask b/installation/mods_MarcMentat/2013/Marc_tools/run_damask deleted file mode 100644 index 485b77525..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRAN $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRAN $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2013/Marc_tools/run_damask_h deleted file mode 100644 index dec30e5e0..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_h +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_h $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGH $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGH $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2013/Marc_tools/run_damask_hmp deleted file mode 100644 index c59e40760..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_hmp +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_hmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTHIGHMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTHIGHMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2013/Marc_tools/run_damask_l deleted file mode 100644 index dec0c9c22..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_l +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_l $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOW $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOW $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2013/Marc_tools/run_damask_lmp deleted file mode 100644 index 05938be60..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_lmp +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_lmp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTLOWMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTLOWMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2013/Marc_tools/run_damask_mp deleted file mode 100644 index 7481797e4..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_damask_mp +++ /dev/null @@ -1,3849 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i4 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -# Change_me -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersnoext= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - - user=$value - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then -export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - if test ! -f $user - then - error="$error -user subroutine file $user not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $user -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=$value - - - - - - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - usernoext=$user - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .F` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .for` - usernoext=`dirname $usernoext`/`$BASENAME $usernoext .f90` - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# -# add DAMASK options for linking - DAMASK="" - - if test "$user" - then - program=$usernoext.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$usernoext.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$usernoext.o - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_damask_mp $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user on host `hostname`" - fi - userobj=$usernoext.o - if test $MACHINENAME = "CRAY" - then - $DFORTRANMP $user || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $DFORTRANMP $user -o $userobj || \ - { - echo "$0: compile failed for $user" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $DAMASK \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null -/bin/rm $DIRJOB/*.mod 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=$usernoext - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Marc_tools/run_marc.original b/installation/mods_MarcMentat/2013/Marc_tools/run_marc.original deleted file mode 100644 index 3185b3573..000000000 --- a/installation/mods_MarcMentat/2013/Marc_tools/run_marc.original +++ /dev/null @@ -1,3890 +0,0 @@ -#!/bin/ksh -############################################################################## -# # -# run_marc - run a marc job # -# ------------------------- # -# # -# usage: run_marc -j jid { options } # -# # -# where standard options are: required: defaults: # -# -------------------------- # -# # -# -j* jid job id number. ** YES ** . # -# -pr* prog program name. . marc # -# -v* y|n do or do not verify inputs. . yes # -# -q* s|l|v|b|f batch queue name or background, . short # -# foreground. # -# -b* as alternative to option -q* # -# # -# ( batch queues only : # -# -pq* intra queue priority. . . # -# -at DATE/TIME delay start of job. . . # -# format : January,1,1990,12:31 # -# or : today,5pm # -# -cpu* secs job CPU limit . . ) # -# # -# -r* rid restart file job id. . . # -# -si* sid substructure file id. . . # -# -pi* post post file job id. . . # -# -de* did defaults file . no # -# -vf vid viewfactor . no # -# # -# -u* user user subroutine. . . # -# -obj obj user objects or libraries. . . # -# -sa* y|n do or do not save load module. . no # -# -autorst auto restart flag for auto forge . no # -# -me manual remeshing control . no # -# -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # -# -mpi selects MPI version # -# each platform has a default MPI version and some # -# have an alternative version. see the include file # -# for the respective platform # -# MPI_DEFAULT defines the default MPI version # -# MPI_OTHER defines versions one can switch to # -# -dcoup for contact decoupling # -# currently not supported # -# -dir directory where the job i/o should take place. # -# defaults to current directory. # -# -sdir directory where scratch files are created # -# defaults to current directory. # -# # -# -alloc only perform memory allocation test, no analysis # -# -list y only list options in the input file, no analysis # -# -fe num set feature number "num" for the run. only one allowed # -# -dytran flag to switch from Dytran to Marc # -# dytran = 0, program will run w/o Marc-Dytran Switch # -# = 1, program will restart Marc after Dytran run # -# >= 2, Not supported yet. # -# currently not supported # -# -ou force analysis to use out-of-core control # -# =0, not used # -# =1, element storage out-of-core # -# -dll run marc using shared library libmarc.so and exe_marc # -# =1, used # -# =2, do not free streaming input memory # -# =3, run with marc input deck # -# -trk run marc for post-tracking # -# -gpuid run marc using GPGPU capability # -# specify gpuid on to be used in the analysis. Multiple # -# IDs may be assigned for DDM runs. # -# Separate a list of IDs with a colon. Each DMP # -# process will be assigned a GPU ID in round robin fastion# -# = 0 # -# = 0:1 etc... # -# # -# where parallel options are: # -# -------------------------- # -# # -# itree, host, and comp options are available for the domain # -# decomposition only. # -# MARC_NUMBER_OF_THREADS, nthread, and dir options always available. # -# # -# # -# -nprocd number of domains. # -# defaults to single domain solution. # -# -nprocds number of domains if single input file. # -# defaults to single domain solution. # -# -nps same as -nprocds. # -# -nsolver number of solver tasks for solver types 12 and 13 # -# these are distributed tasks operating via MPI # -# -nthread number of solver threads for solver types 6, 8, and 11 # -# also can be set through MARC_NUMBER_OF_THREADS # -# environment variable. if both specified, nthread option# -# will be used. # -# = 0: use defaults. # -# defaults to 1 for single domain solution. # -# defaults to number of domains for multi-domain # -# solution. # -# > 1: number of threads to be used by 6, 8, and 11 # -# defaults if neither MARC_NUMBER_OF_THREADS environment # -# variable set nor nthread specified. # -# -itree message passing tree type for domain decomposition. # -# for debugging purposes; should not normally be used. # -# -host hostfile name for distributed execution on network. # -# defaults to no hostfile, unless jobid.defhost exists. # -# if jobid.defhost exists, only -np(s) necessary # -# -comp* y|n to be used with user routines on a network of # -# incompatible machines. # -# if set to no, a separate executable will be created # -# for each machine on the network. # -# if set to yes, the executable located on the machine # -# from which marc is started will be used on all machines.# -# defaults to no if O/S versions different on machines. # -# # -# -ci y|n copy input files to remote hosts (default: yes) # -# if "yes", input files are automatically copied to # -# remote hosts for a network run if necessary. # -# -cr y|n copy post files from remote hosts (default: yes) # -# if "yes", post files are automatically copied back from # -# remote hosts for a network run if necessary. # -############################################################################## -# set DIR to the directory in which this script is -REALCOM="`/bin/ls -l $0 |awk '{ print $NF; }'`" -DIR=`dirname $REALCOM` -# make sure DIR has an absolute path -case $DIR in - \/*) - ;; - *) - DIR=`pwd`/$DIR - ;; -esac -DIRSCRIPT=$DIR -AWK=awk -ARCH=`uname -a | cut -f 1 -d " "` -# Sun has a bad awk, use nawk instead -if test $ARCH = "SunOS" -then - AWK=nawk -fi -BASENAME=basename -# Sun has an incorrect /bin/basename, check if /usr/ucb/basename exists -if test $ARCH = "SunOS" -then - if test -x /usr/ucb/basename - then - BASENAME=/usr/ucb/basename - fi -fi - -# echo command line in the case of ECHO_COMMAND is true -if test "$ECHO_COMMAND" = true ; then - echo command "$0" "$@" -fi - -# -# "mode" selects version, i4 or i8 -# default is i4 -# this can be changed by a file run_marc_defaults -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MODE i8 -# it can also be set by the environmental variable MARC_INTEGER_SIZE -# and by the command line option "-mo" -# -mode= -if test -f $DIRSCRIPT/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -f $HOME/run_marc_defaults; then - line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` - line=`echo $line | $AWK '{print $NF}'` - if test "$line" = "i4"; then - mode=i4 - fi - if test "$line" = "i8"; then - mode=i8 - fi -fi -if test -n "$MARC_INTEGER_SIZE" ; then - mode=$MARC_INTEGER_SIZE -fi -if test -z "$mode" ; then - mode=i8 -fi -case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo "error, version mode must be i4 or i8" - exit - ;; -esac - -setmode=false -for arg in $* ; do - if $setmode ; then - mode=$arg - case $mode in - i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - ;; - i8) - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - ;; - *) - echo " " - echo "error, version mode must be i4 or i8" - echo " " - echo " use -mo i4 or -mo i8 " - echo " " - exit - ;; - esac - setmode=false - fi - if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then - setmode=true - fi - if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - MARC_INTEGER_SIZE=i8 - export MARC_INTEGER_SIZE - fi - if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -done - -# set to i4 version for 32 bit Linux -if test "`uname -s`" = "Linux"; then - if test "`uname -m`" = "i686"; then - mode=i4 - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE - fi -fi - - -. "$DIR/getarch" - -. $MARC_INCLUDE -# - -# -# Dynamically determine the echo syntax -# - -case "`echo '\c'`" in - '\c') - ECHO='echo -n' - ECHOTXT=' ' - ;; - *) - ECHO='echo' - ECHOTXT=' \c' - ;; -esac - -# -# Variables for the MARC environment -# - -PRODUCT="Marc" -EXITMSG=$MARC_TOOLS/MESSAGES -export EXITMSG -FLEXDIR=$DIR/../flexlm/licenses -export FLEXDIR -TIMCHK=3600 -export TIMCHK -BINDIR=$MARC_BIN -export BINDIR -AFMATDAT=$MARC_RUNTIME/AF_flowmat/ -export AFMATDAT -# -# define directory path to global unified material database -# -MATFILE= -export MATFILE - -# -# define memory limit -# first set to MEMLIMIT from include -# -ml option overrules if specified -memlimit=$MEMLIMIT -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -# -if test $MACHINENAME = "HP" -then - SHLIB_PATH=$MARC_LIB:$MARC_LIB_SHARED:$SHLIB_PATH - export SHLIB_PATH -fi -# the one for IBM is defined futher down - -LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH -LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH -LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH -LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH -export LD_LIBRARY_PATH -export LD_LIBRARY64_PATH -export LD_LIBRARYN32_PATH - -atexit() { -kill -15 $$ -# -if test $MPITYPE = "myrinet" -then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi -fi -} - -trap "atexit" 2 - -# -# defaults -# - -prog=marc -exefile=marc -jid= -rid= -pid= -sid= -did= -vid= -user= -usersubname= -objs= -qid=background -cpu= -priority= -att= -trk= -verify=yes -prgsav=no -rmdll=no -cpdll=no -progdll= -pathdll= -error= -nprocd=0 -nprocdddm=1 -nprocdddmprint= -icreated=0 -nprocdarg= -nsolver=0 -nsolverarg=-ns -if test $nprocds -then - if test $nprocds -gt 1 - then - nprocdddm=$nprocds - nprocdddmprint=$nprocds - icreated=1 - nprocdarg=-nprocds - fi -fi -nthread=-1 -gpuids= -nauto=0 -ndcoup=0 -ndytran=0 -noutcore=0 -dllrun=0 -mesh=0 -nthreadprint=0 -itree=0 -iam= -link= -trkrun=0 -DIRJOB=`pwd` -DIRSCR=$DIRJOB -DIRSCRSET= -autoforge=0 -dotdat=.dat -dotdefhost=.defhost -host= -numhost= -mfile= -userhost= -makebdf= -cpinput=yes -cpresults=yes -marcdll=libmarc.$EXT_DLL -# define hostname and strip off extensions (alpha.aaa.com) -thishost=`hostname` -thishost=${thishost%%.*} -compatible=unknown -numfield=1 -justlist= -feature= -mpioption=false -MDSRCLIB=$MARC_LIB/mdsrc.a -# -# check run_marc_defaults file for default MPI setting -# located in the tools directory of the Marc installation -# or in the user's home directory -# format: -# MARC_MPI -# -value= -file= -if test -f $DIRSCRIPT/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $DIRSCRIPT/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$DIRSCRIPT/run_marc_defaults - fi -fi -if test -f $HOME/run_marc_defaults; then - value=`$AWK '{if ($1 == "MARC_MPI") {print $2}}' $HOME/run_marc_defaults` - value=`echo $value | $AWK '{print $NF}'` - if test -n "$value"; then - file=$HOME/run_marc_defaults - fi -fi -if test -n "$value"; then - MARC_MPITYPE=$value - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - echo " " - echo " error, incorrect option for MARC_MPI" - echo " defined in $file: $MARC_MPITYPE" - echo " valid options: $MPI_DEFAULT $MPI_OTHER" - echo " " - exit - fi - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - fi -fi -# -# -# allow scratch directory to be specified with environmental variable -# MARCSCRATCH -if test $MARCSCRATCH -then - if test -d $MARCSCRATCH - then - DIRSCR=$MARCSCRATCH - else - echo "error, scratch directory '$MARCSCRATCH'" - echo " specified via environmental variable MARCSCRATCH does not exist" - exit - fi -fi -# -############################################################################## -# parse input - arguments always come in pairs # -############################################################################## - -arg=$1 -if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then - shift - arg=$1 -fi -while [ -n "$arg" ] -do - shift - value=$1 - case $arg in - -al* | -AL*) - LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - export LD_LIBRARY_PATH - $MARC_BIN/marc -alloc 1 - exit - ;; - -li* | -LI*) - justlist=yes - ;; - -fe* | -FE*) - feature=$value - ;; - -pr* | -PR*) - if test `dirname $value` = '.' - then - prog=`$BASENAME $value .marc` - progdll=`$BASENAME $value` - else - prog=`dirname $value`/`$BASENAME $value .marc` - progdll=`dirname $value`/`$BASENAME $value` - fi - prdir=`dirname $value` - case $prdir in - \/*) - ;; - *) - prog=`pwd`/$prdir/$prog - ;; - esac - ;; - -j* | -J*) - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - ;; - -r* | -R*) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - -si* | -SI*) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - -pi* | -PI*) - if test -f $value.t19 - then - pid=`$BASENAME $value .t19` - else - pid=`$BASENAME $value .t16` - fi - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - -bdf | -BDF) - makebdf=1 - ;; - -de* | -DE*) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - -vf | -VF) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - -u* | -U*) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - -obj | -OBJ) - objs="$value" - ;; - -q* | -Q*) - qid=$value - ;; - -b* | -B*) - case $value in - y* | Y*) - qid=background - ;; - n* | N*) - qid=foreground - ;; - *) - ;; - esac - ;; - -at | -AT) - att=$value - ;; - -cpu* | -CPU*) - cpu=$value - ;; - -pq | -PQ*) - priority=$value - ;; - -v* | -V*) - verify=$value - ;; - -sa* | -SA*) - prgsav=$value - ;; - -np* | -NP*) - nprocdddm=$value - nprocdddmprint=$value - case $arg in - -nps* | -NPS* | -nprocds* | -NPROCDS*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - case $arg in - -np | -NP | -nprocd | -NPROCD) - icreated=0 - nprocdarg=-nprocd - ;; - esac - ;; - -ns* | -NS*) - nsolver=$value - ;; - -nt* | -NT*) - nthread=$value - ;; - -gp* | -GP*) - gpuids=$value - ;; - -it* | -IT*) - itree=$value - ;; - -iam | -IAM) - iam=$value - ;; - -au* | -AU*) - nauto=$value - ;; - -dc* | -DC*) - ndcoup=$value - ;; - -dy* | -DY*) - ndytran=$value - ;; - -ou* | -OU*) - noutcore=$value - ;; - -dll | -DLL) - dllrun=$value - ;; - -trk | -TRK) - trkrun=$value - ;; - -me | -ME ) - mesh=$value - ;; - -ml | -ML ) - memlimit=$value - ;; - -mo | -MO ) - ;; - -mpi | -MPI ) - mpioption=true - MARC_MPITYPE=$value - if test "$value" != "$MPI_DEFAULT"; then - exefile=marc_$value - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a_$value - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a_$value" - fi - else - exefile=marc - . $MARC_INCLUDE - MDSRCLIB=$MARC_LIB/mdsrc.a - if test "$MUMPSSOLVER" = MUMPS; then - MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" - fi - fi - ;; - -dir* | -DIR*) - DIRJOB=$value - case $DIRJOB in - \/*) - ;; - *) - DIRJOB=`pwd`/$DIRJOB - ;; - esac - if test -z "$DIRSCRSET" - then - DIRSCR=$DIRJOB - fi - ;; - -sd* | -SD*) - DIRSCR=$value - DIRSCRSET=yes - case $DIRSCR in - \/*) - ;; - *) - DIRSCR=`pwd`/$DIRSCR - ;; - esac - ;; - -ho* | -HO*) - host=$value - ;; - -co* | -CO*) - compatible=$value - ;; - -ci* | -CI*) - cpinput=$value - ;; - -cr* | -CR*) - cpresults=$value - ;; - *) - error="$error -$arg: invalid option" - break - ;; - esac - case $value in - -*) - error="$error -$arg: invalid name $value" - break - ;; - esac - shift - arg=$1 - if [ ${arg}X = -i8X -o ${arg}X = -I8X -o ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - shift - arg=$1 - fi -done -argc=`expr $# % 2` -if test $argc -eq 1 -then -# -# odd number of arguments -# - error="$error -argument list incomplete" -fi - -if test $nprocdddm -gt 0 -then -nprocd=$nprocdddm -fi - -if test $nsolver -gt 0 -then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi -fi - -if test $nthread -eq -1 -then -nthread=${MARC_NUMBER_OF_THREADS:-0} -fi -if test $nthread -lt 0 -then -nthread=0 -fi - -nthreadprint=$nthread -if test $nthreadprint -eq 0 -then -nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi -fi - -nthread=$nthreadprint - -gpuoption= -if test "$gpuids" = "" ; then - gpuoption= -else - gpuoption="-gp $gpuids" -fi - -if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH -else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH -fi -# Linux 64 + HPMPI, Below code is taken from include_linux64 -if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" -then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" -fi - -if test $nprocd -gt 1; then - if test -f $jid$dotdefhost; then - if test "$host" = ""; then - host=$jid$dotdefhost - fi - fi - if test -f hostfile_qa_$nprocd; then - if test "$host" = ""; then - host=hostfile_qa_$nprocd - fi - fi -fi - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$dllrun" -eq 1 || test "$dllrun" -eq 2; then - dotdat=.inp - fi - - if test "$progdll"; then - /bin/cp ${progdll}_$marcdll $DIRJOB/$marcdll - rmdll=yes - pathdll=yes - progdll=${progdll}_$marcdll - else - progdll=$marcdll - fi - - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - pathdll=yes - fi -fi - -############################################################################## -# check parameter validity # -############################################################################## - -while test forever; do - -# -# check for input file existence -# -if test $nprocdddm -gt 1 -a $icreated -eq 0; then - if test ! -f $DIRJID/1$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/1$jid$dotdat not accessible" - fi - fi -else - if test ! -f $DIRJID/$jid$dotdat; then - if test "$jid" != "" ; then - error="$error -input file $DIRJID/$jid$dotdat not accessible" - fi - fi -fi - if test $nprocd -gt 1; then - if test "$host" ; then - if test ! -f $host; then - error="$error -host name file $host not accessible" - fi - fi - fi - -# -# check if the job is already running in the background -# -if test -f $DIRJOB/$jid.pid; then - error="$error -job is already running (the file $jid.pid exists)" -fi - -# -# if the program name is other than marc, then -# assume that this is a program in the users local directory -# - -bd=$MARC_BIN/ - -case $prog in - marc | MARC | $exefile) - program=$exefile - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 or $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$usersubname" - then - if test ! -f $usersubname - then - error="$error -user subroutine file $usersubname not accessible" - fi - fi - if test "$objs" - then - missingobjs= - for o in $objs - do - if test ! -f "$o" - then - if test -z "$missingobjs" - then - missingobjs="$o" - else - missingobjs="$missingobjs $o" - fi - fi - done - if test -n "$missingobjs" - then - error="$error -user object/library file(s) $missingobjs not accessible" - fi - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$vid" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRVID/1$vid.vfs - then - error="$error -view factor file $DIRVID/1$vid.vfs not accessible" - fi - else - if test ! -f $DIRVID/$vid.vfs - then - error="$error -view factor file $DIRVID/$vid.vfs not accessible" - fi - fi - fi - if $mpioption - then - notok=true - for i in "$MPI_OTHER"; do - if test "$MARC_MPITYPE" = "$i"; then - notok=false - fi - done - if test "$MARC_MPITYPE" = "$MPI_DEFAULT"; then - notok=false - fi - if $notok; then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE (valid: $MPI_OTHER)" - fi - fi - ;; - *) - program=$prog.marc - case $prog in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - if test "$rid" - then - if test ! -f $DIRRID/$rid.t08 - then - error="$error -restart file $DIRRID/$rid.t08 not accessible" - fi - fi - if test "$pid" - then - if test ! -f $DIRPID/$pid.t16 - then - if test ! -f $DIRPID/$pid.t19 - then - error="$error -post file $DIRPID/$pid.t16 and $DIRPID/$pid.t19 not accessible" - fi - fi - fi - if test "$user" - then - error="$error -program option may not be used with user subroutine" - fi - if test "$objs" - then - error="$error -program option may not be used with user objects or libraries" - fi - if test "$did" - then - if test $nprocdddm -gt 1 -a $icreated -eq 0 - then - if test ! -f $DIRDID/1$did$dotdat - then - error="$error -defaults file $DIRDID/1$did$dotdat not accessible" - fi - else - if test ! -f $DIRDID/$did$dotdat - then - error="$error -defaults file $DIRDID/$did$dotdat not accessible" - fi - fi - fi - if test "$nauto" - then - if test $nauto -gt 2 - then - error="$error -incorrect option for auto restart " - fi - fi - if test "$ndcoup" - then - if test $ndcoup -gt 3 - then - error="$error -incorrect option for contact decoupling " - fi - fi - if test "$ndytran" - then - if test $ndytran -gt 1 - then - error="$error -incorrect option for Marc-Dytran Switch " - fi - fi - if $mpioption - then - if test ! -x $MARC_BIN/$exefile - then - error="$error -incorrect option for -mpi option: $MARC_MPITYPE " - fi - fi - ;; -esac - -############################################################################## -# check argument integrity # -############################################################################## - -if test "$jid" -then - : -else - error="$error -job id required" -fi - -if test $nprocd -gt 1 -then - if test $nauto -gt 0 - then - error="$error -cannot run DDM job with auto restart (-au) option " - fi -fi -case $qid in - S* | s*) - qid=short - ;; - L* | l*) - qid=long - ;; - V* | v*) - qid=verylong - ;; - B* | b*) - qid=background - ;; - F* | f*) - qid=foreground - ;; - A* | a*) - qid=at - ;; - *) - error="$error -bad value for queue_id option" - ;; -esac - -case $prgsav in - N* | n*) - prgsav=no - ;; - Y* | y*) - prgsav=yes - ;; - *) - error="$error -bad value for save option" - ;; -esac - -case $verify in - N* | n*) - verify=no - ;; - Y* | y*) - verify=yes - ;; - *) - error="$error -bad value for verify option" - ;; -esac - -case $nprocdddm in - -* ) - error="$error -bad value for nprocd option" - ;; -esac - -case $nthread in - -* ) - error="$error -bad value for nthread option" - ;; -esac - -case $itree in - -* ) - error="$error -bad value for itree option" - ;; -esac -case $iam in - -* ) - error="$error -bad value for iam option" - ;; -esac -case $compatible in - N* | n*) - compatible=no - ;; - Y* | y*) - compatible=yes - ;; - unknown) - ;; - *) - error="$error -bad value for comp option" - ;; -esac -case $cpinput in - N* | n*) - cpinput=no - ;; - Y* | y*) - cpinput=yes - ;; - *) - error="$error -bad value for copy input option" - ;; -esac -case $cpresults in - N* | n*) - cpresults=no - ;; - Y* | y*) - cpresults=yes - ;; - *) - error="$error -bad value for copy results option" - ;; -esac - -# -# check for external file to run -# -if test -f $MARC_TOOLS/run_marc_check -then - . $MARC_TOOLS/run_marc_check -fi - -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi -############################################################################## -# interact with the user to get the required information to run marc or # -# other marc system program # -############################################################################## - -deletelog=yes -if test $qid = background -a $verify = no -then -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log -deletelog=no -fi -echo \ -" -$PRODUCT $REVISION $MACHINE version ------------------------------ -Program name : $prog -Marc shared lib : $progdll -Version type : $mode -Job ID : $DIRJID/$jid -User subroutine name : $usersubname -User objects/libs : $objs -Restart file job ID : $rid -Substructure file ID : $sid -Post file job ID : $pid -Defaults file ID : $did -View Factor file ID : $vid -Save generated module: $prgsav -MPI library : $MPITYPE -DDM processes : $nprocdddmprint -Solver processes : $nthreadprint -GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree -Run job in queue : $qid -Run directory : $DIRJOB -Scratch directory : $DIRSCR -Memory limit in Mbyte: $memlimit -Auto Restart : $nauto" - - -case $qid in - s* | S* | l* | L* | v* | V* ) - echo \ -"Queue priority : $priority -Queue CPU limit : $cpu -Queue start time : $att" - ;; -# * ) -# echo \ -#" " -# ;; -esac - -if test "$error" -then - if test $verify = yes - then - $ECHO "$error - -Please correct or quit(correct,quit,): $ECHOTXT" - error= - read answer - case $answer in - q* | Q*) - answer=quit - ;; - *) - answer=correct - ;; - esac - else - $ECHO "$error - $ECHOTXT" - echo " " - if test "$deletelog" = no - then - $ECHO "$error - $ECHOTXT" >> $jid.log - echo " " >> $jid.log - fi - answer=quit - fi -else - if test $verify = yes - then - $ECHO " -Are these parameters correct (yes,no,quit,)? $ECHOTXT" - read answer - case $answer in - q* | Q*) - answer=quit - ;; - y* | Y*) - answer=yes - ;; - *) - answer=no - ;; - esac - else - answer=yes - fi -fi - -case $answer in - no | correct) - -############################################################################## -# prompt for each value # -############################################################################## - - $ECHO " -Program name ($prog)? $ECHOTXT" - read value - if test "$value" - then - prog=$value - fi - $ECHO "Job ID ($jid)? $ECHOTXT" - read value - if test "$value" - then - jid=`$BASENAME $value $dotdat` - DIRJID=`dirname $value` - case $DIRJID in - \/*) - ;; - *) - DIRJID=`pwd`/$DIRJID - ;; - esac - fi - $ECHO "User subroutine name ($user)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - user= - ;; - *) - user=`dirname $value`/`$BASENAME $value .f` - basefile=`$BASENAME $value` - if test ${basefile##*.} = F - then - user=`dirname $value`/`$BASENAME $value .F` - fi - case $user in - \/*) - ;; - *) - user=`pwd`/$user - ;; - esac - if test -f $user.f - then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user - fi - ;; - esac - fi - $ECHO "User objects or libraries ($objs)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - objs= - ;; - *) - objs="$value" - ;; - esac - fi - $ECHO "Restart File Job ID ($rid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - rid= - ;; - *) - rid=`$BASENAME $value .t08` - DIRRID=`dirname $value` - case $DIRRID in - \/*) - ;; - *) - DIRRID=`pwd`/$DIRRID - ;; - esac - ;; - esac - fi - $ECHO "Substructure File ID ($sid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - sid= - ;; - *) - sid=$value - DIRSID=`dirname $value` - case $DIRSID in - \/*) - ;; - *) - DIRSID=`pwd`/$DIRSID - ;; - esac - ;; - esac - fi - $ECHO "Post File Job ID ($pid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - pid= - ;; - *) - pid=$value - DIRPID=`dirname $value` - case $DIRPID in - \/*) - ;; - *) - DIRPID=`pwd`/$DIRPID - ;; - esac - ;; - esac - fi - $ECHO "Defaults File ID ($did)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - did= - ;; - *) - did=`$BASENAME $value $dotdat` - DIRDID=`dirname $value` - case $DIRDID in - \/*) - ;; - *) - DIRDID=`pwd`/$DIRDID - ;; - esac - ;; - esac - fi - $ECHO "View Factor File ID ($vid)? $ECHOTXT" - read value - if test "$value" - then - case $value in - -*) - vid= - ;; - *) - vid=`$BASENAME $value .vfs` - DIRVID=`dirname $value` - case $DIRVID in - \/*) - ;; - *) - DIRVID=`pwd`/$DIRVID - ;; - esac - ;; - esac - fi - $ECHO "Save generated module ($prgsav)? $ECHOTXT" - read value - if test "$value" - then - prgsav=$value - fi - $ECHO "Run on tasks ($nprocdddm) tasks? $ECHOTXT" - read value - if test "$value" - then - nprocdddm=$value - nprocdddmprint=$value - fi - $ECHO "Run on ($nthread) threads ? $ECHOTXT" - read value - if test "$value" - then - nthread=$value - fi - $ECHO "Run on ($nsolver) solvers ? $ECHOTXT" - read value - if test "$value" - then - nsolver=$value - fi -# - if test $nprocdddm -gt 0 - then - nprocd=$nprocdddm - fi - if test $nsolver -gt 0 - then - if test $nsolver -gt $nprocd - then - nprocd=$nsolver - fi - fi - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - nthreadprint=$nthread - if test $nthreadprint -eq 0 - then - nthreadprint=1 - if test $nprocd -gt 1 - then - nthreadprint=$nprocd - fi - if test $nsolver -gt 1 - then - nthreadprint=$nsolver - fi - fi -# - $ECHO "GPGPU id option ($gpuids)? $ECHOTXT" - read value - if test "$value" - then - gpuids=$value - fi - if test "$gpuids" = "" ; then - gpuoption= - else - gpuoption="-gp $gpuids" - fi - if test "$gpuids" = "" ; then - export LD_LIBRARY_PATH=$CUDALIB1:$LD_LIBRARY_PATH - else - MARCCUDALIBS=$MARCCUDALIBS2 - export LD_LIBRARY_PATH=$CUDALIB2:$LD_LIBRARY_PATH - fi - if test $MPITYPE = hpmpi -a "$ARCHITECTURE" = "linux_amd64" - then - export MPIHPSPECIAL="$MPIHPSPECIAL -e LD_LIBRARY_PATH=$LD_LIBRARY_PATH" - fi -# - if test $nprocd -gt 1 - then - $ECHO "Message passing type ($itree)? $ECHOTXT" - read value - if test "$value" - then - itree=$value - fi - $ECHO "Host file name ($host)? $ECHOTXT" - read value - if test "$value" - then - host=$value - fi - if test $nprocdddm -gt 1 - then - $ECHO "Single input file? $ECHOTXT" - read value - case $value in - y* | Y*) - icreated=1 - nprocdarg=-nprocds - ;; - esac - $ECHO "Compatible machines for DDM ($compatible)? $ECHOTXT" - read value - if test "$value" - then - compatible=$value - fi - $ECHO "Copy input files to remote hosts ($cpinput)? $ECHOTXT" - read value - if test "$value" - then - cpinput=$value - fi - $ECHO "Copy post files from remote hosts ($cpresults)? $ECHOTXT" - read value - if test "$value" - then - cpresults=$value - fi - fi - fi - $ECHO "Run the job in the queue ($qid)? $ECHOTXT" - read value - if test "$value" - then - qid=$value - fi - case $qid in - s* | S* | l* | L* | v* | V* ) - $ECHO "Queue priority ($priority)? $ECHOTXT" - read value - if test "$value" - then - priority=$value - fi - $ECHO "Job starts at ($att)? $ECHOTXT" - read value - if test "$value" - then - att=$value - fi - $ECHO "Queue CPU limit ($cpu)? $ECHOTXT" - read value - if test "$value" - then - cpu=$value - fi - ;; - * ) - ;; - esac - $ECHO "Auto Restart option ($nauto)? $ECHOTXT" - read value - if test "$value" - then - nauto=$value - fi - $ECHO "Run directory ($DIRJOB)? $ECHOTXT" - read value - if test "$value" - then - DIRJOB=$value - DIRSCR=$DIRJOB - fi - $ECHO "Scratch directory ($DIRSCR)? $ECHOTXT" - read value - if test "$value" - then - DIRSCR=$value - fi - ;; - quit) - exit 1 - ;; - *) - break - ;; - -esac - - if test $nthread -eq -1 - then - nthread=${MARC_NUMBER_OF_THREADS:-0} - fi - if test $nthread -lt 0 - then - nthread=0 - fi - -done - -if test "$dllrun" -gt 0; then - exefile=exe_marc - prog=exe_marc - program=$exefile - bd=$MARC_BIN/ - if test "$user"; then - . $MARC_TOOLS/make_marc_user_dll $DIRJOB $user - user= - pathdll=yes - if test $prgsav = no; then - rmdll=yes - fi - if test $prgsav = yes; then - cpdll=yes - rmdll=yes - fi - fi - - if test "$pathdll"; then -# -# reset share lib path -# - if test $MACHINENAME = "HP" - then - SHLIB_PATH=$DIRJOB:$SHLIB_PATH - export SHLIB_PATH - fi - if test $MACHINENAME = "IBM" - then - LIBPATH=$DIRJOB:$LIBPATH - export LIBPATH - fi -# - LD_LIBRARY_PATH=$DIRJOB:$LD_LIBRARY_PATH - LD_LIBRARY64_PATH=$DIRJOB:$LD_LIBRARY64_PATH - LD_LIBRARYN32_PATH=$DIRJOB:$LD_LIBRARYN32_PATH - export LD_LIBRARY_PATH - export LD_LIBRARY64_PATH - export LD_LIBRARYN32_PATH - fi -fi -# end of dllrun>0 - - -if test $program = $exefile -o $program = $prog.marc -then - -# delete the old .log file unless we run in the background -if test "$deletelog" = yes -then - /bin/rm $jid.log 2>/dev/null -else - echo - echo running the job in the background, see $jid.log - echo -fi - -# -# check if this is an autoforge or rezoning or radiation job -# -if test $nprocd -eq 1 -then - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^rezoning"` - if test "$line" - then - autoforge=1 - fi - line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^radiation"` - if test "$line" - then - autoforge=1 - fi -fi -# -# check that jobname for restarted run is not the same -# as restart file basename -# -if test "$rid" -then - if test "$jid" = "$rid" - then - echo " " - echo "ERROR: job name of current run is the same as job name" - echo " of the restarted job" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "ERROR: job name of current run is the same as job name" >> $jid.log - echo " of the restarted job" >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi -fi - -# -# user objects/libraries used -# - - if test "$objs" - then - program="$DIRJOB/$jid.marc" - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# user subroutine used -# - - if test "$user" - then -# program=$user.marc - program=$DIRJOB/`$BASENAME $user .f`.marc - case $program in - \/* | \.\/*) - bd= - ;; - *) - bd=`pwd`/ - ;; - esac - link=yes - fi - -# -# Special case for IBM using POE but not an SP machine -# in this case we always need a host file, also for serial jobs. -# -if test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP -then - MP_HOSTFILE=${jid}.host - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $nprocd -gt 1 - then - numdom=$nprocd - while test $numdom -gt 0 - do - hostname -s >> $MP_HOSTFILE - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - else - hostname -s > $MP_HOSTFILE - fi -fi -# -# check ssh for all hosts in host file -# -if test $nprocd -gt 1 -then -if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" - then -# get host list - if test "$host" - then - line=`grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' | uniq` -# count failing hosts - counter=0 - for i in $line - do - $RSH -o BatchMode=yes -o ConnectTimeout=10 $i uname -n - status=$? - if [[ $status != 0 ]] ; then - counter=$((counter+1)) - if [ "$counter" = "1" ]; then - echo " " - echo " error - connection test failed... " - echo " " - fi - echo " " - echo " connection test with ssh failed on host $i" - echo " check the following command: ssh $i uname -n " - echo " " - fi - done -# echo error message and quit - if test $counter -ne 0 - then - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. ">> $jid.log - echo " The ssh command must be working correctly between ">> $jid.log - echo " the computers used in the analysis. Furthermore, ">> $jid.log - echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi - fi -fi -fi -# -# check correctness of host file; fix for user sub -# - if test $nprocd -gt 1 - then - -# construct the path name to the executable (execpath) - execpath=$MARC_BIN/$exefile - usersub=0 - if test $program = $prog.marc - then - execpath=$prog.marc - usersub=1 - fi - if test "$objs" - then - execpath="$DIRJOB/$jid.marc" - usersub=1 - fi - if test "$user" - then - execpath=$DIRJOB/`$BASENAME $user .f`.marc - usersub=1 - fi - export execpath - execname=`$BASENAME $execpath` - - if test "$host" - then - userhost=$host - case $userhost in - \/* | \.\/*) - ;; - *) - userhost=`pwd`/$userhost - ;; - esac - -# check that the number of processes specified in the hostfile is -# equal to nprocd specified by -nprocd. - numproc=`grep -v '^#' $host | $AWK -v sum=0 '{sum=sum+$2}; END {print sum}'` - if test $nprocd -ne $numproc - then - echo " " - echo "error, the number of processes specified in the host file" - echo "must be equal to the number of processes given by -nprocd/-nsolver" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, the number of processes specified in the host file" >> $jid.log - echo "must be equal to the number of processes given by -nprocd/-nsolver" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - -# check for Myrinet that the number of processes per host is -# less than number of available user ports, 5 -# .gmpi directory must exist in user's home directory -# and must have write permission from remote hosts - if test $MPITYPE = "myrinet" - then - numproc=`grep -v '^#' $host | $AWK -v sum=1 '{if( $2 > 5) sum=6}; END {print sum}'` - if test $numproc -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes specified " - echo "in the hostfile must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes specified " >> $jid.log - echo "in the hostfile must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - if test ! -d ~/.gmpi - then - echo " " - echo "error, for Myrinet a .gmpi directory must exist " - echo "under the user's home directory" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a .gmpi directory must exist " >> $jid.log - echo "under the user's home directory" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - homedir=`echo ~` - for i in `grep -v '^#' $host | $AWK '{if (NF > 0) print $1}'` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - $RSH $i /bin/touch $homedir/.gmpi/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - echo " " - echo "error, for Myrinet a shared .gmpi directory must exist " - echo "under the user's home directory " - echo "with remote write permission" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet a shared .gmpi directory must exist " >> $jid.log - echo "under the user's home directory " >> $jid.log - echo "with remote write permission" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - /bin/rm tmp.$$ - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - fi - fi - done - fi - fi - -# construct the host file $jid.host which is used by mpirun -# skip lines starting with # and only consider lines with more than -# one word in them. Note that the hostfile given to this script -# has two columns: the host name and the number of shared processes -# to run on this host. mpirun wants the number of _other_ -# processes to run in addition to the one being run on the machine -# on which the job is started. hence the $2-1 for fnr == 1. - if test -f $jid.host - then - /bin/rm $jid.host 2> /dev/null - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then -# HPMPI or HP hardware MPI - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ - -v mpihpspecial="$MPIHPSPECIAL" \ -'{if ( NF > 0) {\ - fnr++ ; \ - printf("-h %s -np %s",$1,$2); \ - printf(" %s",mpihpspecial); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF >= 3 ) printf(" -e MPI_WORKDIR=%s", $3);\ - if ( NF >= 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) \ - }\ - }' > $jid.host -# end HPMPI or HP hardware MPI - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then -# IBM using hardware MPI (POE) - MP_HOSTFILE=$jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.host -# end IBM using hardware MPI (POE) -# for Intel MPI, need to create a machinefile for DMP - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then -# Intel MPI - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - /bin/cp $host $jid.host - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Intel MPI for DMP -# for Solaris HPC 7.1, need to create a machinefile for DMP - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then -# Solaris HPC 7.1 - if test -f $jid.mfile - then - /bin/rm $jid.mfile 2> /dev/null - fi - grep -v '^#' $host | $AWK '{host=$1;num=$2;for (i=1;i<=num;i++) print host}' > $jid.mfile -# end Solaris HPC 7.1 for DMP -# for Myrinet, construct a configuration file in ~/.gmpi -# this must be readable by each process -# format is (hostname) (port number) for each process - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - grep -v '^#' $host | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ -{if ( NF > 0 ) \ - for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc]); \ -}' >> ~/.gmpi/$jid.host - else -# this is for mpich-1.2.5 and later, using the -pg option -# format: host nproc executable user arguments -# the arguments are added later - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub -v user=`whoami` \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s %s\n",path,user);\ - if ( NF == 3 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s %s\n",path,user) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s %s\n",$3,en,user); else printf(" %s/bin/%s %s\n",$4,en,user) \ - }\ - }' > $jid.host - fi -# end Myrinet - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then -# Compaq MPI via Memory Channel - grep -v '^#' $host | $AWK '{if (NF > 0) print $1}' > $jid.host -# end Compaq MPI - else -# MPICH - grep -v '^#' $host | $AWK -v path=$execpath -v en=$execname -v us=$usersub \ -'{if ( NF > 0) {\ - fnr++ ; \ - if ( fnr == 1 ) printf("%s %d",$1,$2-1); \ - else printf("%s %s",$1,$2); \ - if ( NF == 2 ) printf(" %s\n",path);\ - if ( NF == 3 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s\n",path) ;\ - if ( NF == 4 ) if (us) printf(" %s/%s\n",$3,en); else printf(" %s/bin/%s\n",$4,en) \ - }\ - }' > $jid.host - fi -# define the variable host and host_filt -# host_filt is used for loops over hosts -# for Myrinet we need to use a filtered variant of userhost -# for others we can use $host - if test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - host=~/.gmpi/$jid.host - host_filt=$jid.host_tMp - grep -v '^#' $userhost | $AWK '{if (NF > 0) print $1}' > $host_filt - else - host=$jid.host - host_filt=$host - fi - else - host=$jid.host - host_filt=$host - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - host_filt=$jid.mfile - fi - fi -# figure out if the machines in the hostfile are nfs mounted -# or distributed and set the variable "dirstatus" accordingly. -# only perform the check if user subroutine is used -# or a user subroutine executable is used - - numfield=1 - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - numfield=2 - fi - DIR1=$DIRJOB - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - counter=0 - echo " " - echo "checking if local or shared directories for host" - if test "$deletelog" = no - then - echo "checking if local or shared directories for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - dirstatus[$counter]="shared" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - $RSH $i /bin/touch $DIR1/$jid.$$ 2> tmp.$$ - if test -s tmp.$$ - then - dirstatus[$counter]="local" - /bin/rm tmp.$$ - else - if test ! -f $jid.$$ - then - dirstatus[$counter]="local" - $RSH $i /bin/rm $DIR1/$jid.$$ - else - /bin/rm $jid.$$ - fi - fi - if test -f tmp.$$ - then - /bin/rm tmp.$$ - fi - if test -f $jid.$$ - then - /bin/rm $jid.$$ - fi - echo " ${dirstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${dirstatus[$counter]}" >> $jid.log - fi - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - fi - -# figure out if this is a compatible set of machines -# unless explicitly specified with flag -comp -# only perform the check if user subroutine is used -# or a user subroutine executable is used -# Myrinet does not support heterogeneous - if test $program = $prog.marc -o -n "$user" -o -n "$objs" - then - if test $compatible = "unknown" - then - thisname=$ARCH - compatible=yes - counter=0 - echo "checking if machines are compatible for host" - if test "$deletelog" = no - then - echo "checking if machines are compatible for host" >> $jid.log - fi - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]="yes" - $ECHO " $i $ECHOTXT" - if test "$deletelog" = no - then - $ECHO " $i $ECHOTXT" >> $jid.log - fi - othername=`$RSH $i uname -a | cut -f 1 -d " "` - if test $thisname != $othername - then - compatible=no - compstatus[$counter]="no" - fi - fi - echo " ${compstatus[$counter]}" - if test "$deletelog" = no - then - echo " ${compstatus[$counter]}" >> $jid.log - fi - done - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - fi - else - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - compstatus[$counter]=$compatible - fi - done - if test $compatible = "no" - then - echo "all machines assumed incompatible" - if test "$deletelog" = no - then - echo "all machines assumed incompatible" >> $jid.log - fi - else - echo "all machines compatible" - if test "$deletelog" = no - then - echo "all machines compatible" >> $jid.log - fi - fi - fi -# error out if user objects or libraries are used on incompatible machines - if test "$compatible" = "no" -a -n "$objs" - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" - if test "$deletelog" = no - then - echo "User object/libraries cannot be used in a parallel job on incompatible machines" >> $jid.log - fi - exit 1 - fi -# modify new host file if NFS mounted heterogeneous machine - doit= - if test $program = $prog.marc - then - doit=yes - fi - if test "$user" - then - doit=yes - fi - if test "$doit" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - $AWK -v hst=$i '{fnr++ ; \ -if ($1 ~ hst) {if ( fnr == 1 ) printf("%s\n",$0); else \ -printf("%s %s %s_%s\n",$1,$2,$3,$1) } else print}' $jid.host > $jid.host{$$} - /bin/mv $jid.host{$$} $jid.host - host=$jid.host - fi - fi - done - fi - fi # if test $program = $prog.marc -o $user -o $obj - - else # if test $host - # assume shared memory machine if no hostfile given and - # MPITYPE is set to mpich or Myrinet - # check for Myrinet that the total number of processes is - # less than number of available user ports, 5 - if test $MPITYPE = "mpich" -o $MPITYPE = "scali" - then - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - host=$jid.host - elif test $MPITYPE = "myrinet" - then - if test $nprocd -gt 5 - then - echo " " - echo "error, for Myrinet the number of processes " - echo "must not exceed 5 for a hostname" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error, for Myrinet the number of processes " >> $jid.log - echo "must not exceed 5 for a hostname" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - fi - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - echo $nprocd > ~/.gmpi/$jid.host - echo `hostname` $nprocd | $AWK \ -'BEGIN {iport[0] = 2; \ - iport[1] = 4; \ - iport[2] = 5; \ - iport[3] = 6; \ - iport[4] = 7 \ - } \ - {for(iproc = 0; iproc < $2; iproc++) printf("%s %d\n",$1,iport[iproc])} \ -' >> ~/.gmpi/$jid.host - host=~/.gmpi/$jid.host - else - numproc=`echo $nprocd | $AWK '{sum=$1-1}; {print sum}'` - echo `hostname` $numproc $execpath > $jid.host - - fi - fi # if test myrinet - - fi # if test $host - - fi # if test $nprocd -gt 1 - -fi # if test $program = $exefile -o $program = $prog.marc - -############################################################################## -# construct run stream (Marc only) # -############################################################################## - -# set maximum message length for ddm to a large number -# for vendor provided mpi -if test $itree -eq 0 -a $MPITYPE = hardware -then - itree=100000000 - if test $MACHINENAME = SGI - then - itree=100000001 - fi -fi -if test $itree -eq 0 -a $MPITYPE = hpmpi -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = myrinet -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = nec -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = scali -then - itree=100000000 -fi -if test $itree -eq 0 -a $MPITYPE = intelmpi -then - itree=100000000 -fi -if test $nprocdddm -lt 2 -then - nprocdarg= -else - nprocdarg="$nprocdarg $nprocdddm" -fi -if test $nsolver -eq 0 -then - nsolverarg= -else - nsolverarg="$nsolverarg $nsolver" -fi -if test $nprocdddm -lt 2 -a $nsolver -eq 0 -then -nprocd=0 -fi -if test $nprocd -gt 0 -then - if test "$host" - then - if test -z "$RUN_JOB2" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - if test $MPITYPE = hpmpi -o $MACHINENAME = HP -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $host -- -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = IBM -a $MPITYPE = hardware -a "$MACHINETYPE" = NONSP - then - RUN_JOB="$RUN_JOB2 $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MPITYPE = "myrinet" - then - if test $MPIVERSION = "MPICH-GM1.2.1..7" - then - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB_TMP="$RUN_JOB2 $host $bd$program" - RUN_JOB=" -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - elif test $MACHINENAME = DEC -a $MPITYPE = hardware - then - RUN_JOB="$RUN_JOB2 $nprocd -hf $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - elif test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - numhost=`uniq $jid.mfile | wc -l` - if test "$INTELMPI_VERSION" = "HYDRA" - then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n $numhost -r $RSH -f $jid.mfile - RUN_JOB_TMP="$RUN_JOB2 $jid.cfile" - fi - -# intelmpi uses configfile. format: -# -host host1 -n n1 executable marcargs -# one such line per host -# collect the marcargs in RUN_JOB and construct the config file later -# collect the run stream in RUN_JOB_TMP - RUN_JOB="-jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - - - elif test $MACHINENAME = "SUN" -a $MPITYPE = "hardware" - then - RUN_JOB="$RUN_JOB2 $jid.mfile -n $nprocd $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB2 $host $bd$program -jid $jid -dirjid $DIRJID \ -$nprocdarg \ -$nsolverarg \ --maxnum $MAXNUM -itree $itree \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test "$userhost" - then - RUN_JOB="$RUN_JOB -mhost $userhost" - fi - if test $MPITYPE = "scali" - then -# set default working directory to /tmp to allow -# different directory names - SCAMPI_WORKING_DIRECTORY=/tmp - export SCAMPI_WORKING_DIRECTORY - fi - else - if test -z "$RUN_JOB1" - then - echo " " - echo "error: parallel job attempted on non-parallel version," - echo " or, if parallel version is installed, the include " - echo " file is probably corrupted" - echo " " - if test "$deletelog" = no - then - echo " " >> $jid.log - echo "error: parallel job attempted on non-parallel version," >> $jid.log - echo " or, if parallel version is installed, the include " >> $jid.log - echo " file is probably corrupted" >> $jid.log - echo " " >> $jid.log - fi - exit - fi - RUNNPROCD=$nprocd - if test $MACHINENAME = "IBM" -a $MPITYPE = "hardware" - then - RUNNPROCD= - MP_PROCS=$nprocd - export MP_PROCS - fi - if test $MPITYPE = "myrinet" - then - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - echo " " > /dev/null - else - export I_MPI_JOB_CONTEXT=$$ - mpdboot -n 1 -f $jid.hosts - fi - RUN_JOB="$RUN_JOB1 $RUNNPROCD $bd$program -jid $jid -dirjid $DIRJID \ - $nprocdarg \ - $nsolverarg \ - -maxnum $MAXNUM -itree $itree \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - fi - fi -else - if test $nauto -gt 0 -o $ndcoup -gt 0 - then - RUN_JOB="$RUN_JOB0 $BINDIR/exe_auto $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ - -nthread $nthread $gpuoption -dirjob $DIRJOB " - else -# this is for a serial job without auto restart: - RUN_JOB="$RUN_JOB0 $bd$program -jid $jid -dirjid $DIRJID \ --maxnum $MAXNUM \ --nthread $nthread $gpuoption -dirjob $DIRJOB " - fi -fi -if test "$rid" -then - RUN_JOB="$RUN_JOB -rid $rid -dirrid $DIRRID" -fi -if test "$pid" -then - RUN_JOB="$RUN_JOB -pid $pid -dirpid $DIRPID" -fi -if test "$sid" -then - RUN_JOB="$RUN_JOB -sid $sid -dirsid $DIRSID" -fi -if test "$did" -then - RUN_JOB="$RUN_JOB -def $did -dirdid $DIRDID" -fi -if test "$vid" -then - RUN_JOB="$RUN_JOB -vf $vid -dirvid $DIRVID" -fi -if test $nauto -gt 0 -then - RUN_JOB="$RUN_JOB -autorst $nauto " -fi -if test $ndcoup -gt 0 -then - RUN_JOB="$RUN_JOB -dcoup $ndcoup " -fi -if test $ndytran -gt 0 -then - RUN_JOB="$RUN_JOB -dytran $ndytran " -fi -if test $mesh -gt 0 -then - RUN_JOB="$RUN_JOB -me $mesh " -fi -if test $noutcore -gt 0 -then - RUN_JOB="$RUN_JOB -outcore $noutcore " -fi -if test "$dllrun" -gt 0 -then - RUN_JOB="$RUN_JOB -dll $dllrun " -fi -if test "$trkrun" -gt 0 -then - RUN_JOB="$RUN_JOB -trk $trkrun " -fi -if test "$iam" -then - RUN_JOB="$RUN_JOB -iam $iam " -fi -if test "$justlist" -then - RUN_JOB="$RUN_JOB -list 1 " -fi -if test "$feature" -then - RUN_JOB="$RUN_JOB -feature $feature " -fi -if test "$memlimit" -ne 0 -then - RUN_JOB="$RUN_JOB -ml $memlimit " -fi -if test "$cpinput" -then - RUN_JOB="$RUN_JOB -ci $cpinput " -fi -if test "$cpresults" -then - RUN_JOB="$RUN_JOB -cr $cpresults " -fi -if test "$DIRSCR" != "$DIRJOB" -then - RUN_JOB="$RUN_JOB -dirscr $DIRSCR" -else - DIRSCR=$DIRJOB -fi -if test "$makebdf" -then - RUN_JOB="$RUN_JOB -bdf $makebdf " -fi -if test $MPITYPE = "myrinet" -a "$host" -a "$MPIVERSION" != "MPICH-GM1.2.1..7" -then - # append $RUN_JOB to all lines of the host file - # and set RUN_JOB - $AWK -v args="$RUN_JOB" '{print $0,args}' $host > $host.$$ - /bin/mv $host.$$ $host - RUN_JOB=$RUN_JOB_TMP -fi -if test $MPITYPE = "intelmpi" -a "$host" -then - # construct config file, append $RUN_JOB to all lines of the config file - # and set RUN_JOB - if test "$INTELMPI_VERSION" = "HYDRA" - then - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-n %s",$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - else - grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ - '{if ( NF > 0) {\ - printf("-host %s -n %s",$1,$2); \ - if ( NF == 2 ) printf(" %s",path);\ - if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ - printf(" %s\n",args); \ - }\ - }' > $jid.cfile - fi - RUN_JOB=$RUN_JOB_TMP -fi -echo " " -echo "Final run stream value" -echo " RUNJOB="$RUN_JOB -if test "$deletelog" = no -then -echo " " >> $jid.log -echo "Final run stream value" >> $jid.log -echo " RUNJOB="$RUN_JOB >> $jid.log -fi - - -############################################################################## -# run marc using valgrind # -############################################################################## -#RUN_JOB="valgrind $RUN_JOB" -#RUN_JOB="valgrind --read-var-info=yes --gen-suppressions=yes $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=all -v $RUN_JOB" -#RUN_JOB="valgrind --gen-suppressions=yes --error-limit=no $RUN_JOB" -############################################################################## - - -############################################################################## -# run the requested program in a queue # -############################################################################## - -if test "$deletelog" = yes -then - echo - date -else - echo >> $jid.log - date >> $jid.log -fi -if [ $qid = short -o $qid = long -o $qid = verylong -o $qid = at ] -then - -/bin/rm -f $jid.runmarcscript - - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - - fi - cat > $jid.runmarcscript << END4 - if test "$user" - then - if test ${basefile##*.} = f - then - ln -sf "$user.f" "$usersub" - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - $SOLVERLIBS \ - $MARCCUDALIBS \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } -END4 -else - prgsav=yes -fi -/bin/rm $userobj 2>/dev/null - -# -# run marc -# - -cat >> $jid.runmarcscript << END5 - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -# first remove all .out files and incremental restart files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - /bin/rm $DIRJOB/$numdom${jid}_i_*.t08 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null - /bin/rm $DIRJOB/${jid}_i_*.t08 2>/dev/null -fi - -if test $nprocdddm -gt 1 -then - $RUN_JOB 2>>$jid.log -else - $RUN_JOB 2>>$jid.log -fi - -if test $dllrun -eq 0; then - if test $prgsav = no - then - /bin/rm -f $bd$program 2>/dev/null - fi -else - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes - then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test \$numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=\`echo \$numdom | $AWK '{sum=\$1-1}; {print sum}'\` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -END5 - - -# Submit to marc batch queue -# -if [ $qid = at ] -then -QUENAME=at -SUBMCMD= -else -# -# Submit to qsub queue -# -QUENAME=qsub -SUBMCMD="-q $qid -o /dev/null -e $jid.batch_err_log -x -r $jid" -if test "$priority" -then - SUBMCMD=$SUBMCMD" -p $priority" -fi -if test "$att" -then - SUBMCMD=$SUBMCMD" -a $att" -fi -if test "$cpu" -then - SUBMCMD=$SUBMCMD" -lt $cpu" -fi - -fi -echo $QUENAME $SUBMCMD -#cat $jid.runmarcscript -$QUENAME $SUBMCMD < $jid.runmarcscript - -/bin/rm -f $jid.runmarcscript - -############################################################################## -# run the requested program in the background # -############################################################################## - -else -if test $qid = background -then - -# -# first remove all old .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi -# -# compile user subroutine if present -# -( -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - echo " $PRODUCT Exit number 3" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - echo " $PRODUCT Exit number 3" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - echo " $PRODUCT Exit number 3" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc - -# - -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi - -$RUN_JOB & - -marcpid=$! -echo $marcpid > $DIRJOB/$jid.pid -wait $marcpid - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - fi - fi - fi -fi - - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi -) 1>>$jid.log 2>&1 & - - -############################################################################## -# run the requested program in the foreground # -############################################################################## - -else - -# -# compile user subroutine if present -# -if test "$link" -then - if test "$user" - then - # compile and link on other hosts in $host if compstatus=no - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${compstatus[$counter]} = "no" - then - DIR1=$DIRJOB - DIR2=$DIR - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - marcdir=`echo $line | $AWK '{print $4}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - if test -n "$marcdir" - then - DIR2=$marcdir - fi - # first copy over the user sub if local directories - if test ${dirstatus[$counter]} = "local" - then - $RCP $user.f $i:$DIR1/ - fi - # do the compilation on the other machine - if test ${dirstatus[$counter]} = "shared" - then - hname=_$ibase - else - hname= - fi - remoteprog=$DIR1/${execname}$hname - remoteuser=$DIR1/`$BASENAME $user` - $RSH $i /bin/rm $remoteprog 2> /dev/null - echo - $RSH $i $DIR2/tools/comp_user $DIR2 $DIR1 $remoteuser $remoteprog - # check if successful, the new executable should be there - line=`$RSH $i /bin/ls $remoteprog 2> /dev/null` - if test "$line" - then - echo compilation and linking successful on host $i - else - echo "$0: compile failed for $user.f on host $i" - exit 1 - fi - # remove the user subroutine on remote machine - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $remoteuser.f 2> /dev/null - fi - fi - fi - done - fi - fi - if test "$userhost" - then - echo - echo "Compiling and linking user subroutine $user.f on host `hostname`" - fi - userobj=$DIRJOB/`$BASENAME $user .f`.o - basefile=`$BASENAME $usersubname` - if test ${basefile##*.} = f - then - usersub=$DIRJOB/`$BASENAME $user .f`.F - ln -sf "$user.f" "$usersub" - else - usersub=$usersubname - fi - if test $MACHINENAME = "CRAY" - then - $FORTRAN $usersub || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - else - $FORTRAN $usersub -o $userobj || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - fi - if test ${basefile##*.} = f - then - /bin/rm -f "$usersub" - fi - fi # if test $user - - - $LOAD $bd${program} $MARC_LIB/main.o \ - $MARC_LIB/blkdta.o $MARC_LIB/comm?.o \ - ${userobj-} \ - $objs \ - $MARC_LIB/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ${MUMPSSOLVERLIBS} \ - $MDSRCLIB \ - $MARC_LIB/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - ${MARCCUDALIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS \ - $SECLIBS || \ - { - echo "$0: link failed for ${user:+$userobj }$objs" - exit 1 - } - # copy user subroutine executable for hosts using local working dir - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - if test ${dirstatus[$counter]} = "local" -a ${compstatus[$counter]} = "yes" - then - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - echo "Copying executable to host ${i}" - $RCP $program ${i}:${DIR1}/ - fi - fi - done - fi - fi -else # if test $link - prgsav=yes -fi # if test $link -/bin/rm $userobj 2>/dev/null - -# -# run marc -# -# Define share library path based on platforms -# This is required for using the Patran Mesher -if test $MACHINENAME = "IBM" -then - LIBPATH=$MARC_LIB:$MARC_LIB_SHARED:$LIBPATH - export LIBPATH -fi -# first remove all .out files -# the ones for ddm are removed in the code -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRJOB/$numdom$jid.out 2>/dev/null - /bin/rm $DIRJOB/$numdom$jid.log 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done -else - /bin/rm $DIRJOB/$jid.out 2>/dev/null -fi - -$RUN_JOB - -if test $nprocd -gt 1 -then - if test $MACHINENAME = "LINUX" -a $MPITYPE = "intelmpi" - then - if test "$INTELMPI_VERSION" = "HYDRA" - then - if test "$host" - then - /bin/rm $jid.mfile 2> /dev/null - /bin/rm $jid.hosts 2> /dev/null - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.cfile 2> /dev/null - else - echo " " > /dev/null - fi - else - if test "$host" - then - mpdcleanup -a -f $jid.mfile - /bin/rm $jid.host 2> /dev/null - /bin/rm $jid.mfile 2> /dev/null - else - mpdcleanup -a -f $jid.hosts - /bin/rm $jid.hosts 2> /dev/null - fi - fi - fi -fi - -if test $dllrun -eq 0; then -if test $prgsav = no -then - /bin/rm -f $bd$program 2>/dev/null - # for network run, remove executable on remote machines - # and executables with modified name - if test $nprocd -gt 1 - then - if test "$userhost" - then - counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" - then - DIR1=$workdir - fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done - fi - fi -fi -else -#dllrun >0 - if test $cpdll = yes; then - filename=`basename $usersubname .f` - /bin/cp $DIRJOB/$marcdll $DIRJOB/${filename}_$marcdll 2>/dev/null - fi - if test $rmdll = yes;then - /bin/rm -f $DIRJOB/$marcdll 2>/dev/null - fi -fi - -if test $nprocdddm -gt 1 -then - numdom=$nprocdddm - while test $numdom -gt 0 - do - /bin/rm $DIRSCR/$numdom$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t74 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t75 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t76 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t77 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t78 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t79 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t84 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t85 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t86 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null - /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null - numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` - done - /bin/rm $DIRJOB/$jid.pid 2>/dev/null - if test $MPITYPE = "myrinet" - then - if test -f "$host_filt" - then - /bin/rm $host_filt - fi - fi -else - /bin/rm $DIRSCR/$jid.t02 2>/dev/null - /bin/rm $DIRSCR/$jid.t03 2>/dev/null - /bin/rm $DIRSCR/$jid.t11 2>/dev/null - /bin/rm $DIRSCR/$jid.t12 2>/dev/null - /bin/rm $DIRSCR/$jid.t13 2>/dev/null - /bin/rm $DIRSCR/$jid.t14 2>/dev/null - /bin/rm $DIRSCR/$jid.t15 2>/dev/null - /bin/rm $DIRSCR/$jid.t22 2>/dev/null - /bin/rm $DIRSCR/$jid.t23 2>/dev/null - /bin/rm $DIRSCR/$jid.t32 2>/dev/null - /bin/rm $DIRSCR/$jid.t33 2>/dev/null - /bin/rm $DIRSCR/$jid.t81 2>/dev/null - /bin/rm $DIRSCR/$jid.t82 2>/dev/null - /bin/rm $DIRSCR/$jid.t83 2>/dev/null - /bin/rm $DIRSCR/$jid.t84 2>/dev/null - /bin/rm $DIRJOB/$jid.pid 2>/dev/null -fi - - -fi -fi diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/edit_window b/installation/mods_MarcMentat/2013/Mentat_bin/edit_window deleted file mode 100644 index b732a7694..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/edit_window +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. -# The command to invoke the editor is specified during DAMASK installation - -%EDITOR% $* \ No newline at end of file diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/edit_window.org b/installation/mods_MarcMentat/2013/Mentat_bin/edit_window.org deleted file mode 100644 index 64c0a68d0..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/edit_window.org +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/sh -# This script opens a window running an editor. The default window is an -# xterm, and the default editor is vi. These may be customized. - -dir= -for d in /usr/bin /usr/bin/X11; do - if test -x "$d/xterm"; then - dir="$d" - break - fi -done - -if test -z "$dir"; then - echo "$0: Could not find xterm" - exit 1 -fi - -"$dir/xterm" -T "vi $*" -n "vi $*" -e vi $* diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill4 b/installation/mods_MarcMentat/2013/Mentat_bin/kill4 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill4 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill5 b/installation/mods_MarcMentat/2013/Mentat_bin/kill5 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill5 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill6 b/installation/mods_MarcMentat/2013/Mentat_bin/kill6 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill6 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill7 b/installation/mods_MarcMentat/2013/Mentat_bin/kill7 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill7 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill8 b/installation/mods_MarcMentat/2013/Mentat_bin/kill8 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill8 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/kill9 b/installation/mods_MarcMentat/2013/Mentat_bin/kill9 deleted file mode 100644 index 6d1ff84bf..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/kill9 +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh - -if [ "$1" = "" ]; then - echo "usage: $0 job_name" - exit 1 -fi - -echo STOP > $1.cnt diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit1.org b/installation/mods_MarcMentat/2013/Mentat_bin/submit1.org deleted file mode 100644 index b54b2ee56..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit1.org +++ /dev/null @@ -1,163 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=ls -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then - srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_marc" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit4 b/installation/mods_MarcMentat/2013/Mentat_bin/submit4 deleted file mode 100644 index dda98f475..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit4 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_hmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit5 b/installation/mods_MarcMentat/2013/Mentat_bin/submit5 deleted file mode 100644 index 1f96942d2..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit5 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_mp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit6 b/installation/mods_MarcMentat/2013/Mentat_bin/submit6 deleted file mode 100644 index a9a74f4f3..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit6 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_lmp" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit7 b/installation/mods_MarcMentat/2013/Mentat_bin/submit7 deleted file mode 100644 index edbc1701c..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit7 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_h" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit8 b/installation/mods_MarcMentat/2013/Mentat_bin/submit8 deleted file mode 100644 index 872125981..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit8 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_bin/submit9 b/installation/mods_MarcMentat/2013/Mentat_bin/submit9 deleted file mode 100644 index 44a4865fb..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_bin/submit9 +++ /dev/null @@ -1,164 +0,0 @@ -#!/bin/sh -# -# The exit status of this script is read by Mentat. -# Normal exit status is 0. -# - -DIR=%INSTALLDIR%/marc%VERSION% -if test $MARCDIR1 -then - DIR=$MARCDIR1 -fi - -SRCEXT=.f -RSTEXT=.t08 -PSTEXT=.t19 -PSTEXTB=.t16 -VWFCEXT=.vfs - -slv=$1 -version=$2 -ndom_fea_solver=$3 -ndom_preprocessor=$4 -hostfile=$5 -compat=$6 -job=$7 -srcfile=$8 -srcmeth=$9 -shift 9 # cannot use $10, $11, ... -restart=$1 -postfile=$2 -viewfactorsfile=$3 -autorst=$4 -copy_datfile="-ci $5" -copy_postfile="-cr $6" -scr_dir=$7 -dcoup=$8 -nthread=$9 -shift 9 # cannot use $10, $11, ... -nsolver=$1 -mode=$2 -gpu=$3 - -if [ "$slv" != "" -a "$slv" != "marc" ]; then - slv="-iam sfm" -else - slv="" -fi - -if [ "$ndom_fea_solver" != "" -a "$ndom_fea_solver" != "1" ]; then - nprocds="-nprocds $ndom_fea_solver" -else - nprocd="" - if [ "$ndom_preprocessor" != "" -a "$ndom_preprocessor" != "1" ]; then - nprocd="-nprocd $ndom_preprocessor" - else - nprocd="" - fi -fi - -if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` - case "$srcmeth" in - -) - srcfile="-u $srcfile" - ;; - compsave) - srcfile="-u $srcfile -save y" - ;; - runsaved) - srcfile=${srcfile%.*}".marc" - srcfile="-prog $srcfile" - ;; - esac -else - srcfile="" -fi - -if [ "$restart" != "" -a "$restart" != "-" ]; then - restart=`echo $restart | sed "s/$RSTEXT$//"` - restart="-r $restart" -else - restart="" -fi - -if [ "$postfile" != "" -a "$postfile" != "-" ]; then - postfile=`echo $postfile | sed "s/$PSTEXT$//"` - postfile=`echo $postfile | sed "s/$PSTEXTB$//"` - postfile="-pid $postfile" -else - postfile="" -fi - -if [ "$viewfactorsfile" != "" -a "$viewfactorsfile" != "-" ]; then - viewfactorsfile=`echo $viewfactorsfile | sed "s/$VWFCEXT$//"` - viewfactorsfile="-vf $viewfactorsfile" -else - viewfactorsfile="" -fi - -if [ "$hostfile" != "" -a "$hostfile" != "-" ]; then - hostfile="-ho $hostfile" -else - hostfile="" -fi - -if [ "$compat" != "" -a "$compat" != "-" ]; then - compat="-co $compat" -else - compat="" -fi - -if [ "$scr_dir" != "" -a "$scr_dir" != "-" ]; then - scr_dir="-sd $scr_dir" -else - scr_dir="" -fi - -if [ "$dcoup" != "" -a "$dcoup" != "0" ]; then - dcoup="-dcoup $dcoup" -else - dcoup="" -fi - -if [ "$nthread" != "" -a "$nthread" != "0" -a "$nthread" != "1" ]; then - nthread="-nthread $nthread" -else - nthread="" -fi - -if [ "$nsolver" != "" -a "$nsolver" != "0" ]; then - nsolver="-nsolver $nsolver" -else - nsolver="" -fi - -case "$mode" in - 4) mode="-mo i4" ;; - 8) mode="-mo i8" ;; - *) mode= ;; -esac - -if [ "$gpu" != "" -a "$gpu" != "-" ]; then - gpu="-gpu $gpu" -else - gpu="" -fi - -rm -f $job.cnt -rm -f $job.sts -rm -f $job.out -rm -f $job.log - -# To prevent a mismatch with the python version used by the solver -# do *not* prepend $MENTAT_INSTALL_DIR/python/bin to environment variable PATH -# unset environment variables PYTHONHOME and PYTHONPATH -unset PYTHONHOME -unset PYTHONPATH - -"${DIR}/tools/run_damask_l" $slv -j $job -v n -b y $nprocds $nprocd -autorst $autorst \ - $srcfile $restart $postfile $viewfactorsfile $hostfile \ - $compat $copy_datfile $copy_postfile $scr_dir $dcoup \ - $nthread $nsolver $mode $gpu > /dev/null 2>&1 -sleep 1 -exit 0 diff --git a/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms b/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms deleted file mode 100644 index cea791ed3..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms +++ /dev/null @@ -1,3206 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif - -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms - -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.f90" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 14 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION/\{GPU}" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads, \ - and(job_solver_mfront_sparse,\ - job_nonsym_off,\ - *job_option solver_use_gpu:on))" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 12 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - - display { - position = +4 - size 23 4 - display job_solver_gpu - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } - } - } - } - } - - button { - position 1 +16 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 16 6 - text "ADV. JOB SUBM." - popmenu job_submit_adv_pm - } - - button { - position +16 = - size 16 6 - text "DAMASK" - popmenu damask - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 113 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - - -#-------------------------------------------------------------------------------------------------- -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - - mode dialog -} - - -#-------------------------------------------------------------------------------------------------- -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - label { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 16 - nvisible 16 - texts "DEFAULT" -#if 0 - "2013" -#endif - "2012" - "2011" - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2013" -#endif - "job_input_version_2012" - "job_input_version_2011" - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2013" -#endif - "*job_option version:2012" - "*job_option version:2011" - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2013" -#endif - "job_allows_input_version_2012" - "job_allows_input_version_2011" - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "\{DCOM}" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - -#-------------------------------------------------------------------------------------------------- -popmenu damask { - -#ifdef QT_MENTAT - text "DAMASK.MPIE.DE" -#endif - - group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "DAMASK.MPIE.DE" - } -#endif - - label { - position 1 6 - size 13 6 - text "Optimzation" - border_width 1 - border_color black - } - - label { - position +13 = - size 20 6 - text "write Input" - border_width 1 - border_color black - } - - label { - position +18 = - size 30 6 - text "do not write Inp." - border_width 1 - border_color black - } - - label { - position -32 +6 - size 12 6 - text "O2 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 4 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 4 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O1 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 5 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 5 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O0 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 6 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 6 *monitor_job" - } - - label { - position -29 +8 - size 9 6 - text "O2" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 7 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 7 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O1" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 8 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 8 *monitor_job" - } - - label { - position -29 +6 - size 9 6 - text "O0" - border_width 1 - border_color black - } - - popdown { - position +9 = - size 20 6 - text "Submit" - command "*submit_job 9 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 9 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "CANCEL" - } -} - - - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} - -#-------------------------------------------------------------------------------------------------- -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT - - text { - position 1 5 - size 84 74 - multiline - readonly - display "job_exit_msg" - } - -#endif - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - - mode dialog -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_user_source_pm { - - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION/\{GPU}" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION/GPU" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 35 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +36 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_generator_gr { - - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_fea_solver_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - help job_param - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - - -#ifdef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { - -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 76 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { - -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - help job_param - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - label { - position 1 +4 - size 15 4 - border_width 1 - border_color black - text "GRAPH" - } - - roller { - position +15 = - size 15 4 - nvalues 2 - texts "COARSE" - "FINE" - help ddm_decomp_coarse_graph - rollers "*job_option ddm_graph:coarse" - "*job_option ddm_graph:fine" - commands "*job_option ddm_graph:coarse" - "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - label { - position 1 +4 - size 15 4 - border_width 1 - border_color black - text "QUADRATIC ELEMENTS" - } - - roller { - position +15 = - size 15 4 - nvalues 2 - texts "GENUINE" - "LINEARIZED" - help job_run_ddm_decomp_linearized - rollers "*job_option ddm_quadr_elems:genuine" - "*job_option ddm_quadr_elems:linearized" - commands "*job_option ddm_quadr_elems:genuine" - "*job_option ddm_quadr_elems:linearized" - } - -#ifdef QT_MENTAT - label { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - help job_param - } -#else - button { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } -#endif - - text { - position +15 = - size 15 4 - display "job_param_value_ddm_elem_weight_factor" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } - - toggle { - position 1 +5 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - help job_run_ddm_decomp_detect_contact - } - -#ifdef QT_MENTAT - label { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - visible "*job_option ddm_detect_contact:on" - } -#else - button { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } -#endif - - text { - position +15 = - size 15 4 - command "*set_ddm_contact_tolerance" - display "job_param_value_ddm_contact_tolerance" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } - -#ifdef QT_MENTAT - label { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - visible "*job_option ddm_detect_contact:on" - } -#else - button { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } -#endif - - text { - position +15 = - size 15 4 - display "job_param_value_ddm_contact_constr_factor" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +77 - size 32 8 - text "OK" - } -#else - frame { - position 0 +77 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_direction_gr { - - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_gr { - - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_meth_gr { - - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_preprocessor_gr { - - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } - - frame { - position 1 +9 - size 46 8 - group job_solver_gpu_gr - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - - -#-------------------------------------------------------------------------------------------------- -group job_run_solver_ddm_opts_gr { - - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_parallel_off_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_parallel_on_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_nsolver_procs_ddm_automatic_gr { - - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_nsolver_procs_ddm_user_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - help job_param - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_mfront_sparse_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_gpu_gr { - - toggle { - position 0 0 - size 30 4 - text "USE \{GPU(s)}" - toggle "*job_option solver_use_gpu:on" - true_command "*job_option solver_use_gpu:on" - false_command "*job_option solver_use_gpu:off" - help job_solver_gpu - } - - label { - position +2 +4 - size 16 4 - text "\{GPU} SELECTION" - border_width 1 - border_color black - visible "*job_option solver_use_gpu:on" - } - - roller { - position +16 = - size 12 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - rollers "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - visible "*job_option solver_use_gpu:on" - help job_solver_gpu - } - - text { - position +12 = - size 16 4 - display job_solver_gpus - command "*clear_job_solver_gpus *job_solver_gpus" - visible "and(*job_option solver_use_gpu:on,*job_option solver_gpus:user)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_pardiso_parallel_off_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_pardiso_parallel_on_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_pardiso_multi_threads_ddm_automatic_gr { - - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_pardiso_multi_threads_ddm_user_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - help job_param - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_network_gr { - - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_network_ddm_gr { - - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu marc_integer_size_pm { - - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - - -#-------------------------------------------------------------------------------------------------- -group marc_integer_size_gr { - - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms.org b/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms.org deleted file mode 100644 index 4b7a8f2c1..000000000 --- a/installation/mods_MarcMentat/2013/Mentat_menus/job_run.ms.org +++ /dev/null @@ -1,3003 +0,0 @@ -#ifndef AUTOFORGE -popmenu job_title_pm file jobs.ms -popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif - -group job_solver_gr file job_common.ms -group user_domains_gr file domain_decomposition.ms -group user_domains_generate_gr file domain_decomposition.ms -group user_domains_tail_gr file domain_decomposition.ms -group job_solver_opts_gr file job_common.ms -popmenu ddm_options file job_common.ms - -#ifdef QT_MENTAT -browser edit_browser file file.ms -browser directory_browser file file.ms -screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu usersub_file_browser_pm { - - group { -#endif - - browser usersub_file_browser { - position 0 0 - size 82 72 - text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.F" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$usersub_file_browser_command" ($usersub_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu host_file_browser_pm { - - group { -#endif - - browser host_file_browser { - position 0 0 - size 82 72 - text "$host_file_browser_label" ($host_file_browser_label) - filter "*" - nvisible 10 - select_files true - cancel_action popdown - ok_action popdown - command "$host_file_browser_command" ($host_file_browser_command) - } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_run_popmenu { - -#ifdef QT_MENTAT - text "RUN JOB" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "RUN JOB" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - button { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 24 4 - text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT - browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif - settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" - set $usersub_file_browser_command "*job_usersub_file" - help job_usersub_file - } - - toggle { - position +26 = - size 22 4 - text "SELECTED USER SUBS" - toggle job_usersubs - help job_run_seluser - visible job_usersubs - popmenu job_usersub_pm - } - - display { - position 1 +4 - size 48 4 - display job_usersub_file - } - - button { - position 1 +4 - size 12 4 - text "EDIT" - command "*job_edit_usersub_file" - visible job_usersub_file - } - - button { - position +12 = - size 12 4 - text "CLEAR" - command "*job_clear_usersub_file" - visible job_usersub_file - } - - roller { - position +12 = - size 24 4 - nvalues 3 - texts "COMPILE / NO SAVE" - "COMPILE AND SAVE" - "RUN SAVED EXECUTABLE" - help job_run_compile - roller "job_option user_source" - visible job_usersub_file -#ifdef QT_MENTAT - commands "*job_option user_source:compile_nosave" - "*job_option user_source:compile_save" - "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif - } - - frame { - position 1 +6 - size 48 14 - border_width 1 - border_color black - - group { - - toggle { - position 1 1 - size 23 4 - text "PARALLELIZATION/\{GPU}" - help job_run_parallel - toggle "or(*job_option parallel:on, \ - solver_multi_procs, \ - solver_multi_threads, \ - and(job_solver_mfront_sparse,\ - job_nonsym_off,\ - *job_option solver_use_gpu:on))" - popmenu job_run_parallelization_pm - set $popname2 "job_run_parallelization_pm" - } - - frame { - position +23 = - size 23 12 - border_width 1 - border_color black - - group { - - display { - position 0 0 - size 23 4 - display job_ddm_domains - } - - display { - position = +4 - size 23 4 - display job_solver_procs - visible solver_allows_multi_procs - } - - display { - position = = - size 23 4 - display job_solver_threads - visible "and(solver_allows_multi_threads,\ - not(and(job_solver_mfront_sparse,\ - *job_option parallel:on)))" - } - - display { - position = +4 - size 23 4 - display job_solver_gpu - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } - } - } - } - } - - button { - position 1 +16 - size 8 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - -# see also job_common.ms -# see also the ADVANCED JOB SUBMISSION popmenu in this file - - label { - position +10 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 16 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif - help job_option_input_style - } - - button { - position +18 = - size 13 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position 1 +6 - size 16 6 - text "SUBMIT (1)" - command "*submit_job 1 *monitor_job" - } - - button { - position +16 = - size 32 6 - text "ADVANCED JOB SUBMISSION" - popmenu job_submit_adv_pm - } - - button { - position 1 +6 - size 16 6 - text "UPDATE" - command "*update_job" - } - - button { - position +16 = - size 16 6 - text "MONITOR" - command "*monitor_job" - } - - button { - position +16 = - size 16 6 - text "KILL" - command "*kill_job *monitor_job" - } - - label { - position 1 +7 - size 32 4 - text "STATUS" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_status" - } - - label { - position -32 +4 - size 32 4 - text "CURRENT INCREMENT (CYCLE)" - border_width 1 - border_color black - } - - display { - position +32 = - size 16 4 - display "job_increment" - } - - label { - position -32 +4 - size 32 4 - text "SINGULARITY RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_singularity_ratio" - } - - label { - position -32 +4 - size 32 4 - text "CONVERGENCE RATIO" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_convergence_ratio" - } - - - label { - position 1 +4 - size 32 4 - text "ANALYSIS TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_analysis_time" - } - - label { - position -32 +4 - size 32 4 - text "WALL TIME" - border_width 1 - border_color black - } - - float { - position +32 = - size 16 4 - display "job_time" - } - - frame { - position 1 +4 - size 48 8 - - group { - - frame { - position 0 0 - size 48 8 - text "TOTAL" - border_width 1 - border_color black - group { - - label { - position +6 = - size 12 4 - text "CYCLES" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_cycles" - border_width 1 - border_color black - } - - label { - position -12 +4 - size 12 4 - text "SEPARATIONS" - border_width 1 - border_color black - } - - integer { - position +12 = - size 10 4 - display "acc_job_separations" - border_width 1 - border_color black - } - - label { - position +10 -4 - size 10 4 - text "CUT BACKS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_cut_backs" - border_width 1 - border_color black - } - - label { - position -10 +4 - size 10 4 - text "REMESHES" - border_width 1 - border_color black - } - - integer { - position +10 = - size 10 4 - display "acc_job_remeshes" - border_width 1 - border_color black - } - } - } - } - } - - label { - position 1 +8 - size 18 4 - text "EXIT NUMBER" - border_width 1 - border_color black - } - - integer { - position +18 = - size 10 4 - display "job_exit" - } - - button { - position +10 = - size 20 4 - text "EXIT MESSAGE" - popmenu job_exit_msg_pm - help exit_message - } - - label { - position 1 +6 - size 5 4 - text "EDIT" - border_width 1 - border_color black - } - - button { - position +5 = - size 12 4 - text "OUTPUT FILE" - command "*job_edit_output" - } - - button { - position +12 = - size 9 4 - text "LOG FILE" - command "*job_edit_log_file" - } - - button { - position +9 = - size 12 4 - text "STATUS FILE" - command "*job_edit_status_file" - } - - button { - position +12 = - size 10 4 - text "ANY FILE" - settext $edit_browser_label "EDIT FILE" - set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT - browser edit_browser -#else - popmenu edit_browser_popmenu -#endif - help edit_file - } - - popdown { - position 1 +6 - size 32 4 - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" - } - - button { - position 1 +6 - size 12 8 - text "RESET" - command "*job_submit_reset" - } - - popdown { - position +36 = - size 12 8 - text "OK" - } - } - - window job_run_wi { - parent mentat - origin 35 4 - size 50 113 - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - - -#-------------------------------------------------------------------------------------------------- -popmenu job_usersub_pm { - -#ifdef QT_MENTAT - text "CURRENTLY SELECTED USER SUBROUTINES" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif - - display { - position 1 +5 - size 64 86 - display "job_usersubs" - } - - popdown { - position 27 +88 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 66 102 - background_color body - border_width 1 - border_color border - buffering single - } - - mode dialog -} - - -#-------------------------------------------------------------------------------------------------- -popmenu job_submit_adv_pm { - -#ifdef QT_MENTAT - text "ADVANCED JOB SUBMISSION" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - label { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 19 4 - text "INITIAL ALLOCATION" - border_width 1 - border_color black - } -#ifdef QT_MENTAT - label { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif - text { - position +15 = - size 10 4 - display "job_param_value_general_init_allocation" - command "*job_param general_init_allocation" - help job_param_general_init_allocation - } - - label { - position +10 = - size 4 4 - text "MB" - border_width 1 - border_color black - } - - toggle { - position 1 +5 - size 32 4 - text "OUT-OF-CORE ELEMENT STORAGE" - help job_param_elsto - toggle "*job_option elsto:on" - true_command "*job_option elsto:on" - false_command "*job_option elsto:off" - } - - toggle { - position 1 +4 - size 32 4 - text "OUT-OF-CORE INCREMENTAL BACKUP" - help job_param_inc_backup_storage - toggle "*job_option inc_backup_storage:out_of_core" - true_command "*job_option inc_backup_storage:out_of_core" - false_command "*job_option inc_backup_storage:in_core" - } - - toggle { - position +34 = - size 14 4 - text "CHECK SIZES" - help job_run_check - toggle "*job_option check:on" - true_command "*job_option check:on" - false_command "*job_option check:off" - } - - label { - position 1 +6 - size 16 4 - text "INTEGER SIZE" - border_width 1 - border_color black - } - - roller { - position +16 = - size 32 4 - nvalues 3 - texts "DEFAULT" - "4-BYTE INTEGERS" - "8-BYTE INTEGERS" -#ifdef QT_MENTAT - commands "*job_option marc_integer_size:default" - "*job_option marc_integer_size:i4" - "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif - help job_run_intsize - roller "job_option marc_integer_size" - } - - frame { - position 1 +6 - size 48 12 - text "MARC INPUT FILE" - border_width 1 - border_color black - - group { - - label { - position 0 4 - size 9 4 - text "VERSION" - border_width 1 - border_color black - } - - roller { - position +9 = - size 14 4 - nvalues 16 - nvisible 16 - texts "DEFAULT" -#if 0 - "2013" -#endif - "2012" - "2011" - "2010.2" - "2010" - "2008" - "2007" - "2005R3" - "2005" - "2003" - "2001" - "2000" -#if 0 - "8" -#endif - "K7" - "K6.2" - "K5" - "K4" - help job_param_version - rollers "job_input_version_default" -#if 0 - "job_input_version_2013" -#endif - "job_input_version_2012" - "job_input_version_2011" - "job_input_version_2010.2" - "job_input_version_2010" - "job_input_version_2008" - "job_input_version_2007" - "job_input_version_2005r3" - "job_input_version_2005" - "job_input_version_2003" - "job_input_version_2001" - "job_input_version_2000" -#if 0 - "job_input_version_8" -#endif - "job_input_version_k7" - "job_input_version_k6" - "job_input_version_k5" - "job_input_version_k4" -#ifdef QT_MENTAT - commands "*job_option version:default" -#if 0 - "*job_option version:2013" -#endif - "*job_option version:2012" - "*job_option version:2011" - "*job_option version:2010.2" - "*job_option version:2010" - "*job_option version:2008" - "*job_option version:2007" - "*job_option version:2005r3" - "*job_option version:2005" - "*job_option version:2003" - "*job_option version:2001" - "*job_option version:2000" -#if 0 - "*job_option version:8" -#endif - "*job_option version:k7" - "*job_option version:k6" - "*job_option version:k5" - "*job_option version:k4" - visibles "job_allows_input_version_default" -#if 0 - "job_allows_input_version_2013" -#endif - "job_allows_input_version_2012" - "job_allows_input_version_2011" - "job_allows_input_version_2010.2" - "job_allows_input_version_2010" - "job_allows_input_version_2008" - "job_allows_input_version_2007" - "job_allows_input_version_2005r3" - "job_allows_input_version_2005" - "job_allows_input_version_2003" - "job_allows_input_version_2001" - "job_allows_input_version_2000" -#if 0 - "job_allows_input_version_8" -#endif - "job_allows_input_version_k7" - "job_allows_input_version_k6" - "job_allows_input_version_k5" - "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif - } - -# see also job_common.ms -# see also the RUN JOB popmenu in this file - - label { - position +14 = - size 7 4 - text "STYLE" - border_width 1 - border_color black - } - - roller { - position +7 = - size 18 4 - nvalues 3 - texts "TABLE-DRIVEN" - "MULTI-PHYSICS" - "OLD" - rollers "job_input_style_table_driven" - "job_input_style_multi_physics" - "job_input_style_old" -#ifdef QT_MENTAT - commands "*job_option input_style:new *job_option input_physics_style:old" - "*job_option input_physics_style:new *job_option input_style:new" - "*job_option input_style:old *job_option input_physics_style:old" - visibles "job_allows_input_style_table_driven" - "job_allows_input_style_multi_physics" - "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif - help job_option_input_style - } - - toggle { - position 0 +4 - size 48 4 - text "EXTENDED PRECISION" - help job_run_precision - toggle "*job_option inp_file_prec:extended" - true_command "*job_option inp_file_prec:extended" - false_command "*job_option inp_file_prec:normal" - } - } - } - - button { - position 1 +14 - size 24 4 - text "SCRATCH DIRECTORY" - settext $directory_browser_label "JOB SCRATCH DIRECTORY" - set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT - browser directory_browser -#else - popmenu directory_browser_popmenu -#endif - help job_scratch_directory - } - - button { - position +24 = - size 24 4 - text "CLEAR" - command "*job_clear_scratch_directory" - visible job_scratch_directory - } - - text { - position 1 +4 - size 48 4 - display job_scratch_dir - command "*job_scratch_directory" - } - -#ifdef DCOM - toggle { - position 1 +6 - size 8 4 - text "\{DCOM}" - toggle "*job_option dcom:on" - help job_run_dcom - true_command "*job_option dcom:on" - false_command "*job_option dcom:off" - visible win32_available - } - - button { - position +8 = - size 12 4 - text "HOSTNAME" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } - - text job_dcom_hostname { - position +12 = - size 28 4 - display "job_dcom_hostname" - command "*job_dcom_hostname" - visible "and(win32_available, *job_option dcom:on)" - } -#endif - - button { - position 1 +6 - size 24 4 - text "TITLE" - popmenu job_title_pm - command "*job_title" - } - - button { - position +24 = - size 24 4 - text "SAVE MODEL" - command "*save_model" - } - - button { - position +4 +6 - size 20 4 - text "WRITE INPUT FILE" - command "*job_write_input" - } - - button { - position = +4 - size 20 4 - text "EDIT INPUT FILE" - command "*job_edit_input" - } - - popdown { - position 1 +5 - size 20 6 - text "SUBMIT 1" - command "*submit_job 1 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 1" - command "*execute_job 1 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 2" - command "*submit_job 2 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 2" - command "*execute_job 2 *monitor_job" - } - - popdown { - position -28 +6 - size 20 6 - text "SUBMIT 3" - command "*submit_job 3 *monitor_job" - } - - popdown { - position +28 = - size 20 6 - text "EXECUTE 3" - command "*execute_job 3 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - - -#-------------------------------------------------------------------------------------------------- -popmenu job_exit_msg_pm { - -#ifdef QT_MENTAT - text "EXIT MESSAGE" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT - - text { - position 1 5 - size 84 74 - multiline - readonly - display "job_exit_msg" - } - -#endif - popdown { - position 37 +76 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 86 90 - background_color body - border_width 1 - border_color border - buffering single - } - - mode dialog -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_user_source_pm { - - window { - parent job_run_wi - origin 25 17 - size 24 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_user_source_gr { - popdown { - position 0 0 - size 24 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 24 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 24 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 24 4 - text "CANCEL" - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_run_parallelization_pm { - -#ifdef QT_MENTAT - text "PARALLELIZATION/\{GPU}" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "PARALLELIZATION/GPU" - } -#endif - -#ifdef QT_MENTAT - label { - position 0 0 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { -#ifdef QT_MENTAT - position 1 9 -#else - position 1 5 -#endif - size 48 28 - group job_ddm_gr - text "DOMAIN DECOMPOSITION" - border_width 1 - border_color black - } - - frame { - position 1 +29 - size 48 35 - group job_parallel_matrix_solver_gr - text "MATRIX SOLVER" - border_width 1 - border_color black - } - - frame { - position 1 +36 - size 48 28 - group job_parallel_env_gr - text "PARALLELIZATION ENVIRONMENT" - border_width 1 - border_color black - visible "or(*job_option parallel:on, \ - solver_multi_procs)" - } - - popdown { - position 19 +30 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 38 8 - size 50 109 - background_color body - border_width 1 - border_color border - buffering single - } -#ifdef QT_MENTAT - mode permanent -#else - mode dialog -#endif -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_gr { - - toggle { - position 1 4 - size 30 4 - text "USE \{DDM}" - toggle "*job_option parallel:on" - help job_run_ddm_use - true_command "*job_option parallel:on" - false_command "*job_option parallel:off" - } - - frame { - position +2 +5 - size 44 18 - group job_ddm_use_gr - visible "*job_option parallel:on" - } -} - -group job_ddm_use_gr { - roller { - position 0 0 - size 30 4 - nvalues 2 - texts "DECOMPOSITION IN MARC" - "DECOMPOSITION IN MENTAT" - roller "job_option ddm_generator" -#ifdef QT_MENTAT - commands "*job_option ddm_generator:fea_solver" - "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif - help job_run_ddm_generator - } - - frame { - position 0 +5 - size 44 8 - group job_ddm_fea_solver_gr - visible "*job_option ddm_generator:fea_solver" - } - - frame { - position = = - size 44 8 - group job_ddm_preprocessor_gr - visible "*job_option ddm_generator:preprocessor" - } - - text { - position 0 +9 - size 22 4 - text "SINGLE INPUT FILE" - readonly - visible "*job_option ddm_generator:fea_solver" - } - - roller { - position = = - size 22 4 - nvalues 2 - texts "MULTIPLE INPUT FILES" - "SINGLE INPUT FILE" - roller "job_option ddm_single_input" - commands "*job_option ddm_single_input:off" - "*job_option ddm_single_input:on" - visible "*job_option ddm_generator:preprocessor" - help job_run_ddm_single_input - } - - roller { - position +23 = - size 21 4 - nvalues 2 - texts "MULTIPLE POST FILES" - "SINGLE POST FILE" - roller "job_option ddm_single_post" - commands "*job_option ddm_single_post:off" - "*job_option ddm_single_post:on" - help job_run_ddm_single_post - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 26 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_generator_gr { - - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_fea_solver_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 10 4 - text "# DOMAINS" - help job_param - } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - - text { - position +10 = - size 4 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position +4 = - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif - } - - button { - position +4 +4 - size 19 4 - text "ADVANCED SETTINGS" -#ifdef QT_MENTAT - popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 31 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - - -#ifdef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_fea_solver_pm { - - text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif - - group { - units 32 120 - -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif - - label { - position 0 5 - size 6 4 - text "NAME" - } - - display { - position +6 = - size 26 4 - display "job_name" - } - -#ifdef QT_MENTAT - label { - position 0 +4 - size 6 4 - text "TYPE" - } - - display { - position +6 = - size 26 4 - display job_class_label - } -#endif - - frame { - -#ifdef QT_MENTAT - position 0 +9 -#else - position 0 +5 -#endif - size 32 76 - text "ADVANCED DECOMPOSITION IN MARC" - border_width 1 - border_color black - - group { - -#ifdef QT_MENTAT - label { - position 1 4 - size 16 4 - text "# DOMAINS" - help job_param - } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif - - text { - position +16 = - size 14 4 - display "job_param_value_ndomains" - command "*job_param ndomains" - } - - label { - position 1 +4 - size 7 4 - text "METHOD" - border_width 1 - border_color black - } - - roller { - position +7 = - size 23 4 - nvalues 7 - texts "METIS BEST" - "METIS ELEMENT" - "METIS NODE" - "REC. COORD. BISECTION" - "VECTOR" - "RADIAL" - "ANGULAR" - help set_job_decomp_type - rollers "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#ifdef QT_MENTAT - commands "*job_option ddm_method:metis_best" - "*job_option ddm_method:metis_element_based" - "*job_option ddm_method:metis_node_based" - "*job_option ddm_method:recur_coord_bisect" - "*job_option ddm_method:vector" - "*job_option ddm_method:radial" - "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif - } - - frame { - position 1 +5 - size 30 20 - group job_ddm_direction_gr - visible "or(*job_option ddm_method:vector, \ - *job_option ddm_method:radial, \ - *job_option ddm_method:angular)" - } - - toggle { - position 1 +21 - size 30 4 - text "DOMAIN ISLAND REMOVAL" - toggle "*job_option ddm_island_removal:on" - true_command "*job_option ddm_island_removal:on" - false_command "*job_option ddm_island_removal:off" - } - - label { - position 1 +4 - size 15 4 - border_width 1 - border_color black - text "GRAPH" - } - - roller { - position +15 = - size 15 4 - nvalues 2 - texts "COARSE" - "FINE" - help ddm_decomp_coarse_graph - rollers "*job_option ddm_graph:coarse" - "*job_option ddm_graph:fine" - commands "*job_option ddm_graph:coarse" - "*job_option ddm_graph:fine" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - } - - label { - position 1 +4 - size 15 4 - border_width 1 - border_color black - text "QUADRATIC ELEMENTS" - } - - roller { - position +15 = - size 15 4 - nvalues 2 - texts "GENUINE" - "LINEARIZED" - help job_run_ddm_decomp_linearized - rollers "*job_option ddm_quadr_elems:genuine" - "*job_option ddm_quadr_elems:linearized" - commands "*job_option ddm_quadr_elems:genuine" - "*job_option ddm_quadr_elems:linearized" - } - -#ifdef QT_MENTAT - label { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - help job_param - } -#else - button { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } -#endif - - text { - position +15 = - size 15 4 - display "job_param_value_ddm_elem_weight_factor" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } - - toggle { - position 1 +5 - size 30 4 - text "DETECT CONTACT" - toggle "*job_option ddm_detect_contact:on" - true_command "*job_option ddm_detect_contact:on" - false_command "*job_option ddm_detect_contact:off" - visible "or(*job_option ddm_method:metis_best, \ - *job_option ddm_method:metis_element_based, \ - *job_option ddm_method:metis_node_based)" - help job_run_ddm_decomp_detect_contact - } - -#ifdef QT_MENTAT - label { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - visible "*job_option ddm_detect_contact:on" - } -#else - button { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } -#endif - - text { - position +15 = - size 15 4 - command "*set_ddm_contact_tolerance" - display "job_param_value_ddm_contact_tolerance" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } - -#ifdef QT_MENTAT - label { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - visible "*job_option ddm_detect_contact:on" - } -#else - button { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } -#endif - - text { - position +15 = - size 15 4 - display "job_param_value_ddm_contact_constr_factor" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } - } - } - -#ifdef QT_MENTAT - popdown { - position 0 +77 - size 32 8 - text "OK" - } -#else - frame { - position 0 +77 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif - } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else - mode permanent -} # job_ddm_fea_solver_pm -#endif - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_direction_gr { - - button { - position 0 0 - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "*job_option ddm_method:vector" - } - - button { - position = = - size 15 4 - text "DIRECTION" - command "*job_vector ddm_sort_direction_x" - visible "not(*job_option ddm_method:vector)" - } - - button { - position +15 = - size 15 4 - text "FROM / TO" - command "*job_vector_from_to ddm_sort_direction_x" - } - - text { - position -15 +4 - size 10 4 - command "*job_param ddm_sort_direction_x" - display "job_param_value_ddm_sort_direction_x" - help ddm_job_decomp_user_direction_x - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_y" - display "job_param_value_ddm_sort_direction_y" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_direction_z" - display "job_param_value_ddm_sort_direction_z" - } - - frame { - position 0 +4 - size 30 8 - group job_ddm_sort_point_gr - visible "not(*job_option ddm_method:vector)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_gr { - - label { - position 0 0 - size 14 4 - border_width 1 - border_color black - text "POINT ON AXIS" - } - - roller { - position +14 = - size 10 4 - nvalues 2 - texts "DEFAULT" - "USER" - roller "job_option ddm_sort_point" -#ifdef QT_MENTAT - commands "*job_option ddm_sort_point:default" - "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif - } - - button { - position +10 = - size 6 4 - text "SET" - command "*job_position ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position 0 +4 - size 10 4 - command "*job_param ddm_sort_point_x" - display "job_param_value_ddm_sort_point_x" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_y" - display "job_param_value_ddm_sort_point_y" - visible "*job_option ddm_sort_point:user" - } - - text { - position +10 = - size 10 4 - command "*job_param ddm_sort_point_z" - display "job_param_value_ddm_sort_point_z" - visible "*job_option ddm_sort_point:user" - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_meth_gr { - - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_preprocessor_gr { - - label { - position 0 0 - size 10 4 - text "# DOMAINS" - border_width 1 - border_color black - } - - integer { - position +10 = - size 4 4 - display valid_domains - } - - button { - position +4 = - size 30 4 - text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif - help job_run_ddm_user_domains - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_matrix_solver_gr { - - label { - position 3 4 - size 12 4 - text "SOLUTION" - border_width 1 - border_color black - } - - roller { - position +12 = - size 18 4 - nvalues 2 - texts "SYMMETRIC" - "NONSYMMETRIC" - rollers job_nonsym_off - job_nonsym_on - commands "*job_option solver_nonsym:off" - "*job_option solver_nonsym:on" - help job_param_solver_method - } - - label { - position -12 +4 - size 6 4 - text "TYPE" - border_width 1 - border_color black - } - - roller { - position +6 = - size 24 4 - nvalues 9 - help job_param_solver_method - texts "MULTIFRONTAL SPARSE" - "MIXED DIRECT-ITERATIVE" - "CASI ITERATIVE" - "PARDISO DIRECT SPARSE" - "MUMPS PARALLEL DIRECT" - "HARDWARE SPARSE" - "ITERATIVE SPARSE" - "DIRECT PROFILE" - "DIRECT SPARSE" - rollers job_solver_mfront_sparse - job_solver_mixed_direct_iterative - job_solver_it_ext - job_solver_pardiso - job_solver_mumps - job_solver_sparse - job_solver_it_sparse - job_solver_dir_profile - job_solver_dir_sparse -#ifdef QT_MENTAT - commands "*job_option solver:mfront_sparse" - "*job_option solver:mixed_direct_iterative" - "*job_option solver:it_ext" - "*job_option solver:pardiso" - "*job_option solver:mumps" - "*job_option solver:sparse" - "*job_option solver:it_sparse" - "*job_option solver:dir_profile" - "*job_option solver:dir_sparse" - visibles job_allows_solver_mfront_sparse - job_allows_solver_mixed_direct_iterative - job_allows_solver_it_ext - job_allows_solver_pardiso - job_allows_solver_mumps - job_allows_solver_sparse - job_allows_solver_it_sparse - job_allows_solver_dir_profile - job_allows_solver_dir_sparse - help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif - } - - button { - position +24 = - size 14 4 - text "OPTIONS" - popmenu job_parallel_matrix_solver_opt_pm - } - - frame { - position = +4 - size 14 4 - group job_run_solver_ddm_opts_gr - visible "*job_option parallel:on" - } - - frame { - position 1 +5 - size 46 8 - group job_solver_multi_procs_gr - visible solver_allows_multi_procs - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_gr - visible solver_allows_multi_threads - } - - frame { - position 1 +9 - size 46 8 - group job_solver_gpu_gr - visible "and(job_solver_mfront_sparse,job_nonsym_off)" - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 54 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif - - -#-------------------------------------------------------------------------------------------------- -popmenu job_parallel_matrix_solver_opt_pm { - -#ifdef QT_MENTAT - text "MATRIX SOLVER OPTIONS" -#endif - - group { - -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif - - frame { - position 1 5 - size 36 23 - group job_solver_opts_gr - } - - popdown { - position 13 +25 - size 12 8 - text "OK" - } - } - - window { - parent mentat - origin 41 12 - size 38 39 - border_width 1 - border_color border - background_color body - } - mode dialog -} - - -#-------------------------------------------------------------------------------------------------- -group job_run_solver_ddm_opts_gr { - - button { - position 0 0 - size 14 4 - text "\{DDM} OPTIONS" - popmenu ddm_options -# see also job_common.ms! - visible "not(or(job_solver_it_sparse, \ - job_solver_it_ext, \ - job_solver_mixed_direct_iterative, \ - job_solver_pardiso, \ - job_solver_mumps))" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_gr { - frame { - position 0 0 - size 46 8 - group job_solver_multi_procs_parallel_off_gr - visible "*job_option parallel:off" - } - - frame { - position = = - size 46 8 - group job_solver_multi_procs_parallel_on_gr - visible "*job_option parallel:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_parallel_off_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - true_command "*job_option nsolver_procs_serial:on" - false_command "*job_option nsolver_procs_serial:off" - toggle "*job_option nsolver_procs_serial:on" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option nsolver_procs_serial:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_procs_parallel_on_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_width 1 - border_color black - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - help job_run_multithreading - rollers "*job_option nsolver_procs_ddm:automatic" - "*job_option nsolver_procs_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_nsolver_procs_ddm_automatic_gr - visible "*job_option nsolver_procs_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_nsolver_procs_ddm_user_gr - visible "*job_option nsolver_procs_ddm:user" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_nsolver_procs_ddm_automatic_gr { - - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_nsolver_procs_ddm_user_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - help job_param - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif - - text { - position +8 = - size 8 4 - display "job_param_value_nsolver_procs" - command "*job_param nsolver_procs" - } -} - -group job_solver_multi_threads_gr { - frame { - position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr - visible "and(job_solver_mfront_sparse,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_off_gr - visible "and(job_solver_pardiso,*job_option parallel:off)" - } - - frame { - position = = - size 46 8 - group job_solver_multi_threads_pardiso_parallel_on_gr - visible "and(job_solver_pardiso,*job_option parallel:on)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_mfront_sparse_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option mfront_sparse_multi_threading:on" - true_command "*job_option mfront_sparse_multi_threading:on" - false_command "*job_option mfront_sparse_multi_threading:off" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option mfront_sparse_multi_threading:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_gpu_gr { - - toggle { - position 0 0 - size 30 4 - text "USE \{GPU(s)}" - toggle "*job_option solver_use_gpu:on" - true_command "*job_option solver_use_gpu:on" - false_command "*job_option solver_use_gpu:off" - help job_solver_gpu - } - - label { - position +2 +4 - size 16 4 - text "\{GPU} SELECTION" - border_width 1 - border_color black - visible "*job_option solver_use_gpu:on" - } - - roller { - position +16 = - size 12 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - rollers "*job_option solver_gpus:automatic" - "*job_option solver_gpus:user" - visible "*job_option solver_use_gpu:on" - help job_solver_gpu - } - - text { - position +12 = - size 16 4 - display job_solver_gpus - command "*clear_job_solver_gpus *job_solver_gpus" - visible "and(*job_option solver_use_gpu:on,*job_option solver_gpus:user)" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_pardiso_parallel_off_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - toggle "*job_option pardiso_multi_threading:on" - true_command "*job_option pardiso_multi_threading:on" - false_command "*job_option pardiso_multi_threading:off" - help job_run_multithreading - } - -#ifdef QT_MENTAT - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - visible "*job_option pardiso_multi_threading:on" - help job_param - } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif - - text { - position +14 = - size 14 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_pardiso_parallel_on_gr { - - toggle { - position 0 0 - size 30 4 - text "MULTIPLE SOLVER PROCESSES" - help job_run_multithreading - toggle true -#ifdef QT_MENTAT - set $dummy dummy -#endif - } - - label { - position +2 +4 - size 14 4 - text "# PROCESSES" - border_color black - border_width 1 - } - - roller { - position +14 = - size 14 4 - nvalues 2 - texts "AUTOMATIC" - "USER" - commands "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - help job_run_multithreading - rollers "*job_option pardiso_multi_threading_ddm:automatic" - "*job_option pardiso_multi_threading_ddm:user" - } - - frame { - position +14 = - size 16 4 - group job_pardiso_multi_threads_ddm_automatic_gr - visible "*job_option pardiso_multi_threading_ddm:automatic" - } - - frame { - position = = - size 16 4 - group job_pardiso_multi_threads_ddm_user_gr - visible "*job_option pardiso_multi_threading_ddm:user" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_pardiso_multi_threads_ddm_automatic_gr { - - label { - position 0 0 - size 8 4 - text "VALUE" - border_width 1 - border_color black - } - - integer { - position +8 = - size 8 4 - display valid_domains - visible "*job_option ddm_generator:preprocessor" - } - - integer { - position = = - size 8 4 - display "job_param_ndomains" - visible "*job_option ddm_generator:fea_solver" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_pardiso_multi_threads_ddm_user_gr { - -#ifdef QT_MENTAT - label { - position 0 0 - size 8 4 - text "VALUE" - help job_param - } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif - - text { - position +8 = - size 8 4 - display "job_param_value_nthreads" - command "*job_param nthreads" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_gr { - - roller { - position 1 4 - size 30 4 - nvalues 2 - texts "SINGLE MACHINE" - "NETWORK" - help job_run_ddm_setup - roller "job_option parallel_setup" - commands "*job_option parallel_setup:single" - "*job_option parallel_setup:network" - } - - frame { - position +2 +5 - size 44 18 - group job_parallel_env_network_gr - visible "*job_option parallel_setup:network" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_network_gr { - - button { - position 0 0 - size 28 4 - text "HOST FILE" -#ifdef QT_MENTAT - browser host_file_browser -#else - popmenu host_file_browser_pm -#endif - settext $host_file_browser_label "SELECT HOST FILE" - set $host_file_browser_command "*job_host_file" - help job_host_file - } - - button { - position +28 = - size 8 4 - text "EDIT" - command "*job_edit_host_file" - help job_edit_host_file - visible job_host_file - } - - button { - position +8 = - size 8 4 - text "CLEAR" - command "*job_clear_host_file" - help job_clear_host_file - visible job_host_file - } - - display { - position 0 +4 - size 44 4 - display job_host_file - } - - frame { - position 0 +5 - size 44 9 - group job_parallel_env_network_ddm_gr - visible "*job_option parallel:on" - } -} - - -#-------------------------------------------------------------------------------------------------- -group job_parallel_env_network_ddm_gr { - - toggle { - position 0 0 - size 22 4 - text "COPY INPUT FILE" - toggle "*job_option copy_input_file:on" - true_command "*job_option copy_input_file:on" - false_command "*job_option copy_input_file:off" - help job_host_copy_inputfile - } - - toggle { - position +23 = - size 21 4 - text "COPY POST FILE" - toggle "*job_option copy_post_file:on" - true_command "*job_option copy_post_file:on" - false_command "*job_option copy_post_file:off" - help job_host_copy_inputfile - } - - label { - position 0 +5 - size 10 4 - text "HOSTS" - border_width 1 - border_color black - visible job_usersub_file - } - - roller { - position +10 = - size 18 4 - nvalues 2 - texts "COMPATIBLE" - "INCOMPATIBLE" - roller "job_option network_hosts" - commands "*job_option network_hosts:compatible" - "*job_option network_hosts:incompatible" - help job_host_comp - visible job_usersub_file - } -} - - -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu marc_integer_size_pm { - - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - - -#-------------------------------------------------------------------------------------------------- -group marc_integer_size_gr { - - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif -#endif diff --git a/installation/mods_MarcMentat/2014.2/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2014.2/Marc_tools/include_linux64 index 8fa7da85b..ba9258f1e 100644 --- a/installation/mods_MarcMentat/2014.2/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2014.2/Marc_tools/include_linux64 @@ -679,9 +679,9 @@ else fi if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" + MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group" else - MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" + MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group" fi SECLIBS="-L$MARC_LIB -llapi" diff --git a/installation/mods_MarcMentat/2014/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2014/Marc_tools/include_linux64 index 07bd73778..b7e6bb140 100644 --- a/installation/mods_MarcMentat/2014/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2014/Marc_tools/include_linux64 @@ -673,9 +673,9 @@ else fi if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB="$MARC_MKL/libmkl_blacs_lp64.a $MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a " + MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group" else - MKLLIB="$MARC_MKL/libmkl_blacs_ilp64.a $MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a " + MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group" fi SECLIBS="-L$MARC_LIB -llapi" diff --git a/installation/mods_MarcMentat/2015/Marc_tools/comp_user b/installation/mods_MarcMentat/2015/Marc_tools/comp_user deleted file mode 100644 index 8679bb041..000000000 --- a/installation/mods_MarcMentat/2015/Marc_tools/comp_user +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/ksh -# 1st arg: $DIR -# 2nd arg: $DIRJOB -# 3rd arg: $user -# 4th arg: $program -DIR=$1 -user=$3 -program=$4 -. $DIR/tools/include -DIRJOB=$2 -cd $DIRJOB -echo "Compiling and linking user subroutine $user.f on host `hostname`" -echo "program: $program" - $FORTRAN $user.f || \ - { - echo "$0: compile failed for $user.f" - exit 1 - } - /bin/rm $program 2>/dev/null - userobj=$user.o - - - $LOAD ${program} $DIR/lib/main.o\ - $DIR/lib/blkdta.o $DIR/lib/comm?.o \ - ${userobj-} \ - $DIR/lib/srclib.a \ - $MNFLIBS \ - $MDUSER \ - ../lib/mdsrc.a \ - ../lib/mcvfit.a \ - $STUBS \ - ${SOLVERLIBS} \ - $TKLIBS \ - $MRCLIBS \ - $METISLIBS \ - $SYSLIBS || \ - { - echo "$0: link failed for $user.o on host `hostname`" - exit 1 - } - /bin/rm $userobj diff --git a/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 index 1395d75b1..0a315f85b 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2015/Marc_tools/include_linux64 @@ -442,20 +442,13 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" # determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" +if test -n "$DAMASK_USER"; then + DAMASKROOT=`dirname $DAMASK_USER`/.. + read DAMASKVERSION < $DAMASKROOT/VERSION + DAMASKVERSION="'"$DAMASKVERSION"'" +else + DAMASKVERSION="'N/A'" +fi # DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ @@ -682,9 +675,9 @@ else fi if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" + MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group" else - MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" + MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group" fi SECLIBS="-L$MARC_LIB -llapi" diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask b/installation/mods_MarcMentat/2015/Marc_tools/run_damask index 5286ccfa0..ef792247a 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h index 5ed49f3a2..b77e80157 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_h @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp index 3e3053f04..270e78f17 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_hmp @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l index 86d5464bd..87c63f05a 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_l @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp index 5fe65b829..9c10c5229 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_lmp @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp index 1e3eadf37..5f34b18f5 100644 --- a/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp +++ b/installation/mods_MarcMentat/2015/Marc_tools/run_damask_mp @@ -299,6 +299,20 @@ fi . "$DIR/getarch" +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE # diff --git a/installation/mods_MarcMentat/2015/Mentat_bin/submit1 b/installation/mods_MarcMentat/2015/Mentat_bin/submit1.original similarity index 100% rename from installation/mods_MarcMentat/2015/Mentat_bin/submit1 rename to installation/mods_MarcMentat/2015/Mentat_bin/submit1.original diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_damask rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_h b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask_h similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_damask_h rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask_h diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_hmp b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask_hmp similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_damask_hmp rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask_hmp diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_l b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask_l similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_damask_l rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask_l diff --git a/installation/mods_MarcMentat/2012/Marc_tools/comp_damask_lmp b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask_lmp similarity index 100% rename from installation/mods_MarcMentat/2012/Marc_tools/comp_damask_lmp rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask_lmp diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_damask_mp b/installation/mods_MarcMentat/2016/Marc_tools/comp_damask_mp similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_damask_mp rename to installation/mods_MarcMentat/2016/Marc_tools/comp_damask_mp diff --git a/installation/mods_MarcMentat/2011/Marc_tools/comp_user.original b/installation/mods_MarcMentat/2016/Marc_tools/comp_user.original similarity index 100% rename from installation/mods_MarcMentat/2011/Marc_tools/comp_user.original rename to installation/mods_MarcMentat/2016/Marc_tools/comp_user.original diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64 b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 similarity index 81% rename from installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64 rename to installation/mods_MarcMentat/2016/Marc_tools/include_linux64 index 10cc5f6ce..a6cc7e2f9 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64 +++ b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64 @@ -1,21 +1,17 @@ # -# General definitions for the Marc 2011 version +# General definitions for the Marc 2016 version # # EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) # -# Linux RedHat 5.4 +# Linux RedHat 6.3 / SuSE 11 # # 64 bit MPI version # -# Intel(R) Fortran Compiler -# Version 12.0.4 +# Intel(R) Fortran Intel(R) 64 Compiler XE for applications +# running on Intel(R) 64, Version 15.0.0.090 Build 20140723 # -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE +# Intel(R) C Intel(R) 64 Compiler XE for applications +# running on Intel(R) 64, Version 15.0.0.090 Build 20140723 # # To check the O/S level, type: # uname -a @@ -24,12 +20,9 @@ # 1) HP MPI 2.3 # To check the mpi version, type: # mpirun -version -# 2) Intel MPI 4.0.1.007 +# 2) Intel MPI 5.1.3 # To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 +# mpiexec.hydra -version # # To check the Compiler level, type using the compiler # installation path: @@ -47,7 +40,6 @@ # MPI_ARCH: system architecture # MPI_EPATH: path where executable resides # - REVISION="VERSION, BUILD" HOSTNAME=`hostname` @@ -72,11 +64,48 @@ else fi FCOMP=ifort +INTELPATH="/opt/intel/composer_xe_2015.0.090" + +# find the root directory of the compiler installation: +# - if ifort is found in $PATH, then the root directory is derived +# from the path to ifort +# - if ifort is not found in $PATH, the root directory is assumed +# to be $INTELPATH and the directory in which ifort is found is +# added to $PATH +FCOMPPATH=`which "$FCOMP" 2>/dev/null` +if test -n "$FCOMPPATH"; then + # derive the root directory from $FCOMPPATH + FCOMPROOT="${FCOMPPATH%/bin/intel64/$FCOMP}" + if test "$FCOMPROOT" = "$FCOMPPATH"; then + FCOMPROOT="${FCOMPPATH%/bin/$FCOMP}" + fi + if test "$FCOMPROOT" = "$FCOMPPATH"; then + FCOMPROOT= + fi +elif test -d "$INTELPATH"; then + # check for compiler in $INTELPATH + if test -d "$INTELPATH/bin/intel64" -a \ + -x "$INTELPATH/bin/intel64/$FCOMP" ; then + FCOMPROOT="$INTELPATH" + PATH="$INTELPATH/bin/intel64:$PATH" + elif test -d "$INTELPATH/bin" -a \ + -x "$INTELPATH/bin/$FCOMP"; then + FCOMPROOT="$INTELPATH" + PATH="$INTELPATH/bin:$PATH" + else + FCOMPROOT= + fi +else + FCOMPROOT= +fi + +# settings for MKL +MARC_MKL="$FCOMPROOT/mkl/lib/intel64" # # settings for Metis # -METIS="-I$METIS_SOURCE" +METIS="-I$METIS_SOURCE/include" METISLIBS="$MARC_LIB/metis.a " # @@ -216,6 +245,9 @@ VKISOLVER=NONE # Edit following 2 lines to build with CASI Solver CASISOLVER=CASI +if test "$MARC_CASISOLVER" = "NONE" ; then + CASISOLVER=NONE +fi #CASISOLVER=NONE # Edit following 2 lines to build with MF2 Solver @@ -317,6 +349,9 @@ fi MARCCODECOV= #MARCCODECOV="ON" +MARCCODEPROF= +#MARCCODEPROF="ON" + if test "$MARC_INTEGER_SIZE" = "i4" ; then I8FFLAGS="-real-size 64 -integer-size 32" I8DEFINES="-DFLOAT=8 -DINT=4" @@ -368,7 +403,7 @@ then fi # -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" +FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT $MARC_SIMUFACT" CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource $METIS" @@ -393,13 +428,13 @@ CCT="$CC" CCTLOW="$CCLOW" CCTHIGH="$CCHIGH" -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" +CC_CASI="$CC -std=c99 $I8CASIDEFS" +CCLOW_CASI="$CCLOW -std=c99 $I8CASIDEFS" +CCHIGH_CASI="$CCHIGH -std=c99 $I8CASIDEFS" -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" +CCT_CASI="$CCT -std=c99 $I8CASIDEFS" +CCTLOW_CASI="$CCLOW -std=c99 $I8CASIDEFS" +CCTHIGH_CASI="$CCHIGH -std=c99 $I8CASIDEFS" #PROFILE="-Mprof=func" #PROFILE="-Mprof=lines" @@ -409,14 +444,18 @@ if test "$MARCCODECOV" = "ON" then PROFILE="-prof-gen=srcpos" fi +if test "$MARCCODEPROF" = "ON" +then +PROFILE=" $PROFILE -pg" +fi -FORT_OPT="-c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -mp1 -WB" +FORT_OPT="-c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr -mp1 -WB -fp-model source" if test "$MTHREAD" = "OPENMP" then - FORT_OPT=" $FORT_OPT -openmp" + FORT_OPT=" $FORT_OPT -qopenmp" if test "$OMP_COMPAT" = "YES" then - FORT_OPT=" $FORT_OPT -openmp-threadprivate=compat" + FORT_OPT=" $FORT_OPT -qopenmp-threadprivate=compat" fi else # FORT_OPT=" $FORT_OPT -auto " @@ -433,42 +472,35 @@ FORTNA="$FCOMP $FORT_OPT -fno-alias -O3 $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" # determine DAMASK version -HIT=0 -for arg in "$@" -do - if [ $HIT = 1 ] - then - DAMASKPATH=`dirname $arg` - break - elif [ ${arg:0:2} = -u -o ${arg:0:2} = -U ] - then - HIT=1 - fi -done -read DAMASKVERSION < $DAMASKPATH/../VERSION -DAMASKVERSION="'"$DAMASKVERSION"'" +if test -n "$DAMASK_USER"; then + DAMASKROOT=`dirname $DAMASK_USER`/.. + read DAMASKVERSION < $DAMASKROOT/VERSION + DAMASKVERSION="'"$DAMASKVERSION"'" +else + DAMASKVERSION="'N/A'" +fi # DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 DFORTLOW="$FCOMP $FORT_OPT $PROFILE -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O0 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRAN="$FCOMP $FORT_OPT $PROFILE -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -O1 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias -O2 $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" if test "$MARCDEBUG" = "ON" @@ -482,27 +514,27 @@ then FORTNA="$FCOMP $FORT_OPT -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM" -# DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 + # DAMASK compiler calls: additional flags are in line 2 OpenMP flags in line 3 DFORTLOW="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTLOWMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRAN="$FCOMP $FORT_OPT $PROFILE $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTRANMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGH="$FCOMP $FORT_OPT $PROFILE -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ + -fpp -ftz -diag-enable sc3 -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" DFORTHIGHMP="$FCOMP -c -assume byterecl -stand f08 -standard-semantics -safe_cray_ptr $PROFILE -zero -mp1 -WB -fno-alias $I8FFLAGS -I$MARC_SOURCE/common \ - -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2013.1 -DDAMASKVERSION=$DAMASKVERSION \ - -openmp -openmp_report2 -openmp-threadprivate=compat\ + -fpp -ftz -diag-disable 5268 -warn declarations -warn general -warn usage -warn interfaces -warn ignore_loc -warn alignments -DMarc4DAMASK=2016 -DDAMASKVERSION=$DAMASKVERSION \ + -qopenmp -qopenmp-threadprivate=compat\ -I$MARC_SOURCE/${BCS_DIR}/common -I$MARC_SOURCE/mumpssolver/include $I8DEFINES -DLinux -DLINUX -DLinux_intel $FDEFINES $DDM $SOLVERFLAGS" fi @@ -549,8 +581,8 @@ then # fi if test $MPITYPE = intelmpi then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " + LOAD="ifort $PROFILE $LINK_OPT -o " + LOADT="ifort $PROFILE $LINK_OPT -o " fi else LOAD="$FCOMP $LINK_OPT -o " @@ -600,7 +632,7 @@ fi if test "$CASISOLVER" = CASI then - CASISOLVERLIBS="$MARC_LIB/casilib.a" + CASISOLVERLIBS="$MARC_CASI/casilib.a" else CASISOLVERLIBS= fi @@ -621,17 +653,6 @@ then $MARC_LIB/mf2parallel/libz.a " fi -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - if test "$MUMPSSOLVER" = MUMPS then MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" @@ -643,17 +664,17 @@ then if test $MPITYPE = intelmpi then if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2=" -lmkl_blacs_intelmpi_lp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_intelmpi_lp64.a " else - MUMPSSOLVERLIBS2=" -lmkl_blacs_intelmpi_ilp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a " fi fi if test $MPITYPE = hpmpi then if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2=" -lmkl_blacs_lp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_lp64.a" else - MUMPSSOLVERLIBS2=" -lmkl_blacs_ilp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_ilp64.a" fi fi else @@ -673,17 +694,17 @@ else fi if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB="$MARC_MKL/libmkl_blacs_lp64.a -L$MARC_MKL -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core " + MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_lp64.a -Wl,--end-group" else - MKLLIB="$MARC_MKL/libmkl_blacs_ilp64.a -L$MARC_MKL -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core " + MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_core.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a -Wl,--end-group" fi SECLIBS="-L$MARC_LIB -llapi" -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MF2SOLVERLIBS} -Wl,--start-group $MKLLIB ${MUMPSSOLVERLIBS2} \ - -liomp5 -Wl,--end-group \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " +SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} ${MUMPSSOLVERLIBS2} \ + $MKLLIB -L$MARC_MKL -liomp5 \ + $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a " + SOLVERLIBS_DLL=${SOLVERLIBS} MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" @@ -691,8 +712,14 @@ MRCLIBSPAR="$MARC_LIB/clib.a" STUBS="$MARC_LIB/stubs.a " MNFLIBS="$MARC_LIB/libmnf.a" MDUSER="$MARC_LIB/md_user.a" +if test "X$MARC_SIMUFACT" != "X" +then + SFLIB="-L$SFMATDIR -lMBA_Grain $SFMATDIR/sfclib.a " +else + SFLIB=" " +fi -OPENMP="-openmp" +OPENMP="-qopenmp" SYSLIBS=" $OPENMP -lpthread " @@ -704,9 +731,10 @@ SYSLIBS=" $OPENMP -lpthread " # fi if test $MPITYPE = intelmpi then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -threads -lpthread" + SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi_mt -lmpifort -lrt $OPENMP -threads -lpthread " fi + SYSLIBSPAR=" " MARC_DLL_CODES="runmarc.f" @@ -726,7 +754,7 @@ LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" + inertie.f em_sso072.f cn_fol3d_qpatch6.f cosim_begin.f" if test "$MARC_INTEGER_SIZE" = "i8" ; then LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" fi @@ -734,7 +762,7 @@ LOW_OPT_CODES_CASI="" HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " + dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f dpsmsah.f tpsmsah.f cn_qsort4_11.f " HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64.original b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64.original similarity index 81% rename from installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64.original rename to installation/mods_MarcMentat/2016/Marc_tools/include_linux64.original index d76bd3df6..4b3e54e90 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/include_linux64.original +++ b/installation/mods_MarcMentat/2016/Marc_tools/include_linux64.original @@ -1,21 +1,17 @@ # -# General definitions for the Marc 2011 version +# General definitions for the Marc 2016 version # # EM64T -# ( LP64 - i4 version) -# (ILP64 - i8 version) # -# Linux RedHat 5.4 +# Linux RedHat 6.3 / SuSE 11 # # 64 bit MPI version # -# Intel(R) Fortran Compiler -# Version 12.0.4 +# Intel(R) Fortran Intel(R) 64 Compiler XE for applications +# running on Intel(R) 64, Version 15.0.0.090 Build 20140723 # -# Intel(R) C Compiler -# Version 12.0.4 -# -# DATE +# Intel(R) C Intel(R) 64 Compiler XE for applications +# running on Intel(R) 64, Version 15.0.0.090 Build 20140723 # # To check the O/S level, type: # uname -a @@ -24,12 +20,9 @@ # 1) HP MPI 2.3 # To check the mpi version, type: # mpirun -version -# 2) Intel MPI 4.0.1.007 +# 2) Intel MPI 5.1.3 # To check the mpi version, type: -# mpirun -version -# -# MKL Libraries: -# Intel(R) MKL 10.3.0.084 +# mpiexec.hydra -version # # To check the Compiler level, type using the compiler # installation path: @@ -47,7 +40,6 @@ # MPI_ARCH: system architecture # MPI_EPATH: path where executable resides # - REVISION="VERSION, BUILD" HOSTNAME=`hostname` @@ -72,11 +64,48 @@ else fi FCOMP=ifort +INTELPATH="/opt/intel/composer_xe_2015.0.090" + +# find the root directory of the compiler installation: +# - if ifort is found in $PATH, then the root directory is derived +# from the path to ifort +# - if ifort is not found in $PATH, the root directory is assumed +# to be $INTELPATH and the directory in which ifort is found is +# added to $PATH +FCOMPPATH=`which "$FCOMP" 2>/dev/null` +if test -n "$FCOMPPATH"; then + # derive the root directory from $FCOMPPATH + FCOMPROOT="${FCOMPPATH%/bin/intel64/$FCOMP}" + if test "$FCOMPROOT" = "$FCOMPPATH"; then + FCOMPROOT="${FCOMPPATH%/bin/$FCOMP}" + fi + if test "$FCOMPROOT" = "$FCOMPPATH"; then + FCOMPROOT= + fi +elif test -d "$INTELPATH"; then + # check for compiler in $INTELPATH + if test -d "$INTELPATH/bin/intel64" -a \ + -x "$INTELPATH/bin/intel64/$FCOMP" ; then + FCOMPROOT="$INTELPATH" + PATH="$INTELPATH/bin/intel64:$PATH" + elif test -d "$INTELPATH/bin" -a \ + -x "$INTELPATH/bin/$FCOMP"; then + FCOMPROOT="$INTELPATH" + PATH="$INTELPATH/bin:$PATH" + else + FCOMPROOT= + fi +else + FCOMPROOT= +fi + +# settings for MKL +MARC_MKL="$FCOMPROOT/mkl/lib/intel64" # # settings for Metis # -METIS="-I$METIS_SOURCE" +METIS="-I$METIS_SOURCE/include" METISLIBS="$MARC_LIB/metis.a " # @@ -216,6 +245,9 @@ VKISOLVER=NONE # Edit following 2 lines to build with CASI Solver CASISOLVER=CASI +if test "$MARC_CASISOLVER" = "NONE" ; then + CASISOLVER=NONE +fi #CASISOLVER=NONE # Edit following 2 lines to build with MF2 Solver @@ -317,6 +349,9 @@ fi MARCCODECOV= #MARCCODECOV="ON" +MARCCODEPROF= +#MARCCODEPROF="ON" + if test "$MARC_INTEGER_SIZE" = "i4" ; then I8FFLAGS= I8DEFINES= @@ -368,7 +403,7 @@ then fi # -D_MSCMARC -FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT" +FDEFINES="$FDEFINES -D_MSCMARC $DEBUG_OPT $MARC_SIMUFACT" CDEFINES="$CDEFINES -D_MSCMARC $C_DEBUG_OPT $I8CDEFINES" CINCL="-I$MARC_SOURCE/mdsrc -I$MARC_SOURCE/csource $METIS" @@ -393,13 +428,13 @@ CCT="$CC" CCTLOW="$CCLOW" CCTHIGH="$CCHIGH" -CC_CASI="$CC -c99 $I8CASIDEFS" -CCLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" +CC_CASI="$CC -std=c99 $I8CASIDEFS" +CCLOW_CASI="$CCLOW -std=c99 $I8CASIDEFS" +CCHIGH_CASI="$CCHIGH -std=c99 $I8CASIDEFS" -CCT_CASI="$CCT -c99 $I8CASIDEFS" -CCTLOW_CASI="$CCLOW -c99 $I8CASIDEFS" -CCTHIGH_CASI="$CCHIGH -c99 $I8CASIDEFS" +CCT_CASI="$CCT -std=c99 $I8CASIDEFS" +CCTLOW_CASI="$CCLOW -std=c99 $I8CASIDEFS" +CCTHIGH_CASI="$CCHIGH -std=c99 $I8CASIDEFS" #PROFILE="-Mprof=func" #PROFILE="-Mprof=lines" @@ -409,8 +444,12 @@ if test "$MARCCODECOV" = "ON" then PROFILE="-prof-gen=srcpos" fi +if test "$MARCCODEPROF" = "ON" +then +PROFILE=" $PROFILE -pg" +fi -FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB" +FORT_OPT="-c -assume byterecl -safe_cray_ptr -mp1 -WB -fp-model source" if test "$MTHREAD" = "OPENMP" then FORT_OPT=" $FORT_OPT -openmp" @@ -486,8 +525,8 @@ then # fi if test $MPITYPE = intelmpi then - LOAD="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " - LOADT="$MPI_ROOT/bin64/$FCOMPMPI $PROFILE $LINK_OPT -o " + LOAD="ifort $PROFILE $LINK_OPT -o " + LOADT="ifort $PROFILE $LINK_OPT -o " fi else LOAD="$FCOMP $LINK_OPT -o " @@ -537,7 +576,7 @@ fi if test "$CASISOLVER" = CASI then - CASISOLVERLIBS="$MARC_LIB/casilib.a" + CASISOLVERLIBS="$MARC_CASI/casilib.a" else CASISOLVERLIBS= fi @@ -558,17 +597,6 @@ then $MARC_LIB/mf2parallel/libz.a " fi -if test "$INTELSOLVER" = PARDISO -then - if test "$MARC_INTEGER_SIZE" = "i4" ; then - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_lp64.a" - else - INTELSOLVERLIBS="$MARC_MKL/libmkl_solver_ilp64.a" - fi -else - INTELSOLVERLIBS= -fi - if test "$MUMPSSOLVER" = MUMPS then MUMPSSOLVERLIBS="$MARC_LIB/libmumps.a" @@ -580,17 +608,17 @@ then if test $MPITYPE = intelmpi then if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2=" -lmkl_blacs_intelmpi_lp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_intelmpi_lp64.a " else - MUMPSSOLVERLIBS2=" -lmkl_blacs_intelmpi_ilp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_intelmpi_ilp64.a " fi fi if test $MPITYPE = hpmpi then if test "$MARC_INTEGER_SIZE" = "i4" ; then - MUMPSSOLVERLIBS2=" -lmkl_blacs_lp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_lp64.a" else - MUMPSSOLVERLIBS2=" -lmkl_blacs_ilp64" + MUMPSSOLVERLIBS2=" $MARC_MKL/libmkl_blacs_ilp64.a" fi fi else @@ -610,17 +638,17 @@ else fi if test "$MARC_INTEGER_SIZE" = "i4" ; then - MKLLIB="$MARC_MKL/libmkl_blacs_lp64.a -L$MARC_MKL -lmkl_scalapack_lp64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core " + MKLLIB="$MARC_MKL/libmkl_scalapack_lp64.a $MARC_MKL/libmkl_blacs_lp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_lp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" else - MKLLIB="$MARC_MKL/libmkl_blacs_ilp64.a -L$MARC_MKL -lmkl_scalapack_ilp64 -lmkl_intel_ilp64 -lmkl_intel_thread -lmkl_core " + MKLLIB="$MARC_MKL/libmkl_scalapack_ilp64.a $MARC_MKL/libmkl_blacs_ilp64.a -Wl,--start-group $MARC_MKL/libmkl_intel_ilp64.a $MARC_MKL/libmkl_intel_thread.a $MARC_MKL/libmkl_core.a -Wl,--end-group" fi SECLIBS="-L$MARC_LIB -llapi" -SOLVERLIBS="${BCSSOLVERLIBS} \ - ${INTELSOLVERLIBS} ${MF2SOLVERLIBS} -Wl,--start-group $MKLLIB ${MUMPSSOLVERLIBS2} \ - -liomp5 -Wl,--end-group \ - $MARC_LIB/blas_src.a ${VKISOLVERLIBS} ${CASISOLVERLIBS} " +SOLVERLIBS="${BCSSOLVERLIBS} ${VKISOLVERLIBS} ${CASISOLVERLIBS} ${MF2SOLVERLIBS} ${MUMPSSOLVERLIBS2} \ + $MKLLIB -L$MARC_MKL -liomp5 \ + $MARC_LIB/blas_src.a ${ACSI_LIB}/ACSI_MarcLib.a " + SOLVERLIBS_DLL=${SOLVERLIBS} MRCLIBS="$MARC_LIB/clib.a ${CASISOLVERLIBS}" @@ -628,10 +656,16 @@ MRCLIBSPAR="$MARC_LIB/clib.a" STUBS="$MARC_LIB/stubs.a " MNFLIBS="$MARC_LIB/libmnf.a" MDUSER="$MARC_LIB/md_user.a" +if test "X$MARC_SIMUFACT" != "X" +then + SFLIB="-L$SFMATDIR -lMBA_Grain $SFMATDIR/sfclib.a " +else + SFLIB=" " +fi OPENMP="-openmp" -SYSLIBS=" $OPENMP -lpthread " +SYSLIBS=" $OPENMP -lpthread -shared-intel " # Uncomment the following lines to turn on the trace and comment out the next 4 lines # if test $MPITYPE = intelmpi @@ -641,9 +675,10 @@ SYSLIBS=" $OPENMP -lpthread " # fi if test $MPITYPE = intelmpi then - SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi -lmpiif -lmpigi -lrt $OPENMP -threads -lpthread" + SYSLIBS="-L${MPI_ROOT}/lib64 -lmpi_mt -lmpifort -lrt $OPENMP -threads -lpthread -shared-intel " fi + SYSLIBSPAR=" " MARC_DLL_CODES="runmarc.f" @@ -663,7 +698,7 @@ LOW_OPT_CODES="are163.f contro.f ndext.f omarc.f omarca.f omarcb.f omarcc.f \ omars.f fixbc.f triang.f bet049.f norst3.f eldata.f \ elec*.f elct*.f fmeig.f oada00.f ogeig.f updtrbe2.f cycrota.f \ cordef.f ogpk.f ogtan.f eldam.f formrbe3.f \ - inertie.f em_sso072.f cn_fol3d_qpatch6.f" + inertie.f em_sso072.f cn_fol3d_qpatch6.f cosim_begin.f" if test "$MARC_INTEGER_SIZE" = "i8" ; then LOW_OPT_CODES="$LOW_OPT_CODES bbcseg.f" fi @@ -671,7 +706,7 @@ LOW_OPT_CODES_CASI="" HIGH_OPT_CODES="dpsmsa1.f dpsmsa2.f dpsmsa3.f dpsmsa4.f dpsmsa5.f dpsmsa6.f \ dpsmsa7.f dpsmsa8.f dpsmsa9.f dpsmsa10.f dpsmsa11.f dpsmsa12.f \ - dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f " + dpsmsa13.f dpsmsa14.f dpsmsa15.f dpsmsa16.f dpsmsah.f tpsmsah.f cn_qsort4_11.f " HIGH_OPT_CODES_CASI="arithkernels.c blockedroutines.c blockedroutines_fd.c elemmatgenkernels.c longvecroutines.c sfmultutils.c solvewithbd.c" diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask b/installation/mods_MarcMentat/2016/Marc_tools/run_damask similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask index 2f1948048..0fc2e639a 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_h b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_h rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask_h index 4aee42fa0..182b5fc25 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_h +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_h @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_hmp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_hmp rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp index 9460819a0..69aa8d652 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_hmp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_hmp @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_l b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_l rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask_l index 31ef667c8..87cd1e5c6 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_l +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_l @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_lmp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_lmp rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp index bd111d6ba..227ac1110 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_lmp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_lmp @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_mp b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp similarity index 95% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_mp rename to installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp index eaa8c253e..03cf4b951 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_damask_mp +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_damask_mp @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -270,7 +299,23 @@ fi . "$DIR/getarch" + +# getting user subroutine file name +found=0 +for i in "$@"; do + if test $found = 1; then + DAMASK_USER=$i + found=0 + fi + case $i in + -u* | -U*) + found=1 + ;; + esac +done +# sourcing include_linux64 (needs DAMASK_USER to be set) . $MARC_INCLUDE + # # @@ -303,6 +348,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +375,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +459,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +484,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -526,6 +578,7 @@ do ;; -fe* | -FE*) feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -711,6 +764,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -730,6 +788,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1262,9 +1323,16 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" fi +fi if test $nprocd -gt 1 then @@ -1398,19 +1466,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1421,8 +1476,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1441,19 +1494,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1470,8 +1525,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1494,6 +1553,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -2051,7 +2115,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2061,7 +2128,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2126,7 +2194,7 @@ fi # user subroutine used # # add DAMASK options for linking - DAMASK="" + DAMASK="-lstdc++" if test "$user" then @@ -2203,8 +2271,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2213,88 +2280,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2921,7 +2913,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3131,8 +3123,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3142,6 +3136,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3193,6 +3188,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$usermoext.o @@ -3237,6 +3241,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3419,6 +3424,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3530,6 +3544,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3583,6 +3598,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3618,6 +3640,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3649,6 +3673,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -3690,6 +3715,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3717,6 +3744,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3732,6 +3761,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3840,6 +3878,7 @@ then $METISLIBS \ $DAMASK \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3878,7 +3917,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null /bin/rm $DIRJOB/*.mod 2>/dev/null - +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3904,7 +3950,13 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi -$RUN_JOB +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB if test $nprocd -gt 1 then @@ -3946,6 +3998,8 @@ then if test "$userhost" then counter=0 + if test -f "$host_filt" + then for i in `$AWK -v n=$numfield '{print $n}' $host_filt` do ibase=${i%%.*} @@ -3977,6 +4031,7 @@ then fi fi fi +fi else #dllrun >0 if test $cpdll = yes; then @@ -4019,6 +4074,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4046,6 +4103,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Marc_tools/run_marc.original b/installation/mods_MarcMentat/2016/Marc_tools/run_marc.original similarity index 92% rename from installation/mods_MarcMentat/2013.1/Marc_tools/run_marc.original rename to installation/mods_MarcMentat/2016/Marc_tools/run_marc.original index f7cd7def5..cb6316033 100644 --- a/installation/mods_MarcMentat/2013.1/Marc_tools/run_marc.original +++ b/installation/mods_MarcMentat/2016/Marc_tools/run_marc.original @@ -35,9 +35,8 @@ # -autorst auto restart flag for auto forge . no # # -me manual remeshing control . no # # -ml memory limit in Mbyte # -# -mo selects i4 or i8 version # -# default: i4 or via defaults file run_marc_defaults # -# the -mo option will override # +# -mo This option is deprecated. As of Marc 2015, only # +# the integer*8 version is available. # # -mpi selects MPI version # # each platform has a default MPI version and some # # have an alternative version. see the include file # @@ -180,21 +179,41 @@ fi # and by the command line option "-mo" # mode= +modeerror= +modeoption= if test -f $DIRSCRIPT/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $DIRSCRIPT/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $DIRSCRIPT/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $DIRSCRIPT/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 fi fi if test -f $HOME/run_marc_defaults; then + line=`$AWK '{if ($1 == "MARC_MODE") {print $1}}' $HOME/run_marc_defaults` + if test "$line" = "MARC_MODE"; then + echo + echo warning: the option MARC_MODE is deprecated, as of Marc 2015, only the integer*8 version is available + echo + line= + fi line=`$AWK '{if ($1 == "MARC_MODE") {print $2}}' $HOME/run_marc_defaults` line=`echo $line | $AWK '{print $NF}'` if test "$line" = "i4"; then - mode=i4 + modeerror="defaults file $HOME/run_marc_defaults used mode $line ; this must be i8" + modeoption=error + echo $modeerror fi if test "$line" = "i8"; then mode=i8 @@ -208,15 +227,16 @@ if test -z "$mode" ; then fi case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for MARC_INTEGER_SIZE variable; only i8 is supported." + modeoption=error + echo $modeerror ;; i8) MARC_INTEGER_SIZE=i8 export MARC_INTEGER_SIZE ;; *) - echo "error, version mode must be i4 or i8" + echo "bad value for MARC_INTEGER_SIZE variable; only i8 is supported." exit ;; esac @@ -227,8 +247,11 @@ for arg in $* ; do mode=$arg case $mode in i4) - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo ;; i8) MARC_INTEGER_SIZE=i8 @@ -236,9 +259,9 @@ for arg in $* ; do ;; *) echo " " - echo "error, version mode must be i4 or i8" + echo "error, version mode must be i8" echo " " - echo " use -mo i4 or -mo i8 " + echo " use -mo i8 " echo " " exit ;; @@ -246,6 +269,9 @@ for arg in $* ; do setmode=false fi if [ ${arg}X = -moX -o ${arg}X = -MOX ] ; then + echo + echo warning: the option -mo is deprecated, as of Marc 2015, only the integer*8 version is available + echo setmode=true fi if [ ${arg}X = -i8X -o ${arg}X = -I8X ] ; then @@ -253,8 +279,11 @@ for arg in $* ; do export MARC_INTEGER_SIZE fi if [ ${arg}X = -i4X -o ${arg}X = -I4X ] ; then - MARC_INTEGER_SIZE=i4 - export MARC_INTEGER_SIZE + modeerror="bad value for mode option; only i8 is supported." + modeoption=error + echo + echo $modeerror + echo fi done @@ -303,6 +332,9 @@ BINDIR=$MARC_BIN export BINDIR AFMATDAT=$MARC_RUNTIME/AF_flowmat/ export AFMATDAT +export MESHERDIR +MSC_LICENSE_FINPROC=1 +export MSC_LICENSE_FINPROC # # define directory path to global unified material database # @@ -327,6 +359,8 @@ fi LD_LIBRARY_PATH=$MARC_LIB_SHARED:$LD_LIBRARY_PATH LD_LIBRARY_PATH=$MARC_LIB:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$MESHERDIR:$LD_LIBRARY_PATH +LD_LIBRARY_PATH=$SFMATDIR:$LD_LIBRARY_PATH LD_LIBRARY64_PATH=$MARC_LIB:$LD_LIBRARY64_PATH LD_LIBRARYN32_PATH=$MARC_LIB:$LD_LIBRARYN32_PATH export LD_LIBRARY_PATH @@ -409,6 +443,7 @@ dllrun=0 mesh=0 itree=0 iam= +ddm_arc=0 link= trkrun=0 DIRJOB=`pwd` @@ -433,6 +468,7 @@ numfield=1 justlist= feature= mpioption=false +iprintsimufact= MDSRCLIB=$MARC_LIB/mdsrc.a # # check run_marc_defaults file for default MPI setting @@ -525,7 +561,8 @@ do justlist=yes ;; -fe* | -FE*) - feature=$value + feature=$value + ;; -pr* | -PR*) if test `dirname $value` = '.' @@ -621,26 +658,48 @@ do ;; -u* | -U*) user=`dirname $value`/`$BASENAME $value .f` + usersubname=$user basefile=`$BASENAME $value` - if test ${basefile##*.} = F + if test ${basefile##*.} = f + then + user=`dirname $value`/`$BASENAME $value .f` + usersubname=$user.f + elif test ${basefile##*.} = F then user=`dirname $value`/`$BASENAME $value .F` + usersubname=$user.F + elif test ${basefile##*.} = f90 + then + user=`dirname $value`/`$BASENAME $value .f90` + usersubname=$user.f90 + elif test ${basefile##*.} = F90 + then + user=`dirname $value`/`$BASENAME $value .F90` + usersubname=$user.F90 fi case $user in \/*) ;; *) user=`pwd`/$user + usersubname=`pwd`/$usersubname ;; esac - if test -f $user.f + if test ! -f $usersubname then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user + if test -f $usersubname.f + then + usersubname=$usersubname.f + elif test -f $usersubname.F + then + usersubname=$usersubname.F + elif test -f $usersubname.f90 + then + usersubname=$usersubname.f90 + elif test -f $usersubname.F90 + then + usersubname=$usersubname.F90 + fi fi ;; -obj | -OBJ) @@ -720,6 +779,11 @@ do ;; -iam | -IAM) iam=$value + case $value in + sfg | sfm | sim) + iprintsimufact=true + ;; + esac ;; -au* | -AU*) nauto=$value @@ -739,6 +803,9 @@ do -trk | -TRK) trkrun=$value ;; + -ddm | -DDM) + ddm_arc=$value + ;; -me | -ME ) mesh=$value ;; @@ -1271,8 +1338,15 @@ if test "$jid" then : else + if test "$user" + then +# allow user sub without giving job id + qid=foreground + verify=no + else error="$error job id required" + fi fi if test $nprocd -gt 1 @@ -1407,19 +1481,6 @@ then . $MARC_TOOLS/run_marc_check fi -# -# pick up version data from bin/VERSION if it exists -# -if test -f $MARC_BIN/VERSION; then - ppp=`grep "version" $MARC_BIN/VERSION | cut -f 2- -d ":"` - if test -n "$ppp" ;then - PRODUCT=$ppp - fi - ppp=`grep "built at changelist" $MARC_BIN/VERSION | cut -f 2 -d ":"` - if test -n "$ppp" ;then - REVISION=", Build $ppp" - fi -fi ############################################################################## # interact with the user to get the required information to run marc or # # other marc system program # @@ -1430,8 +1491,6 @@ if test $qid = background -a $verify = no then echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1450,19 +1509,21 @@ Element loop threads : $nteprint Solver processes : $nsolverprint Solver threads : $ntsprint GPGPU option : $gpuids -Host file name : $host -Message passing type : $itree +Host file name : $host" > $jid.log +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" >> $jid.log +fi +echo \ +"Message passing type : $itree Run job in queue : $qid Run directory : $DIRJOB Scratch directory : $DIRSCR Memory limit in Mbyte: $memlimit -Auto Restart : $nauto " > $jid.log +Auto Restart : $nauto " >> $jid.log deletelog=no fi echo \ " -$PRODUCT $REVISION $MACHINE version ------------------------------ Program name : $prog Marc shared lib : $progdll Version type : $mode @@ -1479,8 +1540,12 @@ MPI library : $MPITYPE DDM processes : $nprocdddmprint Element loop threads : $nteprint Solver processes : $nsolverprint -Solver threads : $ntsprint -GPGPU option : $gpuids +Solver threads : $ntsprint" +if test "$iprintsimufact" = true ; then + echo "DDM with ARC Mapper : $ddm_arc" +fi +echo \ +"GPGPU option : $gpuids Host file name : $host Message passing type : $itree Run job in queue : $qid @@ -1503,6 +1568,11 @@ Queue start time : $att" # ;; esac +if test "$modeoption" +then + error=$modeerror +fi + if test "$error" then if test $verify = yes @@ -1582,7 +1652,7 @@ Program name ($prog)? $ECHOTXT" ;; esac fi - $ECHO "User subroutine name ($user)? $ECHOTXT" + $ECHO "User subroutine name ($usersubname)? $ECHOTXT" read value if test "$value" then @@ -1592,26 +1662,48 @@ Program name ($prog)? $ECHOTXT" ;; *) user=`dirname $value`/`$BASENAME $value .f` + usersubname=$user basefile=`$BASENAME $value` - if test ${basefile##*.} = F + if test ${basefile##*.} = f + then + user=`dirname $value`/`$BASENAME $value .f` + usersubname=$user.f + elif test ${basefile##*.} = F then user=`dirname $value`/`$BASENAME $value .F` + usersubname=$user.F + elif test ${basefile##*.} = f90 + then + user=`dirname $value`/`$BASENAME $value .f90` + usersubname=$user.f90 + elif test ${basefile##*.} = F90 + then + user=`dirname $value`/`$BASENAME $value .F90` + usersubname=$user.F90 fi case $user in - \/*) - ;; - *) + \/*) + ;; + *) user=`pwd`/$user - ;; - esac - if test -f $user.f + usersubname=`pwd`/$usersubname + ;; + esac + if test ! -f $usersubname then - usersubname=$user.f - elif test -f $user.F - then - usersubname=$user.F - else - usersubname=$user + if test -f $usersubname.f + then + usersubname=$usersubname.f + elif test -f $usersubname.F + then + usersubname=$usersubname.F + elif test -f $usersubname.f90 + then + usersubname=$usersubname.f90 + elif test -f $usersubname.F90 + then + usersubname=$usersubname.F90 + fi fi ;; esac @@ -2069,7 +2161,10 @@ then # delete the old .log file unless we run in the background if test "$deletelog" = yes then + if test "$jid" + then /bin/rm $jid.log 2>/dev/null + fi else echo echo running the job in the background, see $jid.log @@ -2079,7 +2174,8 @@ fi # # check if this is an autoforge or rezoning or radiation job # -if test $nprocd -eq 1 +if test $nprocd -eq 1 -a "$jid" + then line=`$AWK '/^[eE][nN][dD]/ {exit} ; {print}' $DIRJID/${jid}$dotdat | grep -i "^autoforge"` if test "$line" @@ -2220,8 +2316,7 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between " echo " the computers used in the analysis. Furthermore, " echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " + echo " user for a password. " echo " " if test "$deletelog" = no then @@ -2230,88 +2325,13 @@ if test $MPITYPE = "intelmpi" -a "$INTELMPI_VERSION" = "HYDRA" echo " The ssh command must be working correctly between ">> $jid.log echo " the computers used in the analysis. Furthermore, ">> $jid.log echo " it must be set up such that it does not prompt the ">> $jid.log - echo " user for a password. Note that this is the case ">> $jid.log - echo " also for running on a single machine. ">> $jid.log + echo " user for a password. ">> $jid.log echo " " >> $jid.log echo " Exit number 8" >> $jid.log echo " " >> $jid.log fi exit 1 fi - else - counter=1 -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh `hostname` - if test $counter -ne 0 - then - line=`hostname -s` - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi -# test ssh localhost - if test $counter -ne 0 - then - line=localhost - $RSH -o BatchMode=yes -o ConnectTimeout=10 $line uname -n - status=$? - if [[ $status != 0 ]] ; then - echo ssh login failed for $line machine. > /dev/null - else - counter=0 - fi - fi - if test $counter -ne 0 - then - echo " error - connection test failed... " - echo " " - echo " ssh needs to work on the machine without asking for a password." - echo " check the following command: ssh localhost uname -n" - echo " " - echo " A parallel job using IntelMPI cannot be started. " - echo " The ssh command must be working correctly between " - echo " the computers used in the analysis. Furthermore, " - echo " it must be set up such that it does not prompt the " - echo " user for a password. Note that this is the case " - echo " also for running on a single machine. " - echo " " - if test "$deletelog" = no - then - echo " error - connection test failed... " >> $jid.log - echo " " >> $jid.log - echo " ssh needs to work on the machine without asking for a password." >> $jid.log - echo " check the following command: ssh localhost uname -n" >> $jid.log - echo " " >> $jid.log - echo " A parallel job using IntelMPI cannot be started. " >> $jid.log - echo " The ssh command must be working correctly between " >> $jid.log - echo " the computers used in the analysis. Furthermore, " >> $jid.log - echo " it must be set up such that it does not prompt the " >> $jid.log - echo " user for a password. Note that this is the case " >> $jid.log - echo " also for running on a single machine. " >> $jid.log - echo " " >> $jid.log - echo " Exit number 8" >> $jid.log - echo " " >> $jid.log - fi - exit 1 - else - echo $line $nprocd > $jid.hosts - host=$jid.hosts - fi fi fi fi @@ -2938,7 +2958,7 @@ $ntearg $nte $ntsarg $nts $gpuoption -dirjob $DIRJOB " numhost=`uniq $jid.mfile | wc -l` if test "$INTELMPI_VERSION" = "HYDRA" then - RUN_JOB_TMP="$RUN_JOB2 -machinefile $jid.mfile -configfile $jid.cfile" + RUN_JOB_TMP="$RUN_JOB2 -configfile $jid.cfile" else export I_MPI_JOB_CONTEXT=$$ mpdboot -n $numhost -r $RSH -f $jid.mfile @@ -3148,8 +3168,10 @@ then then grep -v '^#' $host | $AWK -v args="$RUN_JOB" -v path=$execpath -v en=$execname -v us=$usersub \ '{if ( NF > 0) {\ - printf("-n %s",$2); \ + printf(" -host %s",$1); \ + printf(" -n %s",$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3159,6 +3181,7 @@ then '{if ( NF > 0) {\ printf("-host %s -n %s",$1,$2); \ if ( NF == 2 ) printf(" %s",path);\ + if ( NF >= 3 ) printf(" -wdir %s ",$3); \ if ( NF >= 3 ) if (us) printf(" %s/%s",$3,en); else printf(" %s",path); \ printf(" %s\n",args); \ }\ @@ -3210,6 +3233,15 @@ then # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then userobj=$DIRJOB/`$BASENAME $user .f`.o @@ -3270,6 +3302,7 @@ then $MRCLIBS \ $METISLIBS \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3451,6 +3484,15 @@ fi ( if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3573,6 +3615,7 @@ then $MRCLIBS \ $METISLIBS \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3625,6 +3668,13 @@ then export LIBPATH fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + + $RUN_JOB & marcpid=$! @@ -3660,34 +3710,37 @@ then if test "$userhost" then counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" + if test -f "$host_filt" + then + for i in `$AWK -v n=$numfield '{print $n}' $host_filt` + do + ibase=${i%%.*} + if test $ibase != $thishost then - DIR1=$workdir + counter=$((counter+1)) + DIR1=$DIRJOB + line=`grep -v '^#' $userhost | grep "^$ibase "` + workdir=`echo $line | $AWK '{print $3}'` + if test -n "$workdir" + then + DIR1=$workdir + fi + # if an incompatible host uses shared directory, + # then the root machine deletes the executable + if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" + then + hname=_$ibase + /bin/rm ${execname}$hname + fi + # if local directory used, the remote machine + # deletes the executable + if test ${dirstatus[$counter]} = "local" + then + $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null + fi fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done + done + fi fi fi fi @@ -3732,6 +3785,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -3759,6 +3814,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi ) 1>>$jid.log 2>&1 & @@ -3774,6 +3831,15 @@ else # if test "$link" then + if test -z "$FCOMPROOT"; then + echo "$0: No compiler available" + echo + echo " $PRODUCT Exit number 3" + exit 1 + fi + echo + echo "Using compiler from: $FCOMPROOT" + echo if test "$user" then # compile and link on other hosts in $host if compstatus=no @@ -3893,6 +3959,7 @@ then $MRCLIBS \ $METISLIBS \ $SYSLIBS \ + $SFLIB \ $SECLIBS || \ { echo "$0: link failed for ${user:+$userobj }$objs" @@ -3931,6 +3998,14 @@ else # if test $link fi # if test $link /bin/rm $userobj 2>/dev/null +# done if no job id given +if test -z "$jid" +then + echo + echo only compilation requested + echo + exit +fi # # run marc # @@ -3956,6 +4031,12 @@ else /bin/rm $DIRJOB/$jid.out 2>/dev/null fi +# for DDM with ARC support + +if test $ddm_arc -gt 0; then + RUN_JOB="$MESHERDIR/sf_exeddm $RUN_JOB -ddm $ddm_arc " +fi + $RUN_JOB if test $nprocd -gt 1 @@ -3998,34 +4079,37 @@ then if test "$userhost" then counter=0 - for i in `$AWK -v n=$numfield '{print $n}' $host_filt` - do - ibase=${i%%.*} - if test $ibase != $thishost - then - counter=$((counter+1)) - DIR1=$DIRJOB - line=`grep -v '^#' $userhost | grep "^$ibase "` - workdir=`echo $line | $AWK '{print $3}'` - if test -n "$workdir" + if test -f "$host_filt" + then + for i in `$AWK -v n=$numfield '{print $n}' $host_filt` + do + ibase=${i%%.*} + if test $ibase != $thishost then - DIR1=$workdir + counter=$((counter+1)) + DIR1=$DIRJOB + line=`grep -v '^#' $userhost | grep "^$ibase "` + workdir=`echo $line | $AWK '{print $3}'` + if test -n "$workdir" + then + DIR1=$workdir + fi + # if an incompatible host uses shared directory, + # then the root machine deletes the executable + if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" + then + hname=_$ibase + /bin/rm ${execname}$hname + fi + # if local directory used, the remote machine + # deletes the executable + if test ${dirstatus[$counter]} = "local" + then + $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null + fi fi - # if an incompatible host uses shared directory, - # then the root machine deletes the executable - if test ${dirstatus[$counter]} = "shared" -a ${compstatus[$counter]} = "no" - then - hname=_$ibase - /bin/rm ${execname}$hname - fi - # if local directory used, the remote machine - # deletes the executable - if test ${dirstatus[$counter]} = "local" - then - $RSH $i /bin/rm $DIR1/${execname} 2>/dev/null - fi - fi - done + done + fi fi fi fi @@ -4071,6 +4155,8 @@ then /bin/rm $DIRSCR/$numdom$jid.t87 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t88 2>/dev/null /bin/rm $DIRSCR/$numdom$jid.t90 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sle 2>/dev/null + /bin/rm $DIRSCR/$numdom$jid.sin 2>/dev/null numdom=`echo $numdom | $AWK '{sum=$1-1}; {print sum}'` done /bin/rm $DIRJOB/$jid.pid 2>/dev/null @@ -4098,6 +4184,8 @@ else /bin/rm $DIRSCR/$jid.*.t83* 2>/dev/null /bin/rm $DIRSCR/$jid.t84 2>/dev/null /bin/rm $DIRJOB/$jid.pid 2>/dev/null + /bin/rm $DIRJOB/$jid.sle 2>/dev/null + /bin/rm $DIRJOB/$jid.sin 2>/dev/null fi diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/edit_window b/installation/mods_MarcMentat/2016/Mentat_bin/edit_window similarity index 100% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/edit_window rename to installation/mods_MarcMentat/2016/Mentat_bin/edit_window diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/edit_window.org b/installation/mods_MarcMentat/2016/Mentat_bin/edit_window.original similarity index 100% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/edit_window.org rename to installation/mods_MarcMentat/2016/Mentat_bin/edit_window.original diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill4 b/installation/mods_MarcMentat/2016/Mentat_bin/kill1.original similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill4 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill1.original diff --git a/installation/mods_MarcMentat/2012/Mentat_bin/kill4 b/installation/mods_MarcMentat/2016/Mentat_bin/kill4 similarity index 100% rename from installation/mods_MarcMentat/2012/Mentat_bin/kill4 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill4 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill5 b/installation/mods_MarcMentat/2016/Mentat_bin/kill5 similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill5 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill5 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill6 b/installation/mods_MarcMentat/2016/Mentat_bin/kill6 similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill6 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill6 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill7 b/installation/mods_MarcMentat/2016/Mentat_bin/kill7 similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill7 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill7 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill8 b/installation/mods_MarcMentat/2016/Mentat_bin/kill8 similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill8 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill8 diff --git a/installation/mods_MarcMentat/2011/Mentat_bin/kill9 b/installation/mods_MarcMentat/2016/Mentat_bin/kill9 similarity index 100% rename from installation/mods_MarcMentat/2011/Mentat_bin/kill9 rename to installation/mods_MarcMentat/2016/Mentat_bin/kill9 diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit1.org b/installation/mods_MarcMentat/2016/Mentat_bin/submit1.original similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit1.org rename to installation/mods_MarcMentat/2016/Mentat_bin/submit1.original index f3b2f5c1c..56e2557b7 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit1.org +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit1.original @@ -4,7 +4,7 @@ # Normal exit status is 0. # -DIR=/msc/marc2013.1 +DIR=/msc/marc2016 if test $MARCDIR1 then DIR=$MARCDIR1 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then - srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit4 b/installation/mods_MarcMentat/2016/Mentat_bin/submit4 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit4 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit4 index 8d985d09a..f25a2004e 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit4 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit4 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit5 b/installation/mods_MarcMentat/2016/Mentat_bin/submit5 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit5 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit5 index f78ef9511..786f6efc5 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit5 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit5 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit6 b/installation/mods_MarcMentat/2016/Mentat_bin/submit6 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit6 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit6 index 058a00aa1..6a5d9d79f 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit6 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit6 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit7 b/installation/mods_MarcMentat/2016/Mentat_bin/submit7 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit7 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit7 index 59e2b74e3..d0e3be475 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit7 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit7 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit8 b/installation/mods_MarcMentat/2016/Mentat_bin/submit8 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit8 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit8 index f8fe07a7d..d466fc6ab 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit8 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit8 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit9 b/installation/mods_MarcMentat/2016/Mentat_bin/submit9 similarity index 97% rename from installation/mods_MarcMentat/2013.1/Mentat_bin/submit9 rename to installation/mods_MarcMentat/2016/Mentat_bin/submit9 index b6dcb75be..207a61803 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_bin/submit9 +++ b/installation/mods_MarcMentat/2016/Mentat_bin/submit9 @@ -26,6 +26,7 @@ if test -z "$DIR"; then fi SRCEXT=.f +SRCEXTC=.F RSTEXT=.t08 PSTEXT=.t19 PSTEXTB=.t16 @@ -74,7 +75,7 @@ else fi if [ "$srcfile" != "" -a "$srcfile" != "-" ]; then -# srcfile=`echo $srcfile | sed "s/$SRCEXT$//"` + srcfile=`echo $srcfile | sed "s/$SRCEXT$//" | sed "s/$SRCEXTC$//"` case "$srcmeth" in -) srcfile="-u $srcfile" diff --git a/installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms.org b/installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms similarity index 80% rename from installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms.org rename to installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms index 4c8dde20a..589b9bfcc 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms.org +++ b/installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms @@ -1,11 +1,6 @@ #ifndef AUTOFORGE popmenu job_title_pm file jobs.ms popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif group job_solver_gr file job_common.ms group user_domains_gr file domain_decomposition.ms @@ -14,55 +9,25 @@ group user_domains_tail_gr file domain_decomposition.ms group job_solver_opts_gr file job_common.ms popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT browser edit_browser file file.ms browser directory_browser file file.ms screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu usersub_file_browser_pm { - - group { -#endif browser usersub_file_browser { position 0 0 size 82 72 text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.F" + filter "*.f *.F *.f90 *.F90" nvisible 10 select_files true cancel_action popdown ok_action popdown command "$usersub_file_browser_command" ($usersub_file_browser_command) } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu host_file_browser_pm { - - group { -#endif browser host_file_browser { position 0 0 @@ -75,39 +40,16 @@ popmenu host_file_browser_pm { ok_action popdown command "$host_file_browser_command" ($host_file_browser_command) } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_run_popmenu { -#ifdef QT_MENTAT text "RUN JOB" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 52 4 - text "RUN JOB" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -131,21 +73,12 @@ popmenu job_run_popmenu { size 26 4 display job_class_label } -#endif button { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 24 4 text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" set $usersub_file_browser_command "*job_usersub_file" help job_usersub_file @@ -193,13 +126,9 @@ popmenu job_run_popmenu { help job_run_compile roller "job_option user_source" visible job_usersub_file -#ifdef QT_MENTAT commands "*job_option user_source:compile_nosave" "*job_option user_source:compile_save" "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif } toggle { @@ -292,16 +221,12 @@ popmenu job_run_popmenu { rollers "job_input_style_table_driven" "job_input_style_multi_physics" "job_input_style_old" -#ifdef QT_MENTAT commands "*job_option input_style:new *job_option input_physics_style:old" "*job_option input_physics_style:new *job_option input_style:new" "*job_option input_style:old *job_option input_physics_style:old" visibles "job_allows_input_style_table_driven" "job_allows_input_style_multi_physics" "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif help job_option_input_style } @@ -321,12 +246,19 @@ popmenu job_run_popmenu { button { position +16 = - size 34 6 + size 16 6 text "ADVANCED JOB SUBMISSION" popmenu job_submit_adv_pm } - button { + button { + position +16 = + size 18 6 + text "DAMASK" + popmenu damask + } + + button { position 1 +6 size 16 6 text "UPDATE" @@ -570,25 +502,15 @@ popmenu job_run_popmenu { text "ANY FILE" settext $edit_browser_label "EDIT FILE" set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT browser edit_browser -#else - popmenu edit_browser_popmenu -#endif help edit_file } popdown { position 1 +6 size 32 4 -#ifdef QT_MENTAT text "OPEN POST FILE (MODEL PLOT RESULTS MENU)" command "@popdown(job_properties_pm) @main(results) @popup(modelplot_pm) *post_open_default" -#else - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" -#endif } button { @@ -615,30 +537,17 @@ popmenu job_run_popmenu { buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } #-------------------------------------------------------------------------------------------------- popmenu job_usersub_pm { -#ifdef QT_MENTAT text "CURRENTLY SELECTED USER SUBROUTINES" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif display { position 1 +5 @@ -670,21 +579,11 @@ popmenu job_usersub_pm { #-------------------------------------------------------------------------------------------------- popmenu job_submit_adv_pm { -#ifdef QT_MENTAT text "ADVANCED JOB SUBMISSION" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -708,35 +607,20 @@ popmenu job_submit_adv_pm { size 26 4 display job_class_label } -#endif label { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 19 4 text "INITIAL ALLOCATION" border_width 1 border_color black } -#ifdef QT_MENTAT label { position +19 = size 15 4 text "GENERAL MEMORY" help job_param_general_init_allocation } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif text { position +15 = size 10 4 @@ -798,13 +682,9 @@ popmenu job_submit_adv_pm { texts "DEFAULT" "4-BYTE INTEGERS" "8-BYTE INTEGERS" -#ifdef QT_MENTAT commands "*job_option marc_integer_size:default" "*job_option marc_integer_size:i4" "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif help job_run_intsize roller "job_option marc_integer_size" } @@ -829,12 +709,17 @@ popmenu job_submit_adv_pm { roller { position +9 = size 14 4 - nvalues 17 - nvisible 17 + nvalues 22 + nvisible 22 texts "DEFAULT" #if 0 - "2013.1" + "2016" #endif + "2015" + "2014.2" + "2014.1" + "2014" + "2013.1" "2013" "2012" "2011" @@ -857,8 +742,13 @@ popmenu job_submit_adv_pm { help job_param_version rollers "job_input_version_default" #if 0 - "job_input_version_2013.1" + "job_input_version_2016" #endif + "job_input_version_2015" + "job_input_version_2014.2" + "job_input_version_2014.1" + "job_input_version_2014" + "job_input_version_2013.1" "job_input_version_2013" "job_input_version_2012" "job_input_version_2011" @@ -878,11 +768,15 @@ popmenu job_submit_adv_pm { "job_input_version_k6" "job_input_version_k5" "job_input_version_k4" -#ifdef QT_MENTAT commands "*job_option version:default" #if 0 - "*job_option version:2013.1" + "*job_option version:2016" #endif + "*job_option version:2015" + "*job_option version:2014.2" + "*job_option version:2014.1" + "*job_option version:2014" + "*job_option version:2013.1" "*job_option version:2013" "*job_option version:2012" "*job_option version:2011" @@ -904,8 +798,13 @@ popmenu job_submit_adv_pm { "*job_option version:k4" visibles "job_allows_input_version_default" #if 0 - "job_allows_input_version_2013.1" + "job_allows_input_version_2016" #endif + "job_allows_input_version_2015" + "job_allows_input_version_2014.2" + "job_allows_input_version_2014.1" + "job_allows_input_version_2014" + "job_allows_input_version_2013.1" "job_allows_input_version_2013" "job_allows_input_version_2012" "job_allows_input_version_2011" @@ -925,9 +824,6 @@ popmenu job_submit_adv_pm { "job_allows_input_version_k6" "job_allows_input_version_k5" "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif } # see also job_common.ms @@ -951,16 +847,12 @@ popmenu job_submit_adv_pm { rollers "job_input_style_table_driven" "job_input_style_multi_physics" "job_input_style_old" -#ifdef QT_MENTAT commands "*job_option input_style:new *job_option input_physics_style:old" "*job_option input_physics_style:new *job_option input_style:new" "*job_option input_style:old *job_option input_physics_style:old" visibles "job_allows_input_style_table_driven" "job_allows_input_style_multi_physics" "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif help job_option_input_style } @@ -982,11 +874,7 @@ popmenu job_submit_adv_pm { text "SCRATCH DIRECTORY" settext $directory_browser_label "JOB SCRATCH DIRECTORY" set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT browser directory_browser -#else - popmenu directory_browser_popmenu -#endif help job_scratch_directory } @@ -1126,38 +1014,148 @@ popmenu job_submit_adv_pm { buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } +#-------------------------------------------------------------------------------------------------- +popmenu damask { + +#ifdef QT_MENTAT + text "DAMASK.MPIE.DE" +#endif + + group { +#ifndef QT_MENTAT + label { + position 0 0 + size 50 4 + text "DAMASK.MPIE.DE" + } +#endif + + label { + position 1 6 + size 13 6 + text "Optimzation" + border_width 1 + border_color black + } + + label { + position +13 = + size 20 6 + text "write Input" + border_width 1 + border_color black + } + + label { + position +18 = + size 30 6 + text "do not write Inp." + border_width 1 + border_color black + } + + label { + position -32 +6 + size 12 6 + text "O2 / OpenMP" + border_width 1 + border_color black + } + + popdown { + position +12 = + size 20 6 + text "Submit" + command "*submit_job 4 *monitor_job" + } + + popdown { + position +20 = + size 20 6 + text "Execute" + command "*execute_job 4 *monitor_job" + } + + label { + position -32 +6 + size 12 6 + text "O1 / OpenMP" + border_width 1 + border_color black + } + + popdown { + position +12 = + size 20 6 + text "Submit" + command "*submit_job 5 *monitor_job" + } + + popdown { + position +20 = + size 20 6 + text "Execute" + command "*execute_job 5 *monitor_job" + } + + label { + position -32 +6 + size 12 6 + text "O0 / OpenMP" + border_width 1 + border_color black + } + + popdown { + position +12 = + size 20 6 + text "Submit" + command "*submit_job 6 *monitor_job" + } + + popdown { + position +20 = + size 20 6 + text "Execute" + command "*execute_job 6 *monitor_job" + } + + popdown { + position 19 +8 + size 12 8 + text "CANCEL" + } +} + + + + window { + parent mentat + origin 38 8 +#ifdef DCOM + size 50 100 +#else + size 50 94 +#endif + background_color body + border_width 1 + border_color border + buffering single + } + mode permanent +} #-------------------------------------------------------------------------------------------------- popmenu job_exit_msg_pm { -#ifdef QT_MENTAT text "EXIT MESSAGE" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT text { position 1 5 @@ -1167,7 +1165,6 @@ popmenu job_exit_msg_pm { display "job_exit_msg" } -#endif popdown { position 37 +76 size 12 8 @@ -1189,74 +1186,16 @@ popmenu job_exit_msg_pm { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_user_source_pm { - - window { - parent job_run_wi - origin 25 17 - size 26 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_user_source_gr { - popdown { - position 0 0 - size 26 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 26 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 26 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 26 4 - text "CANCEL" - } -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_run_parallelization_pm { -#ifdef QT_MENTAT text "PARALLELIZATION/\{GPU}" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 60 4 - text "PARALLELIZATION/GPU" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -1280,14 +1219,9 @@ popmenu job_run_parallelization_pm { size 26 4 display job_class_label } -#endif frame { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 48 28 group job_ddm_gr text "DOMAIN DECOMPOSITION" @@ -1340,11 +1274,7 @@ popmenu job_run_parallelization_pm { border_color border buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } @@ -1359,6 +1289,7 @@ group job_ddm_gr { help job_run_ddm_use true_command "*job_option parallel:on" false_command "*job_option parallel:off" + active "not(job_solver_it_ext)" } frame { @@ -1377,12 +1308,8 @@ group job_ddm_use_gr { texts "DECOMPOSITION IN MARC" "DECOMPOSITION IN MENTAT" roller "job_option ddm_generator" -#ifdef QT_MENTAT commands "*job_option ddm_generator:fea_solver" "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif help job_run_ddm_generator } @@ -1403,11 +1330,7 @@ group job_ddm_use_gr { text { position 0 +9 size 22 4 -#ifdef QT_MENTAT text "Single Input File" -#else - text "SINGLE INPUT FILE" -#endif readonly visible "*job_option ddm_generator:fea_solver" } @@ -1439,72 +1362,17 @@ group job_ddm_use_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 19 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_generator_gr { - - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif #-------------------------------------------------------------------------------------------------- group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT label { position 0 0 size 10 4 text "# DOMAINS" help job_param } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif text { position +10 = @@ -1540,7 +1408,6 @@ group job_ddm_fea_solver_gr { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#ifdef QT_MENTAT commands "*job_option ddm_method:metis_best" "*job_option ddm_method:metis_element_based" "*job_option ddm_method:metis_node_based" @@ -1548,126 +1415,27 @@ group job_ddm_fea_solver_gr { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif } button { position +4 +4 size 19 4 text "ADVANCED SETTINGS" -#ifdef QT_MENTAT popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif } } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 24 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#-------------------------------------------------------------------------------------------------- -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - - -#ifdef QT_MENTAT #-------------------------------------------------------------------------------------------------- popmenu job_ddm_fea_solver_pm { text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif group { units 32 120 -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif label { position 0 5 @@ -1681,7 +1449,6 @@ screen job_ddm_fea_solver_sc { display "job_name" } -#ifdef QT_MENTAT label { position 0 +4 size 6 4 @@ -1693,15 +1460,10 @@ screen job_ddm_fea_solver_sc { size 26 4 display job_class_label } -#endif frame { -#ifdef QT_MENTAT position 0 +9 -#else - position 0 +5 -#endif size 32 76 text "ADVANCED DECOMPOSITION IN MARC" border_width 1 @@ -1709,21 +1471,12 @@ screen job_ddm_fea_solver_sc { group { -#ifdef QT_MENTAT label { position 1 4 size 16 4 text "# DOMAINS" help job_param } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif text { position +16 = @@ -1759,7 +1512,6 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#ifdef QT_MENTAT commands "*job_option ddm_method:metis_best" "*job_option ddm_method:metis_element_based" "*job_option ddm_method:metis_node_based" @@ -1767,9 +1519,6 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif } frame { @@ -1835,22 +1584,12 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_quadr_elems:linearized" } -#ifdef QT_MENTAT label { position 1 +5 size 15 4 text "ELEMENT WEIGHT FACTOR" help job_param } -#else - button { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } -#endif text { position +15 = @@ -1873,23 +1612,12 @@ screen job_ddm_fea_solver_sc { help job_run_ddm_decomp_detect_contact } -#ifdef QT_MENTAT label { position = +5 size 15 4 text "CONTACT TOLERANCE" visible "*job_option ddm_detect_contact:on" } -#else - button { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } -#endif text { position +15 = @@ -1901,23 +1629,12 @@ screen job_ddm_fea_solver_sc { help job_run_ddm_decomp_contact_tolerance } -#ifdef QT_MENTAT label { position -15 +4 size 15 4 text "CONTACT CONSTR FACTOR" visible "*job_option ddm_detect_contact:on" } -#else - button { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } -#endif text { position +15 = @@ -1930,54 +1647,16 @@ screen job_ddm_fea_solver_sc { } } -#ifdef QT_MENTAT popdown { position 0 +77 size 32 8 text "OK" } -#else - frame { - position 0 +77 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else mode permanent } # job_ddm_fea_solver_pm -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif #-------------------------------------------------------------------------------------------------- @@ -2055,12 +1734,8 @@ group job_ddm_sort_point_gr { texts "DEFAULT" "USER" roller "job_option ddm_sort_point" -#ifdef QT_MENTAT commands "*job_option ddm_sort_point:default" "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif } button { @@ -2097,49 +1772,6 @@ group job_ddm_sort_point_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_meth_gr { - - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif #-------------------------------------------------------------------------------------------------- @@ -2163,68 +1795,12 @@ group job_ddm_preprocessor_gr { position +4 = size 30 4 text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif + popmenu domains_pm help job_run_ddm_user_domains } } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif #-------------------------------------------------------------------------------------------------- @@ -2239,22 +1815,12 @@ group job_assem_recov_gr { toggle "*job_option assem_recov_multi_threading:on" } -#ifdef QT_MENTAT label { position +2 +4 size 12 4 text "# THREADS" visible "*job_option assem_recov_multi_threading:on" } -#else - button { - position +2 +4 - size 12 4 - text "# THREADS" - command "*job_param assem_recov_nthreads" - visible "*job_option assem_recov_multi_threading:on" - } -#endif text { position +12 = @@ -2339,7 +1905,6 @@ group job_parallel_matrix_solver_gr { job_solver_it_sparse job_solver_dir_profile job_solver_dir_sparse -#ifdef QT_MENTAT commands "*job_option solver:mfront_sparse" "*job_option solver:mixed_direct_iterative" "*job_option solver:it_ext" @@ -2359,9 +1924,6 @@ group job_parallel_matrix_solver_gr { job_allows_solver_dir_profile job_allows_solver_dir_sparse help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif } button { @@ -2401,40 +1963,15 @@ group job_parallel_matrix_solver_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 61 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_parallel_matrix_solver_opt_pm { -#ifdef QT_MENTAT text "MATRIX SOLVER OPTIONS" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif frame { position 1 5 @@ -2510,7 +2047,6 @@ group job_solver_multi_procs_parallel_off_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2518,15 +2054,6 @@ group job_solver_multi_procs_parallel_off_gr { visible "*job_option nsolver_procs_serial:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif text { position +14 = @@ -2547,9 +2074,7 @@ group job_solver_multi_procs_parallel_on_gr { text "MULTIPLE SOLVER PROCESSES" help job_run_multithreading toggle true -#ifdef QT_MENTAT set $dummy dummy -#endif } label { @@ -2619,21 +2144,12 @@ group job_nsolver_procs_ddm_automatic_gr { #-------------------------------------------------------------------------------------------------- group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT label { position 0 0 size 8 4 text "VALUE" help job_param } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif text { position +8 = @@ -2646,11 +2162,18 @@ group job_nsolver_procs_ddm_user_gr { group job_solver_multi_threads_gr { frame { position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr + size 46 8 + group job_solver_multi_threads_mfront_sparse_parallel_off_gr visible "and(job_solver_mfront_sparse,*job_option parallel:off)" } + frame { + position = = + size 46 8 + group job_solver_multi_threads_mfront_sparse_parallel_on_gr + visible "and(job_solver_mfront_sparse,*job_option parallel:on)" + } + frame { position = = size 46 8 @@ -2664,11 +2187,18 @@ group job_solver_multi_threads_gr { group job_solver_multi_threads_pardiso_parallel_on_gr visible "and(job_solver_pardiso,*job_option parallel:on)" } + + frame { + position = = + size 46 8 + group job_solver_multi_threads_it_ext_off_gr + visible "and(job_solver_it_ext,*job_option parallel:off)" + } } #-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_mfront_sparse_gr { +group job_solver_multi_threads_mfront_sparse_parallel_off_gr { toggle { position 0 0 @@ -2680,7 +2210,6 @@ group job_solver_multi_threads_mfront_sparse_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2688,15 +2217,6 @@ group job_solver_multi_threads_mfront_sparse_gr { visible "*job_option mfront_sparse_multi_threading:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# THREADS" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif text { position +14 = @@ -2707,6 +2227,116 @@ group job_solver_multi_threads_mfront_sparse_gr { } } +#-------------------------------------------------------------------------------------------------- +group job_solver_multi_threads_mfront_sparse_parallel_on_gr { + + toggle { + position 0 0 + size 30 4 + text "MULTIPLE THREADS" + help job_run_multithreading + toggle true + set $dummy dummy + } + + label { + position +30 0 + size 12 4 + visible "and( not(*job_option ddm_precond:direct)\ + *job_option parallel:on)" + text "PER DOMAIN" + border_width 1 + border_color black + } + + display { + position +12 0 + size 4 4 + display "job_mfront_sparse_nthreads_dom" + visible "and( not(*job_option ddm_precond:direct)\ + *job_option parallel:on)" + } + + label { + position 2 +4 + size 14 4 + text "# THREADS" + border_color black + border_width 1 + } + + roller { + position +14 = + size 14 4 + nvalues 2 + texts "AUTOMATIC" + "USER" + commands "*job_option mfront_sparse_multi_threading_ddm:automatic" + "*job_option mfront_sparse_multi_threading_ddm:user" + help job_run_multithreading + rollers "*job_option mfront_sparse_multi_threading_ddm:automatic" + "*job_option mfront_sparse_multi_threading_ddm:user" + } + + frame { + position +14 = + size 16 4 + group job_mfront_sparse_multi_threads_ddm_automatic_gr + visible "*job_option mfront_sparse_multi_threading_ddm:automatic" + } + + frame { + position = = + size 16 4 + group job_mfront_sparse_multi_threads_ddm_user_gr + visible "*job_option mfront_sparse_multi_threading_ddm:user" + } +} +#-------------------------------------------------------------------------------------------------- +group job_mfront_sparse_multi_threads_ddm_automatic_gr { + + label { + position 0 0 + size 8 4 + text "VALUE" + border_width 1 + border_color black + } + + integer { + position +8 = + size 8 4 + display valid_domains + visible "*job_option ddm_generator:preprocessor" + } + + integer { + position = = + size 8 4 + display "job_param_ndomains" + visible "*job_option ddm_generator:fea_solver" + } +} + + +#-------------------------------------------------------------------------------------------------- +group job_mfront_sparse_multi_threads_ddm_user_gr { + + label { + position 0 0 + size 8 4 + text "VALUE" + } + + text { + position +8 = + size 8 4 + display "job_param_value_nthreads" + command "*job_param nthreads" + } +} + + #-------------------------------------------------------------------------------------------------- group job_solver_gpu_gr { @@ -2767,7 +2397,6 @@ group job_solver_multi_threads_pardiso_parallel_off_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2775,15 +2404,6 @@ group job_solver_multi_threads_pardiso_parallel_off_gr { visible "*job_option pardiso_multi_threading:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# THREADS" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif text { position +14 = @@ -2804,9 +2424,7 @@ group job_solver_multi_threads_pardiso_parallel_on_gr { text "MULTIPLE THREADS" help job_run_multithreading toggle true -#ifdef QT_MENTAT set $dummy dummy -#endif } label { @@ -2876,21 +2494,12 @@ group job_pardiso_multi_threads_ddm_automatic_gr { #-------------------------------------------------------------------------------------------------- group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT label { position 0 0 size 8 4 text "VALUE" help job_param } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif text { position +8 = @@ -2900,6 +2509,35 @@ group job_pardiso_multi_threads_ddm_user_gr { } } +#-------------------------------------------------------------------------------------------------- +group job_solver_multi_threads_it_ext_off_gr { + + toggle { + position 0 0 + size 30 4 + text "MULTIPLE THREADS" + toggle "*job_option it_ext_multi_threading:on" + true_command "*job_option it_ext_multi_threading:on" + false_command "*job_option it_ext_multi_threading:off" + help job_run_multithreading + } + + label { + position +2 +4 + size 14 4 + text "# THREADS" + visible "*job_option it_ext_multi_threading:on" + help job_param + } + + text { + position +14 = + size 14 4 + display "job_param_value_nthreads" + command "*job_param nthreads" + visible "*job_option it_ext_multi_threading:on" + } +} #-------------------------------------------------------------------------------------------------- group job_parallel_env_gr { @@ -2932,11 +2570,7 @@ group job_parallel_env_network_gr { position 0 0 size 28 4 text "HOST FILE" -#ifdef QT_MENTAT browser host_file_browser -#else - popmenu host_file_browser_pm -#endif settext $host_file_browser_label "SELECT HOST FILE" set $host_file_browser_command "*job_host_file" help job_host_file @@ -3022,57 +2656,4 @@ group job_parallel_env_network_ddm_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu marc_integer_size_pm { - - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - - -#-------------------------------------------------------------------------------------------------- -group marc_integer_size_gr { - - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif #endif diff --git a/installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms b/installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms.original similarity index 77% rename from installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms rename to installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms.original index 630c23b1b..e67605be2 100644 --- a/installation/mods_MarcMentat/2013.1/Mentat_menus/job_run.ms +++ b/installation/mods_MarcMentat/2016/Mentat_menus/job_run.ms.original @@ -1,11 +1,6 @@ #ifndef AUTOFORGE popmenu job_title_pm file jobs.ms popdown job_title_ok file jobs.ms -#ifndef QT_MENTAT -popmenu marc_input_style_pm file job_common.ms -popmenu marc_input_style_run_adv_pm file job_common.ms -popmenu marc_version_run_pm file job_common.ms -#endif group job_solver_gr file job_common.ms group user_domains_gr file domain_decomposition.ms @@ -14,55 +9,25 @@ group user_domains_tail_gr file domain_decomposition.ms group job_solver_opts_gr file job_common.ms popmenu ddm_options file job_common.ms -#ifdef QT_MENTAT browser edit_browser file file.ms browser directory_browser file file.ms screen domains file domain_decomposition.ms -#else -popmenu edit_browser_popmenu file file.ms -popmenu directory_browser_popmenu file file.ms -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu usersub_file_browser_pm { - - group { -#endif browser usersub_file_browser { position 0 0 size 82 72 text "$usersub_file_browser_label" ($usersub_file_browser_label) - filter "*.f *.f90" + filter "*.f *.F *.f90 *.F90" nvisible 10 select_files true cancel_action popdown ok_action popdown command "$usersub_file_browser_command" ($usersub_file_browser_command) } -#ifndef QT_MENTAT - } - - window { - title " Select MARC User Subroutine File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu host_file_browser_pm { - - group { -#endif browser host_file_browser { position 0 0 @@ -75,39 +40,16 @@ popmenu host_file_browser_pm { ok_action popdown command "$host_file_browser_command" ($host_file_browser_command) } -#ifndef QT_MENTAT - } - - window { - title " Select MARC Host File" - origin 30 30 - size 82 72 - } - - mode dialog - disable_right_mouse_button -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_run_popmenu { -#ifdef QT_MENTAT text "RUN JOB" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 52 4 - text "RUN JOB" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -131,21 +73,12 @@ popmenu job_run_popmenu { size 26 4 display job_class_label } -#endif button { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 24 4 text "USER SUBROUTINE FILE" -#ifdef QT_MENTAT browser usersub_file_browser -#else - popmenu usersub_file_browser_pm -#endif settext $usersub_file_browser_label "SELECT USER SUBROUTINE FILE" set $usersub_file_browser_command "*job_usersub_file" help job_usersub_file @@ -193,13 +126,9 @@ popmenu job_run_popmenu { help job_run_compile roller "job_option user_source" visible job_usersub_file -#ifdef QT_MENTAT commands "*job_option user_source:compile_nosave" "*job_option user_source:compile_save" "*job_option user_source:run_saved" -#else - popmenu job_user_source_pm -#endif } toggle { @@ -292,16 +221,12 @@ popmenu job_run_popmenu { rollers "job_input_style_table_driven" "job_input_style_multi_physics" "job_input_style_old" -#ifdef QT_MENTAT commands "*job_option input_style:new *job_option input_physics_style:old" "*job_option input_physics_style:new *job_option input_style:new" "*job_option input_style:old *job_option input_physics_style:old" visibles "job_allows_input_style_table_driven" "job_allows_input_style_multi_physics" "job_allows_input_style_old" -#else - popmenu marc_input_style_pm -#endif help job_option_input_style } @@ -321,18 +246,11 @@ popmenu job_run_popmenu { button { position +16 = - size 16 6 - text "ADV. JOB SUBM." + size 34 6 + text "ADVANCED JOB SUBMISSION" popmenu job_submit_adv_pm } - button { - position +16 = - size 18 6 - text "DAMASK" - popmenu damask - } - button { position 1 +6 size 16 6 @@ -577,25 +495,15 @@ popmenu job_run_popmenu { text "ANY FILE" settext $edit_browser_label "EDIT FILE" set $edit_browser_command "*edit_file" -#ifdef QT_MENTAT browser edit_browser -#else - popmenu edit_browser_popmenu -#endif help edit_file } popdown { position 1 +6 size 32 4 -#ifdef QT_MENTAT text "OPEN POST FILE (MODEL PLOT RESULTS MENU)" command "@popdown(job_properties_pm) @main(results) @popup(modelplot_pm) *post_open_default" -#else - text "OPEN POST FILE (RESULTS MENU)" - screen results - command "*post_open_default" -#endif } button { @@ -622,30 +530,17 @@ popmenu job_run_popmenu { buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } #-------------------------------------------------------------------------------------------------- popmenu job_usersub_pm { -#ifdef QT_MENTAT text "CURRENTLY SELECTED USER SUBROUTINES" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 66 4 - text "CURRENTLY SELECTED USER SUBROUTINES" - } -#endif display { position 1 +5 @@ -677,21 +572,11 @@ popmenu job_usersub_pm { #-------------------------------------------------------------------------------------------------- popmenu job_submit_adv_pm { -#ifdef QT_MENTAT text "ADVANCED JOB SUBMISSION" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "ADVANCED JOB SUBMISSION" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -715,35 +600,20 @@ popmenu job_submit_adv_pm { size 26 4 display job_class_label } -#endif label { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 19 4 text "INITIAL ALLOCATION" border_width 1 border_color black } -#ifdef QT_MENTAT label { position +19 = size 15 4 text "GENERAL MEMORY" help job_param_general_init_allocation } -#else - button { - position +19 = - size 15 4 - text "GENERAL MEMORY" - help job_param_general_init_allocation - command "*job_param general_init_allocation" - } -#endif text { position +15 = size 10 4 @@ -805,13 +675,9 @@ popmenu job_submit_adv_pm { texts "DEFAULT" "4-BYTE INTEGERS" "8-BYTE INTEGERS" -#ifdef QT_MENTAT commands "*job_option marc_integer_size:default" "*job_option marc_integer_size:i4" "*job_option marc_integer_size:i8" -#else - popmenu marc_integer_size_pm -#endif help job_run_intsize roller "job_option marc_integer_size" } @@ -836,12 +702,17 @@ popmenu job_submit_adv_pm { roller { position +9 = size 14 4 - nvalues 17 - nvisible 17 + nvalues 22 + nvisible 22 texts "DEFAULT" #if 0 - "2013.1" + "2016" #endif + "2015" + "2014.2" + "2014.1" + "2014" + "2013.1" "2013" "2012" "2011" @@ -864,8 +735,13 @@ popmenu job_submit_adv_pm { help job_param_version rollers "job_input_version_default" #if 0 - "job_input_version_2013.1" + "job_input_version_2016" #endif + "job_input_version_2015" + "job_input_version_2014.2" + "job_input_version_2014.1" + "job_input_version_2014" + "job_input_version_2013.1" "job_input_version_2013" "job_input_version_2012" "job_input_version_2011" @@ -885,11 +761,15 @@ popmenu job_submit_adv_pm { "job_input_version_k6" "job_input_version_k5" "job_input_version_k4" -#ifdef QT_MENTAT commands "*job_option version:default" #if 0 - "*job_option version:2013.1" + "*job_option version:2016" #endif + "*job_option version:2015" + "*job_option version:2014.2" + "*job_option version:2014.1" + "*job_option version:2014" + "*job_option version:2013.1" "*job_option version:2013" "*job_option version:2012" "*job_option version:2011" @@ -911,8 +791,13 @@ popmenu job_submit_adv_pm { "*job_option version:k4" visibles "job_allows_input_version_default" #if 0 - "job_allows_input_version_2013.1" + "job_allows_input_version_2016" #endif + "job_allows_input_version_2015" + "job_allows_input_version_2014.2" + "job_allows_input_version_2014.1" + "job_allows_input_version_2014" + "job_allows_input_version_2013.1" "job_allows_input_version_2013" "job_allows_input_version_2012" "job_allows_input_version_2011" @@ -932,9 +817,6 @@ popmenu job_submit_adv_pm { "job_allows_input_version_k6" "job_allows_input_version_k5" "job_allows_input_version_k4" -#else - popmenu marc_version_run_pm -#endif } # see also job_common.ms @@ -958,16 +840,12 @@ popmenu job_submit_adv_pm { rollers "job_input_style_table_driven" "job_input_style_multi_physics" "job_input_style_old" -#ifdef QT_MENTAT commands "*job_option input_style:new *job_option input_physics_style:old" "*job_option input_physics_style:new *job_option input_style:new" "*job_option input_style:old *job_option input_physics_style:old" visibles "job_allows_input_style_table_driven" "job_allows_input_style_multi_physics" "job_allows_input_style_old" -#else - popmenu marc_input_style_run_adv_pm -#endif help job_option_input_style } @@ -989,11 +867,7 @@ popmenu job_submit_adv_pm { text "SCRATCH DIRECTORY" settext $directory_browser_label "JOB SCRATCH DIRECTORY" set $directory_browser_command "*job_scratch_directory" -#ifdef QT_MENTAT browser directory_browser -#else - popmenu directory_browser_popmenu -#endif help job_scratch_directory } @@ -1133,168 +1007,18 @@ popmenu job_submit_adv_pm { buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } -#-------------------------------------------------------------------------------------------------- -popmenu damask { - -#ifdef QT_MENTAT - text "DAMASK.MPIE.DE" -#endif - - group { -#ifndef QT_MENTAT - label { - position 0 0 - size 50 4 - text "DAMASK.MPIE.DE" - } -#endif - - label { - position 1 6 - size 13 6 - text "Optimzation" - border_width 1 - border_color black - } - - label { - position +13 = - size 20 6 - text "write Input" - border_width 1 - border_color black - } - - label { - position +18 = - size 30 6 - text "do not write Inp." - border_width 1 - border_color black - } - - label { - position -32 +6 - size 12 6 - text "O2 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 4 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 4 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O1 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 5 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 5 *monitor_job" - } - - label { - position -32 +6 - size 12 6 - text "O0 / OpenMP" - border_width 1 - border_color black - } - - popdown { - position +12 = - size 20 6 - text "Submit" - command "*submit_job 6 *monitor_job" - } - - popdown { - position +20 = - size 20 6 - text "Execute" - command "*execute_job 6 *monitor_job" - } - - popdown { - position 19 +8 - size 12 8 - text "CANCEL" - } -} - - - - window { - parent mentat - origin 38 8 -#ifdef DCOM - size 50 100 -#else - size 50 94 -#endif - background_color body - border_width 1 - border_color border - buffering single - } - mode dialog -} #-------------------------------------------------------------------------------------------------- popmenu job_exit_msg_pm { -#ifdef QT_MENTAT text "EXIT MESSAGE" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 86 4 - text "EXIT MESSAGE" - } - display { - position 1 5 - size 84 74 - display "job_exit_msg" - } -#endif - -#ifdef QT_MENTAT text { position 1 5 @@ -1304,7 +1028,6 @@ popmenu job_exit_msg_pm { display "job_exit_msg" } -#endif popdown { position 37 +76 size 12 8 @@ -1326,74 +1049,16 @@ popmenu job_exit_msg_pm { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_user_source_pm { - - window { - parent job_run_wi - origin 25 17 - size 26 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_user_source_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_user_source_gr { - popdown { - position 0 0 - size 26 4 - text "COMPILE / NO SAVE" - command "*job_option user_source:compile_nosave" - } - - popdown { - position = +4 - size 26 4 - text "COMPILE AND SAVE" - command "*job_option user_source:compile_save" - } - - popdown { - position = +4 - size 26 4 - text "RUN SAVED EXECUTABLE" - command "*job_option user_source:run_saved" - } - - popdown { - position = +5 - size 26 4 - text "CANCEL" - } -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_run_parallelization_pm { -#ifdef QT_MENTAT text "PARALLELIZATION/\{GPU}" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 60 4 - text "PARALLELIZATION/GPU" - } -#endif -#ifdef QT_MENTAT label { position 0 0 size 6 4 @@ -1417,14 +1082,9 @@ popmenu job_run_parallelization_pm { size 26 4 display job_class_label } -#endif frame { -#ifdef QT_MENTAT position 1 9 -#else - position 1 5 -#endif size 48 28 group job_ddm_gr text "DOMAIN DECOMPOSITION" @@ -1477,11 +1137,7 @@ popmenu job_run_parallelization_pm { border_color border buffering single } -#ifdef QT_MENTAT mode permanent -#else - mode dialog -#endif } @@ -1496,6 +1152,7 @@ group job_ddm_gr { help job_run_ddm_use true_command "*job_option parallel:on" false_command "*job_option parallel:off" + active "not(job_solver_it_ext)" } frame { @@ -1514,12 +1171,8 @@ group job_ddm_use_gr { texts "DECOMPOSITION IN MARC" "DECOMPOSITION IN MENTAT" roller "job_option ddm_generator" -#ifdef QT_MENTAT commands "*job_option ddm_generator:fea_solver" "*job_option ddm_generator:preprocessor" -#else - popmenu job_ddm_generator_pm -#endif help job_run_ddm_generator } @@ -1540,11 +1193,7 @@ group job_ddm_use_gr { text { position 0 +9 size 22 4 -#ifdef QT_MENTAT text "Single Input File" -#else - text "SINGLE INPUT FILE" -#endif readonly visible "*job_option ddm_generator:fea_solver" } @@ -1576,72 +1225,17 @@ group job_ddm_use_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_generator_pm { - - window { - parent mentat - origin 42 19 - size 30 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_generator_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_generator_gr { - - popdown { - position 0 0 - size 30 4 - text "DECOMPOSITION IN MARC" - command "*job_option ddm_generator:fea_solver" - help job_run_ddm_generator - } - - popdown { - position = +4 - size 30 4 - text "DECOMPOSITION IN MENTAT" - command "*job_option ddm_generator:preprocessor" - help job_run_ddm_generator - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - help job_run_ddm_generator - } -} -#endif #-------------------------------------------------------------------------------------------------- group job_ddm_fea_solver_gr { -#ifdef QT_MENTAT label { position 0 0 size 10 4 text "# DOMAINS" help job_param } -#else - button { - position 0 0 - size 10 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif text { position +10 = @@ -1677,7 +1271,6 @@ group job_ddm_fea_solver_gr { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#ifdef QT_MENTAT commands "*job_option ddm_method:metis_best" "*job_option ddm_method:metis_element_based" "*job_option ddm_method:metis_node_based" @@ -1685,126 +1278,27 @@ group job_ddm_fea_solver_gr { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#else - popmenu job_ddm_method_pm -#endif } button { position +4 +4 size 19 4 text "ADVANCED SETTINGS" -#ifdef QT_MENTAT popmenu job_ddm_fea_solver_pm -#else - screen job_ddm_fea_solver_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif } } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method_pm { - - window { - parent mentat - origin 56 24 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#-------------------------------------------------------------------------------------------------- -group job_ddm_method_gr { - - popdown { - position 0 0 - size 30 4 - text "METIS BEST" - command "*job_option ddm_method:metis_best" - } - - popdown { - position = +4 - size 30 4 - text "METIS ELEMENT BASED" - command "*job_option ddm_method:metis_element_based" - } - - popdown { - position = +4 - size 30 4 - text "METIS NODE BASED" - command "*job_option ddm_method:metis_node_based" - } - - popdown { - position = +4 - size 30 4 - text "RECURSIVE COORDINATE BISECTION" - command "*job_option ddm_method:recur_coord_bisect" - } - - popdown { - position = +4 - size 30 4 - text "VECTOR" - command "*job_option ddm_method:vector" - } - - popdown { - position = +4 - size 30 4 - text "RADIAL" - command "*job_option ddm_method:radial" - } - - popdown { - position = +4 - size 30 4 - text "ANGULAR" - command "*job_option ddm_method:angular" - } - - popdown { - position = +5 - size 30 4 - text "CANCEL" - } -} -#endif - - -#ifdef QT_MENTAT #-------------------------------------------------------------------------------------------------- popmenu job_ddm_fea_solver_pm { text "JOB PARALLELIZATION" -#else -screen job_ddm_fea_solver_sc { - - menu { -#endif group { units 32 120 -#ifndef QT_MENTAT - label { - position 0 0 - size 32 4 - text "JOB PARALLELIZATION" - } -#endif label { position 0 5 @@ -1818,7 +1312,6 @@ screen job_ddm_fea_solver_sc { display "job_name" } -#ifdef QT_MENTAT label { position 0 +4 size 6 4 @@ -1830,15 +1323,10 @@ screen job_ddm_fea_solver_sc { size 26 4 display job_class_label } -#endif frame { -#ifdef QT_MENTAT position 0 +9 -#else - position 0 +5 -#endif size 32 76 text "ADVANCED DECOMPOSITION IN MARC" border_width 1 @@ -1846,21 +1334,12 @@ screen job_ddm_fea_solver_sc { group { -#ifdef QT_MENTAT label { position 1 4 size 16 4 text "# DOMAINS" help job_param } -#else - button { - position 1 4 - size 16 4 - text "# DOMAINS" - command "*job_param ndomains" - } -#endif text { position +16 = @@ -1896,7 +1375,6 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#ifdef QT_MENTAT commands "*job_option ddm_method:metis_best" "*job_option ddm_method:metis_element_based" "*job_option ddm_method:metis_node_based" @@ -1904,9 +1382,6 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_method:vector" "*job_option ddm_method:radial" "*job_option ddm_method:angular" -#else - popmenu job_ddm_method2_pm -#endif } frame { @@ -1972,22 +1447,12 @@ screen job_ddm_fea_solver_sc { "*job_option ddm_quadr_elems:linearized" } -#ifdef QT_MENTAT label { position 1 +5 size 15 4 text "ELEMENT WEIGHT FACTOR" help job_param } -#else - button { - position 1 +5 - size 15 4 - text "ELEMENT WEIGHT FACTOR" - command "*job_param ddm_elem_weight_factor" - help job_run_ddm_decomp_element_weight_factor - } -#endif text { position +15 = @@ -2010,23 +1475,12 @@ screen job_ddm_fea_solver_sc { help job_run_ddm_decomp_detect_contact } -#ifdef QT_MENTAT label { position = +5 size 15 4 text "CONTACT TOLERANCE" visible "*job_option ddm_detect_contact:on" } -#else - button { - position = +5 - size 15 4 - text "CONTACT TOLERANCE" - command "*job_param ddm_contact_tolerance" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_tolerance - } -#endif text { position +15 = @@ -2038,23 +1492,12 @@ screen job_ddm_fea_solver_sc { help job_run_ddm_decomp_contact_tolerance } -#ifdef QT_MENTAT label { position -15 +4 size 15 4 text "CONTACT CONSTR FACTOR" visible "*job_option ddm_detect_contact:on" } -#else - button { - position -15 +4 - size 15 4 - text "CONTACT CONSTR FACTOR" - command "*job_param ddm_contact_constr_factor" - visible "*job_option ddm_detect_contact:on" - help job_run_ddm_decomp_contact_constraint_factor - } -#endif text { position +15 = @@ -2067,54 +1510,16 @@ screen job_ddm_fea_solver_sc { } } -#ifdef QT_MENTAT popdown { position 0 +77 size 32 8 text "OK" } -#else - frame { - position 0 +77 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return -#endif } -#ifndef QT_MENTAT - window main_window - disable_right_mouse_button - } - - menu transform -} # job_ddm_fea_solver_sc -#else mode permanent } # job_ddm_fea_solver_pm -#endif -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_method2_pm { - - window { - parent mentat - origin 1 22 - size 30 33 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_method_gr -} -#endif #-------------------------------------------------------------------------------------------------- @@ -2192,12 +1597,8 @@ group job_ddm_sort_point_gr { texts "DEFAULT" "USER" roller "job_option ddm_sort_point" -#ifdef QT_MENTAT commands "*job_option ddm_sort_point:default" "*job_option ddm_sort_point:user" -#else - popmenu job_ddm_sort_point_meth_pm -#endif } button { @@ -2234,49 +1635,6 @@ group job_ddm_sort_point_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_ddm_sort_point_meth_pm { - - window { - parent mentat - origin 15 35 - size 14 13 - border_width 1 - border_color border - background_color body - } - - mode dialog - - group job_ddm_sort_point_meth_gr -} - - -#-------------------------------------------------------------------------------------------------- -group job_ddm_sort_point_meth_gr { - - popdown { - position 0 0 - size 14 4 - text "DEFAULT" - command "*job_option ddm_sort_point:default" - } - - popdown { - position = +4 - size 14 4 - text "USER DEFINED" - command "*job_option ddm_sort_point:user" - } - - popdown { - position = +5 - size 14 4 - text "CANCEL" - } -} -#endif #-------------------------------------------------------------------------------------------------- @@ -2300,68 +1658,12 @@ group job_ddm_preprocessor_gr { position +4 = size 30 4 text "USER DOMAINS" -#ifdef QT_MENTAT - screen domains -#else - screen job_ddm_user_domains_sc - command "@popdown($popname2) @popdown($popname1)" ($popname2, $popname1) -#endif + popmenu domains_pm help job_run_ddm_user_domains } } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -screen job_ddm_user_domains_sc { - - menu { - - group { - units 32 120 - - label { - position 0 0 - size 32 4 - text "USER DOMAINS" - } - - frame { - position 0 5 - size 32 28 - group user_domains_gr - } - - frame { - position 0 +29 - size 32 49 - group user_domains_generate_gr - } - - frame { - position 0 +50 - size 32 8 - group user_domains_tail_gr - } - - frame { - position 0 92 - size 32 8 - group ok2_gr - } - - frame select_frame - frame inactive_return - } - window main_window - disable_right_mouse_button - - } - - menu transform - -} # job_ddm_user_domains_sc -#endif #-------------------------------------------------------------------------------------------------- @@ -2376,22 +1678,12 @@ group job_assem_recov_gr { toggle "*job_option assem_recov_multi_threading:on" } -#ifdef QT_MENTAT label { position +2 +4 size 12 4 text "# THREADS" visible "*job_option assem_recov_multi_threading:on" } -#else - button { - position +2 +4 - size 12 4 - text "# THREADS" - command "*job_param assem_recov_nthreads" - visible "*job_option assem_recov_multi_threading:on" - } -#endif text { position +12 = @@ -2476,7 +1768,6 @@ group job_parallel_matrix_solver_gr { job_solver_it_sparse job_solver_dir_profile job_solver_dir_sparse -#ifdef QT_MENTAT commands "*job_option solver:mfront_sparse" "*job_option solver:mixed_direct_iterative" "*job_option solver:it_ext" @@ -2496,9 +1787,6 @@ group job_parallel_matrix_solver_gr { job_allows_solver_dir_profile job_allows_solver_dir_sparse help job_param_solver_method -#else - popmenu job_set_parallel_matrix_solver_pm -#endif } button { @@ -2538,40 +1826,15 @@ group job_parallel_matrix_solver_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu job_set_parallel_matrix_solver_pm { - window { - parent mentat - origin 48 61 - size 24 42 - border_width 1 - border_color border - background_color body - } - mode dialog - - group job_solver_gr -} -#endif #-------------------------------------------------------------------------------------------------- popmenu job_parallel_matrix_solver_opt_pm { -#ifdef QT_MENTAT text "MATRIX SOLVER OPTIONS" -#endif group { -#ifndef QT_MENTAT - label { - position 0 0 - size 38 4 - text "MATRIX SOLVER OPTIONS" - } -#endif frame { position 1 5 @@ -2647,7 +1910,6 @@ group job_solver_multi_procs_parallel_off_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2655,15 +1917,6 @@ group job_solver_multi_procs_parallel_off_gr { visible "*job_option nsolver_procs_serial:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# PROCESSES" - command "*job_param nsolver_procs" - visible "*job_option nsolver_procs_serial:on" - } -#endif text { position +14 = @@ -2684,9 +1937,7 @@ group job_solver_multi_procs_parallel_on_gr { text "MULTIPLE SOLVER PROCESSES" help job_run_multithreading toggle true -#ifdef QT_MENTAT set $dummy dummy -#endif } label { @@ -2756,21 +2007,12 @@ group job_nsolver_procs_ddm_automatic_gr { #-------------------------------------------------------------------------------------------------- group job_nsolver_procs_ddm_user_gr { -#ifdef QT_MENTAT label { position 0 0 size 8 4 text "VALUE" help job_param } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nsolver_procs" - } -#endif text { position +8 = @@ -2783,11 +2025,18 @@ group job_nsolver_procs_ddm_user_gr { group job_solver_multi_threads_gr { frame { position 0 0 - size 30 8 - group job_solver_multi_threads_mfront_sparse_gr + size 46 8 + group job_solver_multi_threads_mfront_sparse_parallel_off_gr visible "and(job_solver_mfront_sparse,*job_option parallel:off)" } + frame { + position = = + size 46 8 + group job_solver_multi_threads_mfront_sparse_parallel_on_gr + visible "and(job_solver_mfront_sparse,*job_option parallel:on)" + } + frame { position = = size 46 8 @@ -2801,11 +2050,18 @@ group job_solver_multi_threads_gr { group job_solver_multi_threads_pardiso_parallel_on_gr visible "and(job_solver_pardiso,*job_option parallel:on)" } + + frame { + position = = + size 46 8 + group job_solver_multi_threads_it_ext_off_gr + visible "and(job_solver_it_ext,*job_option parallel:off)" + } } #-------------------------------------------------------------------------------------------------- -group job_solver_multi_threads_mfront_sparse_gr { +group job_solver_multi_threads_mfront_sparse_parallel_off_gr { toggle { position 0 0 @@ -2817,7 +2073,6 @@ group job_solver_multi_threads_mfront_sparse_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2825,15 +2080,6 @@ group job_solver_multi_threads_mfront_sparse_gr { visible "*job_option mfront_sparse_multi_threading:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# THREADS" - command "*job_param nthreads" - visible "*job_option mfront_sparse_multi_threading:on" - } -#endif text { position +14 = @@ -2844,6 +2090,116 @@ group job_solver_multi_threads_mfront_sparse_gr { } } +#-------------------------------------------------------------------------------------------------- +group job_solver_multi_threads_mfront_sparse_parallel_on_gr { + + toggle { + position 0 0 + size 30 4 + text "MULTIPLE THREADS" + help job_run_multithreading + toggle true + set $dummy dummy + } + + label { + position +30 0 + size 12 4 + visible "and( not(*job_option ddm_precond:direct)\ + *job_option parallel:on)" + text "PER DOMAIN" + border_width 1 + border_color black + } + + display { + position +12 0 + size 4 4 + display "job_mfront_sparse_nthreads_dom" + visible "and( not(*job_option ddm_precond:direct)\ + *job_option parallel:on)" + } + + label { + position 2 +4 + size 14 4 + text "# THREADS" + border_color black + border_width 1 + } + + roller { + position +14 = + size 14 4 + nvalues 2 + texts "AUTOMATIC" + "USER" + commands "*job_option mfront_sparse_multi_threading_ddm:automatic" + "*job_option mfront_sparse_multi_threading_ddm:user" + help job_run_multithreading + rollers "*job_option mfront_sparse_multi_threading_ddm:automatic" + "*job_option mfront_sparse_multi_threading_ddm:user" + } + + frame { + position +14 = + size 16 4 + group job_mfront_sparse_multi_threads_ddm_automatic_gr + visible "*job_option mfront_sparse_multi_threading_ddm:automatic" + } + + frame { + position = = + size 16 4 + group job_mfront_sparse_multi_threads_ddm_user_gr + visible "*job_option mfront_sparse_multi_threading_ddm:user" + } +} +#-------------------------------------------------------------------------------------------------- +group job_mfront_sparse_multi_threads_ddm_automatic_gr { + + label { + position 0 0 + size 8 4 + text "VALUE" + border_width 1 + border_color black + } + + integer { + position +8 = + size 8 4 + display valid_domains + visible "*job_option ddm_generator:preprocessor" + } + + integer { + position = = + size 8 4 + display "job_param_ndomains" + visible "*job_option ddm_generator:fea_solver" + } +} + + +#-------------------------------------------------------------------------------------------------- +group job_mfront_sparse_multi_threads_ddm_user_gr { + + label { + position 0 0 + size 8 4 + text "VALUE" + } + + text { + position +8 = + size 8 4 + display "job_param_value_nthreads" + command "*job_param nthreads" + } +} + + #-------------------------------------------------------------------------------------------------- group job_solver_gpu_gr { @@ -2904,7 +2260,6 @@ group job_solver_multi_threads_pardiso_parallel_off_gr { help job_run_multithreading } -#ifdef QT_MENTAT label { position +2 +4 size 14 4 @@ -2912,15 +2267,6 @@ group job_solver_multi_threads_pardiso_parallel_off_gr { visible "*job_option pardiso_multi_threading:on" help job_param } -#else - button { - position +2 +4 - size 14 4 - text "# THREADS" - command "*job_param nthreads" - visible "*job_option pardiso_multi_threading:on" - } -#endif text { position +14 = @@ -2941,9 +2287,7 @@ group job_solver_multi_threads_pardiso_parallel_on_gr { text "MULTIPLE THREADS" help job_run_multithreading toggle true -#ifdef QT_MENTAT set $dummy dummy -#endif } label { @@ -3013,21 +2357,12 @@ group job_pardiso_multi_threads_ddm_automatic_gr { #-------------------------------------------------------------------------------------------------- group job_pardiso_multi_threads_ddm_user_gr { -#ifdef QT_MENTAT label { position 0 0 size 8 4 text "VALUE" help job_param } -#else - button { - position 0 0 - size 8 4 - text "VALUE" - command "*job_param nthreads" - } -#endif text { position +8 = @@ -3037,6 +2372,35 @@ group job_pardiso_multi_threads_ddm_user_gr { } } +#-------------------------------------------------------------------------------------------------- +group job_solver_multi_threads_it_ext_off_gr { + + toggle { + position 0 0 + size 30 4 + text "MULTIPLE THREADS" + toggle "*job_option it_ext_multi_threading:on" + true_command "*job_option it_ext_multi_threading:on" + false_command "*job_option it_ext_multi_threading:off" + help job_run_multithreading + } + + label { + position +2 +4 + size 14 4 + text "# THREADS" + visible "*job_option it_ext_multi_threading:on" + help job_param + } + + text { + position +14 = + size 14 4 + display "job_param_value_nthreads" + command "*job_param nthreads" + visible "*job_option it_ext_multi_threading:on" + } +} #-------------------------------------------------------------------------------------------------- group job_parallel_env_gr { @@ -3069,11 +2433,7 @@ group job_parallel_env_network_gr { position 0 0 size 28 4 text "HOST FILE" -#ifdef QT_MENTAT browser host_file_browser -#else - popmenu host_file_browser_pm -#endif settext $host_file_browser_label "SELECT HOST FILE" set $host_file_browser_command "*job_host_file" help job_host_file @@ -3159,57 +2519,4 @@ group job_parallel_env_network_ddm_gr { } -#ifndef QT_MENTAT -#-------------------------------------------------------------------------------------------------- -popmenu marc_integer_size_pm { - - window { - parent mentat - origin 55 32 - size 32 17 - border_width 1 - border_color border - background_color body - } - mode dialog - - group marc_integer_size_gr -} - - -#-------------------------------------------------------------------------------------------------- -group marc_integer_size_gr { - - popdown { - position 0 0 - size 32 4 - text "DEFAULT" - command "*job_option marc_integer_size:default" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "4-BYTE INTEGERS" - command "*job_option marc_integer_size:i4" - help job_run_intsize - } - - popdown { - position = +4 - size 32 4 - text "8-BYTE INTEGERS" - command "*job_option marc_integer_size:i8" - help job_run_intsize - } - - popdown { - position = +5 - size 32 4 - text "CANCEL" - help job_run_intsize - } -} -#endif #endif diff --git a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh index 348c24565..f52b70e36 100755 --- a/installation/mods_MarcMentat/apply_DAMASK_modifications.sh +++ b/installation/mods_MarcMentat/apply_DAMASK_modifications.sh @@ -1,21 +1,24 @@ #!/usr/bin/env bash -DEFAULT_VERSION='2015' - -WORKINGDIR="$( cd "$( dirname "$0" )" && pwd )" - -if [ -f $HOME/.damask/damask.conf ]; then - source $HOME/.damask/damask.conf -else - source /etc/damask.conf -fi +SCRIPTLOCATION="$( cd "$( dirname "$0" )" && pwd )" +DAMASK_ROOT=$SCRIPTLOCATION/../../ +# defining set() allows to source the same file for tcsh and bash, with and without space around = +set() { + export $1$2$3 + } +source $DAMASK_ROOT/CONFIG if [ "x$MSC_ROOT" != "x" ]; then DEFAULT_DIR=$MSC_ROOT fi +if [ "x$MARC_VERSION" != "x" ]; then + DEFAULT_VERSION=$MARC_VERSION +fi +if [ "x$DAMASK_BIN" != "x" ]; then + BIN_DIR=$DAMASK_BIN +fi - -while [ ! -d "$WORKINGDIR/$VERSION" ] || [ -z "$VERSION" ] +while [ ! -d "$SCRIPTLOCATION/$VERSION" ] || [ -z "$VERSION" ] do echo "Input version of MARC/MENTAT installation: [${DEFAULT_VERSION}]" read VERSION @@ -66,7 +69,7 @@ for filename in 'comp_damask' \ 'run_damask_lmp' \ 'run_damask_hmp' \ 'include_linux64'; do - cp $WORKINGDIR/$VERSION/Marc_tools/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Marc_tools/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $filename @@ -89,7 +92,7 @@ for filename in 'edit_window' \ 'kill7' \ 'kill8' \ 'kill9'; do - cp $WORKINGDIR/$VERSION/Mentat_bin/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Mentat_bin/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%EDITOR%:${EDITOR}:g" @@ -101,7 +104,7 @@ echo '' echo 'copying Mentat menus...' theDIR=$INSTALLDIR/mentat$VERSION/menus for filename in 'job_run.ms'; do - cp $WORKINGDIR/$VERSION/Mentat_menus/$filename $theDIR + cp $SCRIPTLOCATION/$VERSION/Mentat_menus/$filename $theDIR echo $theDIR/$filename | xargs perl -pi -e "s:%INSTALLDIR%:${INSTALLDIR}:g" echo $theDIR/$filename | xargs perl -pi -e "s:%VERSION%:${VERSION}:g" echo $filename @@ -121,31 +124,33 @@ chmod 755 $INSTALLDIR/mentat$VERSION/bin/submit{4..9} chmod 755 $INSTALLDIR/mentat$VERSION/bin/kill{4..9} #creating symlinks for run_damask_scripts in /usr/local/bin -BIN_DIR=/usr/local/bin -echo '' -echo "Do you want to create symlinks for run_damask scripts in ${BIN_DIR} [YES/no] ?" -read YESNO - if [ -z "$YESNO" ]; then - YESNO=yes - fi -case $YESNO in - y* | Y* ) - echo'' - echo 'creating symlinks ...' - echo'' - theDIR=$INSTALLDIR/marc$VERSION/tools - for filename in 'run_damask' \ - 'run_damask_l' \ - 'run_damask_h' \ - 'run_damask_mp' \ - 'run_damask_lmp' \ - 'run_damask_hmp'; do - echo ${filename:4}$VERSION - [ -f $BIN_DIR/${filename:4}$VERSION ] && rm $BIN_DIR/${filename:4}$VERSION - ln -s $theDIR/$filename $BIN_DIR/${filename:4}$VERSION - done - ;; -esac + +if [ -d "$BIN_DIR" ]; then + echo '' + echo "Do you want to create symlinks for run_damask scripts in ${BIN_DIR} [YES/no] ?" + read YESNO + if [ -z "$YESNO" ]; then + YESNO=yes + fi + case $YESNO in + y* | Y* ) + echo'' + echo 'creating symlinks ...' + echo'' + theDIR=$INSTALLDIR/marc$VERSION/tools + for filename in 'run_damask' \ + 'run_damask_l' \ + 'run_damask_h' \ + 'run_damask_mp' \ + 'run_damask_lmp' \ + 'run_damask_hmp'; do + echo ${filename:4}$VERSION + [ -f $BIN_DIR/${filename:4}$VERSION ] && rm $BIN_DIR/${filename:4}$VERSION + ln -s $theDIR/$filename $BIN_DIR/${filename:4}$VERSION + done + ;; + esac +fi echo '' echo 'done.' diff --git a/installation/mods_MarcMentat/installation.txt b/installation/mods_MarcMentat/installation.txt index 2b9f5d9b4..d463387af 100644 --- a/installation/mods_MarcMentat/installation.txt +++ b/installation/mods_MarcMentat/installation.txt @@ -1,21 +1,13 @@ -Install MPIE modifications to use DAMASK_marc2010/11/12/13/14 +Install DAMASK modifications to use DAMASK_marc +This is for the Linux64 version of Marc/Mentat Refer to http://damask.mpie.de for complete installation instructions. Usually you will need to be root for this to work! -This is for the Linux64 version of Marc/Mentat2011/12/13(.1)/14(.2). See Marc and Mentat Release Guide for List of Build and Supported Platforms! -The Intel Fortran compiler needs to be installed. Marc/Mentat as well as DAMASK rely on Intel Fortran 12.0 or above! Make sure that ifort (the compiler executable) is in the PATH and that LD_LIBRARY_PATH is set correctly, refer to the Intel installation guide for instructions on how to do this. - -The AMD Core Math Library or an other BLAS implementation (currently IMKL and LAPACK are supported) needs to be installed! -Add acml path to LD_LIBRARY_PATH, to do so either use the script setup_shellrc.py in the installation folder or for a system wide setup edit /etc/csh.cshrc.local and/or /etc/bash.bashrc.local. -Assuming ACML is installed in path ACMLDIR the path should read: /ACMLDIR/ifort64_mp/lib (this is the version using paralllization, ie openmp): - for bash: LD_LIBRARY_PATH="/ACMLDIR/ifort64_mp/lib:${LD_LIBRARY_PATH}"; export LD_LIBRARY_PATH - for csh: setenv LD_LIBRARY_PATH /ACMLDIR/ifort64_mp/lib:${LD_LIBRARY_PATH} - -As the apply_DAMASK_modifications script has to fix the path for the BLAS it needs to be installed in a place that can be accessed by all users of the system. In addition you have to specify the respective locations in DAMASK_ROOT/lib/pathInfo. +The Intel Fortran compiler needs to be installed. 1) Install Marc, Mentat and Documentation as usual Run the test example including subroutines to confirm that the installation of both Marc/Mentat and the Intel Fortran Compiler is ok! diff --git a/installation/patch/README.md b/installation/patch/README.md new file mode 100644 index 000000000..86ed44f0d --- /dev/null +++ b/installation/patch/README.md @@ -0,0 +1,17 @@ +# DAMASK patching + +This folder contains patches that modify the functionality of the current version of DAMASK prior to the corresponding inclusion in the official release. + +## Usage + +```bash +cd DAMASK_ROOT +patch -p1 < installation/patch/nameOfPatch +``` + +## Available patches + + * **fwbw_derivative** switches the default spatial derivative from continuous to forward/backward difference. + This generally reduces spurious oscillations in the result as the spatial accuracy of the derivative is then compatible with the underlying solution grid. + * **petsc3.7** adapts to API changes introduced between PETSc 3.6.x and 3.7.x for setting PETSc options. + Use this patch if your system runs PETSc 3.7.x. diff --git a/installation/patch/fwbw_derivative b/installation/patch/fwbw_derivative new file mode 100644 index 000000000..03d5be1c6 --- /dev/null +++ b/installation/patch/fwbw_derivative @@ -0,0 +1,13 @@ +diff --git a/code/numerics.f90 b/code/numerics.f90 +index 24bd190..c968c70 100644 +--- a/code/numerics.f90 ++++ b/code/numerics.f90 +@@ -110,7 +110,7 @@ module numerics + fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag + character(len=64), protected, public :: & + spectral_solver = 'basicpetsc' , & !< spectral solution method +- spectral_derivative = 'continuous' !< spectral spatial derivative method ++ spectral_derivative = 'fwbw_difference' !< spectral spatial derivative method + character(len=1024), protected, public :: & + petsc_defaultOptions = '-mech_snes_type ngmres & + &-damage_snes_type ngmres & diff --git a/installation/patch/petsc3.7 b/installation/patch/petsc3.7 new file mode 100644 index 000000000..b5fd696fb --- /dev/null +++ b/installation/patch/petsc3.7 @@ -0,0 +1,22 @@ +diff --git a/code/spectral_utilities.f90 b/code/spectral_utilities.f90 +index 34eb0ea..a33c7a9 100644 +--- a/code/spectral_utilities.f90 ++++ b/code/spectral_utilities.f90 +@@ -227,12 +227,13 @@ subroutine utilities_init() + trim(PETScDebug), & + ' add more using the PETSc_Options keyword in numerics.config '; flush(6) + +- call PetscOptionsClear(ierr); CHKERRQ(ierr) +- if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr) ++ call PetscOptionsClear(PETSC_NULL_OBJECT,ierr) + CHKERRQ(ierr) +- call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr) ++ if(debugPETSc) call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(PETSCDEBUG),ierr) + CHKERRQ(ierr) +- call PetscOptionsInsertString(trim(petsc_options),ierr) ++ call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_defaultOptions),ierr) ++ CHKERRQ(ierr) ++ call PetscOptionsInsertString(PETSC_NULL_OBJECT,trim(petsc_options),ierr) + CHKERRQ(ierr) + + grid1Red = grid(1)/2_pInt + 1_pInt diff --git a/installation/symlink_Code.py b/installation/symlink_Code.py index f0fea41e3..c215a841e 100755 --- a/installation/symlink_Code.py +++ b/installation/symlink_Code.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -11,39 +11,55 @@ bin_link = { \ ], } -MarcReleases =[2011,2012,2013,2013.1,2014,2014.2,2015] +MarcReleases =[ \ + '2014', + '2014.2', + '2015', + '2016' + ] -baseDir = damask.Environment('../../').relPath('code/') - -try: - binDir = damask.Environment().options['DAMASK_BIN'] -except: - root=os.access('/usr/local/bin', os.W_OK) - if root: - binDir = '/usr/local/bin' - else: - binDir = os.path.join(os.getenv('HOME'),'bin') +damaskEnv = damask.Environment() +baseDir = damaskEnv.relPath('code/') +binDir = damaskEnv.options['DAMASK_BIN'] if not os.path.isdir(binDir): os.mkdir(binDir) -for dir in bin_link: - for file in bin_link[dir]: - src = os.path.abspath(os.path.join(baseDir,dir,file)) - if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(binDir,\ - {True: dir, - False:os.path.splitext(file)[0]}[file == ''])) - if os.path.lexists(sym_link): os.remove(sym_link) - os.symlink(src,sym_link) - sys.stdout.write(sym_link+' -> '+src+'\n') +sys.stdout.write('\nsymbolic linking...\n') +for subDir in bin_link: + theDir = os.path.abspath(os.path.join(baseDir,subDir)) + sys.stdout.write('\n'+binDir+' ->\n'+theDir+damask.util.deemph(' ...')+'\n') + + for theFile in bin_link[subDir]: + theName,theExt = os.path.splitext(theFile) + src = os.path.abspath(os.path.join(theDir,theFile)) + + if os.path.exists(src): + sym_link = os.path.abspath(os.path.join(binDir,subDir if theFile == '' else theName)) + + if os.path.lexists(sym_link): + os.remove(sym_link) + output = theName+damask.util.deemph(theExt) + else: + output = damask.util.emph(theName)+damask.util.deemph(theExt) + + sys.stdout.write(damask.util.deemph('... ')+output+'\n') + os.symlink(src,sym_link) + + +sys.stdout.write('\nMSC.Marc versioning...\n\n') +theMaster = 'DAMASK_marc.f90' for version in MarcReleases: - src = os.path.abspath(os.path.join(baseDir,'DAMASK_marc.f90')) + src = os.path.abspath(os.path.join(baseDir,theMaster)) if os.path.exists(src): - sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc'+str(version)+'.f90')) - if os.path.lexists(sym_link): os.remove(sym_link) - os.symlink(os.path.relpath(src,baseDir),sym_link) - sys.stdout.write(sym_link+' -> '+src+'\n') + sym_link = os.path.abspath(os.path.join(baseDir,'DAMASK_marc{}.f90'.format(version))) + if os.path.lexists(sym_link): + os.remove(sym_link) + output = version + else: + output = damask.util.emph(version) + sys.stdout.write(' '+output+'\n') + os.symlink(theMaster,sym_link) diff --git a/installation/symlink_Processing.py b/installation/symlink_Processing.py index 0ca4f8ba4..d10b5af55 100755 --- a/installation/symlink_Processing.py +++ b/installation/symlink_Processing.py @@ -1,42 +1,59 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- # Makes postprocessing routines acessible from everywhere. import os,sys -from damask import Environment +import damask -BOLD = '\033[1m' -ENDC = '\033[0m' - -damaskEnv = Environment() +damaskEnv = damask.Environment() baseDir = damaskEnv.relPath('processing/') -codeDir = damaskEnv.relPath('code/') -try: - binDir = damaskEnv.options['DAMASK_BIN'] -except: - binDir = '/usr/local/bin' if os.access('/usr/local/bin', os.W_OK) else os.path.join(os.getenv('HOME'),'bin') +binDir = damaskEnv.options['DAMASK_BIN'] if not os.path.isdir(binDir): os.mkdir(binDir) #define ToDo list -processing_subDirs = ['pre','post','misc',] -processing_extensions = ['.py','.sh',] - +processing_subDirs = ['pre', + 'post', + 'misc', + ] +processing_extensions = ['.py', + '.sh', + ] + +sys.stdout.write('\nsymbolic linking...\n') + for subDir in processing_subDirs: theDir = os.path.abspath(os.path.join(baseDir,subDir)) + sys.stdout.write('\n'+binDir+' ->\n'+theDir+damask.util.deemph(' ...')+'\n') + for theFile in os.listdir(theDir): - if os.path.splitext(theFile)[1] in processing_extensions: # only consider files with proper extensions + theName,theExt = os.path.splitext(theFile) + if theExt in processing_extensions: # only consider files with proper extensions src = os.path.abspath(os.path.join(theDir,theFile)) - sym_link = os.path.abspath(os.path.join(binDir,os.path.splitext(theFile)[0])) + sym_link = os.path.abspath(os.path.join(binDir,theName)) if os.path.lexists(sym_link): os.remove(sym_link) - sys.stdout.write(sym_link) + output = theName+damask.util.deemph(theExt) else: - sys.stdout.write(BOLD + sym_link + ENDC) + output = damask.util.emph(theName)+damask.util.deemph(theExt) + sys.stdout.write(damask.util.deemph('... ')+output+'\n') os.symlink(src,sym_link) - sys.stdout.write(' -> '+src+'\n') + + +sys.stdout.write('\npruning broken links...\n') + +brokenLinks = 0 + +for filename in os.listdir(binDir): + path = os.path.join(binDir,filename) + if os.path.islink(path) and not os.path.exists(path): + sys.stdout.write(' '+damask.util.delete(path)+'\n') + os.remove(path) + brokenLinks += 1 + +sys.stdout.write(('none.' if brokenLinks == 0 else '')+'\n') diff --git a/lib/IR_Precision.f90 b/lib/IR_Precision.f90 deleted file mode 100644 index d80923fee..000000000 --- a/lib/IR_Precision.f90 +++ /dev/null @@ -1,1230 +0,0 @@ -!> @addtogroup GlobalVarPar Global Variables and Parameters -!> List of global variables and parameters. -!> @addtogroup Interface Interfaces -!> List of explicitly defined interface. -!> @addtogroup Library Modules Libraries -!> List of modules containing libraries of procedures. -!> @addtogroup PublicProcedure Public Procedures -!> List of public procedures. -!> @addtogroup PrivateProcedure Private Procedures -!> List of private procedures. - -!> @ingroup Library -!> @{ -!> @defgroup IR_PrecisionLibrary IR_Precision -!> Portable kind-parameters module -!> @} - -!> @ingroup Interface -!> @{ -!> @defgroup IR_PrecisionInterface IR_Precision -!> Portable kind-parameters module -!> @} - -!> @ingroup GlobalVarPar -!> @{ -!> @defgroup IR_PrecisionGlobalVarPar IR_Precision -!> Portable kind-parameters module -!> @} - -!> @ingroup PublicProcedure -!> @{ -!> @defgroup IR_PrecisionPublicProcedure IR_Precision -!> Portable kind-parameters module -!> @} - -!> @ingroup PrivateProcedure -!> @{ -!> @defgroup IR_PrecisionPrivateProcedure IR_Precision -!> Portable kind-parameters module -!> @} - -!> @brief Module IR_Precision makes available some portable kind-parameters and some useful procedures to deal with them. -!> @details It also provides variables that contain the minimum and maximum representable values, smallest real values and -!> smallest representable differences by the running calculator. -!> -!> Finally the module provides procedures to convert a string to number and vice versa, a function to check the endianism -!> of the running calculator and a procedure to print all the aboves values. -!> @note The \em quadruple precision R16P could be activated defining \b r16p pre-processor flag (e.g. -Dr16p). Furthermore if -!> compiling with Portland Group Compiler define the pre-processor flag \b pgf95 to avoid error in computing \em Zero variables: -!> pgf compiler doesn't accept \b nearest built-in function in variables initialization. -!> @author Stefano Zaghi -!> @version 1.0 -!> @date 2012-04-24 -!> @copyright GNU Public License version 3. -!> @todo \b g95_test: Test g95 compiler -!> @ingroup IR_PrecisionLibrary -module IR_Precision -!----------------------------------------------------------------------------------------------------------------------------------- -USE, intrinsic:: ISO_FORTRAN_ENV, only: stdout => OUTPUT_UNIT, stderr => ERROR_UNIT ! Standard output/error logical units. -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -implicit none -private -public:: endianL,endianB,endian -public:: R16P, FR16P, DR16P, MinR16P, MaxR16P, BIR16P, BYR16P, smallR16P, ZeroR16 -public:: R8P, FR8P, DR8P, MinR8P, MaxR8P, BIR8P, BYR8P, smallR8P, ZeroR8 -public:: R4P, FR4P, DR4P, MinR4P, MaxR4P, BIR4P, BYR4P, smallR4P, ZeroR4 -public:: R_P, FR_P, DR_P, MinR_P, MaxR_P, BIR_P, BYR_P, smallR_P, Zero -public:: I8P, FI8P, DI8P, MinI8P, MaxI8P, BII8P, BYI8P -public:: I4P, FI4P, DI4P, MinI4P, MaxI4P, BII4P, BYI4P -public:: I2P, FI2P, DI2P, MinI2P, MaxI2P, BII2P, BYI2P -public:: I1P, FI1P, DI1P, MinI1P, MaxI1P, BII1P, BYI1P -public:: I_P, FI_P, DI_P, MinI_P, MaxI_P, BII_P, BYI_P -public:: NRknd, RPl, FRl -public:: NIknd, RIl, FIl -public:: check_endian -public:: bit_size,byte_size -public:: str, strz, cton, bstr, bcton -public:: ir_initialized,IR_Init -public:: IR_Print -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @ingroup IR_PrecisionGlobalVarPar -!> @{ -logical:: ir_initialized = .false. !< Flag for chcecking the initialization of some variables that must be initialized by IR_Init. -! Bit ordering of the running architecture: -integer, parameter:: endianL = 1 !< Little endian parameter. -integer, parameter:: endianB = 0 !< Big endian parameter. -integer:: endian = endianL !< Bit ordering: Little endian (endianL), or Big endian (endianB). - -! The following are the portable kind parameters available. -! Real precision definitions: -#ifdef r16p -integer, parameter:: R16P = selected_real_kind(33,4931) !< 33 digits, range \f$[10^{-4931}, 10^{+4931} - 1]\f$; 128 bits. -#else -integer, parameter:: R16P = selected_real_kind(15,307) !< Defined as R8P; 64 bits. -#endif -integer, parameter:: R8P = selected_real_kind(15,307) !< 15 digits, range \f$[10^{-307} , 10^{+307} - 1]\f$; 64 bits. -integer, parameter:: R4P = selected_real_kind(6,37) !< 6 digits, range \f$[10^{-37} , 10^{+37} - 1]\f$; 32 bits. -integer, parameter:: R_P = R8P !< Default real precision. -! Integer precision definitions: -integer, parameter:: I8P = selected_int_kind(18) !< Range \f$[-2^{63},+2^{63} - 1]\f$, 19 digits plus sign; 64 bits. -integer, parameter:: I4P = selected_int_kind(9) !< Range \f$[-2^{31},+2^{31} - 1]\f$, 10 digits plus sign; 32 bits. -integer, parameter:: I2P = selected_int_kind(4) !< Range \f$[-2^{15},+2^{15} - 1]\f$, 5 digits plus sign; 16 bits. -integer, parameter:: I1P = selected_int_kind(2) !< Range \f$[-2^{7} ,+2^{7} - 1]\f$, 3 digits plus sign; 8 bits. -integer, parameter:: I_P = I4P !< Default integer precision. - -! Format parameters useful for writing in a well-ascii-format numeric variables. -! Real output formats: -character(10), parameter:: FR16P = '(E42.33E4)' !< Output format for kind=R16P variable. -character(10), parameter:: FR8P = '(E23.15E3)' !< Output format for kind=R8P variable. -character(9), parameter:: FR4P = '(E13.6E2)' !< Output format for kind=R4P variable. -character(10), parameter:: FR_P = FR8P !< Output format for kind=R_P variable. -! Real number of digits of output formats: -integer, parameter:: DR16P = 42 !< Number of digits of output format FR16P. -integer, parameter:: DR8P = 23 !< Number of digits of output format FR8P. -integer, parameter:: DR4P = 13 !< Number of digits of output format FR4P. -integer, parameter:: DR_P = DR8P !< Number of digits of output format FR_P. -! Integer output formats: -character(5), parameter:: FI8P = '(I20)' !< Output format for kind=I8P variable. -character(8), parameter:: FI8PZP = '(I20.19)' !< Output format with zero prefixing for kind=I8P variable. -character(5), parameter:: FI4P = '(I11)' !< Output format for kind=I4P variable. -character(8), parameter:: FI4PZP = '(I11.10)' !< Output format with zero prefixing for kind=I4P variable. -character(4), parameter:: FI2P = '(I6)' !< Output format for kind=I2P variable. -character(6), parameter:: FI2PZP = '(I6.5)' !< Output format with zero prefixing for kind=I2P variable. -character(4), parameter:: FI1P = '(I4)' !< Output format for kind=I1P variable. -character(6), parameter:: FI1PZP = '(I4.3)' !< Output format with zero prefixing for kind=I1P variable. -character(5), parameter:: FI_P = FI4P !< Output format for kind=I_P variable. -character(8), parameter:: FI_PZP = FI4PZP !< Output format with zero prefixing for kind=I_P variable. -! Integer number of digits of output formats: -integer, parameter:: DI8P = 20 !< Number of digits of output format I8P. -integer, parameter:: DI4P = 11 !< Number of digits of output format I4P. -integer, parameter:: DI2P = 6 !< Number of digits of output format I2P. -integer, parameter:: DI1P = 4 !< Number of digits of output format I1P. -integer, parameter:: DI_P = DI4P !< Number of digits of output format I_P. -! List of kinds -integer, parameter:: NRknd=4 !< Number of defined real kinds. -integer, parameter:: RPl(1:NRknd)=[R16P,R8P,R4P,R_P] !< List of defined real kinds. -character(10), parameter:: FRl(1:NRknd)=[FR16P,FR8P,FR4P//' ',FR_P] !< List of defined real kinds output format. -integer, parameter:: NIknd=5 !< Number of defined integer kinds. -integer, parameter:: RIl(1:NIknd)=[I8P,I4P,I2P,I1P,I_P] !< List of defined integer kinds. -character(5), parameter:: FIl(1:NIknd)=[FI8P,FI4P,FI2P//' ',FI1P//' ',FI_P] !< List of defined integer kinds output format. - -! Useful parameters for handling numbers ranges. -! Real min and max values: -real(R16P), parameter:: MinR16P = -huge(1._R16P), MaxR16P = huge(1._R16P) !< Min and max values of kind=R16P variable. -real(R8P), parameter:: MinR8P = -huge(1._R8P ), MaxR8P = huge(1._R8P ) !< Min and max values of kind=R8P variable. -real(R4P), parameter:: MinR4P = -huge(1._R4P ), MaxR4P = huge(1._R4P ) !< Min and max values of kind=R4P variable. -real(R_P), parameter:: MinR_P = MinR8P, MaxR_P = MaxR8P !< Min and max values of kind=R_P variable. -! Real number of bits/bytes -integer(I2P):: BIR16P, BYR16P !< Number of bits/bytes of kind=R16P variable. -integer(I1P):: BIR8P, BYR8P !< Number of bits/bytes of kind=R8P variable. -integer(I1P):: BIR4P, BYR4P !< Number of bits/bytes of kind=R4P variable. -integer(I1P):: BIR_P, BYR_P !< Number of bits/bytes of kind=R_P variable. -! Real smallest values: -real(R16P), parameter:: smallR16P = tiny(1._R16P) !< Smallest representable value of kind=R16P variable. -real(R8P), parameter:: smallR8P = tiny(1._R8P ) !< Smallest representable value of kind=R8P variable. -real(R4P), parameter:: smallR4P = tiny(1._R4P ) !< Smallest representable value of kind=R4P variable. -real(R_P), parameter:: smallR_P = smallR8P !< Smallest representable value of kind=R_P variable. -! Integer min and max values: -integer(I8P), parameter:: MinI8P = -huge(1_I8P), MaxI8P = huge(1_I8P) !< Min and max values of kind=I8P variable. -integer(I4P), parameter:: MinI4P = -huge(1_I4P), MaxI4P = huge(1_I4P) !< Min and max values of kind=I4P variable. -integer(I2P), parameter:: MinI2P = -huge(1_I2P), MaxI2P = huge(1_I2P) !< Min and max values of kind=I2P variable. -integer(I1P), parameter:: MinI1P = -huge(1_I1P), MaxI1P = huge(1_I1P) !< Min and max values of kind=I1P variable. -integer(I_P), parameter:: MinI_P = MinI4P, MaxI_P = MaxI4P !< Min and max values of kind=I_P variable. -! Integer number of bits/bytes: -integer(I8P), parameter:: BII8P = bit_size(MaxI8P), BYI8P = bit_size(MaxI8P)/8_I8P !< Number of bits/bytes of kind=I8P variable. -integer(I4P), parameter:: BII4P = bit_size(MaxI4P), BYI4P = bit_size(MaxI4P)/8_I4P !< Number of bits/bytes of kind=I4P variable. -integer(I2P), parameter:: BII2P = bit_size(MaxI2P), BYI2P = bit_size(MaxI2P)/8_I2P !< Number of bits/bytes of kind=I2P variable. -integer(I1P), parameter:: BII1P = bit_size(MaxI1P), BYI1P = bit_size(MaxI1P)/8_I1P !< Number of bits/bytes of kind=I1P variable. -integer(I_P), parameter:: BII_P = bit_size(MaxI_P), BYI_P = bit_size(MaxI_P)/8_I_P !< Number of bits/bytes of kind=I_P variable. -! Smallest real representable difference by the running calculator. -#ifdef pgf95 -real(R16P), parameter:: ZeroR16 = 0._R16P -real(R8P), parameter:: ZeroR8 = 0._R8P -real(R4P), parameter:: ZeroR4 = 0._R4P -#else -real(R16P), parameter:: ZeroR16 = nearest(1._R16P, 1._R16P) - & - nearest(1._R16P,-1._R16P) !< Smallest representable difference of kind=R16P variable. -real(R8P), parameter:: ZeroR8 = nearest(1._R8P, 1._R8P) - & - nearest(1._R8P,-1._R8P) !< Smallest representable difference of kind=R8P variable. -real(R4P), parameter:: ZeroR4 = nearest(1._R4P, 1._R4P) - & - nearest(1._R4P,-1._R4P) !< Smallest representable difference of kind=R4P variable. -#endif -real(R_P), parameter:: Zero = ZeroR8 !< Smallest representable difference of kind=R_P variable. -!> @} -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @brief Overloading of the intrinsic "bit_size" function for computing the number of bits of (also) real and character variables; -!> variable, intent(\b IN):: \em n input; -!> integer(I1P), intent(\b OUT):: \em bits output number of bits of input number. -!> @ingroup IR_PrecisionInterface -interface bit_size - module procedure & -#ifdef r16p - bit_size_R16p, & -#endif - bit_size_R8P, & - bit_size_R4P, & - bit_size_chr -endinterface -!> @brief Overloading of the "byte_size" function for computing the number of bytes. -!> @ingroup IR_PrecisionInterface -interface byte_size - module procedure & - byte_size_I8P, & - byte_size_I4P, & - byte_size_I2P, & - byte_size_I1P, & -#ifdef r16p - byte_size_R16p, & -#endif - byte_size_R8P, & - byte_size_R4P, & - byte_size_chr -endinterface -!> @brief Procedure for converting number, real and integer, to string (number to string type casting); -!> logical, intent(\b IN), optional:: \em no_sign flag for do not write sign; -!> number, intent(\b IN):: \em n input number; -!> string, intent(\b OUT):: \em str output string. -!> @ingroup IR_PrecisionInterface -interface str - module procedure & -#ifdef r16p - strf_R16P,str_R16P,& -#endif - strf_R8P ,str_R8P, & - strf_R4P ,str_R4P, & - strf_I8P ,str_I8P, & - strf_I4P ,str_I4P, & - strf_I2P ,str_I2P, & - strf_I1P ,str_I1P -endinterface -!> @brief Procedure for converting number, integer, to string, prefixing with the right number of zeros (number to string type -!> casting with zero padding); -!> number, intent(\b IN), optional:: \em no_zpad number of padding zeros; -!> number, intent(\b IN):: \em n input number; -!> string, intent(\b OUT):: \em str output string. -!> @ingroup IR_PrecisionInterface -interface strz - module procedure strz_I8P, & - strz_I4P, & - strz_I2P, & - strz_I1P -endinterface -!> @brief Procedure for converting string to number, real or initeger, (string to number type casting); -!> string, intent(\b IN):: \em str input string; -!> number, intent(\b OUT):: \em n output number. -!> @ingroup IR_PrecisionInterface -interface cton - module procedure & -#ifdef r16p - ctor_R16P, & -#endif - ctor_R8P, & - ctor_R4P, & - ctoi_I8P, & - ctoi_I4P, & - ctoi_I2P, & - ctoi_I1P -endinterface -!> @brief Procedure for converting number, real and integer, to bit-string (number to bit-string type casting); -!> number, intent(\b IN):: \em n input number; -!> string, intent(\b OUT):: \em bstr output bit-string. -!> @ingroup IR_PrecisionInterface -interface bstr - module procedure & -#ifdef r16p - bstr_R16P,& -#endif - bstr_R8P, & - bstr_R4P, & - bstr_I8P, & - bstr_I4P, & - bstr_I2P, & - bstr_I1P -endinterface -!> @brief Procedure for converting bit-string to number, real or initeger, (bit-string to number type casting); -!> string, intent(\b IN):: \em bstr input bit-string; -!> number, intent(\b OUT):: \em n output number. -!> @ingroup IR_PrecisionInterface -interface bcton - module procedure & -#ifdef r16p - bctor_R16P, & -#endif - bctor_R8P, & - bctor_R4P, & - bctoi_I8P, & - bctoi_I4P, & - bctoi_I2P, & - bctoi_I1P -endinterface -!----------------------------------------------------------------------------------------------------------------------------------- -contains - !> @ingroup IR_PrecisionPublicProcedure - !> @{ - !> @brief Procedure for checking if the type of the bit ordering of the running architecture is little endian. - pure function is_little_endian() result(is_little) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical:: is_little !< Logical output: true is the running architecture uses little endian ordering, false otherwise. - integer(I1P):: int1(1:4) !< One byte integer array for casting 4 bytes integer. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - int1 = transfer(1_I4P,int1) - is_little = (int1(1)==1_I1P) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction is_little_endian - - !> @brief Subroutine for checking the type of bit ordering (big or little endian) of the running architecture; the result is - !> stored into the "endian" global variable. - subroutine check_endian() - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (is_little_endian()) then - endian = endianL - else - endian = endianB - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine check_endian - !> @} - - !> @ingroup IR_PrecisionPrivateProcedure - !> @{ - !> @brief Procedure for computing the number of bits of a real variable. - elemental function bit_size_R16P(r) result(bits) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R16P), intent(IN):: r !< Real variable whose number of bits must be computed. - integer(I2P):: bits !< Number of bits of r. - integer(I1P):: mold(1) !< "Molding" dummy variable for bits counting. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bits = size(transfer(r,mold),dim=1,kind=I2P)*8_I2P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bit_size_R16P - - !> @brief Procedure for computing the number of bits of a real variable. - elemental function bit_size_R8P(r) result(bits) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: r !< Real variable whose number of bits must be computed. - integer(I1P):: bits !< Number of bits of r. - integer(I1P):: mold(1) !< "Molding" dummy variable for bits counting. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bits = size(transfer(r,mold),dim=1,kind=I1P)*8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bit_size_R8P - - !> @brief Procedure for computing the number of bits of a real variable. - elemental function bit_size_R4P(r) result(bits) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: r !< Real variable whose number of bits must be computed. - integer(I1P):: bits !< Number of bits of r. - integer(I1P):: mold(1) !< "Molding" dummy variable for bits counting. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bits = size(transfer(r,mold),dim=1,kind=I1P)*8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bit_size_R4P - - !> @brief Procedure for computing the number of bits of a character variable. - elemental function bit_size_chr(c) result(bits) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: c !< Character variable whose number of bits must be computed. - integer(I4P):: bits !< Number of bits of c. - integer(I1P):: mold(1) !< "Molding" dummy variable for bits counting. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bits = size(transfer(c,mold),dim=1,kind=I4P)*8_I4P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bit_size_chr - - !> @brief Procedure for computing the number of bytes of an integer variable. - elemental function byte_size_I8P(i) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: i !< Integer variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of i. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(i)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_I8P - - !> @brief Procedure for computing the number of bytes of an integer variable. - elemental function byte_size_I4P(i) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: i !< Integer variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of i. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(i)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_I4P - - !> @brief Procedure for computing the number of bytes of an integer variable. - elemental function byte_size_I2P(i) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: i !< Integer variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of i. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(i)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_I2P - - !> @brief Procedure for computing the number of bytes of an integer variable. - elemental function byte_size_I1P(i) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: i !< Integer variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of i. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(i)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_I1P - - !> @brief Procedure for computing the number of bytes of a real variable. - elemental function byte_size_R16P(r) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R16P), intent(IN):: r !< Real variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of r. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(r)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_R16P - - !> @brief Procedure for computing the number of bytes of a real variable. - elemental function byte_size_R8P(r) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: r !< Real variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of r. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(r)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_R8P - - !> @brief Procedure for computing the number of bytes of a real variable. - elemental function byte_size_R4P(r) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: r !< Real variable whose number of bytes must be computed. - integer(I1P):: bytes !< Number of bytes of r. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(r)/8_I1P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_R4P - - !> @brief Procedure for computing the number of bytes of a character variable. - elemental function byte_size_chr(c) result(bytes) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: c !< Character variable whose number of bytes must be computed. - integer(I4P):: bytes !< Number of bytes of c. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - bytes = bit_size(c)/8_I4P - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction byte_size_chr - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function strf_R16P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - real(R16P), intent(IN):: n !< Real to be converted. - character(DR16P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_R16P - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function strf_R8P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - real(R8P), intent(IN):: n !< Real to be converted. - character(DR8P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_R8P - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function strf_R4P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - real(R4P), intent(IN):: n !< Real to be converted. - character(DR4P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_R4P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function strf_I8P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - integer(I8P), intent(IN):: n !< Integer to be converted. - character(DI8P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_I8P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function strf_I4P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - integer(I4P), intent(IN):: n !< Integer to be converted. - character(DI4P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_I4P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function strf_I2P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - integer(I2P), intent(IN):: n !< Integer to be converted. - character(DI2P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_I2P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function strf_I1P(fm,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fm !< Format different from the standard for the kind. - integer(I1P), intent(IN):: n !< Integer to be converted. - character(DI1P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,trim(fm)) n ! Casting of n to string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strf_I1P - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function str_R16P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - real(R16P), intent(IN):: n !< Real to be converted. - character(DR16P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FR16P) n ! Casting of n to string. - if (n>0._R16P) str(1:1)='+' ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_R16P - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function str_R8P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - real(R8P), intent(IN):: n !< Real to be converted. - character(DR8P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FR8P) n ! Casting of n to string. - if (n>0._R8P) str(1:1)='+' ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_R8P - - !> @brief Procedure for converting real to string. This function achieves casting of real to string. - elemental function str_R4P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - real(R4P), intent(IN):: n !< Real to be converted. - character(DR4P):: str !< Returned string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FR4P) n ! Casting of n to string. - if (n>0._R4P) str(1:1)='+' ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_R4P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function str_I8P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - integer(I8P), intent(IN):: n !< Integer to be converted. - character(DI8P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI8P) n ! Casting of n to string. - str = adjustl(trim(str)) ! Removing white spaces. - if (n>=0_I8P) str='+'//trim(str) ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_I8P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function str_I4P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - integer(I4P), intent(IN):: n !< Integer to be converted. - character(DI4P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI4P) n ! Casting of n to string. - str = adjustl(trim(str)) ! Removing white spaces. - if (n>=0_I4P) str='+'//trim(str) ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_I4P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function str_I2P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - integer(I2P), intent(IN):: n !< Integer to be converted. - character(DI2P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI2P) n ! Casting of n to string. - str = adjustl(trim(str)) ! Removing white spaces. - if (n>=0_I2P) str='+'//trim(str) ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_I2P - - !> @brief Procedure for converting integer to string. This function achieves casting of integer to string. - elemental function str_I1P(no_sign,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - logical, intent(IN), optional:: no_sign !< Flag for leaving out the sign. - integer(I1P), intent(IN):: n !< Integer to be converted. - character(DI1P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI1P) n ! Casting of n to string. - str = adjustl(trim(str)) ! Removing white spaces. - if (n>=0_I1P) str='+'//trim(str) ! Prefixing plus if n>0. - if (present(no_sign)) str=str(2:) ! Leaving out the sign. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction str_I1P - - !> @brief Procedure for converting integer to string, prefixing with the right number of zeros. This function achieves casting of - !> integer to string. - elemental function strz_I8P(nz_pad,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: nz_pad !< Number of zeros padding. - integer(I8P), intent(IN):: n !< Integer to be converted. - character(DI8P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI8PZP) n ! Casting of n to string. - str=str(2:) ! Leaving out the sign. - if (present(nz_pad)) str=str(DI8P-nz_pad:DI8P-1) ! Leaving out the extra zeros padding - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strz_I8P - - !> @brief Procedure for converting integer to string, prefixing with the right number of zeros. This function achieves casting of - !> integer to string. - elemental function strz_I4P(nz_pad,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: nz_pad !< Number of zeros padding. - integer(I4P), intent(IN):: n !< Integer to be converted. - character(DI4P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI4PZP) n ! Casting of n to string. - str=str(2:) ! Leaving out the sign. - if (present(nz_pad)) str=str(DI4P-nz_pad:DI4P-1) ! Leaving out the extra zeros padding - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strz_I4P - - !> @brief Procedure for converting integer to string, prefixing with the right number of zeros. This function achieves casting of - !> integer to string. - elemental function strz_I2P(nz_pad,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: nz_pad !< Number of zeros padding. - integer(I2P), intent(IN):: n !< Integer to be converted. - character(DI2P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI2PZP) n ! Casting of n to string. - str=str(2:) ! Leaving out the sign. - if (present(nz_pad)) str=str(DI2P-nz_pad:DI2P-1) ! Leaving out the extra zeros padding - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strz_I2P - - !> @brief Procedure for converting integer to string, prefixing with the right number of zeros. This function achieves casting of - !> integer to string. - elemental function strz_I1P(nz_pad,n) result(str) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: nz_pad !< Number of zeros padding. - integer(I1P), intent(IN):: n !< Integer to be converted. - character(DI1P):: str !< Returned string containing input number plus padding zeros. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(str,FI1PZP) n ! Casting of n to string. - str=str(2:) ! Leaving out the sign. - if (present(nz_pad)) str=str(DI1P-nz_pad:DI1P-1) ! Leaving out the extra zeros padding - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction strz_I1P - - !> @brief Procedure for converting string to real. This function achieves casting of string to real. - function ctor_R16P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - real(R16P), intent(IN):: knd !< Number kind. - real(R16P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to real failed' - write(stderr,'(A,'//FR16P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctor_R16P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctor_R16P - - !> @brief Procedure for converting string to real. This function achieves casting of string to real. - function ctor_R8P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - real(R8P), intent(IN):: knd !< Number kind. - real(R8P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to real failed' - write(stderr,'(A,'//FR8P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctor_R8P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctor_R8P - - !> @brief Procedure for converting string to real. This function achieves casting of string to real. - function ctor_R4P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - real(R4P), intent(IN):: knd !< Number kind. - real(R4P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to real failed' - write(stderr,'(A,'//FR4P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctor_R4P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctor_R4P - - !> @brief Procedure for converting string to integer. This function achieves casting of string to integer. - function ctoi_I8P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - integer(I8P), intent(IN):: knd !< Number kind. - integer(I8P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to integer failed' - write(stderr,'(A,'//FI8P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctoi_I8P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctoi_I8P - - !> @brief Procedure for converting string to integer. This function achieves casting of string to integer. - function ctoi_I4P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - integer(I4P), intent(IN):: knd !< Number kind. - integer(I4P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to integer failed' - write(stderr,'(A,'//FI4P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctoi_I4P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctoi_I4P - - !> @brief Procedure for converting string to integer. This function achieves casting of string to integer. - function ctoi_I2P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - integer(I2P), intent(IN):: knd !< Number kind. - integer(I2P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to integer failed' - write(stderr,'(A,'//FI2P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctoi_I2P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctoi_I2P - - !> @brief Procedure for converting string to integer. This function achieves casting of string to integer. - function ctoi_I1P(str,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: str !< String containing input number. - integer(I1P), intent(IN):: knd !< Number kind. - integer(I1P):: n !< Number returned. - integer(I4P):: err !< Error trapping flag: 0 no errors, >0 error occurs. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(str,*,iostat=err) n ! Casting of str to n. - if (err/=0) then - write(stderr,'(A)') 'Conversion of string "'//str//'" to integer failed' - write(stderr,'(A,'//FI1P//')') 'Kind parameter ',knd - write(stderr,'(A)') 'Function used "ctoi_I1P"' - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction ctoi_I1P - - !> @brief Procedure for converting real to string of bits. This function achieves casting of real to bit-string. - !> @note It is assumed that R16P is represented by means of 128 bits, but this is not ensured in all architectures. - elemental function bstr_R16P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: n !< Real to be converted. - character(128):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B128.128)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_R16P - - !> @brief Procedure for converting real to string of bits. This function achieves casting of real to bit-string. - !> @note It is assumed that R8P is represented by means of 64 bits, but this is not ensured in all architectures. - elemental function bstr_R8P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: n !< Real to be converted. - character(64):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B64.64)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_R8P - - !> @brief Procedure for converting real to string of bits. This function achieves casting of real to bit-string. - !> @note It is assumed that R4P is represented by means of 32 bits, but this is not ensured in all architectures. - elemental function bstr_R4P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: n !< Real to be converted. - character(32):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B32.32)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_R4P - - !> @brief Procedure for converting integer to string of bits. This function achieves casting of integer to bit-string. - !> @note It is assumed that I8P is represented by means of 64 bits, but this is not ensured in all architectures. - elemental function bstr_I8P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: n !< Real to be converted. - character(64):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B64.64)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_I8P - - !> @brief Procedure for converting integer to string of bits. This function achieves casting of integer to bit-string. - !> @note It is assumed that I4P is represented by means of 32 bits, but this is not ensured in all architectures. - elemental function bstr_I4P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: n !< Real to be converted. - character(32):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B32.32)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_I4P - - !> @brief Procedure for converting integer to string of bits. This function achieves casting of integer to bit-string. - !> @note It is assumed that I2P is represented by means of 16 bits, but this is not ensured in all architectures. - elemental function bstr_I2P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: n !< Real to be converted. - character(16):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B16.16)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_I2P - - !> @brief Procedure for converting integer to string of bits. This function achieves casting of integer to bit-string. - !> @note It is assumed that I1P is represented by means of 8 bits, but this is not ensured in all architectures. - elemental function bstr_I1P(n) result(bstr) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: n !< Real to be converted. - character(8):: bstr !< Returned bit-string containing input number. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - write(bstr,'(B8.8)')n ! Casting of n to bit-string. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bstr_I1P - - !> @brief Procedure for converting bit-string to real. This function achieves casting of bit-string to real. - elemental function bctor_R8P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - real(R8P), intent(IN):: knd !< Number kind. - real(R8P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctor_R8P - - !> @brief Procedure for converting bit-string to real. This function achieves casting of bit-string to real. - elemental function bctor_R4P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - real(R4P), intent(IN):: knd !< Number kind. - real(R4P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctor_R4P - - !> @brief Procedure for converting bit-string to integer. This function achieves casting of bit-string to integer. - elemental function bctoi_I8P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - integer(I8P), intent(IN):: knd !< Number kind. - integer(I8P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctoi_I8P - - !> @brief Procedure for converting bit-string to integer. This function achieves casting of bit-string to integer. - elemental function bctoi_I4P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - integer(I4P), intent(IN):: knd !< Number kind. - integer(I4P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctoi_I4P - - !> @brief Procedure for converting bit-string to integer. This function achieves casting of bit-string to integer. - elemental function bctoi_I2P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - integer(I2P), intent(IN):: knd !< Number kind. - integer(I2P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctoi_I2P - - !> @brief Procedure for converting bit-string to integer. This function achieves casting of bit-string to integer. - elemental function bctoi_I1P(bstr,knd) result(n) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: bstr !< String containing input number. - integer(I1P), intent(IN):: knd !< Number kind. - integer(I1P):: n !< Number returned. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - read(bstr,'(B'//trim(str(.true.,bit_size(knd)))//'.'//trim(str(.true.,bit_size(knd)))//')')n ! Casting of bstr to n. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction bctoi_I1P - !> @} - - !> Subroutine for initilizing module's variables that are not initialized into the definition specification. - !> @ingroup IR_PrecisionPublicProcedure - subroutine IR_init() - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - ! checking the bit ordering architecture - call check_endian - ! computing the bits/bytes sizes of real variables - BIR8P = bit_size(r=MaxR8P) ; BYR8P = BIR8P/8_I1P - BIR4P = bit_size(r=MaxR4P) ; BYR4P = BIR4P/8_I1P - BIR_P = bit_size(r=MaxR_P) ; BYR_P = BIR_P/8_I1P -#ifdef r16p - BIR16P = bit_size(r=MaxR16P) ; BYR16P = BIR16P/8_I2P -#else - BIR16P = int(BIR8P,kind=I2P) ; BYR16P = BIR16P/8_I2P -#endif - ir_initialized = .true. - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine IR_init - - !>Subroutine for printing to the standard output the kind definition of reals and integers and the utility variables. - !> @ingroup IR_PrecisionPublicProcedure - subroutine IR_Print(myrank,Nproc) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: myrank !< Actual rank process necessary for concurrent multi-processes calls. - integer(I4P), intent(IN), optional:: Nproc !< Number of MPI processes used. - character(DI4P):: rks !< String containing myrank. - integer(I4P):: rank,Np !< Dummy temporary variables. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (.not.ir_initialized) call IR_init - rank = 0 ; if (present(myrank)) rank = myrank ; Np = 1 ; if (present(Nproc)) Np = Nproc ; rks = 'rank'//trim(strz(Np,rank)) - ! printing informations - if (endian==endianL) then - write(stdout,'(A)') trim(rks)//' This architecture has LITTLE Endian bit ordering' - else - write(stdout,'(A)') trim(rks)//' This architecture has BIG Endian bit ordering' - endif - write(stdout,'(A)') trim(rks)//' Reals kind precision definition' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R16P Kind "',R16P,'" | FR16P format "'//FR16P//'" | DR16P chars "',DR16P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R8P Kind "',R8P, '" | FR8P format "'//FR8P// '" | DR8P chars "',DR8P ,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R4P Kind "',R4P, '" | FR4P format "'//FR4P//'" | DR4P chars "',DR4P ,'"' - write(stdout,'(A)') trim(rks)//' Integers kind precision definition' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I8P Kind "',I8P,'" | FI8P format "'//FI8P// '" | DI8P chars "',DI8P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I4P Kind "',I4P,'" | FI4P format "'//FI4P// '" | DI4P chars "',DI4P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I2P Kind "',I2P,'" | FI2P format "'//FI2P//'" | DI2P chars "',DI2P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I1P Kind "',I1P,'" | FI1P format "'//FI1P//'" | DI1P chars "',DI1P,'"' - write(stdout,'(A)') trim(rks)//' Reals minimum and maximum values' - write(stdout,'(A)') trim(rks)//' MinR16P "'//trim(str(n=MinR16P))//'" | MaxR16P "'//trim(str(n=MaxR16P))//'"' - write(stdout,'(A)') trim(rks)//' MinR8P "'//trim(str(n=MinR8P))// '" | MaxR8P "'//trim(str(n=MaxR8P))// '"' - write(stdout,'(A)') trim(rks)//' MinR4P "'//trim(str(n=MinR4P))// '" | MaxR4P "'//trim(str(n=MaxR4P))// '"' - write(stdout,'(A)') trim(rks)//' Reals bits/bytes sizes' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R16P bits "',BIR16P,'", bytes "',BYR16P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R8P bits "', BIR8P, '", bytes "',BYR8P, '"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R4P bits "', BIR4P, '", bytes "',BYR4P, '"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' R_P bits "', BIR_P, '", bytes "',BYR_P, '"' - write(stdout,'(A)') trim(rks)//' Integers minimum and maximum values' - write(stdout,'(A)') trim(rks)//' MinI8P "'//trim(str(n=MinI8P))//'" | MaxI8P "'//trim(str(n=MaxI8P))//'"' - write(stdout,'(A)') trim(rks)//' MinI4P "'//trim(str(n=MinI4P))//'" | MaxI4P "'//trim(str(n=MaxI4P))//'"' - write(stdout,'(A)') trim(rks)//' MinI2P "'//trim(str(n=MinI2P))//'" | MaxI2P "'//trim(str(n=MaxI2P))//'"' - write(stdout,'(A)') trim(rks)//' MinI1P "'//trim(str(n=MinI1P))//'" | MaxI1P "'//trim(str(n=MaxI1P))//'"' - write(stdout,'(A)') trim(rks)//' Integers bits/bytes sizes' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I8P bits "',BII8P,'", bytes "',BYI8P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I4P bits "',BII4P,'", bytes "',BYI4P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I2P bits "',BII2P,'", bytes "',BYI2P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I1P bits "',BII1P,'", bytes "',BYI1P,'"' - write(stdout,'(A,I2,A,I2,A)')trim(rks)//' I_P bits "',BII_P,'", bytes "',BYI_P,'"' - write(stdout,'(A)') trim(rks)//' Machine precisions' - write(stdout,'(A)') trim(rks)//' ZeroR16 "'//trim(str(.true.,ZeroR16))//'"' - write(stdout,'(A)') trim(rks)//' ZeroR8 "'//trim(str(.true.,ZeroR8 ))//'"' - write(stdout,'(A)') trim(rks)//' ZeroR4 "'//trim(str(.true.,ZeroR4 ))//'"' - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine IR_Print -endmodule IR_Precision diff --git a/lib/Lib_Base64.f90 b/lib/Lib_Base64.f90 deleted file mode 100644 index f1a5754eb..000000000 --- a/lib/Lib_Base64.f90 +++ /dev/null @@ -1,909 +0,0 @@ -!> @ingroup Library -!> @{ -!> @defgroup Lib_Base64Library Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> @ingroup Interface -!> @{ -!> @defgroup Lib_Base64Interface Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> @ingroup PublicProcedure -!> @{ -!> @defgroup Lib_Base64PublicProcedure Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> @ingroup PrivateProcedure -!> @{ -!> @defgroup Lib_Base64PrivateProcedure Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> @ingroup GlobalVarPar -!> @{ -!> @defgroup Lib_Base64GlobalVarPar Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> @ingroup PrivateVarPar -!> @{ -!> @defgroup Lib_Base64PrivateVarPar Lib_Base64 -!> base64 encoding/decoding library -!> @} - -!> This module contains base64 encoding/decoding procedures. -!> @todo \b Decoding: Implement decoding functions. -!> @todo \b DocComplete: Complete the documentation. -!> @ingroup Lib_Base64Library -module Lib_Base64 -!----------------------------------------------------------------------------------------------------------------------------------- -USE IR_Precision ! Integers and reals precision definition. -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -implicit none -private -public:: b64_encode -!public:: b64_decode -public:: pack_data -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @ingroup Lib_Base64GlobalVarPar -!> @{ -!> @} -!> @ingroup Lib_Base64PrivateVarPar -!> @{ -character(64):: base64="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/" !< Base64 alphabet. -!> @} -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @brief Subroutine for encoding numbers (integer and real) to base64. -!> @ingroup Lib_Base64Interface -interface b64_encode - module procedure b64_encode_R8_a, & - b64_encode_R4_a, & - b64_encode_I8_a, & - b64_encode_I4_a, & - b64_encode_I2_a, & - b64_encode_I1_a -endinterface -!!> @brief Subroutine for decoding numbers (integer and real) from base64. -!!> @ingroup Lib_Base64Interface -!interface b64_decode -! module procedure b64_decode_R8_a, & -! b64_decode_R4_a, & -! b64_decode_I8_a, & -! b64_decode_I4_a, & -! b64_decode_I2_a, & -! b64_decode_I1_a -!endinterface -!> @brief Subroutine for packing different kinds of data into single I1P array. This is useful for encoding different kinds -!> variables into a single stream of bits. -!> @ingroup Lib_Base64Interface -interface pack_data - module procedure pack_data_R8_R4,pack_data_R8_I8,pack_data_R8_I4,pack_data_R8_I2,pack_data_R8_I1, & - pack_data_R4_R8,pack_data_R4_I8,pack_data_R4_I4,pack_data_R4_I2,pack_data_R4_I1, & - pack_data_I8_R8,pack_data_I8_R4,pack_data_I8_I4,pack_data_I8_I2,pack_data_I8_I1, & - pack_data_I4_R8,pack_data_I4_R4,pack_data_I4_I8,pack_data_I4_I2,pack_data_I4_I1, & - pack_data_I2_R8,pack_data_I2_R4,pack_data_I2_I8,pack_data_I2_I4,pack_data_I2_I1, & - pack_data_I1_R8,pack_data_I1_R4,pack_data_I1_I8,pack_data_I1_I4,pack_data_I1_I2 -endinterface -!----------------------------------------------------------------------------------------------------------------------------------- -contains - !> @ingroup Lib_Base64PrivateProcedure - !> @{ - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R8_R4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: a1(1:) !< Firs data stream. - real(R4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R8_R4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R8_I8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: a1(1:) !< First data stream. - integer(I8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R8_I8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R8_I4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: a1(1:) !< First data stream. - integer(I4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R8_I4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R8_I2(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: a1(1:) !< First data stream. - integer(I2P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R8_I2 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R8_I1(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: a1(1:) !< First data stream. - integer(I1P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R8_I1 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R4_R8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: a1(1:) !< Firs data stream. - real(R8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R4_R8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R4_I8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: a1(1:) !< First data stream. - integer(I8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R4_I8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R4_I4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: a1(1:) !< First data stream. - integer(I4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R4_I4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R4_I2(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: a1(1:) !< First data stream. - integer(I2P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R4_I2 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_R4_I1(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: a1(1:) !< First data stream. - integer(I1P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_R4_I1 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I8_R8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: a1(1:) !< First data stream. - real(R8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I8_R8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I8_R4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: a1(1:) !< First data stream. - real(R4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I8_R4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I8_I4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: a1(1:) !< First data stream. - integer(I4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I8_I4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I8_I2(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: a1(1:) !< First data stream. - integer(I2P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I8_I2 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I8_I1(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: a1(1:) !< First data stream. - integer(I1P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I8_I1 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I4_R8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: a1(1:) !< First data stream. - real(R8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I4_R8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I4_R4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: a1(1:) !< First data stream. - real(R4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I4_R4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I4_I8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: a1(1:) !< First data stream. - integer(I8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I4_I8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I4_I2(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: a1(1:) !< First data stream. - integer(I2P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I4_I2 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I4_I1(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: a1(1:) !< First data stream. - integer(I1P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I4_I1 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I2_R8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: a1(1:) !< First data stream. - real(R8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I2_R8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I2_R4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: a1(1:) !< First data stream. - real(R4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I2_R4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I2_I8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: a1(1:) !< First data stream. - integer(I8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I2_I8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I2_I4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: a1(1:) !< First data stream. - integer(I4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I2_I4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I2_I1(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: a1(1:) !< First data stream. - integer(I1P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I2_I1 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I1_R8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: a1(1:) !< First data stream. - real(R8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I1_R8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I1_R4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: a1(1:) !< First data stream. - real(R4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I1_R4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I1_I8(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: a1(1:) !< First data stream. - integer(I8P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I1_I8 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I1_I4(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: a1(1:) !< First data stream. - integer(I4P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I1_I4 - - !> @brief Subroutine for packing different kinds of data into single I1P array. - pure subroutine pack_data_I1_I2(a1,a2,packed) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: a1(1:) !< First data stream. - integer(I2P), intent(IN):: a2(1:) !< Second data stream. - integer(I1P), allocatable, intent(INOUT):: packed(:) !< Packed data into I1P array. - integer(I1P), allocatable:: p1(:) !< Temporary packed data of first stream. - integer(I1P), allocatable:: p2(:) !< Temporary packed data of second stream. - integer(I4P):: np !< Size of temporary packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - np = size(transfer(a1,p1)) ; allocate(p1(1:np)) ; p1 = transfer(a1,p1) - np = size(transfer(a2,p2)) ; allocate(p2(1:np)) ; p2 = transfer(a2,p2) - if (allocated(packed)) deallocate(packed) ; allocate(packed(1:size(p1,dim=1)+size(p2,dim=1))) ; packed = [p1,p2] - deallocate(p1,p2) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine pack_data_I1_I2 - - !> @brief Subroutine for encoding bits (must be multiple of 24 bits) into base64 charcaters code (of length multiple of 4). - !> @note The bits stream are encoded in chunks of 24 bits as the following example (in little endian order): - !> @code - !> +--first octet--+-second octet--+--third octet--+ - !> |7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0|7 6 5 4 3 2 1 0| - !> +-----------+---+-------+-------+---+-----------+ - !> |5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0|5 4 3 2 1 0| - !> +--1.index--+--2.index--+--3.index--+--4.index--+ - !> @endcode - !> The 4 indexes are stored into 4 elements 8 bits array, thus 2 bits of each array element are not used. - pure subroutine encode_bits(bits,padd,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: bits(1:) !< Bits to be encoded. - integer(I4P), intent(IN):: padd !< Number of padding characters ('='). - character(1), intent(OUT):: code(1:) !< Characters code. - integer(I1P):: sixb(1:4) !< 6 bits slices (stored into 8 bits integer) of 24 bits input. - integer(I8P):: c,e !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - c = 1_I8P - do e=1_I8P,size(bits,dim=1,kind=I8P),3_I8P ! loop over array elements: 3 bytes (24 bits) scanning - sixb = 0_I1P - call mvbits(bits(e ),2,6,sixb(1),0) - call mvbits(bits(e ),0,2,sixb(2),4) ; call mvbits(bits(e+1),4,4,sixb(2),0) - call mvbits(bits(e+1),0,4,sixb(3),2) ; call mvbits(bits(e+2),6,2,sixb(3),0) - call mvbits(bits(e+2),0,6,sixb(4),0) - sixb = sixb + 1_I1P - code(c :c )(1:1) = base64(sixb(1):sixb(1)) - code(c+1:c+1)(1:1) = base64(sixb(2):sixb(2)) - code(c+2:c+2)(1:1) = base64(sixb(3):sixb(3)) - code(c+3:c+3)(1:1) = base64(sixb(4):sixb(4)) - c = c + 4_I8P - enddo - if (padd>0) code(size(code,dim=1)-padd+1:)(1:1)='=' - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine encode_bits - - !> @brief Subroutine for encoding array numbers to base64 (R8P). - pure subroutine b64_encode_R8_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - real(R8P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_R8_a - - !> @brief Subroutine for encoding array numbers to base64 (R4P). - pure subroutine b64_encode_R4_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - real(R4P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_R4_a - - !> @brief Subroutine for encoding array numbers to base64 (I8P). - pure subroutine b64_encode_I8_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - integer(I8P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_I8_a - - !> @brief Subroutine for encoding array numbers to base64 (I4P). - pure subroutine b64_encode_I4_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - integer(I4P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_I4_a - - !> @brief Subroutine for encoding array numbers to base64 (I2P). - pure subroutine b64_encode_I2_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - integer(I2P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_I2_a - - !> @brief Subroutine for encoding array numbers to base64 (I1P). - pure subroutine b64_encode_I1_a(nB,n,code) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nB !< Number of bytes of single element of n. - integer(I1P), intent(IN):: n(1:) !< Array of numbers to be encoded. - character(1), allocatable, intent(OUT):: code(:) !< Encoded array. - integer(I1P):: nI1P(1:((size(n,dim=1)*nB+2)/3)*3) !< One byte integer array containing n. - integer(I4P):: padd !< Number of padding characters ('='). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - if (allocated(code)) deallocate(code) ; allocate(code(1:((size(n,dim=1)*nB+2)/3)*4)) ! allocating code chars - nI1P = transfer(n,nI1P) ! casting n to integer array of 1 byte elem - padd = mod((size(n,dim=1)*nB),3_I4P) ; if (padd>0_I4P) padd = 3_I4P - padd ! computing the number of padding characters - call encode_bits(bits=nI1P,padd=padd,code=code) ! encoding bits - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine b64_encode_I1_a - - !!> @brief Subroutine for decoding array numbers from base64 (R8P). - !pure subroutine b64_decode_R8_a(code,n) - !!-------------------------------------------------------------------------------------------------------------------------------- - !implicit none - !real(R8P), intent(OUT):: n(1:) !< Number to be decoded. - !character(ncR8P*size(n,dim=1)), intent(IN):: code !< Encoded number. - !integer(I4P):: c,d !< Counters. - !!-------------------------------------------------------------------------------------------------------------------------------- - - !!-------------------------------------------------------------------------------------------------------------------------------- - !d = 1_I4P - !do c=1,len(code),ncR8P - ! call b64_decode_R8_s(code=code(c:c+ncR8P-1),n=n(d)) - ! d = d + 1_I4P - !enddo - !return - !!-------------------------------------------------------------------------------------------------------------------------------- - !endsubroutine b64_decode_R8_a - !> @} -endmodule Lib_Base64 diff --git a/lib/Lib_VTK_IO.f90 b/lib/Lib_VTK_IO.f90 deleted file mode 100644 index 62a838189..000000000 --- a/lib/Lib_VTK_IO.f90 +++ /dev/null @@ -1,6070 +0,0 @@ -!> @addtogroup PrivateVarPar Private Variables and Parameters -!> List of private variables and parameters. -!> @addtogroup Interface Interfaces -!> List of explicitly defined interface. -!> @addtogroup Library Modules Libraries -!> List of modules containing libraries of procedures. -!> @addtogroup PublicProcedure Public Procedures -!> List of public procedures. -!> @addtogroup PrivateProcedure Private Procedures -!> List of private procedures. - -!> @ingroup Library -!> @{ -!> @defgroup Lib_VTK_IOLibrary Lib_VTK_IO -!> @} - -!> @ingroup Interface -!> @{ -!> @defgroup Lib_VTK_IOInterface Lib_VTK_IO -!> @} - -!> @ingroup PrivateVarPar -!> @{ -!> @defgroup Lib_VTK_IOPrivateVarPar Lib_VTK_IO -!> @} - -!> @ingroup PublicProcedure -!> @{ -!> @defgroup Lib_VTK_IOPublicProcedure Lib_VTK_IO -!> @} - -!> @ingroup PrivateProcedure -!> @{ -!> @defgroup Lib_VTK_IOPrivateProcedure Lib_VTK_IO -!> @} - -!> @brief This is a library of functions for Input and Output pure Fortran data in VTK format. -!> @details It is useful for Paraview visualization tool. Even though there are many wrappers/porting of the VTK source -!> code (C++ code), there is not a Fortran one. This library is not a porting or a wrapper of the VTK code, -!> but it only an exporter/importer of the VTK data format written in pure Fortran language (standard Fortran 2003 or -!> higher) that can be used by Fortran coders (yes, there are still a lot of these brave coders...) without mixing Fortran -!> with C++ language. Fortran is still the best language for high performance computing for scientific purpose, like CFD -!> computing. It is necessary a tool to deal with VTK standard directly by Fortran code. The library was made to fill -!> this empty: it is a simple Fortran module able to export native Fortran data into VTK data format and to import VTK -!> data into a Fortran code, both in ascii and binary file format. -!> -!> The library provides an automatic way to deal with VTK data format: all the formatting processes is nested into the -!> library and users communicate with it by a simple API passing only native Fortran data (Fortran scalars and arrays). -!> -!> The library is still in developing and testing, this is first usable release, but there are not all the features of -!> the stable release (the importer is totally absent and the exporter is not complete). Surely there are a lot of bugs -!> and the programming style is not the best, but the exporters are far-complete. -!> -!> The supported VTK features are: -!> - Exporters: -!> - Legacy standard: -!> - Structured Points; -!> - Structured Grid; -!> - Unstructured Grid; -!> - Polydata (\b missing); -!> - Rectilinear Grid; -!> - Field (\b missing); -!> - XML standard: -!> - serial dataset: -!> - Image Data (\b missing); -!> - Polydata (\b missing); -!> - Rectilinear Grid; -!> - Structured Grid; -!> - Unstructured Grid; -!> - parallel (partitioned) dataset: -!> - Image Data (\b missing); -!> - Polydata (\b missing); -!> - Rectilinear Grid; -!> - Structured Grid; -!> - Unstructured Grid; -!> - composite dataset: -!> - vtkMultiBlockDataSet; -!> - Importers are \b missing. -!> -!> @libvtk can handle multiple concurrent files and it is \b thread/processor-safe (meaning that can be safely used into -!> parallel frameworks as OpenMP or MPI, see \ref SpeedUP "Parallel Frameworks Benchmarks"). -!> -!> The library is an open source project, it is distributed under the GPL v3. Anyone is interest to use, to develop or -!> to contribute to @libvtk is welcome. -!> -!> It can be found at: https://github.com/szaghi/Lib_VTK_IO -!> -!> @par VTK_Standard -!> VTK, Visualization Toolkit, is an open source software that provides a powerful framework for the computer graphic, for -!> the images processing and for 3D rendering. It is widely used in the world and so it has a very large community of users, -!> besides the Kitware (The Kitware homepage can be found here: http://public.kitware.com) company provides professional -!> support. The toolkit is written in C++ and a lot of porting/wrappers for Tcl/Tk, Java and Python are provided, unlucky -!> there aren't wrappers for Fortran. -!> -!> Because of its good features the VTK toolkit has been used to develop a large set of open source programs. For my work -!> the most important family of programs is the scientific visualization programs. A lot of high-quality scientific -!> visualization tool are available on the web but for me the best is ParaView: I think that it is one of the best -!> scientific visualization program in the world and it is open source! Paraview is based on VTK. -!> @par Paraview -!> ParaView (The ParaView homepage can be found here: http://www.paraview.org) is an open source software voted to scientific -!> visualization and able to use the power of parallel architectures. It has an architecture client-server in order to make -!> easy the remote visualization of very large set of data. Because it is based on VTK it inherits all VTK features. ParaView -!> is very useful for Computational Fluid Dynamics visualizations because it provides powerful post-processing tools, it -!> provides a very large set of importers for the most used format like Plot3D and HDF (the list is very large). It is easy to -!> extend ParaView because it supports all the scripting language supported by VTK. -!> @note All the @libvtk functions are I4P integer functions: the returned integer output is 0 if the function calling has -!> been completed right while it is >0 if some errors occur (the error handling is only at its embryonic phase). Therefore the -!> functions calling must be done in the following way: \n -!> @code -!> ... -!> integer(I4P):: E_IO -!> ... -!> E_IO = VTK_INI(.... -!> ... @endcode -!> @libvtk programming style is based on two main principles: portable kind-precision of reals and integers -!> variables and dynamic dispatching. Using dynamic dispatching @libvtk has a simple API. The user calls -!> a generic procedure (VTK_INI, VTK_GEO,...) and the library, depending on the type and number of the inputs passed, calls the -!> correct internal function (i.e. VTK_GEO for R8P real type if the input passed is R8P real type). By this interface only few -!> functions are used without the necessity of calling a different function for each different input type. -!> Dynamic dispatching is based on the internal kind-precision/rank selecting convention: Fortran 90/95 standard has introduced some -!> useful functions to achieve the portability of reals and integers precision and @libvtk uses these functions to define portable -!> kind-precision; to this aim @libvtk uses IR_Precision module. -!> @author Stefano Zaghi -!> @version 1.1 -!> @date 2013-05-23 -!> @par News -!> - Added packed API and 3D(or higher) arrays for VTK_VAR_XML function: this avoids the necessity of explicit reshape of -!> multi-dimensional arrays containing saved variables in VAR callings; the following inputs are now available: -!> - scalar input: -!> - input is 1D-rank array: var[1:NC_NN]; -!> - input is 3D-rank array: var[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - vectorial inputs: -!> - inputs are 1D-rank arrays: varX[1:NC_NN],varY[1:NC_NN],varZ[1:NC_NN]; -!> - inputs are 3D-rank arrays: varX[nx1:nx2,ny1:ny2,nz1:nz2],varY[nx1:nx2,ny1:ny2,nz1:nz2],varX[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - 3D(or higher) vectorial inputs: -!> - input is 1D-rank (packed API): var[1:N_COL,1:NC_NN]; -!> - input is 3D-rank (packed API): var[1:N_COL,nx1:nx2,ny1:ny2,nz1:nz2]. -!> - Added packed API and 3D arrays for VTK_GEO and VTK_GEO_XML function: this avoids the necessity of explicit reshape of -!> multi-dimensional arrays containing X, Y and Z coordinates in GEO callings; the following inputs are now available: -!> - StructuredGrid (NN is the number of grid points, n\#1-n\#2, \#x,y,z are the domain extents): -!> - 1D arrays of size NN: X[1:NN],Y[1:NN],Z[1:NN]; -!> - 3D arrays of size NN: X[nx1:nx2,ny1:ny2,nz1:nz2],Y[nx1:nx2,ny1:ny2,nz1:nz2],Z[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - 1D array of size 3*NN (packed API): XYZ[1:3,1:NN]; -!> - 3D array of size 3*NN (packed API): XYZ[1:3,nx1:nx2,ny1:ny2,nz1:nz2]. -!> - UnStructuredGrid (NN is the number of grid points): -!> - 1D arrays of size NN: X[1:NN],Y[1:NN],Z[1:NN]; -!> - 1D array of size 3*NN (packed API): XYZ[1:3,1:NN]. -!> - Added base64 encoding format: the output format specifier of VTK_INI_XML has been changed: -!> - output_format = 'ascii' means \b ascii data, the same as the previous version; -!> - output_format = 'binary' means \b base64 encoded data, different from the previous version where it meant appended -!> raw-binary data; base64 encoding was missing in the previous version; -!> - output_format = 'raw' means \b appended \b raw-binary data, as 'binary' of the previous version; -!> - Added support for OpenMP multi-threads framework; -!> - Correct bug affecting binary output; -!> - implement concurrent multiple files IO capability; -!> - implement FieldData tag for XML files, useful for tagging dataset with global auxiliary data, e.g. time, time step, ecc; -!> - implement Parallel (Partitioned) XML files support (.pvtu,.pvts,.pvtr); -!> - implement Driver testing program for providing practical examples of @libvtk usage; -!> - added support for parallel framework, namely OpenMP (thread-safe) and MPI (process-safe). -!> @copyright GNU Public License version 3. -!> @note The supported compilers are GNU gfortran 4.7.x (or higher) and Intel Fortran 12.x (or higher). @libvtk needs a modern -!> compiler providing support for some Fortran standard 2003 features. -!> @todo \b CompleteExporter: Complete the exporters -!> @todo \b CompleteImporter: Complete the importers -!> @todo \b DocExamples: Complete the documentation of examples -!> @todo \b g95_test: Test g95 compiler -!> @bug XML-Efficiency: \n This is not properly a bug. There is an inefficiency when saving XML raw (binary) file. To write -!> raw data into XML file @libvtk uses a temporary scratch file to save binary data while saving all -!> formatting data to the final XML file. Only when all XML formatting data have been written the -!> scratch file is rewind and the binary data is saved in the final tag of XML file as \b raw -!> \b appended data. This approach is not efficient. -!> @ingroup Lib_VTK_IOLibrary -module Lib_VTK_IO -!----------------------------------------------------------------------------------------------------------------------------------- -USE IR_Precision ! Integers and reals precision definition. -USE Lib_Base64 ! Base64 encoding/decoding procedures. -USE, intrinsic:: ISO_FORTRAN_ENV, only: stdout=>OUTPUT_UNIT, stderr=>ERROR_UNIT ! Standard output/error logical units. -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -implicit none -private -save -! functions for VTK XML -public:: VTK_INI_XML -public:: VTK_FLD_XML -public:: VTK_GEO_XML -public:: VTK_CON_XML -public:: VTK_DAT_XML -public:: VTK_VAR_XML -public:: VTK_END_XML -! functions for VTM XML -public:: VTM_INI_XML -public:: VTM_BLK_XML -public:: VTM_WRF_XML -public:: VTM_END_XML -! functions for PVTK XML -public:: PVTK_INI_XML -public:: PVTK_GEO_XML -public:: PVTK_DAT_XML -public:: PVTK_VAR_XML -public:: PVTK_END_XML -! functions for VTK LEGACY -public:: VTK_INI -public:: VTK_GEO -public:: VTK_CON -public:: VTK_DAT -public:: VTK_VAR -public:: VTK_END -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @brief Function for saving field data (global auxiliary data, eg time, step number, dataset name, etc). -!> VTK_FLD_XML is an interface to 7 different functions, there are 2 functions for real field data, 4 functions for integer one -!> and one function for open and close field data tag. -!> @remark VTK_FLD_XML must be called after VTK_INI_XML and befor VTK_GEO_XML. It must always called three times at least: 1) for -!> opening the FieldData tag, 2) for saving at least one FieldData entry and 3) for closing the FieldData tag. -!> Examples of usage are: \n -!> \b saving the time and step cicle counter of current dataset: \n -!> @code ... -!> real(R8P):: time -!> integer(I4P):: step -!> ... -!> E_IO=VTK_FLD_XML(fld_action='open') -!> E_IO=VTK_FLD_XML(fld=time,fname='TIME') -!> E_IO=VTK_FLD_XML(fld=step,fname='CYCLE') -!> E_IO=VTK_FLD_XML(fld_action='close') -!> ... @endcode -!> @ingroup Lib_VTK_IOInterface -interface VTK_FLD_XML - module procedure VTK_FLD_XML_OC, & ! open/close field data tag - VTK_FLD_XML_R8, & ! real(R8P) scalar - VTK_FLD_XML_R4, & ! real(R4P) scalar - VTK_FLD_XML_I8, & ! integer(I8P) scalar - VTK_FLD_XML_I4, & ! integer(I4P) scalar - VTK_FLD_XML_I2, & ! integer(I2P) scalar - VTK_FLD_XML_I1 ! integer(I1P) scalar -endinterface -!> @brief Function for saving mesh with different topologies in VTK-XML standard. -!> VTK_GEO_XML is an interface to 15 different functions; there are 2 functions for each of 3 topologies supported and a function -!> for closing XML pieces: one function for mesh coordinates with R8P precision and one for mesh coordinates with R4P precision. -!> @remark 1D/3D-rank arrays and packed API for any kinds \n -!> - For StructuredGrid there are 4 functions for each real kinds: -!> - inputs are 1D-rank arrays: X[1:NN],Y[1:NN],Z[1:NN]; -!> - inputs are 3D-rank arrays: X[nx1:nx2,ny1:ny2,nz1:nz2],Y[nx1:nx2,ny1:ny2,nz1:nz2],Z[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - input is 1D-rank array (packed API): XYZ[1:3,1:NN]; -!> - input is 3D-rank array (packed API): XYZ[1:3,nx1:nx2,ny1:ny2,nz1:nz2]. -!> - For UnStructuredGrid there are 2 functions for each real kinds: -!> - inputs are 1D arrays: X[1:NN],Y[1:NN],Z[1:NN]; -!> - input is 1D array (packed API): XYZ[1:3,1:NN]. -!> -!> @remark VTK_GEO_XML must be called after VTK_INI_XML. It saves the mesh geometry. The inputs that must be passed -!> change depending on the topologies chosen. Not all VTK topologies have been implemented (\em polydata topologies are absent). -!> @note The XML standard is more powerful than legacy. XML file can contain more than 1 mesh with its -!> associated variables. Thus there is the necessity to close each \em pieces that compose the data-set saved in the -!> XML file. The VTK_GEO_XML called in the close piece format is used just to close the -!> current piece before saving another piece or closing the file. \n -!> Examples of usage are: \n -!> \b Structured grid calling: \n -!> @code ... -!> integer(I4P):: nx1,nx2,ny1,ny2,nz1,nz2,NN -!> real(R8P):: X(1:NN),Y(1:NN),Z(1:NN) -!> ... -!> E_IO=VTK_GEO_XML(nx1,nx2,ny1,ny2,nz1,nz2,Nn,X,Y,Z) -!> ... @endcode -!> \b Rectilinear grid calling: \n -!> @code ... -!> integer(I4P):: nx1,nx2,ny1,ny2,nz1,nz2 -!> real(R8P):: X(nx1:nx2),Y(ny1:ny2),Z(nz1:nz2) -!> ... -!> E_IO=VTK_GEO_XML(nx1,nx2,ny1,ny2,nz1,nz2,X,Y,Z) -!> ... @endcode -!> \b Unstructured grid calling: \n -!> @code ... -!> integer(I4P):: Nn,Nc -!> real(R8P):: X(1:Nn),Y(1:Nn),Z(1:Nn) -!> ... -!> E_IO=VTK_GEO_XML(Nn,Nc,X,Y,Z) -!> ... @endcode -!> \b Closing piece calling: 1n -!> @code ... -!> E_IO=VTK_GEO_XML() -!> ... @endcode -!> @ingroup Lib_VTK_IOInterface -interface VTK_GEO_XML - module procedure VTK_GEO_XML_STRG_1DA_R8, VTK_GEO_XML_STRG_3DA_R8, & ! real(R8P) StructuredGrid, 1D/3D Arrays - VTK_GEO_XML_STRG_1DAP_R8,VTK_GEO_XML_STRG_3DAP_R8, & ! real(R8P) StructuredGrid, 1D/3D Arrays packed API - VTK_GEO_XML_STRG_1DA_R4, VTK_GEO_XML_STRG_3DA_R4, & ! real(R4P) StructuredGrid, 1D/3D Arrays - VTK_GEO_XML_STRG_1DAP_R4,VTK_GEO_XML_STRG_3DAP_R4, & ! real(R4P) StructuredGrid, 1D/3D Arrays packed API - VTK_GEO_XML_RECT_R8, & ! real(R8P) RectilinearGrid - VTK_GEO_XML_RECT_R4, & ! real(R4P) RectilinearGrid - VTK_GEO_XML_UNST_R8,VTK_GEO_XML_UNST_PACK_R4, & ! real(R8P) UnstructuredGrid, standard and packed API - VTK_GEO_XML_UNST_R4,VTK_GEO_XML_UNST_PACK_R8, & ! real(R4P) UnstructuredGrid, standard and packed API - VTK_GEO_XML_CLOSEP ! closing tag "Piece" function -endinterface -!> @brief Function for saving data variable(s) in VTK-XML standard. -!> VTK_VAR_XML is an interface to 36 different functions, there are 6 functions for scalar variables, 6 functions for vectorial -!> variables and 6 functions for 3D(or higher) vectorial variables: for all of types the precision can be R8P, R4P, I8P, I4P, I2P -!> and I1P. This function saves the data variables related (cell-centered or node-centered) to geometric mesh. -!> @remark 1D/3D-rank arrays and packed API for any kinds \n -!> The inputs arrays can be passed as 1D-rank or 3D-rank and the vectorial variables can be component-separated (one for each of -!> the 3 components) or packed into one multidimensional array: -!> - scalar input: -!> - input is 1D-rank array: var[1:NC_NN]; -!> - input is 3D-rank array: var[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - vectorial inputs: -!> - inputs are 1D-rank arrays: varX[1:NC_NN],varY[1:NC_NN],varZ[1:NC_NN]; -!> - inputs are 3D-rank arrays: varX[nx1:nx2,ny1:ny2,nz1:nz2],varY[nx1:nx2,ny1:ny2,nz1:nz2],varX[nx1:nx2,ny1:ny2,nz1:nz2]; -!> - 3D(or higher) vectorial inputs: -!> - input is 1D-rank (packed API): var[1:N_COL,1:NC_NN]; -!> - input is 3D-rank (packed API): var[1:N_COL,nx1:nx2,ny1:ny2,nz1:nz2]. -!> -!> @remark Note that the inputs that must be passed change depending on the data variables type. -!> -!> @note Examples of usage are: \n -!> \b Scalar data calling: \n -!> @code ... -!> integer(I4P):: NN -!> real(R8P):: var(1:NN) -!> ... -!> E_IO=VTK_VAR_XML(NN,'Sca',var) -!> ... @endcode -!> \b Vectorial data calling: \n -!> @code ... -!> integer(I4P):: NN -!> real(R8P):: varX(1:NN),varY(1:NN),varZ(1:NN), -!> ... -!> E_IO=VTK_VAR_XML(NN,'Vec',varX,varY,varZ) -!> ... @endcode -!> @ingroup Lib_VTK_IOInterface -interface VTK_VAR_XML - module procedure VTK_VAR_XML_SCAL_1DA_R8,VTK_VAR_XML_SCAL_3DA_R8, & ! real(R8P) scalar 1D/3D array - VTK_VAR_XML_SCAL_1DA_R4,VTK_VAR_XML_SCAL_3DA_R4, & ! real(R4P) scalar 1D/3D array - VTK_VAR_XML_SCAL_1DA_I8,VTK_VAR_XML_SCAL_3DA_I8, & ! integer(I8P) scalar 1D/3D array - VTK_VAR_XML_SCAL_1DA_I4,VTK_VAR_XML_SCAL_3DA_I4, & ! integer(I4P) scalar 1D/3D array - VTK_VAR_XML_SCAL_1DA_I2,VTK_VAR_XML_SCAL_3DA_I2, & ! integer(I2P) scalar 1D/3D array - VTK_VAR_XML_SCAL_1DA_I1,VTK_VAR_XML_SCAL_3DA_I1, & ! integer(I1P) scalar 1D/3D array - VTK_VAR_XML_VECT_1DA_R8,VTK_VAR_XML_VECT_3DA_R8, & ! real(R8P) vectorial 1D/3D arrays - VTK_VAR_XML_VECT_1DA_R4,VTK_VAR_XML_VECT_3DA_R4, & ! real(R4P) vectorial 1D/3D arrays - VTK_VAR_XML_VECT_1DA_I8,VTK_VAR_XML_VECT_3DA_I8, & ! integer(I8P) vectorial 1D/3D arrays - VTK_VAR_XML_VECT_1DA_I4,VTK_VAR_XML_VECT_3DA_I4, & ! integer(I4P) vectorial 1D/3D arrays - VTK_VAR_XML_VECT_1DA_I2,VTK_VAR_XML_VECT_3DA_I2, & ! integer(I2P) vectorial 1D/3D arrays - VTK_VAR_XML_VECT_1DA_I1,VTK_VAR_XML_VECT_3DA_I1, & ! integer(I1P) vectorial 1D/3D arrays - VTK_VAR_XML_LIST_1DA_R8,VTK_VAR_XML_LIST_3DA_R8, & ! real(R8P) list 1D/3D array - VTK_VAR_XML_LIST_1DA_R4,VTK_VAR_XML_LIST_3DA_R4, & ! real(R4P) list 1D/3D array - VTK_VAR_XML_LIST_1DA_I8,VTK_VAR_XML_LIST_3DA_I8, & ! integer(I4P) list 1D/3D array - VTK_VAR_XML_LIST_1DA_I4,VTK_VAR_XML_LIST_3DA_I4, & ! integer(I4P) list 1D/3D array - VTK_VAR_XML_LIST_1DA_I2,VTK_VAR_XML_LIST_3DA_I2, & ! integer(I2P) list 1D/3D array - VTK_VAR_XML_LIST_1DA_I1,VTK_VAR_XML_LIST_3DA_I1 ! integer(I1P) list 1D/3D array -endinterface -!> @brief Function for saving mesh with different topologies in VTK-legacy standard. -!> VTK_GEO is an interface to 16 different functions, there are 2 functions for each of 4 different topologies actually supported: -!> one function for mesh coordinates with R8P precision and one for mesh coordinates with R4P precision. -!> @remark This function must be called after VTK_INI. It saves the mesh geometry. The inputs that must be passed change depending -!> on the topologies chosen. Not all VTK topologies have been implemented (\em polydata topologies are absent). -!> @note Examples of usage are: \n -!> \b Structured points calling: \n -!> @code ... -!> integer(I4P):: Nx,Ny,Nz -!> real(I8P):: X0,Y0,Z0,Dx,Dy,Dz -!> ... -!> E_IO=VTK_GEO(Nx,Ny,Nz,X0,Y0,Z0,Dx,Dy,Dz) -!> ... @endcode -!> \b Structured grid calling: \n -!> @code ... -!> integer(I4P):: Nx,Ny,Nz,Nnodes -!> real(R8P):: X(1:Nnodes),Y(1:Nnodes),Z(1:Nnodes) -!> ... -!> E_IO=VTK_GEO(Nx,Ny,Nz,Nnodes,X,Y,Z) -!> ... @endcode -!> \b Rectilinear grid calling: \n -!> @code ... -!> integer(I4P):: Nx,Ny,Nz -!> real(R8P):: X(1:Nx),Y(1:Ny),Z(1:Nz) -!> ... -!> E_IO=VTK_GEO(Nx,Ny,Nz,X,Y,Z) -!> ... @endcode -!> \b Unstructured grid calling: \n -!> @code ... -!> integer(I4P):: NN -!> real(R4P):: X(1:NN),Y(1:NN),Z(1:NN) -!> ... -!> E_IO=VTK_GEO(NN,X,Y,Z) -!> ... @endcode -!> @ingroup Lib_VTK_IOInterface -interface VTK_GEO - module procedure VTK_GEO_UNST_R8,VTK_GEO_UNST_P_R8, & ! real(R8P) UNSTRUCTURED_GRID, standard and packed API - VTK_GEO_UNST_R4,VTK_GEO_UNST_P_R4, & ! real(R4P) UNSTRUCTURED_GRID, standard and packed API - VTK_GEO_STRP_R8, & ! real(R8P) STRUCTURED_POINTS - VTK_GEO_STRP_R4, & ! real(R4P) STRUCTURED_POINTS - VTK_GEO_STRG_1DA_R8, VTK_GEO_STRG_3DA_R8, & ! real(R8P) STRUCTURED_GRID 1D/3D arrays - VTK_GEO_STRG_1DAP_R8,VTK_GEO_STRG_3DAP_R8, & ! real(R8P) STRUCTURED_GRID 1D/3D arrays, packed API - VTK_GEO_STRG_1DA_R4, VTK_GEO_STRG_3DA_R4, & ! real(R4P) STRUCTURED_GRID 1D/3D arrays - VTK_GEO_STRG_1DAP_R4,VTK_GEO_STRG_3DAP_R4, & ! real(R4P) STRUCTURED_GRID 1D/3D arrays, packed API - VTK_GEO_RECT_R8, & ! real(R8P) RECTILINEAR_GRID - VTK_GEO_RECT_R4 ! real(R4P) RECTILINEAR_GRID -endinterface -!> @brief Function for saving data variable(s) in VTK-legacy standard. -!> VTK_VAR is an interface to 8 different functions, there are 3 functions for scalar variables, 3 functions for vectorial -!> variables and 2 functions texture variables: scalar and vectorial data can be R8P, R4P and I4P data while texture variables can -!> be only R8P or R4P. -!> This function saves the data variables related to geometric mesh. -!> @remark The inputs that must be passed change depending on the data -!> variables type. -!> @note Examples of usage are: \n -!> \b Scalar data calling: \n -!> @code ... -!> integer(I4P):: NN -!> real(R4P):: var(1:NN) -!> ... -!> E_IO=VTK_VAR(NN,'Sca',var) -!> ... @endcode -!> \b Vectorial data calling: \n -!> @code ... -!> integer(I4P):: NN -!> real(R4P):: varX(1:NN),varY(1:NN),varZ(1:NN) -!> ... -!> E_IO=VTK_VAR('vect',NN,'Vec',varX,varY,varZ) -!> ... @endcode -!> @ingroup Lib_VTK_IOInterface -interface VTK_VAR - module procedure VTK_VAR_SCAL_R8, & ! real(R8P) scalar - VTK_VAR_SCAL_R4, & ! real(R4P) scalar - VTK_VAR_SCAL_I4, & ! integer(I4P) scalar - VTK_VAR_VECT_R8, & ! real(R8P) vectorial - VTK_VAR_VECT_R4, & ! real(R4P) vectorial - VTK_VAR_VECT_I4, & ! integer(I4P) vectorial - VTK_VAR_TEXT_R8, & ! real(R8P) vectorial (texture) - VTK_VAR_TEXT_R4 ! real(R4P) vectorial (texture) -endinterface -!----------------------------------------------------------------------------------------------------------------------------------- - -!----------------------------------------------------------------------------------------------------------------------------------- -!> @ingroup Lib_VTK_IOPrivateVarPar -!> @{ -! The library uses a small set of internal variables that are private (not accessible from the outside). The following are -! private variables. -! Parameters: -integer(I4P), parameter:: maxlen = 500 !< Max number of characters of static string. -character(1), parameter:: end_rec = char(10) !< End-character for binary-record finalize. -integer(I4P), parameter:: ascii = 0 !< Ascii-output-format parameter identifier. -integer(I4P), parameter:: binary = 1 !< Base64-output-format parameter identifier. -integer(I4P), parameter:: raw = 2 !< Raw-appended-binary-output-format parameter identifier. -integer(I4P), parameter:: bin_app = 3 !< Base64-appended-output-format parameter identifier. -! VTK file data: -type:: Type_VTK_File - integer(I4P):: f = ascii !< Current output-format (initialized to ascii format). - character(len=maxlen):: topology = '' !< Mesh topology. - integer(I4P):: u = 0_I4P !< Logical unit. - integer(I4P):: ua = 0_I4P !< Logical unit for raw binary XML append file. -#ifdef HUGE - integer(I8P):: N_Byte = 0_I8P !< Number of byte to be written/read. -#else - integer(I4P):: N_Byte = 0_I4P !< Number of byte to be written/read. -#endif - integer(I8P):: ioffset = 0_I8P !< Offset pointer. - integer(I4P):: indent = 0_I4P !< Indent pointer. - contains - procedure:: byte_update ! Procedure for updating N_Byte and ioffset pointer. -endtype Type_VTK_File -type(Type_VTK_File), allocatable:: vtk(:) !< Global data of VTK files [1:Nvtk]. -integer(I4P):: Nvtk = 0_I4P !< Number of (concurrent) VTK files. -integer(I4P):: f = 0_I4P !< Current VTK file index. -! VTM file data: -type:: Type_VTM_File - integer(I4P):: u = 0_I4P !< Logical unit. - integer(I4P):: blk = 0_I4P !< Block index. - integer(I4P):: indent = 0_I4P !< Indent pointer. -endtype Type_VTM_File -type(Type_VTM_File):: vtm !< Global data of VTM files. -!> @} -!----------------------------------------------------------------------------------------------------------------------------------- -contains - ! The library uses five auxiliary procedures that are private thus they cannot be called outside the library. - !> @ingroup Lib_VTK_IOPrivateProcedure - !> @{ - !> @brief Function for getting a free logic unit. The users of @libvtk does not know which is the logical - !> unit: @libvtk uses this information without boring the users. The logical unit used is safe-free: if the program - !> calling @libvtk has others logical units used @libvtk will never use these units, but will choice one that is free. - !>@return Free_Unit - integer function Get_Unit(Free_Unit) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(OUT), optional:: Free_Unit !< Free logic unit. - integer:: n1 !< Counter. - integer:: ios !< Inquiring flag. - logical:: lopen !< Inquiring flag. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - Get_Unit = -1 - n1=1 - do - if ((n1/=stdout).AND.(n1/=stderr)) then - inquire(unit=n1,opened=lopen,iostat=ios) - if (ios==0) then - if (.NOT.lopen) then - Get_Unit = n1 ; if (present(Free_Unit)) Free_Unit = Get_Unit - return - endif - endif - endif - n1=n1+1 - enddo - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction Get_Unit - - !> @brief Function for converting lower case characters of a string to upper case ones. @libvtk uses this function in - !> order to achieve case-insensitive: all character variables used within @libvtk functions are pre-processed by - !> Uppper_Case function before these variables are used. So the users can call @libvtk functions without pay attention of - !> the case of the keywords passed to the functions: calling the function VTK_INI with the string - !> E_IO = VTK_INI('Ascii',...) is equivalent to E_IO = VTK_INI('ASCII',...). - !>@return Upper_Case - elemental function Upper_Case(string) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(len=*), intent(IN):: string !< String to be converted. - character(len=len(string)):: Upper_Case !< Converted string. - integer:: n1 !< Characters counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - Upper_Case = string - do n1=1,len(string) - select case(ichar(string(n1:n1))) - case(97:122) - Upper_Case(n1:n1)=char(ichar(string(n1:n1))-32) ! Upper case conversion - endselect - enddo - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction Upper_Case - - !> @brief Subroutine for updating N_Byte and ioffset pointer. - elemental subroutine byte_update(vtk,N_Byte) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - class(Type_VTK_File), intent(INOUT):: vtk !< Global data of VTK file. -#ifdef HUGE - integer(I8P), intent(IN):: N_Byte !< Number of bytes saved. -#else - integer(I4P), intent(IN):: N_Byte !< Number of bytes saved. -#endif - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - vtk%N_Byte = N_Byte - if (vtk%f==raw) then -#ifdef HUGE - vtk%ioffset = vtk%ioffset + BYI8P + N_Byte -#else - vtk%ioffset = vtk%ioffset + BYI4P + N_Byte -#endif - else -#ifdef HUGE - vtk%ioffset = vtk%ioffset + ((N_Byte + BYI8P + 2_I8P)/3_I8P)*4_I8P -#else - vtk%ioffset = vtk%ioffset + ((N_Byte + BYI4P + 2_I4P)/3_I4P)*4_I4P -#endif - endif - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine byte_update - - !> @brief Subroutine for updating (adding and removing elements into) vtk array. - pure subroutine vtk_update(act,cf,Nvtk,vtk) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: act !< Action: 'ADD' one more element, 'REMOVE' current element file. - integer(I4P), intent(INOUT):: cf !< Current file index (for concurrent files IO). - integer(I4P), intent(INOUT):: Nvtk !< Number of (concurrent) VTK files. - type(Type_VTK_File), allocatable, intent(INOUT):: vtk(:) !< VTK files data. - type(Type_VTK_File), allocatable:: vtk_tmp(:) !< Temporary array of VTK files data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - select case(Upper_Case(trim(act))) - case('ADD') - if (Nvtk>0_I4P) then - allocate(vtk_tmp(1:Nvtk)) - vtk_tmp = vtk - deallocate(vtk) - Nvtk = Nvtk + 1 - allocate(vtk(1:Nvtk)) - vtk(1:Nvtk-1) = vtk_tmp - deallocate(vtk_tmp) - cf = Nvtk - else - Nvtk = 1_I4P - allocate(vtk(1:Nvtk)) - cf = Nvtk - endif - case default - if (Nvtk>1_I4P) then - allocate(vtk_tmp(1:Nvtk-1)) - if (cf==Nvtk) then - vtk_tmp = vtk(1:Nvtk-1) - else - vtk_tmp(1 :cf-1) = vtk(1 :cf-1) - vtk_tmp(cf: ) = vtk(cf+1: ) - endif - deallocate(vtk) - Nvtk = Nvtk - 1 - allocate(vtk(1:Nvtk)) - vtk = vtk_tmp - deallocate(vtk_tmp) - cf = 1_I4P - else - Nvtk = 0_I4P - if (allocated(vtk)) deallocate(vtk) - cf = Nvtk - endif - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endsubroutine vtk_update - - !> @brief Function for converting array of 1 character to a string of characters. It is used for writing the stream of base64 - !> encoded data. - pure function tochar(string) result (char_string) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(1), intent(IN):: string(1:) !< Array of 1 character. - character(size(string,dim=1)):: char_string !< String of characters. - integer(I4P):: i !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - forall(i = 1:size(string,dim=1)) - char_string(i:i) = string(i) - endforall - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction tochar - !> @} - - !> @brief Function for initializing VTK-XML file. - !> The XML standard is more powerful than legacy one. It is flexible but on the other hand is (but not so more using a library - !> like @libvtk...) complex than legacy standard. The output of XML functions is a well-formated valid XML file, at least for the - !> ascii, binary and binary appended formats (in the raw-binary format @libvtk uses raw-binary-appended format that is not a valid - !> XML file). - !> Note that the XML functions have the same name of legacy functions with the suffix \em XML. - !> @remark This function must be the first to be called. - !> @note Supported output formats are (the passed specifier value is case insensitive): - !> - ASCII: data are saved in ASCII format; - !> - BINARY: data are saved in base64 encoded format; - !> - RAW: data are saved in raw-binary format in the appended tag of the XML file; - !> - BINARY-APPENDED: data are saved in base64 encoded format in the appended tag of the XML file. - !> @note Supported topologies are: - !> - RectilinearGrid; - !> - StructuredGrid; - !> - UnstructuredGrid. - !> @note An example of usage is: \n - !> @code ... - !> integer(I4P):: nx1,nx2,ny1,ny2,nz1,nz2 - !> ... - !> E_IO = VTK_INI_XML('BINARY','XML_RECT_BINARY.vtr','RectilinearGrid',nx1=nx1,nx2=nx2,ny1=ny1,ny2=ny2,nz1=nz1,nz2=nz2) - !> ... @endcode - !> Note that the file extension is necessary in the file name. The XML standard has different extensions for each - !> different topologies (e.g. \em vtr for rectilinear topology). See the VTK-standard file for more information. - !> @return E_IO: integer(I4P) error flag - function VTK_INI_XML(output_format,filename,mesh_topology,cf,nx1,nx2,ny1,ny2,nz1,nz2) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: output_format !< Output format: ASCII, BINARY, RAW or BINARY-APPENDED. - character(*), intent(IN):: filename !< File name. - character(*), intent(IN):: mesh_topology !< Mesh topology. - integer(I4P), intent(OUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P), intent(IN), optional:: nx1 !< Initial node of x axis. - integer(I4P), intent(IN), optional:: nx2 !< Final node of x axis. - integer(I4P), intent(IN), optional:: ny1 !< Initial node of y axis. - integer(I4P), intent(IN), optional:: ny2 !< Final node of y axis. - integer(I4P), intent(IN), optional:: nz1 !< Initial node of z axis. - integer(I4P), intent(IN), optional:: nz2 !< Final node of z axis. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - if (.not.ir_initialized) call IR_Init - call vtk_update(act='add',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - vtk(rf)%topology = trim(mesh_topology) - select case(trim(Upper_Case(output_format))) - case('ASCII') - vtk(rf)%f = ascii - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),form='FORMATTED',& - access='SEQUENTIAL',action='WRITE',status='REPLACE',iostat=E_IO) - ! writing header of file - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'' - if (endian==endianL) then - s_buffer = '' - else - s_buffer = '' - endif - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = 2 - select case(trim(vtk(rf)%topology)) - case('RectilinearGrid','StructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' WholeExtent="'//& - trim(str(n=nx1))//' '//trim(str(n=nx2))//' '// & - trim(str(n=ny1))//' '//trim(str(n=ny2))//' '// & - trim(str(n=nz1))//' '//trim(str(n=nz2))//'">' - case('UnstructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//'>' - endselect - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('RAW','BINARY-APPENDED') - vtk(rf)%f = raw - if (trim(Upper_Case(output_format))=='BINARY-APPENDED') vtk(rf)%f = bin_app - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),& - form='UNFORMATTED',access='STREAM',action='WRITE',status='REPLACE',iostat=E_IO) - ! writing header of file - write(unit=vtk(rf)%u,iostat=E_IO)''//end_rec - if (endian==endianL) then - s_buffer = '' - else - s_buffer = '' - endif - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = 2 - select case(trim(vtk(rf)%topology)) - case('RectilinearGrid','StructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' WholeExtent="'//& - trim(str(n=nx1))//' '//trim(str(n=nx2))//' '// & - trim(str(n=ny1))//' '//trim(str(n=ny2))//' '// & - trim(str(n=nz1))//' '//trim(str(n=nz2))//'">' - case('UnstructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//'>' - endselect - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - ! opening the SCRATCH file used for appending raw binary data - open(unit=Get_Unit(vtk(rf)%ua), form='UNFORMATTED', access='STREAM', action='READWRITE', status='SCRATCH', iostat=E_IO) - vtk(rf)%ioffset = 0 ! initializing offset pointer - case('BINARY') - vtk(rf)%f = binary - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),& - form='UNFORMATTED',access='STREAM',action='WRITE',status='REPLACE',iostat=E_IO) - ! writing header of file - write(unit=vtk(rf)%u,iostat=E_IO)''//end_rec - if (endian==endianL) then - s_buffer = '' - else - s_buffer = '' - endif - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = 2 - select case(trim(vtk(rf)%topology)) - case('RectilinearGrid','StructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' WholeExtent="'//& - trim(str(n=nx1))//' '//trim(str(n=nx2))//' '// & - trim(str(n=ny1))//' '//trim(str(n=ny2))//' '// & - trim(str(n=nz1))//' '//trim(str(n=nz2))//'">' - case('UnstructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//'>' - endselect - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_INI_XML - - !> @ingroup Lib_VTK_IOPrivateProcedure - !> @{ - !> Function for open/close field data tag. - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_OC(fld_action,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: fld_action !< Field data tag action: OPEN or CLOSE tag. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(trim(Upper_Case(fld_action))) - case('OPEN') - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - case(raw,binary,bin_app) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - endselect - case('CLOSE') - select case(vtk(rf)%f) - case(ascii) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,binary,bin_app) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_OC - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_R8(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R8P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//''//& - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYR8P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(BYR8P,I4P)],a2=[fld],packed=fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_R8 - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_R4(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - real(R4P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//''//& - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYR4P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(BYR4P,I4P)],a2=[fld],packed=fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_R4 - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (I8P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_I8(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I8P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//''// & - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYI8P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(BYI8P,I4P)],a2=[fld],packed=fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_I8 - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (I4P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_I4(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I8P):: Nfldp !< Dimension of fldp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//''// & - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYI4P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - Nfldp=size(transfer([int(BYI4P,I4P),fld],fldp),kind=I8P) ; if (allocated(fldp)) deallocate(fldp) ; allocate(fldp(1:Nfldp)) - fldp = transfer([int(BYI4P,I4P),fld],fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_I4 - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (I2P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_I2(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I2P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//''// & - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYI2P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(BYI2P,I4P)],a2=[fld],packed=fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_I2 - - !> Function for saving field data (global auxiliary data, e.g. time, step number, data set name...) (I1P). - !> @return E_IO: integer(I4P) error flag - function VTK_FLD_XML_I1(fld,fname,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I1P), intent(IN):: fld !< Field data value. - character(*), intent(IN):: fname !< Field data name. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: fldp(:) !< Packed field data. - character(1), allocatable:: fld64(:) !< Field data encoded in base64. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//''// & - trim(str(n=fld))//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(BYI1P,I4P)) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',1_I4P - write(unit=vtk(rf)%ua,iostat=E_IO)fld - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(BYI1P,I4P)],a2=[fld],packed=fldp) - call b64_encode(nB=int(BYI1P,I4P),n=fldp,code=fld64) ; deallocate(fldp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(fld64)//end_rec ; deallocate(fld64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_FLD_XML_I1 - - !> Function for saving mesh with \b StructuredGrid topology (R8P, 1D Arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_1DA_R8(nx1,nx2,ny1,ny2,nz1,nz2,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: X(1:) !< X coordinates [1:NN]. - real(R8P), intent(IN):: Y(1:) !< Y coordinates [1:NN]. - real(R8P), intent(IN):: Z(1:) !< Z coordinates [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I1P), allocatable:: XYZp(:) !< Packed coordinates data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=[(X(n1),Y(n1),Z(n1),n1=1,NN)],packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_1DA_R8 - - !> Function for saving mesh with \b StructuredGrid topology (R8P, 3D Arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_3DA_R8(nx1,nx2,ny1,ny2,nz1,nz2,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: X(nx1:,ny1:,nz1:) !< X coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - real(R8P), intent(IN):: Y(nx1:,ny1:,nz1:) !< Y coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - real(R8P), intent(IN):: Z(nx1:,ny1:,nz1:) !< Z coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I1P), allocatable:: XYZp(:) !< Packed coordinates data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do nz=nz1,nz2 - do ny=ny1,ny2 - do nx=nx1,nx2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=X(nx,ny,nz))//' '//str(n=Y(nx,ny,nz))//' '//str(n=Z(nx,ny,nz)) - enddo - enddo - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(((X(nx,ny,nz),Y(nx,ny,nz),Z(nx,ny,nz),nx=nx1,nx2),ny=ny1,ny2),nz=nz1,nz2) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=[(((X(nx,ny,nz),Y(nx,ny,nz),Z(nx,ny,nz),nx=nx1,nx2),ny=ny1,ny2),nz=nz1,nz2)],& - packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_3DA_R8 - - !> Function for saving mesh with \b StructuredGrid topology (R8P, 1D Arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_1DAP_R8(nx1,nx2,ny1,ny2,nz1,nz2,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: XYZ(1:,1:) !< X, Y, Z coordinates (packed API) [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I1P), allocatable:: XYZp(:) !< Packed coordinates data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=reshape(XYZ,[3*NN]),packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_1DAP_R8 - - !> Function for saving mesh with \b StructuredGrid topology (R8P, 3D Arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_3DAP_R8(nx1,nx2,ny1,ny2,nz1,nz2,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: XYZ(1:,nx1:,ny1:,nz1:) !< X, Y, Z coordinates (packed API). - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I1P), allocatable:: XYZp(:) !< Packed coordinates data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do nz=nz1,nz2 - do ny=ny1,ny2 - do nx=nx1,nx2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,nx,ny,nz))//' '//str(n=XYZ(2,nx,ny,nz))//' '//str(n=XYZ(3,nx,ny,nz)) - enddo - enddo - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=reshape(XYZ,[3*NN]),packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_3DAP_R8 - - !> Function for saving mesh with \b StructuredGrid topology (R4P, 1D Arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_1DA_R4(nx1,nx2,ny1,ny2,nz1,nz2,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: X(1:) !< X coordinates [1:NN]. - real(R4P), intent(IN):: Y(1:) !< Y coordinates [1:NN]. - real(R4P), intent(IN):: Z(1:) !< Z coordinates [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=[(X(n1),Y(n1),Z(n1),n1=1,NN)],packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_1DA_R4 - - !> Function for saving mesh with \b StructuredGrid topology (R4P, 3D Arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_3DA_R4(nx1,nx2,ny1,ny2,nz1,nz2,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: X(nx1:,ny1:,nz1:) !< X coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - real(R4P), intent(IN):: Y(nx1:,ny1:,nz1:) !< Y coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - real(R4P), intent(IN):: Z(nx1:,ny1:,nz1:) !< Z coordinates [nx1:nx2,ny1:ny2,nz1:nz2]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do nz=nz1,nz2 - do ny=ny1,ny2 - do nx=nx1,nx2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=X(nx,ny,nz))//' '//str(n=Y(nx,ny,nz))//' '//str(n=Z(nx,ny,nz)) - enddo - enddo - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(((X(nx,ny,nz),Y(nx,ny,nz),Z(nx,ny,nz),nx=nx1,nx2),ny=ny1,ny2),nz=nz1,nz2) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=[(((X(nx,ny,nz),Y(nx,ny,nz),Z(nx,ny,nz),nx=nx1,nx2),ny=ny1,ny2),nz=nz1,nz2)], & - packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_3DA_R4 - - !> Function for saving mesh with \b StructuredGrid topology (R4P, 1D Arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_1DAP_R4(nx1,nx2,ny1,ny2,nz1,nz2,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: XYZ(1:,1:) !< X, Y, Z coordinates (packed API) [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=reshape(XYZ,[3*NN]),packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_1DAP_R4 - - !> Function for saving mesh with \b StructuredGrid topology (R4P, 3D Arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_STRG_3DAP_R4(nx1,nx2,ny1,ny2,nz1,nz2,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: XYZ(1:,nx1:,ny1:,nz1:) !< X, Y, Z coordinates (packed API) [1:3,nx1:nx2,ny1:ny2,nz1:nz2]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do nz=nz1,nz2 - do ny=ny1,ny2 - do nx=nx1,nx2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,nx,ny,nz))//' '//str(n=XYZ(2,nx,ny,nz))//' '//str(n=XYZ(3,nx,ny,nz)) - enddo - enddo - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=reshape(XYZ,[3*NN]),packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_STRG_3DAP_R4 - - !> Function for saving mesh with \b RectilinearGrid topology (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_RECT_R8(nx1,nx2,ny1,ny2,nz1,nz2,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - real(R8P), intent(IN):: X(nx1:nx2) !< X coordinates. - real(R8P), intent(IN):: Y(ny1:ny2) !< Y coordinates. - real(R8P), intent(IN):: Z(nz1:nz2) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR8P, iostat=E_IO)(X(n1),n1=nx1,nx2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR8P, iostat=E_IO)(Y(n1),n1=ny1,ny2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR8P, iostat=E_IO)(Z(n1),n1=nz1,nz2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (nx2-nx1+1)*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',(nx2-nx1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),n1=nx1,nx2) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (ny2-ny1+1)*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',(ny2-ny1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(Y(n1),n1=ny1,ny2) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (nz2-nz1+1)*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',(nz2-nz1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(Z(n1),n1=nz1,nz2) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((nx2-nx1+1)*BYR8P,I4P)],a2=X,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((ny2-ny1+1)*BYR8P,I4P)],a2=Y,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((nz2-nz1+1)*BYR8P,I4P)],a2=Z,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_RECT_R8 - - !> Function for saving mesh with \b RectilinearGrid topology (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_RECT_R4(nx1,nx2,ny1,ny2,nz1,nz2,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: nx1 !< Initial node of x axis. - integer(I4P), intent(IN):: nx2 !< Final node of x axis. - integer(I4P), intent(IN):: ny1 !< Initial node of y axis. - integer(I4P), intent(IN):: ny2 !< Final node of y axis. - integer(I4P), intent(IN):: nz1 !< Initial node of z axis. - integer(I4P), intent(IN):: nz2 !< Final node of z axis. - real(R4P), intent(IN):: X(nx1:nx2) !< X coordinates. - real(R4P), intent(IN):: Y(ny1:ny2) !< Y coordinates. - real(R4P), intent(IN):: Z(nz1:nz2) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR4P, iostat=E_IO)(X(n1),n1=nx1,nx2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR4P, iostat=E_IO)(Y(n1),n1=ny1,ny2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FR4P, iostat=E_IO)(Z(n1),n1=nz1,nz2) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (nx2-nx1+1)*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',(nx2-nx1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),n1=nx1,nx2) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (ny2-ny1+1)*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',(ny2-ny1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(Y(n1),n1=ny1,ny2) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = (nz2-nz1+1)*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',(nz2-nz1+1) - write(unit=vtk(rf)%ua,iostat=E_IO)(Z(n1),n1=nz1,nz2) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((nx2-nx1+1)*BYR4P,I4P)],a2=X,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((ny2-ny1+1)*BYR4P,I4P)],a2=Y,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int((nz2-nz1+1)*BYR4P,I4P)],a2=Z,packed=XYZp) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_RECT_R4 - - !> Function for saving mesh with \b UnstructuredGrid topology (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_UNST_R8(NN,NC,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - integer(I4P), intent(IN):: NC !< Number of cells. - real(R8P), intent(IN):: X(1:NN) !< X coordinates. - real(R8P), intent(IN):: Y(1:NN) !< Y coordinates. - real(R8P), intent(IN):: Z(1:NN) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R8P), allocatable:: XYZa(:) !< X, Y, Z coordinates. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(XYZa(1:3*NN)) - do n1 = 1,NN - XYZa(1+(n1-1)*3:1+(n1-1)*3+2)=[X(n1),Y(n1),Z(n1)] - enddo - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=XYZa,packed=XYZp) ; deallocate(XYZa) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_UNST_R8 - - !> Function for saving mesh with \b UnstructuredGrid topology (R8P, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_UNST_PACK_R8(NN,NC,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - integer(I4P), intent(IN):: NC !< Number of cells. - real(R8P), intent(IN):: XYZ(1:3,1:NN) !< X, Y, Z coordinates (packed API). - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R8P), allocatable:: XYZa(:) !< X, Y, Z coordinates. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR8P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(XYZa(1:3*NN)) - do n1 = 1,NN - XYZa(1+(n1-1)*3:1+(n1-1)*3+2)=XYZ(1:3,n1) - enddo - call pack_data(a1=[int(3*NN*BYR8P,I4P)],a2=XYZa,packed=XYZp) ; deallocate(XYZa) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_UNST_PACK_R8 - - !> Function for saving mesh with \b UnstructuredGrid topology (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_UNST_R4(NN,NC,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - integer(I4P), intent(IN):: NC !< Number of cells. - real(R4P), intent(IN):: X(1:NN) !< X coordinates. - real(R4P), intent(IN):: Y(1:NN) !< Y coordinates. - real(R4P), intent(IN):: Z(1:NN) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R4P), allocatable:: XYZa(:) !< X, Y, Z coordinates. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(XYZa(1:3*NN)) - do n1 = 1,NN - XYZa(1+(n1-1)*3:1+(n1-1)*3+2)=[X(n1),Y(n1),Z(n1)] - enddo - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=XYZa,packed=XYZp) ; deallocate(XYZa) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_UNST_R4 - - !> Function for saving mesh with \b UnstructuredGrid topology (R4P, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_UNST_PACK_R4(NN,NC,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - integer(I4P), intent(IN):: NC !< Number of cells. - real(R4P), intent(IN):: XYZ(1:3,1:NN) !< X, Y, Z coordinates (packed API). - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R4P), allocatable:: XYZa(:) !< X, Y, Z coordinates. - integer(I1P), allocatable:: XYZp(:) !< Packed data. - character(1), allocatable:: XYZ64(:) !< X, Y, Z coordinates encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)// & - '' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NN*BYR4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NN - write(unit=vtk(rf)%ua,iostat=E_IO)XYZ - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(XYZa(1:3*NN)) - do n1 = 1,NN - XYZa(1+(n1-1)*3:1+(n1-1)*3+2)=XYZ(1:3,n1) - enddo - call pack_data(a1=[int(3*NN*BYR4P,I4P)],a2=XYZa,packed=XYZp) ; deallocate(XYZa) - call b64_encode(nB=int(BYI1P,I4P),n=XYZp,code=XYZ64) ; deallocate(XYZp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(XYZ64)//end_rec ; deallocate(XYZ64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_UNST_PACK_R4 - - !> @brief Function for closing mesh block data. - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_XML_CLOSEP(cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - vtk(rf)%indent = vtk(rf)%indent - 2 - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,binary,bin_app) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_XML_CLOSEP - !> @} - - !> Function that \b must be used when unstructured grid is used, it saves the connectivity of the unstructured gird. - !> @note The vector \b connect must follow the VTK-legacy standard. It is passed as \em assumed-shape array - !> because its dimensions is related to the mesh dimensions in a complex way. Its dimensions can be calculated by the following - !> equation: \f$dc = dc = \sum\limits_{i = 1}^{NC} {nvertex_i }\f$. - !> Note that this equation is different from the legacy one. The XML connectivity convention is quite different from the - !> legacy standard. As an example suppose we have a mesh composed by 2 cells, one hexahedron (8 vertices) and one pyramid with - !> square basis (5 vertices) and suppose that the basis of pyramid is constitute by a face of the hexahedron and so the two cells - !> share 4 vertices. The above equation gives \f$dc=8+5=13\f$. The connectivity vector for this mesh can be: \n - !> first cell \n - !> connect(1) = 0 identification flag of \f$1^\circ\f$ vertex of 1° cell \n - !> connect(2) = 1 identification flag of \f$2^\circ\f$ vertex of 1° cell \n - !> connect(3) = 2 identification flag of \f$3^\circ\f$ vertex of 1° cell \n - !> connect(4) = 3 identification flag of \f$4^\circ\f$ vertex of 1° cell \n - !> connect(5) = 4 identification flag of \f$5^\circ\f$ vertex of 1° cell \n - !> connect(6) = 5 identification flag of \f$6^\circ\f$ vertex of 1° cell \n - !> connect(7) = 6 identification flag of \f$7^\circ\f$ vertex of 1° cell \n - !> connect(8) = 7 identification flag of \f$8^\circ\f$ vertex of 1° cell \n - !> second cell \n - !> connect(9 ) = 0 identification flag of \f$1^\circ\f$ vertex of 2° cell \n - !> connect(10) = 1 identification flag of \f$2^\circ\f$ vertex of 2° cell \n - !> connect(11) = 2 identification flag of \f$3^\circ\f$ vertex of 2° cell \n - !> connect(12) = 3 identification flag of \f$4^\circ\f$ vertex of 2° cell \n - !> connect(13) = 8 identification flag of \f$5^\circ\f$ vertex of 2° cell \n - !> Therefore this connectivity vector convention is more simple than the legacy convention, now we must create also the - !> \em offset vector that contains the data now missing in the \em connect vector. The offset - !> vector for this mesh can be: \n - !> first cell \n - !> offset(1) = 8 => summ of nodes of \f$1^\circ\f$ cell \n - !> second cell \n - !> offset(2) = 13 => summ of nodes of \f$1^\circ\f$ and \f$2^\circ\f$ cells \n - !> The value of every cell-offset can be calculated by the following equation: \f$offset_c=\sum\limits_{i=1}^{c}{nvertex_i}\f$ - !> where \f$offset_c\f$ is the value of \f$c^{th}\f$ cell and \f$nvertex_i\f$ is the number of vertices of \f$i^{th}\f$ cell. - !> The function VTK_CON_XML does not calculate the connectivity and offset vectors: it writes the connectivity and offset - !> vectors conforming the VTK-XML standard, but does not calculate them. - !> The vector variable \em cell_type must conform the VTK-XML standard (see the file VTK-Standard at the - !> Kitware homepage) that is the same of the legacy standard. It contains the - !> \em type of each cells. For the above example this vector is: \n - !> first cell \n - !> cell_type(1) = 12 hexahedron type of \f$1^\circ\f$ cell \n - !> second cell \n - !> cell_type(2) = 14 pyramid type of \f$2^\circ\f$ cell \n - !> @return E_IO: integer(I4P) error flag - function VTK_CON_XML(NC,connect,offset,cell_type,idx,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC !< Number of cells. - integer(I4P), intent(IN):: connect(1:) !< Mesh connectivity. - integer(I4P), intent(IN):: offset(1:NC) !< Cell offset. - integer(I1P), intent(IN):: cell_type(1:) !< VTK cell type. - integer(I1P), intent(IN), optional:: idx !< Id offset to convert Fortran (first id 1) to C (first id 0) standards. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: cocp(:) !< Packed data. - character(1), allocatable:: coc64(:) !< Data encoded in base64. - integer(I1P):: incr !< Actual id offset increment. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - integer(I8P):: Ncocp !< Dimension of cocp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - incr = 0_I1P - if (present(idx)) then - incr = idx - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - '' - write(unit=vtk(rf)%u,fmt=FI4P, iostat=E_IO)(connect(n1)+incr,n1=1,offset(NC)) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt=FI4P, iostat=E_IO)(offset(n1),n1=1,NC) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - if (lbound(cell_type,dim=1)==ubound(cell_type,dim=1)) then - write(unit=vtk(rf)%u,fmt=FI1P, iostat=E_IO)(cell_type(1),n1=1,NC) - else - write(unit=vtk(rf)%u,fmt=FI1P, iostat=E_IO)(cell_type(n1),n1=1,NC) - endif - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = offset(NC)*BYI4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',offset(NC) - write(unit=vtk(rf)%ua,iostat=E_IO)(connect(n1)+incr,n1=1,offset(NC)) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC*BYI4P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',NC - write(unit=vtk(rf)%ua,iostat=E_IO)(offset(n1),n1=1,NC) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC*BYI1P) - write(unit=vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',NC - if (lbound(cell_type,dim=1)==ubound(cell_type,dim=1)) then - write(unit=vtk(rf)%ua,iostat=E_IO)(cell_type(1),n1=1,NC) - else - write(unit=vtk(rf)%ua,iostat=E_IO)(cell_type(n1),n1=1,NC) - endif - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - case(binary) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - ''//end_rec - Ncocp=size(transfer([int(offset(NC)*BYI4P,I4P),connect],cocp),kind=I8P) - if (allocated(cocp)) deallocate(cocp) ; allocate(cocp(1:Ncocp)) - cocp = transfer([int(offset(NC)*BYI4P,I4P),connect],cocp) - call b64_encode(nB=int(BYI1P,I4P),n=cocp,code=coc64) - deallocate(cocp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(coc64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - Ncocp=size(transfer([int(NC*BYI4P,I4P),offset],cocp),kind=I8P) ; if (allocated(cocp)) deallocate(cocp) ; allocate(cocp(1:Ncocp)) - cocp = transfer([int(NC*BYI4P,I4P),offset],cocp) - call b64_encode(nB=int(BYI1P,I4P),n=cocp,code=coc64) - deallocate(cocp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(coc64)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - if (lbound(cell_type,dim=1)==ubound(cell_type,dim=1)) then - call pack_data(a1=[int(NC*BYI1P,I4P)],a2=[(cell_type(1),n1=1,NC)],packed=cocp) - else - call pack_data(a1=[int(NC*BYI1P,I4P)],a2=cell_type,packed=cocp) - endif - call b64_encode(nB=int(BYI1P,I4P),n=cocp,code=coc64) ; deallocate(cocp) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(coc64)//end_rec ; deallocate(coc64) - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_CON_XML - - !> Function that \b must be called before saving the data related to geometric mesh, this function initializes the - !> saving of data variables indicating the \em type (node or cell centered) of variables that will be saved. - !> @note A single file can contain both cell and node centered variables. In this case the VTK_DAT_XML function must be - !> called two times, before saving cell-centered variables and before saving node-centered variables. - !> Examples of usage are: \n - !> \b Opening node piece: \n - !> @code ... - !> E_IO=VTK_DAT_XML('node','OPEN') - !> ... @endcode - !> \b Closing node piece: \n - !> @code ... - !> E_IO=VTK_DAT_XML('node','CLOSE') - !> ... @endcode - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_DAT_XML(var_location,var_block_action,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: var_location !< Location of saving variables: CELL or NODE centered. - character(*), intent(IN):: var_block_action !< Variables block action: OPEN or CLOSE block. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - select case(trim(Upper_Case(var_location))) - case('CELL') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - case('NODE') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - endselect - case(raw,binary,bin_app) - select case(trim(Upper_Case(var_location))) - case('CELL') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - case('NODE') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - endselect - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_DAT_XML - - !> @ingroup Lib_VTK_IOPrivateProcedure - !> @{ - - !> Function for saving field of scalar variable (R8P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_R8(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYR8P,I4P)],a2=var,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_R8 - - !> Function for saving field of scalar variable (R8P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_R8(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)', iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)', iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYR8P,I4P)],a2=reshape(var,[NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_R8 - - !> Function for saving field of scalar variable (R4P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_R4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)', iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)', iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYR4P,I4P)],a2=var,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_R4 - - !> Function for saving field of scalar variable (R4P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_R4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)', iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)', iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYR4P,I4P)],a2=reshape(var,[NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_R4 - - !> Function for saving field of scalar variable (I8P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_I8(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)',iostat=E_IO)'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI8P,I4P)],a2=var,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_I8 - - !> Function for saving field of scalar variable (I8P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_I8(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI8P,I4P)],a2=reshape(var,[NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_I8 - - !> Function for saving field of scalar variable (I4P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_I4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - Nvarp=size(transfer([int(NC_NN*BYI4P,I4P),var],varp),kind=I8P) ; if (allocated(varp)) deallocate(varp) ; allocate(varp(1:Nvarp)) - varp = transfer([int(NC_NN*BYI4P,I4P),var],varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_I4 - - !> Function for saving field of scalar variable (I4P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_I4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - Nvarp=size(transfer([int(NC_NN*BYI4P,I4P),reshape(var,[NC_NN])],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(NC_NN*BYI4P,I4P),reshape(var,[NC_NN])],varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_I4 - - !> Function for saving field of scalar variable (I2P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_I2(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI2P,I4P)],a2=var,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_I2 - - !> Function for saving field of scalar variable (I2P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_I2(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI2P,I4P)],a2=reshape(var,[NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_I2 - - !> Function for saving field of scalar variable (I1P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_1DA_I1(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: var(1:) !< Variable to be saved [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),(' '//str(n=var(n1)),n1=1,NC_NN) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI1P,I4P)],a2=var,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_1DA_I1 - - !> Function for saving field of scalar variable (I1P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_SCAL_3DA_I1(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: var(1:,1:,1:) !< Variable to be saved [1:Nx,1:ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - write(vtk(rf)%u,'('//trim(str(.true.,NC_NN+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (((' '//str(n=var(nx,ny,nz)),nx=1,size(var,dim=1)),ny=1,size(var,dim=2)),nz=1,size(var,dim=3)) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(NC_NN*BYI1P,I4P)],a2=reshape(var,[NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_SCAL_3DA_I1 - - !> Function for saving field of vectorial variable (R8P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_R8(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - real(R8P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - real(R8P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R8P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - call pack_data(a1=[int(3*NC_NN*BYR8P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_R8 - - !> Function for saving field of vectorial variable (R8P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_R8(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - real(R8P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - real(R8P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R8P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - call pack_data(a1=[int(3*NC_NN*BYR8P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_R8 - - !> Function for saving field of vectorial variable (R4P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_R4(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - real(R4P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - real(R4P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R4P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - call pack_data(a1=[int(3*NC_NN*BYR4P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_R4 - - !> Function for saving field of vectorial variable (R4P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_R4(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - real(R4P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - real(R4P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - real(R4P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - call pack_data(a1=[int(3*NC_NN*BYR4P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_R4 - - !> Function for saving field of vectorial variable (I8P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_I8(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - integer(I8P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - integer(I8P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I8P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(3*NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - call pack_data(a1=[int(3*NC_NN*BYI8P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_I8 - - !> Function for saving field of vectorial variable (I8P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_I8(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - integer(I8P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - integer(I8P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I8P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(3*NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - call pack_data(a1=[int(3*NC_NN*BYI8P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_I8 - - !> Function for saving field of vectorial variable (I4P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_I4(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - integer(I4P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - integer(I4P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - Nvarp=size(transfer([int(3*NC_NN*BYI4P,I4P),var],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(3*NC_NN*BYI4P,I4P),var],varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_I4 - - !> Function for saving field of vectorial variable (I4P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_I4(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - Nvarp=size(transfer([int(3*NC_NN*BYI4P,I4P),var],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(3*NC_NN*BYI4P,I4P),var],varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_I4 - - !> Function for saving field of vectorial variable (I2P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_I2(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - integer(I2P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - integer(I2P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I2P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - call pack_data(a1=[int(3*NC_NN*BYI2P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_I2 - - !> Function for saving field of vectorial variable (I2P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_I2(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - integer(I2P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - integer(I2P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I2P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - call pack_data(a1=[int(3*NC_NN*BYI2P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_I2 - - !> Function for saving field of vectorial variable (I1P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_1DA_I1(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: varX(1:) !< X component [1:NC_NN]. - integer(I1P), intent(IN):: varY(1:) !< Y component [1:NC_NN]. - integer(I1P), intent(IN):: varZ(1:) !< Z component [1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n1=1,NC_NN - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//str(n=varX(n1))//' '//str(n=varY(n1))//' '//str(n=varZ(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - vtk(rf)%N_Byte = 3*NC_NN*BYI1P - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - do n1=1,NC_NN - var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(n1),varY(n1),varZ(n1)] - enddo - call pack_data(a1=[int(3*NC_NN*BYI1P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_1DA_I1 - - !> Function for saving field of vectorial variable (I1P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_VECT_3DA_I1(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: varX(1:,1:,1:) !< X component [1:Nx,1:Ny,1:Nz]. - integer(I1P), intent(IN):: varY(1:,1:,1:) !< Y component [1:Nx,1:Ny,1:Nz]. - integer(I1P), intent(IN):: varZ(1:,1:,1:) !< Z component [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: var(:) !< X, Y, Z component. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//& - str(n=varX(nx,ny,nz))//' '//str(n=varY(nx,ny,nz))//' '//str(n=varZ(nx,ny,nz)) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer=repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - vtk(rf)%N_Byte = 3*NC_NN*BYI1P - call vtk(rf)%byte_update(N_Byte = 3*NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',3*NC_NN - write(vtk(rf)%ua,iostat=E_IO)(((varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz),& - nx=1,size(varX,dim=1)),ny=1,size(varX,dim=2)),nz=1,size(varX,dim=3)) - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - allocate(var(1:3*NC_NN)) - n1 = 0_I4P - do nz=1,size(varX,dim=3) ; do ny=1,size(varX,dim=2) ; do nx=1,size(varX,dim=1) - n1 = n1 + 1_I4P ; var(1+(n1-1)*3:1+(n1-1)*3+2)=[varX(nx,ny,nz),varY(nx,ny,nz),varZ(nx,ny,nz)] - enddo ; enddo ; enddo - call pack_data(a1=[int(3*NC_NN*BYI1P,I4P)],a2=var,packed=varp) ; deallocate(var) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_VECT_3DA_I1 - - !> Function for saving field of list variable (R8P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_R8(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYR8P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_R8 - - !> Function for saving field of list variable (R8P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_R8(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYR8P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R8',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYR8P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_R8 - - !> Function for saving field of list variable (R4P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_R4(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYR4P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_R4 - - !> Function for saving field of list variable (R4P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_R4(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYR4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'R4',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYR4P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_R4 - - !> Function for saving field of list variable (I8P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_I8(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(N_COL*NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI8P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_I8 - - !> Function for saving field of list variable (I8P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_I8(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I8P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = int(N_COL*NC_NN*BYI8P,I4P)) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I8',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI8P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_I8 - - !> Function for saving field of list variable (I4P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_I4(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - Nvarp=size(transfer([int(N_COL*NC_NN*BYI4P,I4P),reshape(var,[N_COL*NC_NN])],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(N_COL*NC_NN*BYI4P,I4P),reshape(var,[N_COL*NC_NN])],varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_I4 - - !> Function for saving field of list variable (I4P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_I4(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - integer(I8P):: Nvarp !< Dimension of varp, packed data. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI4P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I4',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - Nvarp=size(transfer([int(N_COL*NC_NN*BYI4P,I4P),reshape(var,[N_COL*NC_NN])],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(N_COL*NC_NN*BYI4P,I4P),reshape(var,[N_COL*NC_NN])],varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_I4 - - !> Function for saving field of list variable (I2P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_I2(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI2P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_I2 - - !> Function for saving field of list variable (I2P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_I2(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I2P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI2P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I2',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI2P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_I2 - - !> Function for saving field of list variable (I1P, 1D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_1DA_I1(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: var(1:,1:) !< Components [1:N_COL,1:NC_NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do n2=1,NC_NN - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,n2)),n1=1,N_COL) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI1P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_1DA_I1 - - !> Function for saving field of list variable (I1P, 3D array). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_XML_LIST_3DA_I1(NC_NN,N_COL,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes. - integer(I4P), intent(IN):: N_COL !< Number of columns. - character(*), intent(IN):: varname !< Variable name. - integer(I1P), intent(IN):: var(1:,1:,1:,1:) !< Components [1:N_COL,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I4P):: nx,ny,nz,n1 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,'(A)',iostat=E_IO)trim(s_buffer) - do nz=1,size(var,dim=4) ; do ny=1,size(var,dim=3) ; do nx=1,size(var,dim=2) - write(vtk(rf)%u,'('//trim(str(.true.,N_COL+1))//'A)',iostat=E_IO)repeat(' ',vtk(rf)%indent),& - (' '//str(n=var(n1,nx,ny,nz)),n1=1,N_COL) - enddo ; enddo ; enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case(raw,bin_app) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call vtk(rf)%byte_update(N_Byte = N_COL*NC_NN*BYI1P) - write(vtk(rf)%ua,iostat=E_IO)vtk(rf)%N_Byte,'I1',N_COL*NC_NN - write(vtk(rf)%ua,iostat=E_IO)var - case(binary) - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - call pack_data(a1=[int(N_COL*NC_NN*BYI1P,I4P)],a2=reshape(var,[N_COL*NC_NN]),packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent+2)//tochar(var64)//end_rec ; deallocate(var64) - write(vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_XML_LIST_3DA_I1 - !> @} - - !> @brief Function for finalizing the VTK-XML file. - !> @note An example of usage is: \n - !> @code ... - !> E_IO = VTK_END_XML() - !> ... @endcode - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_END_XML(cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(INOUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(2):: var_type !< Varable type = R8,R4,I8,I4,I2,I1. - real(R8P), allocatable:: v_R8(:) !< R8 vector for IO in AppendData. - real(R4P), allocatable:: v_R4(:) !< R4 vector for IO in AppendData. - integer(I8P), allocatable:: v_I8(:) !< I8 vector for IO in AppendData. - integer(I4P), allocatable:: v_I4(:) !< I4 vector for IO in AppendData. - integer(I2P), allocatable:: v_I2(:) !< I2 vector for IO in AppendData. - integer(I1P), allocatable:: v_I1(:) !< I1 vector for IO in AppendData. - integer(I1P), allocatable:: varp(:) !< Packed data. - character(1), allocatable:: var64(:) !< Variable encoded in base64. - integer(I4P):: rf !< Real file index. - integer(I8P):: Nvarp !< Dimension of varp, packed data. -#ifdef HUGE - integer(I8P):: N_v !< Vector dimension. - integer(I8P):: n1 !< Counter. -#else - integer(I4P):: N_v !< Vector dimension. - integer(I4P):: n1 !< Counter. -#endif - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'' - case(raw,bin_app) - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit =vtk(rf)%u, iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - if (vtk(rf)%f==raw) then - write(unit =vtk(rf)%u, iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - else - write(unit =vtk(rf)%u, iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - endif - write(unit =vtk(rf)%u, iostat=E_IO)'_' - endfile(unit=vtk(rf)%ua,iostat=E_IO) - rewind(unit =vtk(rf)%ua,iostat=E_IO) - do - read(unit=vtk(rf)%ua,iostat=E_IO,end=100)vtk(rf)%N_Byte,var_type,N_v - select case(var_type) - case('R8') - allocate(v_R8(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_R8(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_R8(n1),n1=1,N_v) - else - call pack_data(a1=[int(vtk(rf)%N_Byte,I4P)],a2=v_R8,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_R8) - case('R4') - allocate(v_R4(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_R4(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_R4(n1),n1=1,N_v) - else - call pack_data(a1=[int(vtk(rf)%N_Byte,I4P)],a2=v_R4,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_R4) - case('I8') - allocate(v_I8(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_I8(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_I8(n1),n1=1,N_v) - else - call pack_data(a1=[int(vtk(rf)%N_Byte,I4P)],a2=v_I8,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_I8) - case('I4') - allocate(v_I4(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_I4(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_I4(n1),n1=1,N_v) - else - Nvarp=size(transfer([int(vtk(rf)%N_Byte,I4P),v_I4],varp),kind=I8P) - if (allocated(varp)) deallocate(varp); allocate(varp(1:Nvarp)) - varp = transfer([int(vtk(rf)%N_Byte,I4P),v_I4],varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_I4) - case('I2') - allocate(v_I2(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_I2(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_I2(n1),n1=1,N_v) - else - call pack_data(a1=[int(vtk(rf)%N_Byte,I4P)],a2=v_I2,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_I2) - case('I1') - allocate(v_I1(1:N_v)) - read(unit =vtk(rf)%ua,iostat=E_IO)(v_I1(n1),n1=1,N_v) - if (vtk(rf)%f==raw) then - write(unit=vtk(rf)%u,iostat=E_IO)int(vtk(rf)%N_Byte,I4P),(v_I1(n1),n1=1,N_v) - else - call pack_data(a1=[int(vtk(rf)%N_Byte,I4P)],a2=v_I1,packed=varp) - call b64_encode(nB=int(BYI1P,I4P),n=varp,code=var64) ; deallocate(varp) - write(unit=vtk(rf)%u,iostat=E_IO)tochar(var64) ; deallocate(var64) - endif - deallocate(v_I1) - case default - E_IO = 1 - write (stderr,'(A)')' bad var_type = '//var_type - write (stderr,'(A)')' N_Byte = '//trim(str(n=vtk(rf)%N_Byte))//' N_v = '//trim(str(n=N_v)) - return - endselect - enddo - 100 continue - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)''//end_rec - close(unit=vtk(rf)%ua,iostat=E_IO) - case(binary) - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,iostat=E_IO)repeat(' ',vtk(rf)%indent)//''//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)''//end_rec - endselect - close(unit=vtk(rf)%u,iostat=E_IO) - call vtk_update(act='remove',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_END_XML - - !> The VTK_VTM_XML function is used for initializing a VTM (VTK Multiblocks) XML file that is a wrapper to a set of VTK-XML files. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTM_INI_XML(filename) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: filename !< File name of output VTM file. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - if (.not.ir_initialized) call IR_Init - if (endian==endianL) then - s_buffer='' - else - s_buffer='' - endif - open(unit=Get_Unit(vtm%u),file=trim(filename),form='FORMATTED',access='SEQUENTIAL',action='WRITE',status='REPLACE',iostat=E_IO) - write(unit=vtm%u,fmt='(A)',iostat=E_IO)'' - write(unit=vtm%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtm%indent = 2 - write(unit=vtm%u,fmt='(A)',iostat=E_IO)repeat(' ',vtm%indent)//'' ; vtm%indent = vtm%indent + 2 - vtm%blk = -1 - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTM_INI_XML - - !> The VTM_BLK_XML function is used for opening or closing a block level of a VTM file. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTM_BLK_XML(block_action) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: block_action !< Block action: OPEN or CLOSE block. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - select case(trim(Upper_Case(block_action))) - case('OPEN') - vtm%blk = vtm%blk + 1 - write(unit=vtm%u,fmt='(A)',iostat=E_IO)repeat(' ',vtm%indent)//'' - vtm%indent = vtm%indent + 2 - case('CLOSE') - vtm%indent = vtm%indent - 2 ; write(unit=vtm%u,fmt='(A)',iostat=E_IO)repeat(' ',vtm%indent)//'' - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTM_BLK_XML - - !> The VTM_WRF_XML function is used for saving the list of VTK-XML wrapped files by the actual block of the mutliblock VTM file. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTM_WRF_XML(flist) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: flist(:) !< List of VTK-XML wrapped files. - integer(I4P):: E_IO !< Input/Output inquiring flag: 0 if IO is done, > 0 if IO is not done. - integer(I4P):: f !< File counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - do f=1,size(flist) - write(unit=vtm%u,fmt='(A)',iostat=E_IO)repeat(' ',vtm%indent)//'' - enddo - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTM_WRF_XML - - !> Function for finalizing open file, it has not inputs, @libvtk manages the file unit without the - !> user's action. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTM_END_XML() result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - vtm%indent = vtm%indent - 2 - write(unit=vtm%u,fmt='(A)',iostat=E_IO)repeat(' ',vtm%indent)//'' - write(unit=vtm%u,fmt='(A)',iostat=E_IO)'' - close(unit=vtm%u) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTM_END_XML - - !> @brief Function for initializing parallel (partitioned) VTK-XML file. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function PVTK_INI_XML(filename,mesh_topology,tp,cf,nx1,nx2,ny1,ny2,nz1,nz2) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: filename !< File name. - character(*), intent(IN):: mesh_topology !< Mesh topology. - character(*), intent(IN):: tp !< Type of geometry representation (Float32, Float64, ecc). - integer(I4P), intent(OUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P), intent(IN), optional:: nx1 !< Initial node of x axis. - integer(I4P), intent(IN), optional:: nx2 !< Final node of x axis. - integer(I4P), intent(IN), optional:: ny1 !< Initial node of y axis. - integer(I4P), intent(IN), optional:: ny2 !< Final node of y axis. - integer(I4P), intent(IN), optional:: nz1 !< Initial node of z axis. - integer(I4P), intent(IN), optional:: nz2 !< Final node of z axis. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - if (.not.ir_initialized) call IR_Init - call vtk_update(act='add',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - vtk(rf)%topology = trim(mesh_topology) - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),& - form='FORMATTED',access='SEQUENTIAL',action='WRITE',status='REPLACE',iostat=E_IO) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'' - if (endian==endianL) then - s_buffer = '' - else - s_buffer = '' - endif - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = 2 - select case(trim(vtk(rf)%topology)) - case('PRectilinearGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' WholeExtent="'//& - trim(str(n=nx1))//' '//trim(str(n=nx2))//' '// & - trim(str(n=ny1))//' '//trim(str(n=ny2))//' '// & - trim(str(n=nz1))//' '//trim(str(n=nz2))//'" GhostLevel="#">' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case('PStructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' WholeExtent="'//& - trim(str(n=nx1))//' '//trim(str(n=nx2))//' '// & - trim(str(n=ny1))//' '//trim(str(n=ny2))//' '// & - trim(str(n=nz1))//' '//trim(str(n=nz2))//'" GhostLevel="#">' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - case('PUnstructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'<'//trim(vtk(rf)%topology)//' GhostLevel="0">' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) ; vtk(rf)%indent = vtk(rf)%indent + 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction PVTK_INI_XML - - !> Function for saving piece geometry source for parallel (partitioned) VTK-XML file. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function PVTK_GEO_XML(source,cf,nx1,nx2,ny1,ny2,nz1,nz2) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: source !< Source file name containing the piece data. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P), intent(IN), optional:: nx1 !< Initial node of x axis. - integer(I4P), intent(IN), optional:: nx2 !< Final node of x axis. - integer(I4P), intent(IN), optional:: ny1 !< Initial node of y axis. - integer(I4P), intent(IN), optional:: ny2 !< Final node of y axis. - integer(I4P), intent(IN), optional:: nz1 !< Initial node of z axis. - integer(I4P), intent(IN), optional:: nz2 !< Final node of z axis. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case (vtk(rf)%topology) - case('PRectilinearGrid','PStructuredGrid') - s_buffer = repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - case('PUnstructuredGrid') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction PVTK_GEO_XML - - !> Function that \b must be called before saving the data related to geometric mesh, this function initializes the - !> saving of data variables indicating the \em type (node or cell centered) of variables that will be saved. - !> @ingroup Lib_VTK_IOPublicProcedure - function PVTK_DAT_XML(var_location,var_block_action,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: var_location !< Location of saving variables: CELL or NODE centered. - character(*), intent(IN):: var_block_action !< Variables block action: OPEN or CLOSE block. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(trim(Upper_Case(var_location))) - case('CELL') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - case('NODE') - select case(trim(Upper_Case(var_block_action))) - case('OPEN') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' ; vtk(rf)%indent = vtk(rf)%indent + 2 - case('CLOSE') - vtk(rf)%indent = vtk(rf)%indent - 2 ; write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - endselect - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction PVTK_DAT_XML - - !> Function for saving variable associated to nodes or cells geometry. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function PVTK_VAR_XML(varname,tp,cf,Nc) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: varname !< Variable name. - character(*), intent(IN):: tp !< Type of data representation (Float32, Float64, ecc). - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P), intent(IN), optional:: Nc !< Number of components of variable. - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - if (present(Nc)) then - s_buffer = repeat(' ',vtk(rf)%indent)//'' - else - s_buffer = repeat(' ',vtk(rf)%indent)//'' - endif - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(s_buffer) - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction PVTK_VAR_XML - - !> @brief Function for finalizing the parallel (partitioned) VTK-XML file. - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function PVTK_END_XML(cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(INOUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - vtk(rf)%indent = vtk(rf)%indent - 2 - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)repeat(' ',vtk(rf)%indent)//'' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'' - close(unit=vtk(rf)%u,iostat=E_IO) - call vtk_update(act='remove',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction PVTK_END_XML - - !> @brief Function for initializing VTK-legacy file. - !> @remark This function must be the first to be called. - !> @note An example of usage is: \n - !> @code ... - !> E_IO=VTK_INI('Binary','example.vtk','VTK legacy file','UNSTRUCTURED_GRID') - !> ... @endcode - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_INI(output_format,filename,title,mesh_topology,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: output_format !< Output format: ASCII or RAW. - character(*), intent(IN):: filename !< Name of file. - character(*), intent(IN):: title !< Title. - character(*), intent(IN):: mesh_topology !< Mesh topology. - integer(I4P), intent(OUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - if (.not.ir_initialized) call IR_Init - call vtk_update(act='add',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - vtk(rf)%topology = trim(mesh_topology) - select case(trim(Upper_Case(output_format))) - case('ASCII') - vtk(rf)%f = ascii - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),form='FORMATTED',& - access='SEQUENTIAL',action='WRITE',status='REPLACE',iostat=E_IO) - ! writing header of file - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'# vtk DataFile Version 3.0' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(title) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)trim(Upper_Case(output_format)) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'DATASET '//trim(vtk(rf)%topology) - case('RAW') - vtk(rf)%f = raw - open(unit=Get_Unit(vtk(rf)%u),file=trim(filename),& - form='UNFORMATTED',access='STREAM',action='WRITE',status='REPLACE',iostat=E_IO) - ! writing header of file - write(unit=vtk(rf)%u,iostat=E_IO)'# vtk DataFile Version 3.0'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)trim(title)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)trim(Upper_Case(output_format))//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)'DATASET '//trim(vtk(rf)%topology)//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_INI - - !> @ingroup Lib_VTK_IOPrivateProcedure - !> @{ - !> Function for saving mesh with \b STRUCTURED_POINTS topology (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRP_R8(Nx,Ny,Nz,X0,Y0,Z0,Dx,Dy,Dz,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - real(R8P), intent(IN):: X0 !< X coordinate of origin. - real(R8P), intent(IN):: Y0 !< Y coordinate of origin. - real(R8P), intent(IN):: Z0 !< Z coordinate of origin. - real(R8P), intent(IN):: Dx !< Space step in x direction. - real(R8P), intent(IN):: Dy !< Space step in y direction. - real(R8P), intent(IN):: Dz !< Space step in z direction. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'ORIGIN '//trim(str(n=X0))//' '//trim(str(n=Y0))//' '//trim(str(n=Z0)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'SPACING '//trim(str(n=Dx))//' '//trim(str(n=Dy))//' '//trim(str(n=Dz)) - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'ORIGIN '//trim(str(n=X0))//' '//trim(str(n=Y0))//' '//trim(str(n=Z0))//end_rec - write(vtk(rf)%u,iostat=E_IO)'SPACING '//trim(str(n=Dx))//' '//trim(str(n=Dy))//' '//trim(str(n=Dz))//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRP_R8 - - !> Function for saving mesh with \b STRUCTURED_POINTS topology (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRP_R4(Nx,Ny,Nz,X0,Y0,Z0,Dx,Dy,Dz,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - real(R4P), intent(IN):: X0 !< X coordinate of origin. - real(R4P), intent(IN):: Y0 !< Y coordinate of origin. - real(R4P), intent(IN):: Z0 !< Z coordinate of origin. - real(R4P), intent(IN):: Dx !< Space step in x direction. - real(R4P), intent(IN):: Dy !< Space step in y direction. - real(R4P), intent(IN):: Dz !< Space step in z direction. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'ORIGIN '//trim(str(n=X0))//' '//trim(str(n=Y0))//' '//trim(str(n=Z0)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'SPACING '//trim(str(n=Dx))//' '//trim(str(n=Dy))//' '//trim(str(n=Dz)) - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'ORIGIN '//trim(str(n=X0))//' '//trim(str(n=Y0))//' '//trim(str(n=Z0))//end_rec - write(vtk(rf)%u,iostat=E_IO)'SPACING '//trim(str(n=Dx))//' '//trim(str(n=Dy))//' '//trim(str(n=Dz))//end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRP_R4 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R8P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_1DA_R8(Nx,Ny,Nz,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: X(1:) !< X coordinates [1:NN]. - real(R8P), intent(IN):: Y(1:) !< Y coordinates [1:NN]. - real(R8P), intent(IN):: Z(1:) !< Z coordinates [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double' - do n1=1,NN - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_1DA_R8 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R8P, 1D arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_1DAP_R8(Nx,Ny,Nz,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: XYZ(1:,1:) !< X, Y and Z coordinates [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double' - do n1=1,NN - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)XYZ - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_1DAP_R8 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R8P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_3DA_R8(Nx,Ny,Nz,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: X(1:,1:,1:) !< X coordinates [1:Nx,1:Ny,1:Nz]. - real(R8P), intent(IN):: Y(1:,1:,1:) !< Y coordinates [1:Nx,1:Ny,1:Nz]. - real(R8P), intent(IN):: Z(1:,1:,1:) !< Z coordinates [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2,n3 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double' - do n3=1,Nz - do n2=1,Ny - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1,n2,n3))//' '//str(n=Y(n1,n2,n3))//' '//str(n=Z(n1,n2,n3)) - enddo - enddo - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)(((X(n1,n2,n3),Y(n1,n2,n3),Z(n1,n2,n3),n1=1,Nx),n2=1,Ny),n3=1,Nz) - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_3DA_R8 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R8P, 3D arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_3DAP_R8(Nx,Ny,Nz,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R8P), intent(IN):: XYZ(1:,1:,1:,1:) !< X, Y and Z coordinates [1:3,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2,n3 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double' - do n3=1,Nz - do n2=1,Ny - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=XYZ(1,n1,n2,n3))//' '//str(n=XYZ(2,n1,n2,n3))//' '//str(n=XYZ(3,n1,n2,n3)) - enddo - enddo - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)XYZ - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_3DAP_R8 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R4P, 1D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_1DA_R4(Nx,Ny,Nz,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: X(1:) !< X coordinates [1:NN]. - real(R4P), intent(IN):: Y(1:) !< Y coordinates [1:NN]. - real(R4P), intent(IN):: Z(1:) !< Z coordinates [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float' - do n1=1,NN - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_1DA_R4 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R4P, 1D arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_1DAP_R4(Nx,Ny,Nz,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: XYZ(1:,1:) !< X, Y and Z coordinates [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float' - do n1=1,NN - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)XYZ - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_1DAP_R4 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R4P, 3D arrays). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_3DA_R4(Nx,Ny,Nz,NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: X(1:,1:,1:) !< X coordinates [1:Nx,1:Ny,1:Nz]. - real(R4P), intent(IN):: Y(1:,1:,1:) !< Y coordinates [1:Nx,1:Ny,1:Nz]. - real(R4P), intent(IN):: Z(1:,1:,1:) !< Z coordinates [1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2,n3 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float' - do n3=1,Nz - do n2=1,Ny - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1,n2,n3))//' '//str(n=Y(n1,n2,n3))//' '//str(n=Z(n1,n2,n3)) - enddo - enddo - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)(((X(n1,n2,n3),Y(n1,n2,n3),Z(n1,n2,n3),n1=1,Nx),n2=1,Ny),n3=1,Nz) - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_3DA_R4 - - !> Function for saving mesh with \b STRUCTURED_GRID topology (R4P, 3D arrays, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_STRG_3DAP_R4(Nx,Ny,Nz,NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - integer(I4P), intent(IN):: NN !< Number of all nodes. - real(R4P), intent(IN):: XYZ(1:,1:,1:,1:) !< X, Y and Z coordinates [1:3,1:Nx,1:Ny,1:Nz]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2,n3 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float' - do n3=1,Nz - do n2=1,Ny - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=XYZ(1,n1,n2,n3))//' '//str(n=XYZ(2,n1,n2,n3))//' '//str(n=XYZ(3,n1,n2,n3)) - enddo - enddo - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'POINTS '//trim(str(.true.,NN))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)XYZ - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_STRG_3DAP_R4 - - !> Function for saving mesh with \b RECTILINEAR_GRID topology (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_RECT_R8(Nx,Ny,Nz,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - real(R8P), intent(IN):: X(1:Nx) !< X coordinates. - real(R8P), intent(IN):: Y(1:Ny) !< Y coordinates. - real(R8P), intent(IN):: Z(1:Nz) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'X_COORDINATES '//trim(str(.true.,Nx))//' double' - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)'Y_COORDINATES '//trim(str(.true.,Ny))//' double' - do n1=1,Ny - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=Y(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)'Z_COORDINATES '//trim(str(.true.,Nz))//' double' - do n1=1,Nz - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=Z(n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'X_COORDINATES '//trim(str(.true.,Nx))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)X - write(vtk(rf)%u,iostat=E_IO)end_rec - write(vtk(rf)%u,iostat=E_IO)'Y_COORDINATES '//trim(str(.true.,Ny))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)Y - write(vtk(rf)%u,iostat=E_IO)end_rec - write(vtk(rf)%u,iostat=E_IO)'Z_COORDINATES '//trim(str(.true.,Nz))//' double'//end_rec - write(vtk(rf)%u,iostat=E_IO)Z - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_RECT_R8 - - !> Function for saving mesh with \b RECTILINEAR_GRID topology (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_RECT_R4(Nx,Ny,Nz,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: Nx !< Number of nodes in x direction. - integer(I4P), intent(IN):: Ny !< Number of nodes in y direction. - integer(I4P), intent(IN):: Nz !< Number of nodes in z direction. - real(R4P), intent(IN):: X(1:Nx) !< X coordinates. - real(R4P), intent(IN):: Y(1:Ny) !< Y coordinates. - real(R4P), intent(IN):: Z(1:Nz) !< Z coordinates. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(vtk(rf)%u,'(A)',iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz)) - write(vtk(rf)%u,'(A)',iostat=E_IO)'X_COORDINATES '//trim(str(.true.,Nx))//' float' - do n1=1,Nx - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=X(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)'Y_COORDINATES '//trim(str(.true.,Ny))//' float' - do n1=1,Ny - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=Y(n1)) - enddo - write(vtk(rf)%u,'(A)',iostat=E_IO)'Z_COORDINATES '//trim(str(.true.,Nz))//' float' - do n1=1,Nz - write(vtk(rf)%u,'(A)',iostat=E_IO)str(n=Z(n1)) - enddo - case(raw) - write(vtk(rf)%u,iostat=E_IO)'DIMENSIONS '//trim(str(.true.,Nx))//' '//trim(str(.true.,Ny))//' '//trim(str(.true.,Nz))//end_rec - write(vtk(rf)%u,iostat=E_IO)'X_COORDINATES '//trim(str(.true.,Nx))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)X - write(vtk(rf)%u,iostat=E_IO)end_rec - write(vtk(rf)%u,iostat=E_IO)'Y_COORDINATES '//trim(str(.true.,Ny))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)Y - write(vtk(rf)%u,iostat=E_IO)end_rec - write(vtk(rf)%u,iostat=E_IO)'Z_COORDINATES '//trim(str(.true.,Nz))//' float'//end_rec - write(vtk(rf)%u,iostat=E_IO)Z - write(vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_RECT_R4 - - !> Function for saving mesh with \b UNSTRUCTURED_GRID topology (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_UNST_R8(NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - real(R8P), intent(IN):: X(1:) !< X coordinates of all nodes [1:NN]. - real(R8P), intent(IN):: Y(1:) !< Y coordinates of all nodes [1:NN]. - real(R8P), intent(IN):: Z(1:) !< Z coordinates of all nodes [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'POINTS '//str(.true.,NN)//' double' - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'POINTS '//str(.true.,NN)//' double'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_UNST_R8 - - !> Function for saving mesh with \b UNSTRUCTURED_GRID topology (R8P, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_UNST_P_R8(NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< Number of nodes. - real(R8P), intent(IN):: XYZ(1:,1:) !< X, Y and Z coordinates of all nodes [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'POINTS '//str(.true.,NN)//' double' - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'POINTS '//str(.true.,NN)//' double'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)XYZ - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_UNST_P_R8 - - !> Function for saving mesh with \b UNSTRUCTURED_GRID topology (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_UNST_R4(NN,X,Y,Z,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< number of nodes. - real(R4P), intent(IN):: X(1:) !< X coordinates of all nodes [1:NN]. - real(R4P), intent(IN):: Y(1:) !< Y coordinates of all nodes [1:NN]. - real(R4P), intent(IN):: Z(1:) !< Z coordinates of all nodes [1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'POINTS '//str(.true.,NN)//' float' - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)str(n=X(n1))//' '//str(n=Y(n1))//' '//str(n=Z(n1)) - enddo - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'POINTS '//str(.true.,NN)//' float'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)(X(n1),Y(n1),Z(n1),n1=1,NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_UNST_R4 - - !> Function for saving mesh with \b UNSTRUCTURED_GRID topology (R4P, packed API). - !> @return E_IO: integer(I4P) error flag - function VTK_GEO_UNST_P_R4(NN,XYZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NN !< number of nodes. - real(R4P), intent(IN):: XYZ(1:,1:) !< X, Y and Z coordinates of all nodes [1:3,1:NN]. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'POINTS '//str(.true.,NN)//' float' - do n1=1,NN - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)str(n=XYZ(1,n1))//' '//str(n=XYZ(2,n1))//' '//str(n=XYZ(3,n1)) - enddo - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'POINTS '//str(.true.,NN)//' float'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)XYZ - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_GEO_UNST_P_R4 - !> @} - - !> Function that \b must be used when unstructured grid is used, it saves the connectivity of the unstructured gird. - !> @note The vector \b connect must follow the VTK-legacy standard. It is passed as \em assumed-shape array - !> because its dimensions is related to the mesh dimensions in a complex way. Its dimensions can be calculated by the following - !> equation: \f$dc = NC + \sum\limits_{i = 1}^{NC} {nvertex_i }\f$ - !> where \f$dc\f$ is connectivity vector dimension and \f$nvertex_i\f$ is the number of vertices of \f$i^{th}\f$ cell. The VTK- - !> legacy standard for the mesh connectivity is quite obscure at least at first sight. It is more simple analyzing an example. - !> Suppose we have a mesh composed by 2 cells, one hexahedron (8 vertices) and one pyramid with square basis (5 vertices) and - !> suppose that the basis of pyramid is constitute by a face of the hexahedron and so the two cells share 4 vertices. - !> The above equation !> gives \f$dc=2+8+5=15\f$. The connectivity vector for this mesh can be: \n - !> first cell \n - !> connect(1) = 8 number of vertices of \f$1^\circ\f$ cell \n - !> connect(2) = 0 identification flag of \f$1^\circ\f$ vertex of 1° cell \n - !> connect(3) = 1 identification flag of \f$2^\circ\f$ vertex of 1° cell \n - !> connect(4) = 2 identification flag of \f$3^\circ\f$ vertex of 1° cell \n - !> connect(5) = 3 identification flag of \f$4^\circ\f$ vertex of 1° cell \n - !> connect(6) = 4 identification flag of \f$5^\circ\f$ vertex of 1° cell \n - !> connect(7) = 5 identification flag of \f$6^\circ\f$ vertex of 1° cell \n - !> connect(8) = 6 identification flag of \f$7^\circ\f$ vertex of 1° cell \n - !> connect(9) = 7 identification flag of \f$8^\circ\f$ vertex of 1° cell \n - !> second cell \n - !> connect(10) = 5 number of vertices of \f$2^\circ \f$cell \n - !> connect(11) = 0 identification flag of \f$1^\circ\f$ vertex of 2° cell \n - !> connect(12) = 1 identification flag of \f$2^\circ\f$ vertex of 2° cell \n - !> connect(13) = 2 identification flag of \f$3^\circ\f$ vertex of 2° cell \n - !> connect(14) = 3 identification flag of \f$4^\circ\f$ vertex of 2° cell \n - !> connect(15) = 8 identification flag of \f$5^\circ\f$ vertex of 2° cell \n - !> Note that the first 4 identification flags of pyramid vertices as the same of the first 4 identification flags of - !> the hexahedron because the two cells share this face. It is also important to note that the identification flags start - !> form $0$ value: this is impose to the VTK standard. The function VTK_CON does not calculate the connectivity vector: it - !> writes the connectivity vector conforming the VTK standard, but does not calculate it. - !> The vector variable \em cell_type must conform the VTK-legacy standard (see the file VTK-Standard at the - !> Kitware homepage). It contains the - !> \em type of each cells. For the above example this vector is: \n - !> first cell \n - !> cell_type(1) = 12 hexahedron type of \f$1^\circ\f$ cell \n - !> second cell \n - !> cell_type(2) = 14 pyramid type of \f$2^\circ\f$ cell \n - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_CON(NC,connect,cell_type,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC !< Number of cells. - integer(I4P), intent(IN):: connect(:) !< Mesh connectivity. - integer(I4P), intent(IN):: cell_type(1:NC) !< VTK cell type. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: ncon !< Dimension of connectivity vector. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - ncon = size(connect,1) - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A,2'//FI4P//')',iostat=E_IO)'CELLS ',NC,ncon - write(unit=vtk(rf)%u,fmt=FI4P, iostat=E_IO)connect - write(unit=vtk(rf)%u,fmt='(A,'//FI4P//')', iostat=E_IO)'CELL_TYPES ',NC - write(unit=vtk(rf)%u,fmt=FI4P, iostat=E_IO)cell_type - case(raw) - write(s_buffer, fmt='(A,2'//FI4P//')',iostat=E_IO)'CELLS ',NC,ncon - write(unit=vtk(rf)%u, iostat=E_IO)trim(s_buffer)//end_rec - write(unit=vtk(rf)%u, iostat=E_IO)connect - write(unit=vtk(rf)%u, iostat=E_IO)end_rec - write(s_buffer, fmt='(A,'//FI4P//')', iostat=E_IO)'CELL_TYPES ',NC - write(unit=vtk(rf)%u, iostat=E_IO)trim(s_buffer)//end_rec - write(unit=vtk(rf)%u, iostat=E_IO)cell_type - write(unit=vtk(rf)%u, iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_CON - - !> Function that \b must be called before saving the data related to geometric mesh, this function initializes the - !> saving of data variables indicating the \em type (node or cell centered) of variables that will be saved. - !> @note A single file can contain both cell and node centered variables. In this case the VTK_DAT function must be - !> called two times, before saving cell-centered variables and before saving node-centered variables. - !> Examples of usage are: \n - !> \b Node piece: \n - !> @code ... - !> E_IO=VTK_DAT(50,'node') - !> ... @endcode - !> \b Cell piece: \n - !> @code ... - !> E_IO=VTK_DAT(50,'cell') - !> ... @endcode - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_DAT(NC_NN,var_location,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of cells or nodes of field. - character(*), intent(IN):: var_location !< Location of saving variables: cell for cell-centered, node for node-centered. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - select case(trim(Upper_Case(var_location))) - case('CELL') - write(unit=vtk(rf)%u,fmt='(A,'//FI4P//')',iostat=E_IO)'CELL_DATA ',NC_NN - case('NODE') - write(unit=vtk(rf)%u,fmt='(A,'//FI4P//')',iostat=E_IO)'POINT_DATA ',NC_NN - endselect - case(raw) - select case(trim(Upper_Case(var_location))) - case('CELL') - write(s_buffer,fmt='(A,'//FI4P//')',iostat=E_IO)'CELL_DATA ',NC_NN - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - case('NODE') - write(s_buffer,fmt='(A,'//FI4P//')',iostat=E_IO)'POINT_DATA ',NC_NN - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - endselect - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_DAT - - !> @ingroup Lib_VTK_IOPrivateProcedure - !> @{ - !> Function for saving field of scalar variable (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_SCAL_R8(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: var(1:NC_NN) !< Variable to be saved. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'SCALARS '//trim(varname)//' double 1' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'LOOKUP_TABLE default' - write(unit=vtk(rf)%u,fmt=FR8P, iostat=E_IO)var - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'SCALARS '//trim(varname)//' double 1'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)'LOOKUP_TABLE default'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)var - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_SCAL_R8 - - !> Function for saving field of scalar variable (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_SCAL_R4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: var(1:NC_NN) !< Variable to be saved. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'SCALARS '//trim(varname)//' float 1' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'LOOKUP_TABLE default' - write(unit=vtk(rf)%u,fmt=FR4P, iostat=E_IO)var - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'SCALARS '//trim(varname)//' float 1'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)'LOOKUP_TABLE default'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)var - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_SCAL_R4 - - !> Function for saving field of scalar variable (I4P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_SCAL_I4(NC_NN,varname,var,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: var(1:NC_NN) !< Variable to be saved. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'SCALARS '//trim(varname)//' int 1' - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'LOOKUP_TABLE default' - write(unit=vtk(rf)%u,fmt=FI4P, iostat=E_IO)var - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'SCALARS '//trim(varname)//' int 1'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)'LOOKUP_TABLE default'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)var - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_SCAL_I4 - - !> Function for saving field of vectorial variable (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_VECT_R8(vec_type,NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: vec_type !< Vector type: vect = generic vector , norm = normal vector. - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: varX(1:NC_NN) !< X component of vector. - real(R8P), intent(IN):: varY(1:NC_NN) !< Y component of vector. - real(R8P), intent(IN):: varZ(1:NC_NN) !< Z component of vector. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - select case(Upper_Case(trim(vec_type))) - case('VECT') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'VECTORS '//trim(varname)//' double' - case('NORM') - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'NORMALS '//trim(varname)//' double' - endselect - write(unit=vtk(rf)%u,fmt='(3'//FR8P//')',iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(raw) - select case(Upper_Case(trim(vec_type))) - case('VECT') - write(unit=vtk(rf)%u,iostat=E_IO)'VECTORS '//trim(varname)//' double'//end_rec - case('NORM') - write(unit=vtk(rf)%u,iostat=E_IO)'NORMALS '//trim(varname)//' double'//end_rec - endselect - write(unit=vtk(rf)%u,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_VECT_R8 - - !> Function for saving field of vectorial variable (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_VECT_R4(vec_type,NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - character(*), intent(IN):: vec_type !< Vector type: vect = generic vector , norm = normal vector. - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: varX(1:NC_NN) !< X component of vector. - real(R4P), intent(IN):: varY(1:NC_NN) !< Y component of vector. - real(R4P), intent(IN):: varZ(1:NC_NN) !< Z component of vector. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - select case(Upper_Case(trim(vec_type))) - case('vect') - write(unit=vtk(rf)%u,fmt='(A)', iostat=E_IO)'VECTORS '//trim(varname)//' float' - case('norm') - write(unit=vtk(rf)%u,fmt='(A)', iostat=E_IO)'NORMALS '//trim(varname)//' float' - endselect - write(unit=vtk(rf)%u,fmt='(3'//FR4P//')',iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(raw) - select case(Upper_Case(trim(vec_type))) - case('vect') - write(unit=vtk(rf)%u,iostat=E_IO)'VECTORS '//trim(varname)//' float'//end_rec - case('norm') - write(unit=vtk(rf)%u,iostat=E_IO)'NORMALS '//trim(varname)//' float'//end_rec - endselect - write(unit=vtk(rf)%u,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_VECT_R4 - - !> Function for saving field of vectorial variable (I4P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_VECT_I4(NC_NN,varname,varX,varY,varZ,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - character(*), intent(IN):: varname !< Variable name. - integer(I4P), intent(IN):: varX(1:NC_NN) !< X component of vector. - integer(I4P), intent(IN):: varY(1:NC_NN) !< Y component of vector. - integer(I4P), intent(IN):: varZ(1:NC_NN) !< Z component of vector. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1 !< Counter. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A)',iostat=E_IO)'VECTORS '//trim(varname)//' int' - write(unit=vtk(rf)%u,fmt='(3'//FI4P//')',iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - case(raw) - write(unit=vtk(rf)%u,iostat=E_IO)'VECTORS '//trim(varname)//' int'//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)(varX(n1),varY(n1),varZ(n1),n1=1,NC_NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_VECT_I4 - - !> Function for saving texture variable (R8P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_TEXT_R8(NC_NN,dimm,varname,textCoo,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - integer(I4P), intent(IN):: dimm !< Texture dimensions. - character(*), intent(IN):: varname !< Variable name. - real(R8P), intent(IN):: textCoo(1:NC_NN,1:dimm) !< Texture. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A,1X,'//FI4P//',1X,A)',iostat=E_IO)'TEXTURE_COORDINATES '//trim(varname),dimm,' double' - write(s_buffer,fmt='(I1)',iostat=E_IO)dimm - s_buffer='('//trim(s_buffer)//FR4P//')' - write(unit=vtk(rf)%u,fmt=trim(s_buffer),iostat=E_IO)((textCoo(n1,n2),n2=1,dimm),n1=1,NC_NN) - case(raw) - write(s_buffer,fmt='(A,1X,'//FI4P//',1X,A)',iostat=E_IO)'TEXTURE_COORDINATES '//trim(varname),dimm,' double' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)((textCoo(n1,n2),n2=1,dimm),n1=1,NC_NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_TEXT_R8 - - !> Function for saving texture variable (R4P). - !> @return E_IO: integer(I4P) error flag - function VTK_VAR_TEXT_R4(NC_NN,dimm,varname,textCoo,cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - !! Function for saving texture variable (R4P). - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(IN):: NC_NN !< Number of nodes or cells. - integer(I4P), intent(IN):: dimm !< Texture dimensions. - character(*), intent(IN):: varname !< Variable name. - real(R4P), intent(IN):: textCoo(1:NC_NN,1:dimm) !< Texture. - integer(I4P), intent(IN), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - character(len=maxlen):: s_buffer !< Buffer string. - integer(I4P):: rf !< Real file index. - integer(I4P):: n1,n2 !< Counters. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - select case(vtk(rf)%f) - case(ascii) - write(unit=vtk(rf)%u,fmt='(A,1X,'//FI4P//',1X,A)',iostat=E_IO)'TEXTURE_COORDINATES '//trim(varname),dimm,' float' - write(s_buffer,fmt='(I1)',iostat=E_IO)dimm - s_buffer='('//trim(s_buffer)//FR4P//')' - write(unit=vtk(rf)%u,fmt=trim(s_buffer),iostat=E_IO)((textCoo(n1,n2),n2=1,dimm),n1=1,NC_NN) - case(raw) - write(s_buffer,fmt='(A,1X,'//FI4P//',1X,A)',iostat=E_IO)'TEXTURE_COORDINATES '//trim(varname),dimm,' float' - write(unit=vtk(rf)%u,iostat=E_IO)trim(s_buffer)//end_rec - write(unit=vtk(rf)%u,iostat=E_IO)((textCoo(n1,n2),n2=1,dimm),n1=1,NC_NN) - write(unit=vtk(rf)%u,iostat=E_IO)end_rec - endselect - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_VAR_TEXT_R4 - !> @} - - !>Function for finalizing open file, it has not inputs, @libvtk manages the file unit without the - !>user's action. - !> @note An example of usage is: \n - !> @code ... - !> E_IO=VTK_END() - !> ... @endcode - !> @return E_IO: integer(I4P) error flag - !> @ingroup Lib_VTK_IOPublicProcedure - function VTK_END(cf) result(E_IO) - !--------------------------------------------------------------------------------------------------------------------------------- - implicit none - integer(I4P), intent(INOUT), optional:: cf !< Current file index (for concurrent files IO). - integer(I4P):: E_IO !< Input/Output inquiring flag: $0$ if IO is done, $> 0$ if IO is not done. - integer(I4P):: rf !< Real file index. - !--------------------------------------------------------------------------------------------------------------------------------- - - !--------------------------------------------------------------------------------------------------------------------------------- - E_IO = -1_I4P - rf = f - if (present(cf)) then - rf = cf ; f = cf - endif - close(unit=vtk(rf)%u,iostat=E_IO) - call vtk_update(act='remove',cf=rf,Nvtk=Nvtk,vtk=vtk) - f = rf - if (present(cf)) cf = rf - return - !--------------------------------------------------------------------------------------------------------------------------------- - endfunction VTK_END -endmodule Lib_VTK_IO diff --git a/lib/MarcInclude/concom2016 b/lib/MarcInclude/concom2016 new file mode 100644 index 000000000..e26774bfc --- /dev/null +++ b/lib/MarcInclude/concom2016 @@ -0,0 +1,417 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: concom.cmn +! +! MSC.Marc include file +! +integer(pInt) & + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen , idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush, istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout, igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr +dimension :: ideva(60) +integer(pInt) num_concom +parameter(num_concom=245) +common/marc_concom/& + iacous, iasmbl, iautth, ibear, icompl, iconj, icreep, ideva, idyn, idynt,& + ielas, ielcma, ielect, iform, ifour, iharm, ihcps, iheat, iheatt, ihresp,& + ijoule, ilem, ilnmom, iloren, inc, incext, incsub, ipass, iplres, ipois,& + ipoist, irpflo, ismall, ismalt, isoil, ispect, ispnow, istore, iswep, ithcrp,& + itherm, iupblg, iupdat, jacflg, jel, jparks, largst, lfond, loadup, loaduq,& + lodcor, lovl, lsub, magnet, ncycle, newtnt, newton, noshr, linear, ivscpl,& + icrpim, iradrt, ipshft, itshr, iangin, iupmdr, iconjf, jincfl, jpermg, jhour,& + isolvr, jritz, jtable, jshell, jdoubl, jform, jcentr, imini, kautth, iautof,& + ibukty, iassum, icnstd, icnstt, kmakmas, imethvp, iradrte, iradrtp, iupdate, iupdatp,& + ncycnt, marmen, idynme, ihavca, ispf, kmini, imixex, largtt, kdoela, iautofg,& + ipshftp, idntrc, ipore, jtablm, jtablc, isnecma, itrnspo, imsdif, jtrnspo, mcnear,& + imech, imecht, ielcmat, ielectt, magnett, imsdift, noplas, jtabls, jactch, jtablth,& + kgmsto , jpzo, ifricsh, iremkin, iremfor, ishearp, jspf, machining, jlshell, icompsol,& + iupblgfo, jcondir, nstcrp, nactive, ipassref, nstspnt, ibeart, icheckmpc, noline, icuring,& + ishrink, ioffsflg, isetoff, ioffsetm,iharmt, inc_incdat, iautspc, ibrake, icbush , istream_input,& + iprsinp, ivlsinp, ifirst_time,ipin_m, jgnstr_glb, imarc_return,iqvcinp, nqvceid, istpnx, imicro1,& + iaxisymm, jbreakglue,iglstif, jfastasm,iwear, iwearcf, imixmeth, ielcmadyn, idinout,igena_meth,& + magf_meth, non_assumed, iredoboudry, ioffsz0,icomplt, mesh_dual, iactrp, mgnewton, iusedens,igsigd0,& + iaem, icosim, inodels, nlharm, iampini, iphasetr +! +! comments of variables: +! +! iacous Control flag for acoustic analysis. Input data. +! iacous=1 modal acoustic analysis. +! iacous=2 harmonic acoustic-structural analysis. +! iasmbl Control flag to indicate that operator matrix should be +! recalculated. +! iautth Control flag for AUTO THERM option. +! ibear Control flag for bearing analysis. Input data. +! icompl Control variable to indicate that a complex analysis is +! being performed. Either a Harmonic analysis with damping, +! or a harmonic electro-magnetic analysis. Input data. +! iconj Flag for EBE conjugate gradient solver (=solver 1, retired) +! Also used for VKI iterative solver. +! icreep Control flag for creep analysis. Input data. +! ideva(60) - debug print out flag +! 1 print element stiffness matrices, mass matrix +! 2 output matrices used in tying +! 3 force the solution of a nonpositive definite matrix +! 4 print info of connections to each node +! 5 info of gap convergence, internal heat generated, contact +! touching and separation +! 6 nodal value array during rezoning +! 7 tying info in CONRAD GAP option, fluid element numbers in +! CHANNEL option +! 8 output incremental displacements in local coord. system +! 9 latent heat output +! 10 stress-strain in local coord. system +! 11 additional info on interlaminar stress +! 12 output right hand side and solution vector +! 13 info of CPU resources used and memory available on NT +! 14 info of mesh adaption process, 2D outline information +! info of penetration checking for remeshing +! save .fem files after afmesh3d meshing +! 15 surface energy balance flag +! 16 print info regarding pyrolysis +! 17 print info of "streamline topology" +! 18 print mesh data changes after remeshing +! 19 print material flow stress data read in from *.mat file +! if unit flag is on, print out flow stress after conversion +! 20 print information on table input +! 21 print out information regarding kinematic boundary conditions +! 22 print out information regarding dist loads, point loads, film +! and foundations +! 23 print out information about automatic domain decomposition +! 24 print out iteration information in SuperForm status report file +! 25 print out information for ablation +! 26 print out information for films - Table input +! 27 print out the tying forces +! 28 print out for CASI solver, convection, +! 29 DDM single file debug printout +! 30 print out cavity debug info +! 31 print out welding related info +! 32 prints categorized DDM memory usage +! 33 print out the cutting info regarding machining feature +! 34 print out the list of quantities which can be defined via a table +! and for each quantity the supported independent variables +! 35 print out detailed coupling region info +! 36 print out solver debug info level 1 (Least Detailed) +! 37 print out solver debug info level 1 (Medium Detailed) +! 38 print out solver debug info level 1 (Very Detailed) +! 39 print detailed memory allocation info +! 40 print out marc-adams debug info +! 41 output rezone mapping post file for debugging +! 42 output post file after calling oprofos() for debugging +! 43 debug printout for vcct +! 44 debug printout for progressive failure +! 45 print out automatically generated midside node coordinates (arecrd) +! 46 print out message about routine and location, where the ibort is raised (ibort_inc) +! 47 print out summary message of element variables on a +! group-basis after all the automatic changes have been +! made (em_ellibp) +! 48 Automatically generate check results based on max and min vals. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the generate_check_results script from /marc/tools +! 49 Automatically generate check results based on the real calculated values +! at the sppecified check result locations. +! These vals are stored in the checkr file, which is inserted +! into the *dat file by the update_check_results script from /marc/tools +! 50 generate a file containing the resistance or capacity matrix; +! this file can be used to compare results with a reference file +! 51 print out detailed information for segment-to-segment contact +! 52 print out detailed relative displacement information +! for uniaxial sliding contact +! 53 print out detailed sliding direction information for +! uniaxial sliding contact +! 54 print out detailed information for edges attached to a curve +! 55 print information related to viscoelasticity calculations +! 56 print out detailed information for element coloring for multithreading +! 57 print out extra overheads due to multi-threading. +! These overhead includes (i) time and (ii) memory. +! The memory report will be summed over all the children. +! +! +! 58 debug output for ELSTO usage +! +! idyn Control flag for dynamics. Input data. +! 1 = eigenvalue extraction and / or modal superposition +! 2 = Newmark Beta and Single Step Houbolt (ssh with idynme=1) +! 3 = Houbolt +! 4 = Central difference +! 5 = Newer central difference +! idynt Copy of idyn at begining of increment +! ielas Control flag for ELASTIC analysis. Input data. +! Set by user or automatically turned on by Fourier option. +! Implies that each load case is treated separately. +! In Adaptive meshing analysis , forces re-analysis until +! convergence obtained. +! Also seriously misused to indicate no convergence. +! = 1 elastic option with fourier analysis +! = 2 elastic option without fourier analysis +! =-1 no convergence in recycles or max # increments reached +! Set to 1 if ELASTIC or SUBSTRUC parameter cards are used, +! or if fourier option is used. +! Then set to 2 if not fourier analysis. +! ielcma Control flag for electromagnetic analysis. Input data. +! ielcma = 1 Harmonic formulation +! ielcma = 2 Transient formulation +! ielect Control flag for electrostatic option. Input data. +! iform Control flag indicating that contact will be performed. +! ifour Control flag for Fourier analysis. +! 0 = Odd and even terms. +! 1 = symmetric (cosine) terms +! 2 = antisymmetric (sine) terms. +! iharm Control flag to indicate that a harmonic analysis will +! be performed. May change between passes. +! ihcps Control flag for coupled thermal - stress analysis. +! iheat Control flag for heat transfer analysis. Input data. +! iheatt Permanent control flag for heat transfer analysis. +! Note in coupled analysis iheatt will remain as one, +! but iheat will be zero in stress pass. +! ihresp Control flag to indicate to perform a harmonic subincrement. +! ijoule Control flag for Joule heating. +! ilem Control flag to determin which vector is to be transformed. +! Control flag to see where one is: +! ilem = 1 - elem.f +! ilem = 2 - initst.f +! ilem = 3 - pressr.f +! ilem = 3 - fstif.f +! ilem = 4 - jflux.f +! ilem = 4 - strass.f +! ilem = 5 - mass.f +! ilem = 5 - osolty.f +! ilnmom Control flag for soil - pore pressure calculation. Input data. +! ilnmom = 0 - perform only pore pressure calculation. +! = 1 - couples pore pressure - displacement analysis +! iloren Control flag for DeLorenzi J-Integral evaluation. Input data. +! inc Increment number. +! incext Control flag indicating that currently working on a +! subincrement. +! Could be due to harmonics , damping component (bearing), +! stiffness component (bearing), auto therm creep or +! old viscoplaticity +! incsub Sub-increment number. +! ipass Control flag for which part of coupled analysis. +! ipass = -1 - reset to base values +! ipass = 0 - do nothing +! ipass = 1 - stress part +! ipass = 2 - heat transfer part +! iplres Flag indicating that either second matrix is stored. +! dynamic analysis - mass matrix +! heat transfer - specific heat matrix +! buckle - initial stress stiffness +! ipois Control flag indicating Poisson type analysis +! ipois = 1 for heat transfer +! = 1 for heat transfer part of coupled +! = 1 for bearing +! = 1 for electrostatic +! = 1 for magnetostatic +! ipoist Permanent copy of ipois. In coupled analysis , ipois = 0 +! in stress portion, yet ipoist will still =1. +! irpflo global flag for rigid plastic flow analysis +! = 1 eularian formulation +! = 2 regular formulation; rigid material present in the analysis + +! ismall control flag to indicate small displacement analysis. input data. +! ismall = 0 - large disp included. +! ismall = 1 - small displacement. +! the flag is changing between passes. +! ismalt permanent copy of ismall . in heat transfer portion of +! coupled analysis ismall =0 , but ismalt remains the same. +! isoil control flag indicating that soil / pore pressure +! calculation . input data. +! ispect control flag for response spectrum calculation. input data. +! ispnow control flag to indicate to perform a spectrum response +! calculation now. +! istore store stresses flag. +! istore = 0 in elem.f and if first pass of creep +! convergence checking in ogetst.f +! or harmonic analysis or thruc.f if not +! converged. +! iswep control flag for eigenvalue analysis. +! iswep=1 - go do extraction process +! ithcrp control flag for auto therm creep option. input data. +! itherm control flag for either temperature dependent material +! properties and/or thermal loads. +! iupblg control flag for follower force option. input data. +! iupdat control flag for update lagrange option for current element. +! jacflg control flag for lanczos iteration method. input data. +! jel control flag indicating that total load applied in +! increment, ignore previous solution. +! jel = 1 in increment 0 +! = 1 if elastic or fourier +! = 1 in subincrements with elastic and adaptive +! jparks control flag for j integral by parks method. input data. +! largst control flag for finite strain plasticity. input data. +! lfond control variable that indicates if doing elastic +! foundation or film calculation. influences whether +! this is volumetric or surface integration. +! loadup control flag that indicates that nonlinearity occurred +! during previous increment. +! loaduq control flag that indicates that nonlinearity occurred. +! lodcor control flag for switching on the residual load correction. +! notice in input stage lodcor=0 means no loadcor, +! after omarc lodcor=1 means no loadcor +! lovl control flag for determining which "overlay" is to +! be called from ellib. +! lovl = 1 omarc +! = 2 oaread +! = 3 opress +! = 4 oasemb +! = 5 osolty +! = 6 ogetst +! = 7 oscinc +! = 8 odynam +! = 9 opmesh +! = 10 omesh2 +! = 11 osetz +! = 12 oass +! = 13 oincdt +! = 14 oasmas +! = 15 ofluas +! = 16 ofluso +! = 17 oshtra +! = 18 ocass +! = 19 osoltc +! = 20 orezon +! = 21 otest +! = 22 oeigen +! lsub control variable to determine which part of element +! assembly function is being done. +! lsub = 1 - no longer used +! = 2 - beta* +! = 3 - cons* +! = 4 - ldef* +! = 5 - posw* +! = 6 - theta* +! = 7 - tmarx* +! = 8 - geom* +! magnet control flag for magnetostatic analysis. input data. +! ncycle cycle number. accumulated in osolty.f +! note first time through oasemb.f , ncycle = 0. +! newtnt control flag for permanent copy of newton. +! newton iteration type. input data. +! newton : = 1 full newton raphson +! 2 modified newton raphson +! 3 newton raphson with strain correct. +! 4 direct substitution +! 5 direct substitution followed by n.r. +! 6 direct substitution with line search +! 7 full newton raphson with secant initial stress +! 8 secant method +! 9 full newton raphson with line search +! noshr control flag for calculation interlaminar shears for +! elements 22,45, and 75. input data. +!ees +! +! jactch = 1 or 2 if elements are activated or deactivated +! = 3 if elements are adaptively remeshed or rezoned +! = 0 normally / reset to 0 when assembly is done +! ifricsh = 0 call to fricsh in otest not needed +! = 1 call to fricsh (nodal friction) in otest needed +! iremkin = 0 remove deactivated kinematic boundary conditions +! immediately - only in new input format (this is default) +! = 1 remove deactivated kinematic boundary conditions +! gradually - only in new input format +! iremfor = 0 remove force boundary conditions immediately - +! only in new input format (this is default) +! = 1 remove force boundary conditions gradually - +! only in new input format (this is default) +! ishearp set to 1 if shear panel elements are present in the model +! +! jspf = 0 not in spf loadcase +! > 0 in spf loadcase (jspf=1 during first increment) +! machining = 1 if the metal cutting feature is used, for memory allocation purpose +! = 0 (default) if no metal cutting feature required +! +! jlshell = 1 if there is a shell element in the mesh +! icompsol = 1 if there is a composite solid element in the mesh +! iupblgfo = 1 if follower force for point loads +! jcondir = 1 if contact priority option is used +! nstcrp = 0 (default) steady state creep flag (undocumented feature. +! if not 0, turns off special ncycle = 0 code in radial.f) +! nactive = number of active passes, if =1 then it's not a coupled analysis +! ipassref = reference ipass, if not in a multiphysics pass ipass=ipassref +! icheckmpc = value of mpc-check parameter option +! noline = set to 1 in osolty if no line seacrh should be done in ogetst +! icuring = set to 1 if the curing is included for the heat transfer analysis. +! ishrink = set to 1 if shrinkage strain is included for mechancial analysis. +! ioffsflg = 1 for small displacement beam/shell offsets +! = 2 for large displacement beam/shell offsets +! isetoff = 0 - do not apply beam/shell offsets +! = 1 - apply beam/shell offsets +! ioffsetm = min. value of offset flag +! iharmt = 1 global flag if a coupled analysis contains an harmonic pass +! inc_incdat = flag to record increment number of a new loadcase in incdat.f +! iautspc = flag for AutoSPC option +! ibrake = brake squeal in this increment +! icbush = set to 1 if cbush elements present in model +! istream_input = set to 1 for streaming input calling Marc as library +! iprsinp = set to 1 if pressure input, introduced so other variables +! such as h could be a function of pressure +! ivlsinp = set to 1 if velocity input, introduced so other variables +! such as h could be a function of velocity +! ipin_m = # of beam element with PIN flag +! jgnstr_glb = global control over pre or fast integrated composite shells +! imarc_return = Marc return flag for streaming input control +! iqvcimp = if non-zero, then the number of QVECT boundary conditions +! nqvceid = number of QVECT boundary conditions, where emisivity/absorbtion id entered +! istpnx = 1 if to stop at end of increment +! imicro1 = 1 if micro1 interface is used +! iaxisymm = set to 1 if axisymmetric analysis +! jbreakglue = set to 1 if breaking glued option is used +! iglstif = 1 if ddm and global stiffness matrix formed (sgi solver 6 or solver9) +! jfastasm = 1 do fast assembly using SuperForm code +! iwear = set to 1 if wear model, set to 2 if wear model and coordinates updated +! iwearcf = set to 1 to store nodal coefficient of friction for wear calculation +! imixmeth = set=1 then use nonlinear mixture material - allocate memory +! ielcmadyn = flag for magnetodynamics +! 0 - electromagnetics using newmark beta +! 1 - transient magnetics using backward euler +! idinout = flag to control if inside out elements should be deactivated +! igena_meth = 0 - generalized alpha parameters depend on whether or not contact +! is flagged (dynamic,7) +! 10 - generalized alpha parameters are optimized for a contact +! analysis (dynamic,8) +! 11 - generalized alpha parameters are optimized for an analysis +! without contact (dynamic,8) +! magf_meth = - Method to compute force in magnetostatic - structural +! = 1 - Virtual work method based on finite difference for the force computation +! = 2 - Maxwell stress tensor +! = 3 - Virtual work method based on local derivative for the force computation +! non_assumed = 1 no assumed strain formulation (forced) +! iredoboudry set to 1 if contact boundary needs to be recalculated +! ioffsz0 = 1 if composite are used with reference position.ne.0 +! icomplt = 1 global flag if a coupled analysis contains an complex pass +! mesh_dual = 1 two independent meshes are used in magnetodynamic/thermal/structural +! one for magnetodynamic and the other for the remaining passes +! iactrp = 1 in an analysis with global remeshing, include inactive +! rigid bodies on post file +! mgnewton = 1 Use full Newton Raphson iteration for magnetostatic pass +! +! iusedens > 0 if mass density is used in the analysis (dynamics, mass dependent loading) +! igsigd0 = 1 set varselem(igsigd) to zero in next oasemb +! iaem = 1 if marc is called from aem (0 - off - default) +! icosim = 1 if marc is used in co-simulation software (ADAMS-MARC) +! inodels = 1 nodal integration elements 239/240/241 present +! nlharm = 0 harmonic subincrements are linear +! = 1 harmonic subincrements are nonlinear +! iampini = 0 amplitude of previous harmonic subinc is initial estimate (default) +! = 1 zero amplitude is initial estimate +! iphasetr = 1 phase transformation material model is used +! +!*********************************************************************** +!$omp threadprivate(/marc_concom/) +!! diff --git a/lib/MarcInclude/creeps2016 b/lib/MarcInclude/creeps2016 new file mode 100644 index 000000000..85c67492d --- /dev/null +++ b/lib/MarcInclude/creeps2016 @@ -0,0 +1,66 @@ +! common block definition file taken from respective MSC.Marc release and reformated to free format +!*********************************************************************** +! +! File: creeps.cmn +! +! MSC.Marc include file +! +real(pReal) cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b +integer(pInt) icfte,icfst,icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,& + icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +real(pReal) time_beg_lcase,time_beg_inc,fractol,time_beg_pst +real(pReal) fraction_donn,timinc_ol2 +! +integer(pInt) num_creepsr,num_creepsi,num_creeps2r +parameter(num_creepsr=7) +parameter(num_creepsi=17) +parameter(num_creeps2r=6) +common/marc_creeps/cptim,timinc,timinc_p,timinc_s,timincm,timinc_a,timinc_b,icfte,icfst,& + icfeq,icftm,icetem,mcreep,jcreep,icpa,icftmp,icfstr,icfqcp,icfcpm,icrppr,icrcha,icpb,iicpmt,iicpa +common/marc_creeps2/time_beg_lcase,time_beg_inc,fractol,time_beg_pst,fraction_donn,timinc_ol2 +! +! cptim Total time at begining of increment. +! timinc Incremental time for this step. +! icfte Local copy number of slopes of creep strain rate function +! versus temperature. Is -1 if exponent law used. +! icfst Local copy number of slopes of creep strain rate function +! versus equivalent stress. Is -1 if exponent law used. +! icfeq Local copy number of slopes of creep strain rate function +! versus equivalent strain. Is -1 if exponent law used. +! icftm Local copy number of slopes of creep strain rate function +! versus time. Is -1 if exponent law used. +! icetem Element number that needs to be checked for creep convergence +! or, if negative, the number of elements that need to +! be checked. In the latter case the elements to check +! are stored in ielcp. +! mcreep Maximum nuber of iterations for explicit creep. +! jcreep Counter of number of iterations for explicit creep +! procedure. jcreep must be .le. mcreep +! icpa Pointer to constant in creep strain rate expression. +! icftmp Pointer to temperature dependent creep strain rate data. +! icfstr Pointer to equivalent stress dependent creep strain rate data. +! icfqcp Pointer to equivalent creep strain dependent creep strain +! rate data. +! icfcpm Pointer to equivalent creep strain rate dependent +! creep strain rate data. +! icrppr Permanent copy of icreep +! icrcha Control flag for creep convergence checking , if set to +! 1 then testing on absolute change in stress and creep +! strain, not relative testing. Input data. +! icpb Pointer to storage of material id cross reference numbers. +! iicpmt +! iicpa Pointer to constant in creep strain rate expression +! +! time_beg_lcase time at the beginning of the current load case +! time_beg_inc time at the beginning of the current increment +! fractol fraction of loadcase or increment time when we +! consider it to be finished +! time_beg_pst time corresponding to first increment to be +! read in from thermal post file for auto step +! +! timinc_old Time step of the previous increment +! +!*********************************************************************** +!!$omp threadprivate(/marc_creeps/) +!!$omp threadprivate(/marc_creeps2/) +!! diff --git a/lib/damask/.gitignore b/lib/damask/.gitignore index 00feaa11f..1b8936623 100644 --- a/lib/damask/.gitignore +++ b/lib/damask/.gitignore @@ -1,2 +1,3 @@ core.so corientation.so +*.pyx diff --git a/lib/damask/DS_HDF5.xml b/lib/damask/DS_HDF5.xml new file mode 100644 index 000000000..1277ce8d2 --- /dev/null +++ b/lib/damask/DS_HDF5.xml @@ -0,0 +1,198 @@ + + + + + attr + / + + store cmd history + + + + attr + / + + + + + + + Scalar + /Geometry/Vx + Geometry + Vector along x define the spectral mesh + + + + Scalar + /Geometry/Vy + Geometry + Vector along y defines the spectral mesh + + + + Scalar + /Geometry/Vz + Geometry + Vector along z defines the spectral mesh + + + + Scalar + /Geometry/ip + Geometry + + + + + Scalar + /Geometry/node + Geometry + + + + + Scalar + /Geometry/grain + Geometry + + + + + Vector + /Geometry/pos + Geometry + + + + + Scalar + /Geometry/elem + Geometry + + + + + + Scalar + /Crystallite/phase + Crystallite + + + + + Scalar + /Crystallite/texture + Crystallite + + + + + Scalar + /Crystallite/volume + Crystallite + + + + + Vector + /Crystallite/orientation + Crystallite + + + + + Vector + /Crystallite/eulerangles + Crystallite + Bunnge Euler angles in degrees + + + + Vector + /Crystallite/grainrotation + Crystallite + + + + + Tensor + /Crystallite/f + Crystallite + deformation gradient (F) + + +

+ Tensor + /Crystallite/p + Crystallite + Pikola Kirkhoff stress +

+ + + Tensor + /Crystallite/Cauchy + Crystallite + Cauchy stress tensor + + + + Tensor + /Crystallite/lnV + Crystallite + + + + + Scalar + /Crystallite/MisesCauchy + Crystallite + von Mises equivalent of Cauchy stress + + + + Scalar + /Crystallite/MiseslnV + Crystallite + left von Mises strain + + + + + Vector + /Constitutive/resistance_slip + Constitutive + + + + + Vector + /Constitutive/shearrate_slip + Constitutive + + + + + Vector + /Constitutive/resolvedstress_slip + Constitutive + + + + + Scalar + /Constitutive/totalshear + Constitutive + + + + + Matrix + /Constitutive/accumulatedshear_slip + Constitutive + vector contains accumulated shear per slip system + + + + +
\ No newline at end of file diff --git a/lib/damask/__init__.py b/lib/damask/__init__.py index 1b6ec409d..c71d50a94 100644 --- a/lib/damask/__init__.py +++ b/lib/damask/__init__.py @@ -1,56 +1,24 @@ # -*- coding: UTF-8 no BOM -*- """Main aggregator""" -import sys, os +import os with open(os.path.join(os.path.dirname(__file__),'../../VERSION')) as f: version = f.readline()[:-1] from .environment import Environment # noqa from .asciitable import ASCIItable # noqa +try: + from .h5table import H5Table # noqa +except ImportError: + print("h5py module not found") from .config import Material # noqa from .colormaps import Colormap, Color # noqa from .orientation import Quaternion, Rodrigues, Symmetry, Orientation # noqa -# try: -# from .corientation import Quaternion, Rodrigues, Symmetry, Orientation -# print "Import Cython version of Orientation module" -# except: -# from .orientation import Quaternion, Rodrigues, Symmetry, Orientation + #from .block import Block # only one class from .result import Result # noqa from .geometry import Geometry # noqa from .solver import Solver # noqa from .test import Test # noqa from .util import extendableOption # noqa - -try: - from . import core -# cleaning up namespace -################################################################################################### -# capitalize according to convention - core.IO = core.io - core.FEsolving = core.fesolving - core.DAMASK_interface = core.damask_interface -# remove modulePrefix_ - core.prec.init = core.prec.prec_init - core.DAMASK_interface.init = core.DAMASK_interface.DAMASK_interface_init - core.IO.init = core.IO.IO_init - core.numerics.init = core.numerics.numerics_init - core.debug.init = core.debug.debug_init - core.math.init = core.math.math_init - core.math.tensorAvg = core.math.math_tensorAvg - core.FEsolving.init = core.FEsolving.FE_init - core.mesh.init = core.mesh.mesh_init - core.mesh.nodesAroundCentres = core.mesh.mesh_nodesAroundCentres - core.mesh.deformedCoordsFFT = core.mesh.mesh_deformedCoordsFFT - core.mesh.volumeMismatch = core.mesh.mesh_volumeMismatch - core.mesh.shapeMismatch = core.mesh.mesh_shapeMismatch - -except (ImportError,AttributeError) as e: - core = None # from http://www.python.org/dev/peps/pep-0008/ - if os.path.split(sys.argv[0])[1] not in ('symLink_Processing.py', - 'compile_CoreModule.py', - ): - sys.stderr.write('\nWARNING: Core module (Fortran code) not available, \n'\ - "try to run 'make processing'\n"\ - 'Error message when importing core.so: %s\n\n'%e) diff --git a/lib/damask/asciitable.py b/lib/damask/asciitable.py index 4fe4f9156..446770313 100644 --- a/lib/damask/asciitable.py +++ b/lib/damask/asciitable.py @@ -3,6 +3,14 @@ import os,sys import numpy as np +# ------------------------------------------------------------------ +# python 3 has no unicode object, this ensures that the code works on Python 2&3 +try: + test=isinstance('test', unicode) +except(NameError): + unicode=str + +# ------------------------------------------------------------------ class ASCIItable(): """Read and write to ASCII tables""" @@ -76,7 +84,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def _quote(self, what): - """quote empty or white space-containing output""" + """Quote empty or white space-containing output""" import re return '{quote}{content}{quote}'.format( @@ -99,7 +107,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def output_write(self, what): - """aggregate a single row (string) or list of (possibly containing further lists of) rows into output""" + """Aggregate a single row (string) or list of (possibly containing further lists of) rows into output""" if not isinstance(what, (str, unicode)): try: for item in what: self.output_write(item) @@ -139,7 +147,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def head_read(self): """ - get column labels + Get column labels by either reading the first row or, if keyword "head[*]" is present, the last line of the header @@ -158,12 +166,12 @@ class ASCIItable(): if self.__IO__['labeled']: # table features labels - self.info = [self.__IO__['in'].readline().strip() for i in xrange(1,int(m.group(1)))] + self.info = [self.__IO__['in'].readline().strip() for i in range(1,int(m.group(1)))] self.tags = shlex.split(self.__IO__['in'].readline()) # store tags found in last line else: - self.info = [self.__IO__['in'].readline().strip() for i in xrange(0,int(m.group(1)))] # all header is info ... + self.info = [self.__IO__['in'].readline().strip() for i in range(0,int(m.group(1)))] # all header is info ... else: # other table format try: @@ -192,7 +200,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def head_write(self, header = True): - """write current header information (info + labels)""" + """Write current header information (info + labels)""" head = ['{}\theader'.format(len(self.info)+self.__IO__['labeled'])] if header else [] head.append(self.info) if self.__IO__['labeled']: head.append('\t'.join(map(self._quote,self.tags))) @@ -201,7 +209,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def head_getGeom(self): - """interpret geom header""" + """Interpret geom header""" identifiers = { 'grid': ['a','b','c'], 'size': ['x','y','z'], @@ -224,11 +232,11 @@ class ASCIItable(): extra_header = [] for header in self.info: - headitems = map(str.lower,header.split()) + headitems = list(map(str.lower,header.split())) if len(headitems) == 0: continue # skip blank lines - if headitems[0] in mappings.keys(): - if headitems[0] in identifiers.keys(): - for i in xrange(len(identifiers[headitems[0]])): + if headitems[0] in list(mappings.keys()): + if headitems[0] in list(identifiers.keys()): + for i in range(len(identifiers[headitems[0]])): info[headitems[0]][i] = \ mappings[headitems[0]](headitems[headitems.index(identifiers[headitems[0]][i])+1]) else: @@ -241,7 +249,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def head_putGeom(self,info): - """translate geometry description to header""" + """Translate geometry description to header""" self.info_append([ "grid\ta {}\tb {}\tc {}".format(*info['grid']), "size\tx {}\ty {}\tz {}".format(*info['size']), @@ -254,7 +262,7 @@ class ASCIItable(): def labels_append(self, what, reset = False): - """add item or list to existing set of labels (and switch on labeling)""" + """Add item or list to existing set of labels (and switch on labeling)""" if not isinstance(what, (str, unicode)): try: for item in what: self.labels_append(item) @@ -268,7 +276,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def labels_clear(self): - """delete existing labels and switch to no labeling""" + """Delete existing labels and switch to no labeling""" self.tags = [] self.__IO__['labeled'] = False @@ -277,7 +285,7 @@ class ASCIItable(): tags = None, raw = False): """ - tell abstract labels. + Tell abstract labels. "x" for "1_x","2_x",... unless raw output is requested. operates on object tags or given list. @@ -314,7 +322,7 @@ class ASCIItable(): def label_index(self, labels): """ - tell index of column label(s). + Tell index of column label(s). return numpy array if asked for list of labels. transparently deals with label positions implicitly given as numbers or their headings given as strings. @@ -328,6 +336,7 @@ class ASCIItable(): try: idx.append(int(label)-1) # column given as integer number? except ValueError: + label = label[1:-1] if label[0] == label[-1] and label[0] in ('"',"'") else label # remove outermost quotations try: idx.append(self.tags.index(label)) # locate string in label list except ValueError: @@ -340,6 +349,7 @@ class ASCIItable(): idx = int(labels)-1 # offset for python array indexing except ValueError: try: + labels = labels[1:-1] if labels[0] == labels[-1] and labels[0] in ('"',"'") else labels # remove outermost quotations idx = self.tags.index(labels) except ValueError: try: @@ -353,7 +363,7 @@ class ASCIItable(): def label_dimension(self, labels): """ - tell dimension (length) of column label(s). + Tell dimension (length) of column label(s). return numpy array if asked for list of labels. transparently deals with label positions implicitly given as numbers or their headings given as strings. @@ -372,6 +382,7 @@ class ASCIItable(): while idx+myDim < len(self.tags) and self.tags[idx+myDim].startswith("%i_"%(myDim+1)): myDim += 1 # add while found except ValueError: # column has string label + label = label[1:-1] if label[0] == label[-1] and label[0] in ('"',"'") else label # remove outermost quotations if label in self.tags: # can be directly found? myDim = 1 # scalar by definition elif '1_'+label in self.tags: # look for first entry of possible multidim object @@ -391,6 +402,7 @@ class ASCIItable(): while idx+dim < len(self.tags) and self.tags[idx+dim].startswith("%i_"%(dim+1)): dim += 1 # add as long as found except ValueError: # column has string label + labels = labels[1:-1] if labels[0] == labels[-1] and labels[0] in ('"',"'") else labels # remove outermost quotations if labels in self.tags: # can be directly found? dim = 1 # scalar by definition elif '1_'+labels in self.tags: # look for first entry of possible multidim object @@ -405,7 +417,7 @@ class ASCIItable(): def label_indexrange(self, labels): """ - tell index range for given label(s). + Tell index range for given label(s). return numpy array if asked for list of labels. transparently deals with label positions implicitly given as numbers or their headings given as strings. @@ -415,14 +427,14 @@ class ASCIItable(): start = self.label_index(labels) dim = self.label_dimension(labels) - return np.hstack(map(lambda c: xrange(c[0],c[0]+c[1]), zip(start,dim))) \ - if isinstance(labels, Iterable) and not isinstance(labels, str) \ - else xrange(start,start+dim) + return np.hstack([range(s,s+d) for s,d in zip(start,dim)]).astype(int) \ + if isinstance(labels, Iterable) and not isinstance(labels, str) \ + else range(start,start+dim) # ------------------------------------------------------------------ def info_append(self, what): - """add item or list to existing set of infos""" + """Add item or list to existing set of infos""" if not isinstance(what, (str, unicode)): try: for item in what: self.info_append(item) @@ -433,7 +445,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def info_clear(self): - """delete any info block""" + """Delete any info block""" self.info = [] # ------------------------------------------------------------------ @@ -446,8 +458,8 @@ class ASCIItable(): # ------------------------------------------------------------------ def data_skipLines(self, count): - """wind forward by count number of lines""" - for i in xrange(count): + """Wind forward by count number of lines""" + for i in range(count): alive = self.data_read() return alive @@ -456,7 +468,7 @@ class ASCIItable(): def data_read(self, advance = True, respectLabels = True): - """read next line (possibly buffered) and parse it into data array""" + """Read next line (possibly buffered) and parse it into data array""" import shlex self.line = self.__IO__['readBuffer'].pop(0) if len(self.__IO__['readBuffer']) > 0 \ @@ -478,7 +490,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def data_readArray(self, labels = []): - """read whole data of all (given) labels as numpy array""" + """Read whole data of all (given) labels as numpy array""" from collections import Iterable try: @@ -501,21 +513,22 @@ class ASCIItable(): columns = [] for i,(c,d) in enumerate(zip(indices[present],dimensions[present])): # for all valid labels ... # ... transparently add all components unless column referenced by number or with explicit dimension - columns += range(c,c + \ - (d if str(c) != str(labels[present[i]]) else \ - 1)) - use = np.array(columns) + columns += list(range(c,c + + (d if str(c) != str(labels[present[i]]) else + 1))) + use = np.array(columns) if len(columns) > 0 else None self.tags = list(np.array(self.tags)[use]) # update labels with valid subset self.data = np.loadtxt(self.__IO__['in'],usecols=use,ndmin=2) +# self.data = np.genfromtxt(self.__IO__['in'],dtype=None,names=self.tags,usecols=use) return labels_missing # ------------------------------------------------------------------ def data_write(self, delimiter = '\t'): - """write current data array and report alive output back""" + """Write current data array and report alive output back""" if len(self.data) == 0: return True if isinstance(self.data[0],list): @@ -527,14 +540,17 @@ class ASCIItable(): def data_writeArray(self, fmt = None, delimiter = '\t'): - """write whole numpy array data""" + """Write whole numpy array data""" for row in self.data: try: - output = [fmt % value for value in row] if fmt else map(repr,row) + output = [fmt % value for value in row] if fmt else list(map(repr,row)) except: output = [fmt % row] if fmt else [repr(row)] - self.__IO__['out'].write(delimiter.join(output) + '\n') + try: + self.__IO__['out'].write(delimiter.join(output) + '\n') + except: + pass # ------------------------------------------------------------------ def data_append(self, @@ -550,12 +566,12 @@ class ASCIItable(): # ------------------------------------------------------------------ def data_set(self, what, where): - """update data entry in column "where". grows data array if needed.""" + """Update data entry in column "where". grows data array if needed.""" idx = -1 try: idx = self.label_index(where) if len(self.data) <= idx: - self.data_append(['n/a' for i in xrange(idx+1-len(self.data))]) # grow data if too short + self.data_append(['n/a' for i in range(idx+1-len(self.data))]) # grow data if too short self.data[idx] = str(what) except(ValueError): pass @@ -568,7 +584,7 @@ class ASCIItable(): # ------------------------------------------------------------------ def data_asFloat(self): - return map(self._transliterateToFloat,self.data) + return list(map(self._transliterateToFloat,self.data)) @@ -577,7 +593,7 @@ class ASCIItable(): grid, type = 'i', strict = False): - """read microstructure data (from .geom format)""" + """Read microstructure data (from .geom format)""" def datatype(item): return int(item) if type.lower() == 'i' else float(item) @@ -588,10 +604,13 @@ class ASCIItable(): while i < N and self.data_read(): items = self.data if len(items) > 2: - if items[1].lower() == 'of': items = np.ones(datatype(items[0]))*datatype(items[2]) - elif items[1].lower() == 'to': items = np.arange(datatype(items[0]),1+datatype(items[2])) - else: items = map(datatype,items) - else: items = map(datatype,items) + if items[1].lower() == 'of': + items = np.ones(datatype(items[0]))*datatype(items[2]) + elif items[1].lower() == 'to': + items = np.linspace(datatype(items[0]),datatype(items[2]), + abs(datatype(items[2])-datatype(items[0]))+1,dtype=int) + else: items = list(map(datatype,items)) + else: items = list(map(datatype,items)) s = min(len(items), N-i) # prevent overflow of microstructure array microstructure[i:i+s] = items[:s] diff --git a/lib/damask/colormaps.py b/lib/damask/colormaps.py index 45c88e8d5..646950118 100644 --- a/lib/damask/colormaps.py +++ b/lib/damask/colormaps.py @@ -5,16 +5,18 @@ import math,numpy as np ### --- COLOR CLASS -------------------------------------------------- class Color(): - """Conversion of colors between different color-spaces. + """ + Conversion of colors between different color-spaces. - Colors should be given in the form - Color('model',[vector]).To convert and copy color from one space to other, use the methods - convertTo('model') and expressAs('model')spectively + Colors should be given in the form Color('model',[vector]). + To convert or copy color from one space to other, use the methods + convertTo('model') or expressAs('model'), respectively. """ __slots__ = [ 'model', 'color', + '__dict__', ] @@ -32,7 +34,7 @@ class Color(): } model = model.upper() - if model not in self.__transforms__.keys(): model = 'RGB' + if model not in list(self.__transforms__.keys()): model = 'RGB' if model == 'RGB' and max(color) > 1.0: # are we RGB255 ? for i in range(3): color[i] /= 255.0 # rescale to RGB @@ -61,7 +63,7 @@ class Color(): # ------------------------------------------------------------------ def convertTo(self,toModel = 'RGB'): toModel = toModel.upper() - if toModel not in self.__transforms__.keys(): return + if toModel not in list(self.__transforms__.keys()): return sourcePos = self.__transforms__[self.model]['index'] targetPos = self.__transforms__[toModel]['index'] @@ -84,9 +86,9 @@ class Color(): def _HSL2RGB(self): """ - convert H(ue) S(aturation) L(uminance) to R(red) G(reen) B(lue) + Convert H(ue) S(aturation) L(uminance) to R(red) G(reen) B(lue) - with S,L,H,R,G,B running from 0 to 1 + with all values in the range of 0 to 1 from http://en.wikipedia.org/wiki/HSL_and_HSV """ if self.model != 'HSL': return @@ -110,9 +112,9 @@ class Color(): def _RGB2HSL(self): """ - convert R(ed) G(reen) B(lue) to H(ue) S(aturation) L(uminance) + Convert R(ed) G(reen) B(lue) to H(ue) S(aturation) L(uminance) - with S,L,H,R,G,B running from 0 to 1 + with all values in the range of 0 to 1 from http://130.113.54.154/~monger/hsl-rgb.html """ if self.model != 'RGB': return @@ -138,7 +140,7 @@ class Color(): HSL[0] = HSL[0]*60.0 # scaling to 360 might be dangerous for small values if (HSL[0] < 0.0): HSL[0] = HSL[0] + 360.0 - for i in xrange(2): + for i in range(2): HSL[i+1] = min(HSL[i+1],1.0) HSL[i+1] = max(HSL[i+1],0.0) @@ -150,7 +152,7 @@ class Color(): def _RGB2XYZ(self): """ - convert R(ed) G(reen) B(lue) to CIE XYZ + Convert R(ed) G(reen) B(lue) to CIE XYZ with all values in the range of 0 to 1 from http://www.cs.rit.edu/~ncs/color/t_convert.html @@ -163,11 +165,11 @@ class Color(): [0.212671,0.715160,0.072169], [0.019334,0.119193,0.950227]]) - for i in xrange(3): + for i in range(3): if (self.color[i] > 0.04045): RGB_lin[i] = ((self.color[i]+0.0555)/1.0555)**2.4 else: RGB_lin[i] = self.color[i] /12.92 XYZ = np.dot(convert,RGB_lin) - for i in xrange(3): + for i in range(3): XYZ[i] = max(XYZ[i],0.0) @@ -179,12 +181,13 @@ class Color(): def _XYZ2RGB(self): """ - convert CIE XYZ to R(ed) G(reen) B(lue) + Convert CIE XYZ to R(ed) G(reen) B(lue) with all values in the range of 0 to 1 from http://www.cs.rit.edu/~ncs/color/t_convert.html """ - if self.model != 'XYZ': return + if self.model != 'XYZ': + return convert = np.array([[ 3.240479,-1.537150,-0.498535], [-0.969256, 1.875992, 0.041556], @@ -192,10 +195,10 @@ class Color(): RGB_lin = np.dot(convert,self.color) RGB = np.zeros(3,'d') - for i in xrange(3): + for i in range(3): if (RGB_lin[i] > 0.0031308): RGB[i] = ((RGB_lin[i])**(1.0/2.4))*1.0555-0.0555 else: RGB[i] = RGB_lin[i] *12.92 - for i in xrange(3): + for i in range(3): RGB[i] = min(RGB[i],1.0) RGB[i] = max(RGB[i],0.0) @@ -210,7 +213,7 @@ class Color(): def _CIELAB2XYZ(self): """ - convert CIE Lab to CIE XYZ + Convert CIE Lab to CIE XYZ with XYZ in the range of 0 to 1 from http://www.easyrgb.com/index.php?X=MATH&H=07#text7 @@ -224,7 +227,7 @@ class Color(): XYZ[0] = XYZ[1] + self.color[1]/ 500.0 XYZ[2] = XYZ[1] - self.color[2]/ 200.0 - for i in xrange(len(XYZ)): + for i in range(len(XYZ)): if (XYZ[i] > 6./29. ): XYZ[i] = XYZ[i]**3. else: XYZ[i] = 108./841. * (XYZ[i] - 4./29.) @@ -234,17 +237,18 @@ class Color(): def _XYZ2CIELAB(self): """ - convert CIE XYZ to CIE Lab + Convert CIE XYZ to CIE Lab with XYZ in the range of 0 to 1 - from http://en.wikipedia.org/wiki/Lab_color_space, http://www.cs.rit.edu/~ncs/color/t_convert.html + from http://en.wikipedia.org/wiki/Lab_color_space, + http://www.cs.rit.edu/~ncs/color/t_convert.html """ if self.model != 'XYZ': return ref_white = np.array([.95047, 1.00000, 1.08883],'d') # Observer = 2, Illuminant = D65 XYZ = self.color/ref_white - for i in xrange(len(XYZ)): + for i in range(len(XYZ)): if (XYZ[i] > 216./24389 ): XYZ[i] = XYZ[i]**(1.0/3.0) else: XYZ[i] = (841./108. * XYZ[i]) + 16.0/116.0 @@ -257,7 +261,7 @@ class Color(): def _CIELAB2MSH(self): """ - convert CIE Lab to Msh colorspace + Convert CIE Lab to Msh colorspace from http://www.cs.unm.edu/~kmorel/documents/ColorMaps/DivergingColorMapWorkshop.xls """ @@ -277,9 +281,9 @@ class Color(): def _MSH2CIELAB(self): """ - convert Msh colorspace to CIE Lab + Convert Msh colorspace to CIE Lab - s,h in radians + with s,h in radians from http://www.cs.unm.edu/~kmorel/documents/ColorMaps/DivergingColorMapWorkshop.xls """ if self.model != 'MSH': return @@ -295,7 +299,7 @@ class Color(): class Colormap(): - """perceptually uniform diverging or sequential colormaps.""" + """Perceptually uniform diverging or sequential colormaps.""" __slots__ = [ 'left', @@ -370,7 +374,7 @@ class Colormap(): # ------------------------------------------------------------------ def __repr__(self): - """left and right value of colormap""" + """Left and right value of colormap""" return 'Left: %s Right: %s'%(self.left,self.right) @@ -414,11 +418,7 @@ class Colormap(): return Color('MSH',Msh) def interpolate_linear(lo, hi, frac): - """ - linearly interpolate color at given fraction between lower and - - higher color in model of lower color - """ + """Linear interpolation between lo and hi color at given fraction; output in model of lo color.""" interpolation = (1.0 - frac) * np.array(lo.color[:]) \ + frac * np.array(hi.expressAs(lo.model).color[:]) @@ -442,25 +442,24 @@ class Colormap(): """ [RGB] colormap for use in paraview or gmsh, or as raw string, or array. - arguments: name, format, steps, crop. - format is one of (paraview, gmsh, raw, list). - crop selects a (sub)range in [-1.0,1.0]. - generates sequential map if one limiting color is either white or black, + Arguments: name, format, steps, crop. + Format is one of (paraview, gmsh, raw, list). + Crop selects a (sub)range in [-1.0,1.0]. + Generates sequential map if one limiting color is either white or black, diverging map otherwise. """ format = format.lower() # consistent comparison basis frac = 0.5*(np.array(crop) + 1.0) # rescale crop range to fractions - colors = [self.color(float(i)/(steps-1)*(frac[1]-frac[0])+frac[0]).expressAs(model).color for i in xrange(steps)] + colors = [self.color(float(i)/(steps-1)*(frac[1]-frac[0])+frac[0]).expressAs(model).color for i in range(steps)] if format == 'paraview': colormap = ['[\n {{\n "ColorSpace" : "RGB", "Name" : "{}",\n "RGBPoints" : ['.format(name)] \ + [' {:4d},{:8.6f},{:8.6f},{:8.6f},'.format(i,color[0],color[1],color[2],) for i,color in enumerate(colors[:-1])]\ - + [' {:4d},{:8.6f},{:8.6f},{:8.6f} '.format(i+1,colors[-1][0],colors[-1][1],colors[-1][2],)]\ + + [' {:4d},{:8.6f},{:8.6f},{:8.6f} '.format(len(colors),colors[-1][0],colors[-1][1],colors[-1][2],)]\ + [' ]\n }\n]'] - elif format == 'gmsh': colormap = ['View.ColorTable = {'] \ - + [',\n'.join(['{%s}'%(','.join(map(lambda x:str(x*255.0),color))) for color in colors])] \ + + [',\n'.join(['{%s}'%(','.join([str(x*255.0) for x in color])) for color in colors])] \ + ['}'] elif format == 'gom': @@ -468,7 +467,7 @@ class Colormap(): + ' 9 ' + str(name) \ + ' 0 1 0 3 0 0 -1 9 \ 0 0 0 255 255 255 0 0 255 ' \ + '30 NO_UNIT 1 1 64 64 64 255 1 0 0 0 0 0 0 3 0 ' + str(len(colors)) \ - + ' '.join([' 0 %s 255 1'%(' '.join(map(lambda x:str(int(x*255.0)),color))) for color in reversed(colors)])] + + ' '.join([' 0 %s 255 1'%(' '.join([str(int(x*255.0)) for x in color])) for color in reversed(colors)])] elif format == 'raw': colormap = ['\t'.join(map(str,color)) for color in colors] @@ -480,4 +479,3 @@ class Colormap(): raise NameError('unknown color export format') return '\n'.join(colormap) + '\n' if type(colormap[0]) is str else colormap - diff --git a/lib/damask/config/material.py b/lib/damask/config/material.py index c1c3ad6b4..d59aaa6a9 100644 --- a/lib/damask/config/material.py +++ b/lib/damask/config/material.py @@ -19,7 +19,7 @@ class Section(): self.parameters[key] = data[key] if '__order__' not in self.parameters: - self.parameters['__order__'] = self.parameters.keys() + self.parameters['__order__'] = list(self.parameters.keys()) if part.lower() in classes: self.__class__ = classes[part.lower()] self.__init__(data) @@ -61,11 +61,11 @@ class Texture(Section): def add_component(self,theType,properties): - if 'scatter' not in map(str.lower,properties.keys()): + if 'scatter' not in list(map(str.lower,list(properties.keys()))): scatter = 0.0 else: scatter = properties['scatter'] - if 'fraction' not in map(str.lower,properties.keys()): + if 'fraction' not in list(map(str.lower,list(properties.keys()))): fraction = 1.0 else: fraction = properties['fraction'] @@ -104,7 +104,7 @@ class Material(): __slots__ = ['data'] def __init__(self,verbose=True): - """generates ordered list of parts""" + """Generates ordered list of parts""" self.parts = [ 'homogenization', 'microstructure', @@ -122,7 +122,7 @@ class Material(): self.verbose = verbose def __repr__(self): - """returns current configuration to be used as material.config""" + """Returns current configuration to be used as material.config""" me = [] for part in self.parts: if self.verbose: print('doing '+part) @@ -224,10 +224,10 @@ class Material(): def add_microstructure(self, section='', components={}, # dict of phase,texture, and fraction lists ): - """Experimental! Needs expansion to multi-constituent microstructures...""" + """Experimental! Needs expansion to multi-constituent microstructures...""" microstructure = Microstructure() # make keys lower case (http://stackoverflow.com/questions/764235/dictionary-to-lowercase-in-python) - components=dict((k.lower(), v) for k,v in components.iteritems()) + components=dict((k.lower(), v) for k,v in components.items()) for key in ['phase','texture','fraction','crystallite']: if type(components[key]) is not list: diff --git a/lib/damask/corientation.pyx b/lib/damask/corientation.pyx deleted file mode 100644 index 6da6ba8a5..000000000 --- a/lib/damask/corientation.pyx +++ /dev/null @@ -1,1277 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 -# filename: corientation.pyx - -# __ __ __________ ____ __ ____ ______ ____ -# / //_// ____/ __ \/ __ \/ //_/ / / / __ \/ __ \ -# / ,< / __/ / / / / / / / ,< / / / / / / / / / / -# / /| |/ /___/ /_/ / /_/ / /| / /_/ / /_/ / /_/ / -# /_/ |_/_____/_____/\____/_/ |_\____/_____/\____/ - - -###################################################### -# This is a Cython implementation of original DAMASK # -# orientation class, mainly for speed improvement. # -###################################################### - -""" -NOTE ----- -The static method in Cython is different from Python, need more -time to figure out details. -""" - -import math, random, os -import numpy as np -cimport numpy as np - - -## -# This Rodrigues class is odd, not sure if it will function -# properly or not -cdef class Rodrigues: - """Rodrigues representation of orientation """ - cdef public double[3] r - - def __init__(self, vector): - if isinstance(vector, Rodrigues): - self.r[0] = vector.r[0] - self.r[1] = vector.r[1] - self.r[2] = vector.r[2] - else: - self.r[0] = vector[0] - self.r[1] = vector[1] - self.r[2] = vector[2] - - def asQuaternion(self): - cdef double norm, halfAngle - cdef double[4] q - - norm = np.linalg.norm(self.vector) - halfAngle = np.arctan(norm) - q[0] = np.cos(halfAngle) - tmp = np.sin(halfAngle)*self.vector/norm - q[1],q[2],q[3] = tmp[0],tmp[1],tmp[2] - - return Quaternion(q) - - def asAngleAxis(self): - cdef double norm, halfAngle - - norm = np.linalg.norm(self.vector) - halfAngle = np.arctan(norm) - - return (2.0*halfAngle,self.vector/norm) - - -## -# The Quaternion class do the heavy lifting of orientation -# calculation -cdef class Quaternion: - """ Quaternion representation of orientation """ - # All methods and naming conventions based off - # http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions - cdef public double w,x,y,z - - def __init__(self, data): - """ - @description - ------------ - copy constructor friendly - @parameters - ----------- - data: array - """ - cdef double[4] q - - if isinstance(data, Quaternion): - q[0] = data.w - q[1] = data.x - q[2] = data.y - q[3] = data.z - else: - q[0] = data[0] - q[1] = data[1] - q[2] = data[2] - q[3] = data[3] - - self.Quaternion(q) - - cdef Quaternion(self, double* quatArray): - """ - @description - ------------ - internal constructor for Quaternion - @parameters - ----------- - quatArray: double[4] // - w is the real part, (x, y, z) are the imaginary parts - """ - if quatArray[0] < 0: - self.w = -quatArray[0] - self.x = -quatArray[1] - self.y = -quatArray[2] - self.z = -quatArray[3] - else: - self.w = quatArray[0] - self.x = quatArray[1] - self.y = quatArray[2] - self.z = quatArray[3] - - def __copy__(self): - cdef double[4] q = [self.w,self.x,self.y,self.z] - return Quaternion(q) - - copy = __copy__ - - def __iter__(self): - return iter([self.w,self.x,self.y,self.z]) - - def __repr__(self): - return 'Quaternion(real={:.4f},imag=<{:.4f},{:.4f}, {:.4f}>)'.format(self.w, - self.x, - self.y, - self.z) - - def __pow__(self, exponent, modulo): - # declare local var for speed gain - cdef double omega, vRescale - cdef double[4] q - - omega = math.acos(self.w) - vRescale = math.sin(exponent*omega)/math.sin(omega) - - q[0] = math.cos(exponent*omega) - q[1] = self.x*vRescale - q[2] = self.y*vRescale - q[3] = self.z*vRescale - return Quaternion(q) - - def __ipow__(self, exponent): - self = self.__pow__(self, exponent, 1.0) - return self - - def __mul__(self, other): - # declare local var for speed gain - cdef double Aw,Ax,Ay,Az,Bw,Bx,By,Bz - cdef double w,x,y,z,Vx,Vy,Vz - cdef double[4] q - - # quaternion * quaternion - try: - Aw = self.w - Ax = self.x - Ay = self.y - Az = self.z - Bw = other.w - Bx = other.x - By = other.y - Bz = other.z - q[0] = - Ax * Bx - Ay * By - Az * Bz + Aw * Bw - q[1] = + Ax * Bw + Ay * Bz - Az * By + Aw * Bx - q[2] = - Ax * Bz + Ay * Bw + Az * Bx + Aw * By - q[3] = + Ax * By - Ay * Bx + Az * Bw + Aw * Bz - return Quaternion(q) - except: - pass - # vector (perform active rotation, i.e. q*v*q.conjugated) - try: - w = self.w - x = self.x - y = self.y - z = self.z - Vx = other[0] - Vy = other[1] - Vz = other[2] - return np.array([\ - w * w * Vx + 2 * y * w * Vz - 2 * z * w * Vy + \ - x * x * Vx + 2 * y * x * Vy + 2 * z * x * Vz - \ - z * z * Vx - y * y * Vx, - 2 * x * y * Vx + y * y * Vy + 2 * z * y * Vz + \ - 2 * w * z * Vx - z * z * Vy + w * w * Vy - \ - 2 * x * w * Vz - x * x * Vy, - 2 * x * z * Vx + 2 * y * z * Vy + \ - z * z * Vz - 2 * w * y * Vx - y * y * Vz + \ - 2 * w * x * Vy - x * x * Vz + w * w * Vz ]) - except: - pass - # quaternion * scalar - try: - Q = self.copy() - Q.w *= other - Q.x *= other - Q.y *= other - Q.z *= other - return Q - except: - return self.copy() - - def __imul__(self, other): - if isinstance(other, Quaternion): - self = self.__mul__(other) - return self - else: - return NotImplemented - - def __div__(self, other): - cdef double[4] q - - if isinstance(other, (int,float,long)): - q[0] = self.w / other - q[1] = self.x / other - q[2] = self.y / other - q[3] = self.z / other - return Quaternion(q) - else: - NotImplemented - - def __idiv__(self, other): - self = self.__div__(other) - return self - - def __add__(self, other): - cdef double[4] q - - if isinstance(other, Quaternion): - q[0] = self.w + other.w - q[1] = self.x + other.x - q[2] = self.y + other.y - q[3] = self.z + other.z - return self.__class__(q) - else: - return NotImplemented - - def __iadd__(self, other): - self = self.__add__(other) - return self - - def __sub__(self, other): - cdef double[4] q - - if isinstance(other, Quaternion): - q[0] = self.w - other.w - q[1] = self.x - other.x - q[2] = self.y - other.y - q[3] = self.z - other.z - return self.__class__(q) - else: - return NotImplemented - - def __isub__(self, other): - self = self.__sub__(other) - return self - - def __neg__(self): - cdef double[4] q - - q[0] = -self.w - q[1] = -self.x - q[2] = -self.y - q[3] = -self.z - - return self.__class__(q) - - def __abs__(self): - cdef double tmp - - tmp = self.w**2 + self.x**2 + self.y**2 + self.z**2 - tmp = math.sqrt(tmp) - return tmp - - magnitude = __abs__ - - def __richcmp__(Quaternion self, Quaternion other, int op): - cdef bint tmp - - tmp = (abs(self.w-other.w) < 1e-8 and \ - abs(self.x-other.x) < 1e-8 and \ - abs(self.y-other.y) < 1e-8 and \ - abs(self.z-other.z) < 1e-8) \ - or \ - (abs(-self.w-other.w) < 1e-8 and \ - abs(-self.x-other.x) < 1e-8 and \ - abs(-self.y-other.y) < 1e-8 and \ - abs(-self.z-other.z) < 1e-8) - if op == 2: #__eq__ - return tmp - elif op ==3: #__ne__ - return not tmp - else: - return NotImplemented - - def __cmp__(self,other): - # not sure if this actually works or not - return cmp(self.Rodrigues(),other.Rodrigues()) - - def magnitude_squared(self): - cdef double tmp - - tmp = self.w**2 + self.x**2 + self.y**2 + self.z**2 - return tmp - - def identity(self): - self.w = 1.0 - self.x = 0.0 - self.y = 0.0 - self.z = 0.0 - return self - - def normalize(self): - cdef double d - - d = self.magnitude() - if d > 0.0: - self /= d - return self - - def conjugate(self): - self.x = -self.x - self.y = -self.y - self.z = -self.z - return self - - def inverse(self): - cdef double d - - d = self.magnitude() - if d > 0.0: - self.conjugate() - self /= d - return self - - def homomorph(self): - if self.w < 0.0: - self.w = -self.w - self.x = -self.x - self.y = -self.y - self.z = -self.z - return self - - # return a copy of me - def normalized(self): - cdef Quaternion q - - q = Quaternion(self.normalize()) - return q - - def conjugated(self): - cdef Quaternion q - - q = Quaternion(self.conjugate()) - return q - - def asList(self): - cdef double[4] q = [self.w, self.x, self.y, self.z] - - return list(q) - - def asM(self): # to find Averaging Quaternions (see F. Landis Markley et al.) - return np.outer([i for i in self],[i for i in self]) - - def asMatrix(self): - return np.array([[1.0-2.0*(self.y*self.y+self.z*self.z), 2.0*(self.x*self.y-self.z*self.w), 2.0*(self.x*self.z+self.y*self.w)], - [ 2.0*(self.x*self.y+self.z*self.w), 1.0-2.0*(self.x*self.x+self.z*self.z), 2.0*(self.y*self.z-self.x*self.w)], - [ 2.0*(self.x*self.z-self.y*self.w), 2.0*(self.x*self.w+self.y*self.z), 1.0-2.0*(self.x*self.x+self.y*self.y)]]) - - def asAngleAxis(self): - # keep the return as radians for simplicity - cdef double s,x,y - - if self.w > 1: - self.normalize() - - s = math.sqrt(1. - self.w**2) - x = 2*self.w**2 - 1. - y = 2*self.w * s - - angle = math.atan2(y,x) - if angle < 0.0: - angle *= -1.0 - s *= -1.0 - - return (angle, - np.array([1.0, 0.0, 0.0] if np.abs(angle) < 1e-3 else [self.x/s, self.y/s, self.z/s]) ) - - def asRodrigues(self): - if self.w != 0.0: - return np.array([self.x, self.y, self.z])/self.w - else: - return np.array([float('inf')]*3) - - def asEulers(self, - type='bunge', - degrees=False, - standardRange=False): - """ - CONVERSION TAKEN FROM: - Melcher, A.; Unser, A.; Reichhardt, M.; Nestler, B.; Pötschke, M.; Selzer, M. - Conversion of EBSD data by a quaternion based algorithm to be used for grain structure simulations - Technische Mechanik 30 (2010) pp 401--413 - """ - cdef double x,y - - angles = [0.0,0.0,0.0] - - if type.lower() == 'bunge' or type.lower() == 'zxz': - if abs(self.x) < 1e-4 and abs(self.y) < 1e-4: - x = self.w**2 - self.z**2 - y = 2.*self.w*self.z - angles[0] = math.atan2(y,x) - elif abs(self.w) < 1e-4 and abs(self.z) < 1e-4: - x = self.x**2 - self.y**2 - y = 2.*self.x*self.y - angles[0] = math.atan2(y,x) - angles[1] = math.pi - else: - chi = math.sqrt((self.w**2 + self.z**2)*(self.x**2 + self.y**2)) - - x = (self.w * self.x - self.y * self.z)/2./chi - y = (self.w * self.y + self.x * self.z)/2./chi - angles[0] = math.atan2(y,x) - - x = self.w**2 + self.z**2 - (self.x**2 + self.y**2) - y = 2.*chi - angles[1] = math.atan2(y,x) - - x = (self.w * self.x + self.y * self.z)/2./chi - y = (self.z * self.x - self.y * self.w)/2./chi - angles[2] = math.atan2(y,x) - if standardRange: - angles[0] %= 2*math.pi - if angles[1] < 0.0: - angles[1] += math.pi - angles[2] *= -1.0 - angles[2] %= 2*math.pi - - return np.degrees(angles) if degrees else angles - - @staticmethod - def fromIdentity(): - cdef double[4] q = [1.0, 0.0, 0.0, 0.0] - - return Quaternion(q) - - @staticmethod - def fromRandom(randomSeed=None): - cdef double r1,r2,r3 - cdef double[4] q - - if randomSeed == None: - randomSeed = int(os.urandom(4).encode('hex'), 16) - random.seed(randomSeed) - - r1 = random.random() - r2 = random.random() - r3 = random.random() - q[0] = math.cos(2.0*math.pi*r1)*math.sqrt(r3) - q[1] = math.sin(2.0*math.pi*r2)*math.sqrt(1.0-r3) - q[2] = math.cos(2.0*math.pi*r2)*math.sqrt(1.0-r3) - q[3] = math.sin(2.0*math.pi*r1)*math.sqrt(r3) - return Quaternion(q) - - @staticmethod - def fromRodrigues(rodrigues): - if not isinstance(rodrigues, np.ndarray): rodrigues = np.array(rodrigues) - halfangle = math.atan(np.linalg.norm(rodrigues)) - c = math.cos(halfangle) - w = c - x,y,z = c*rodrigues - return Quaternion([w,x,y,z]) - - @staticmethod - def fromAngleAxis(angle, axis): - if not isinstance(axis, np.ndarray): axis = np.array(axis) - axis /= np.linalg.norm(axis) - s = math.sin(angle / 2.0) - w = math.cos(angle / 2.0) - x = axis[0] * s - y = axis[1] * s - z = axis[2] * s - return Quaternion([w,x,y,z]) - - @staticmethod - def fromEulers(eulers, type = 'Bunge'): - cdef double c1,s1,c2,s2,c3,s3 - cdef double[4] q - cdef double[3] halfEulers - cdef int i - - for i in range(3): - halfEulers[i] = eulers[i] * 0.5 # reduce to half angles - - - c1 = math.cos(halfEulers[0]) - s1 = math.sin(halfEulers[0]) - c2 = math.cos(halfEulers[1]) - s2 = math.sin(halfEulers[1]) - c3 = math.cos(halfEulers[2]) - s3 = math.sin(halfEulers[2]) - - if type.lower() == 'bunge' or type.lower() == 'zxz': - q[0] = c1 * c2 * c3 - s1 * c2 * s3 - q[1] = c1 * s2 * c3 + s1 * s2 * s3 - q[2] = - c1 * s2 * s3 + s1 * s2 * c3 - q[3] = c1 * c2 * s3 + s1 * c2 * c3 - else: - q[0] = c1 * c2 * c3 - s1 * s2 * s3 - q[1] = s1 * s2 * c3 + c1 * c2 * s3 - q[2] = s1 * c2 * c3 + c1 * s2 * s3 - q[3] = c1 * s2 * c3 - s1 * c2 * s3 - return Quaternion(q) - - ## Modified Method to calculate Quaternion from Orientation Matrix, Source: http://www.euclideanspace.com/maths/geometry/rotations/conversions/matrixToQuaternion/ - - @staticmethod - def fromMatrix(m): - # This is a slow implementation - if m.shape != (3,3) and np.prod(m.shape) == 9: - m = m.reshape(3,3) - - tr=np.trace(m) - if tr > 0.00000001: - s = math.sqrt(tr + 1.0)*2.0 - - return Quaternion( - [ s*0.25, - (m[2,1] - m[1,2])/s, - (m[0,2] - m[2,0])/s, - (m[1,0] - m[0,1])/s - ]) - - elif m[0,0] > m[1,1] and m[0,0] > m[2,2]: - t = m[0,0] - m[1,1] - m[2,2] + 1.0 - s = 2.0*math.sqrt(t) - - return Quaternion( - [ (m[2,1] - m[1,2])/s, - s*0.25, - (m[0,1] + m[1,0])/s, - (m[2,0] + m[0,2])/s, - ]) - - elif m[1,1] > m[2,2]: - t = -m[0,0] + m[1,1] - m[2,2] + 1.0 - s = 2.0*math.sqrt(t) - - return Quaternion( - [ (m[0,2] - m[2,0])/s, - (m[0,1] + m[1,0])/s, - s*0.25, - (m[1,2] + m[2,1])/s, - ]) - - else: - t = -m[0,0] - m[1,1] + m[2,2] + 1.0 - s = 2.0*math.sqrt(t) - - return Quaternion( - [ (m[1,0] - m[0,1])/s, - (m[2,0] + m[0,2])/s, - (m[1,2] + m[2,1])/s, - s*0.25, - ]) - - @staticmethod - def new_interpolate(q1, q2, t): - # see http://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/20070017872_2007014421.pdf for (another?) way to interpolate quaternions - - assert isinstance(q1, Quaternion) and isinstance(q2, Quaternion) - Q = Quaternion.fromIdentity() - - costheta = q1.w * q2.w + q1.x * q2.x + q1.y * q2.y + q1.z * q2.z - if costheta < 0.: - costheta = -costheta - q1 = q1.conjugated() - elif costheta > 1: - costheta = 1 - - theta = math.acos(costheta) - if abs(theta) < 0.01: - Q.w = q2.w - Q.x = q2.x - Q.y = q2.y - Q.z = q2.z - return Q - - sintheta = math.sqrt(1.0 - costheta * costheta) - if abs(sintheta) < 0.01: - Q.w = (q1.w + q2.w) * 0.5 - Q.x = (q1.x + q2.x) * 0.5 - Q.y = (q1.y + q2.y) * 0.5 - Q.z = (q1.z + q2.z) * 0.5 - return Q - - ratio1 = math.sin((1 - t) * theta) / sintheta - ratio2 = math.sin(t * theta) / sintheta - - Q.w = q1.w * ratio1 + q2.w * ratio2 - Q.x = q1.x * ratio1 + q2.x * ratio2 - Q.y = q1.y * ratio1 + q2.y * ratio2 - Q.z = q1.z * ratio1 + q2.z * ratio2 - return Q - -## -# Define lattice_type to make it easier for future -# development -cdef enum lattice_type: - NONE = 0 - ORTHORHOMBIC= 1 - TETRAGONAL = 2 - HEXAGONAL = 3 - CUBIC = 4 -## -# Symmetry class -cdef class Symmetry: - cdef public lattice_type lattice - # cdef enum LATTICES: - # NONE = 0 - # ORTHORHOMBIC= 1 - # TETRAGONAL = 2 - # HEXAGONAL = 3 - # CUBIC = 4 - - def __init__(self, symmetry): - if symmetry == 0 or symmetry == None: - self.lattice = NONE - elif symmetry == 1 or symmetry == 'orthorhombic': - self.lattice = ORTHORHOMBIC - elif symmetry == 2 or symmetry == 'tetragonal': - self.lattice = TETRAGONAL - elif symmetry == 3 or symmetry == 'hexagonal': - self.lattice = HEXAGONAL - elif symmetry == 4 or symmetry == 'cubic': - self.lattice = CUBIC - else: - self.lattice = NONE - - def __copy__(self): - return self.__class__(self.lattice) - - copy = __copy__ - - def __repr__(self): - return '{}'.format(self.lattice) - - def __richcmp__(Symmetry self, Symmetry other, int op): - cdef bint tmp - - tmp = self.lattice == other.lattice - if op == 2: #__eq__ - return tmp - elif op ==3: #__ne__ - return not tmp - else: - return NotImplemented - - def __cmp__(self,other): - return cmp(self.lattice,other.lattice) - - def symmetryQuats(self): - ''' - List of symmetry operations as quaternions. - ''' - if self.lattice == 'cubic': - symQuats = [ - [ 1.0, 0.0, 0.0, 0.0 ], - [ 0.0, 1.0, 0.0, 0.0 ], - [ 0.0, 0.0, 1.0, 0.0 ], - [ 0.0, 0.0, 0.0, 1.0 ], - [ 0.0, 0.0, 0.5*math.sqrt(2), 0.5*math.sqrt(2) ], - [ 0.0, 0.0, 0.5*math.sqrt(2),-0.5*math.sqrt(2) ], - [ 0.0, 0.5*math.sqrt(2), 0.0, 0.5*math.sqrt(2) ], - [ 0.0, 0.5*math.sqrt(2), 0.0, -0.5*math.sqrt(2) ], - [ 0.0, 0.5*math.sqrt(2),-0.5*math.sqrt(2), 0.0 ], - [ 0.0, -0.5*math.sqrt(2),-0.5*math.sqrt(2), 0.0 ], - [ 0.5, 0.5, 0.5, 0.5 ], - [-0.5, 0.5, 0.5, 0.5 ], - [-0.5, 0.5, 0.5, -0.5 ], - [-0.5, 0.5, -0.5, 0.5 ], - [-0.5, -0.5, 0.5, 0.5 ], - [-0.5, -0.5, 0.5, -0.5 ], - [-0.5, -0.5, -0.5, 0.5 ], - [-0.5, 0.5, -0.5, -0.5 ], - [-0.5*math.sqrt(2), 0.0, 0.0, 0.5*math.sqrt(2) ], - [ 0.5*math.sqrt(2), 0.0, 0.0, 0.5*math.sqrt(2) ], - [-0.5*math.sqrt(2), 0.0, 0.5*math.sqrt(2), 0.0 ], - [-0.5*math.sqrt(2), 0.0, -0.5*math.sqrt(2), 0.0 ], - [-0.5*math.sqrt(2), 0.5*math.sqrt(2), 0.0, 0.0 ], - [-0.5*math.sqrt(2),-0.5*math.sqrt(2), 0.0, 0.0 ], - ] - elif self.lattice == 'hexagonal': - symQuats = [ - [ 1.0,0.0,0.0,0.0 ], - [-0.5*math.sqrt(3), 0.0, 0.0,-0.5 ], - [ 0.5, 0.0, 0.0, 0.5*math.sqrt(3) ], - [ 0.0,0.0,0.0,1.0 ], - [-0.5, 0.0, 0.0, 0.5*math.sqrt(3) ], - [-0.5*math.sqrt(3), 0.0, 0.0, 0.5 ], - [ 0.0,1.0,0.0,0.0 ], - [ 0.0,-0.5*math.sqrt(3), 0.5, 0.0 ], - [ 0.0, 0.5,-0.5*math.sqrt(3), 0.0 ], - [ 0.0,0.0,1.0,0.0 ], - [ 0.0,-0.5,-0.5*math.sqrt(3), 0.0 ], - [ 0.0, 0.5*math.sqrt(3), 0.5, 0.0 ], - ] - elif self.lattice == 'tetragonal': - symQuats = [ - [ 1.0,0.0,0.0,0.0 ], - [ 0.0,1.0,0.0,0.0 ], - [ 0.0,0.0,1.0,0.0 ], - [ 0.0,0.0,0.0,1.0 ], - [ 0.0, 0.5*math.sqrt(2), 0.5*math.sqrt(2), 0.0 ], - [ 0.0,-0.5*math.sqrt(2), 0.5*math.sqrt(2), 0.0 ], - [ 0.5*math.sqrt(2), 0.0, 0.0, 0.5*math.sqrt(2) ], - [-0.5*math.sqrt(2), 0.0, 0.0, 0.5*math.sqrt(2) ], - ] - elif self.lattice == 'orthorhombic': - symQuats = [ - [ 1.0,0.0,0.0,0.0 ], - [ 0.0,1.0,0.0,0.0 ], - [ 0.0,0.0,1.0,0.0 ], - [ 0.0,0.0,0.0,1.0 ], - ] - else: - symQuats = [ - [ 1.0,0.0,0.0,0.0 ], - ] - - return map(Quaternion,symQuats) - - def equivalentQuaternions(self,quaternion): - ''' - List of symmetrically equivalent quaternions based on own symmetry. - ''' - return [quaternion*Quaternion(q) for q in self.symmetryQuats()] - - def inFZ(self,R): - ''' - Check whether given Rodrigues vector falls into fundamental zone of own symmetry. - ''' - if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentially passed quaternion - R = abs(R) # fundamental zone in Rodrigues space is point symmetric around origin - if self.lattice == CUBIC: - return math.sqrt(2.0)-1.0 >= R[0] \ - and math.sqrt(2.0)-1.0 >= R[1] \ - and math.sqrt(2.0)-1.0 >= R[2] \ - and 1.0 >= R[0] + R[1] + R[2] - elif self.lattice == HEXAGONAL: - return 1.0 >= R[0] and 1.0 >= R[1] and 1.0 >= R[2] \ - and 2.0 >= math.sqrt(3)*R[0] + R[1] \ - and 2.0 >= math.sqrt(3)*R[1] + R[0] \ - and 2.0 >= math.sqrt(3) + R[2] - elif self.lattice == TETRAGONAL: - return 1.0 >= R[0] and 1.0 >= R[1] \ - and math.sqrt(2.0) >= R[0] + R[1] \ - and math.sqrt(2.0) >= R[2] + 1.0 - elif self.lattice == ORTHORHOMBIC: - return 1.0 >= R[0] and 1.0 >= R[1] and 1.0 >= R[2] - else: - return True - - def inDisorientationSST(self,R): - ''' - Check whether given Rodrigues vector (of misorientation) falls into standard stereographic triangle of own symmetry. - Determination of disorientations follow the work of A. Heinz and P. Neumann: - Representation of Orientation and Disorientation Data for Cubic, Hexagonal, Tetragonal and Orthorhombic Crystals - Acta Cryst. (1991). A47, 780-789 - ''' - if isinstance(R, Quaternion): R = R.asRodrigues() # translate accidentally passed quaternion - - cdef double epsilon = 0.0 - - if self.lattice == CUBIC: - return R[0] >= R[1]+epsilon and R[1] >= R[2]+epsilon and R[2] >= epsilon - - elif self.lattice == HEXAGONAL: - return R[0] >= math.sqrt(3)*(R[1]+epsilon) and R[1] >= epsilon and R[2] >= epsilon - - elif self.lattice == TETRAGONAL: - return R[0] >= R[1]+epsilon and R[1] >= epsilon and R[2] >= epsilon - - elif self.lattice == ORTHORHOMBIC: - return R[0] >= epsilon and R[1] >= epsilon and R[2] >= epsilon - - else: - return True - - def inSST(self, - vector, - color = False): - ''' - Check whether given vector falls into standard stereographic triangle of own symmetry. - Return inverse pole figure color if requested. - ''' -# basis = {4 : np.linalg.inv(np.array([[0.,0.,1.], # direction of red -# [1.,0.,1.]/np.sqrt(2.), # direction of green -# [1.,1.,1.]/np.sqrt(3.)]).transpose()), # direction of blue -# 3 : np.linalg.inv(np.array([[0.,0.,1.], # direction of red -# [1.,0.,0.], # direction of green -# [np.sqrt(3.),1.,0.]/np.sqrt(4.)]).transpose()), # direction of blue -# 2 : np.linalg.inv(np.array([[0.,0.,1.], # direction of red -# [1.,0.,0.], # direction of green -# [1.,1.,0.]/np.sqrt(2.)]).transpose()), # direction of blue -# 1 : np.linalg.inv(np.array([[0.,0.,1.], # direction of red -# [1.,0.,0.], # direction of green -# [0.,1.,0.]]).transpose()), # direction of blue -# } - if self.lattice == CUBIC: - basis = np.array([ [-1. , 0. , 1. ], - [ np.sqrt(2.), -np.sqrt(2.), 0. ], - [ 0. , np.sqrt(3.), 0. ] ]) - elif self.lattice == HEXAGONAL: - basis = np.array([ [ 0. , 0. , 1. ], - [ 1. , -np.sqrt(3.), 0. ], - [ 0. , 2. , 0. ] ]) - elif self.lattice == TETRAGONAL: - basis = np.array([ [ 0. , 0. , 1. ], - [ 1. , -1. , 0. ], - [ 0. , np.sqrt(2.), 0. ] ]) - elif self.lattice == ORTHORHOMBIC: - basis = np.array([ [ 0., 0., 1.], - [ 1., 0., 0.], - [ 0., 1., 0.] ]) - else: - basis = np.zeros((3,3),dtype=float) - - if np.all(basis == 0.0): - theComponents = -np.ones(3,'d') - else: - v = np.array(vector,dtype = float) - v[2] = abs(v[2]) # z component projects identical for positive and negative values - theComponents = np.dot(basis,v) - - inSST = np.all(theComponents >= 0.0) - - if color: # have to return color array - if inSST: - rgb = np.power(theComponents/np.linalg.norm(theComponents),0.5) # smoothen color ramps - rgb = np.minimum(np.ones(3,'d'),rgb) # limit to maximum intensity - rgb /= max(rgb) # normalize to (HS)V = 1 - else: - rgb = np.zeros(3,'d') - return (inSST,rgb) - else: - return inSST - -# code derived from http://pyeuclid.googlecode.com/svn/trunk/euclid.py -# suggested reading: http://web.mit.edu/2.998/www/QuaternionReport1.pdf - - -## -# Orientation class is a composite class of Symmetry and Quaternion -cdef class Orientation: - cdef public Quaternion quaternion - cdef public Symmetry symmetry - - def __init__(self, - quaternion = Quaternion.fromIdentity(), - Rodrigues = None, - angleAxis = None, - matrix = None, - Eulers = None, - random = False, # put any integer to have a fixed seed or True for real random - symmetry = None - ): - if random: # produce random orientation - if isinstance(random, bool ): - self.quaternion = Quaternion.fromRandom() - else: - self.quaternion = Quaternion.fromRandom(randomSeed=random) - elif isinstance(Eulers, np.ndarray) and Eulers.shape == (3,): # based on given Euler angles - self.quaternion = Quaternion.fromEulers(Eulers, type='bunge') - elif isinstance(matrix, np.ndarray) : # based on given rotation matrix - self.quaternion = Quaternion.fromMatrix(matrix) - elif isinstance(angleAxis, np.ndarray) and angleAxis.shape == (4,): # based on given angle and rotation axis - self.quaternion = Quaternion.fromAngleAxis(angleAxis[0],angleAxis[1:4]) - elif isinstance(Rodrigues, np.ndarray) and Rodrigues.shape == (3,): # based on given Rodrigues vector - self.quaternion = Quaternion.fromRodrigues(Rodrigues) - elif isinstance(quaternion, Quaternion): # based on given quaternion - self.quaternion = quaternion.homomorph() - elif isinstance(quaternion, np.ndarray) and quaternion.shape == (4,): # based on given quaternion - self.quaternion = Quaternion(quaternion).homomorph() - - self.symmetry = Symmetry(symmetry) - - def __copy__(self): - return self.__class__(quaternion=self.quaternion,symmetry=self.symmetry.lattice) - - copy = __copy__ - - def __repr__(self): - return 'Symmetry: %s\n' % (self.symmetry) + \ - 'Quaternion: %s\n' % (self.quaternion) + \ - 'Matrix:\n%s\n' % ( '\n'.join(['\t'.join(map(str,self.asMatrix()[i,:])) for i in range(3)]) ) + \ - 'Bunge Eulers / deg: %s' % ('\t'.join(map(lambda x:str(np.degrees(x)),self.asEulers('bunge'))) ) - - def asQuaternion(self): - return self.quaternion.asList() - - def asEulers(self,type='bunge'): - return self.quaternion.asEulers(type) - - def asRodrigues(self): - return self.quaternion.asRodrigues() - - def asAngleAxis(self): - return self.quaternion.asAngleAxis() - - def asMatrix(self): - return self.quaternion.asMatrix() - - def inFZ(self): - return self.symmetry.inFZ(self.quaternion.asRodrigues()) - - def equivalentQuaternions(self): - return self.symmetry.equivalentQuaternions(self.quaternion) - - def equivalentOrientations(self): - return map(lambda q: Orientation(quaternion=q,symmetry=self.symmetry.lattice), - self.equivalentQuaternions()) - - - def reduced(self): - '''Transform orientation to fall into fundamental zone according to symmetry''' - for me in self.symmetry.equivalentQuaternions(self.quaternion): - if self.symmetry.inFZ(me.asRodrigues()): break - - return Orientation(quaternion=me,symmetry=self.symmetry.lattice) - - def disorientation_old(self,other): - ''' - Disorientation between myself and given other orientation - (either reduced according to my own symmetry or given one) - ''' - - lowerSymmetry = min(self.symmetry,other.symmetry) - breaker = False - - for me in self.symmetry.equivalentQuaternions(self.quaternion): - me.conjugate() - for they in other.symmetry.equivalentQuaternions(other.quaternion): - theQ = they * me - breaker = lowerSymmetry.inDisorientationSST(theQ.asRodrigues()) #\ -# or lowerSymmetry.inDisorientationSST(theQ.conjugated().asRodrigues()) - if breaker: break - if breaker: break - - return Orientation(quaternion=theQ,symmetry=self.symmetry.lattice) #, me.conjugated(), they - - def disorientation(self,other): - ''' - Disorientation between myself and given other orientation - (currently needs to be of same symmetry. - look into A. Heinz and P. Neumann 1991 for cases with differing sym.) - ''' - if self.symmetry != other.symmetry: - raise TypeError('disorientation between different symmetry classes not supported yet.') - - misQ = self.quaternion.conjugated()*other.quaternion - - for i,sA in enumerate(self.symmetry.symmetryQuats()): - for j,sB in enumerate(other.symmetry.symmetryQuats()): - theQ = sA.conjugated()*misQ*sB - for k in xrange(2): - theQ.conjugate() - hitSST = other.symmetry.inDisorientationSST(theQ) - hitFZ = self.symmetry.inFZ(theQ) - breaker = hitSST and hitFZ - if breaker: break - if breaker: break - if breaker: break - return Orientation(quaternion=theQ,symmetry=self.symmetry.lattice) # disorientation, own sym, other sym, self-->other: True, self<--other: False - - def inversePole(self,axis,SST = True): - ''' - axis rotated according to orientation (using crystal symmetry to ensure location falls into SST) - ''' - - if SST: # pole requested to be within SST - for i,q in enumerate(self.symmetry.equivalentQuaternions(self.quaternion)): # test all symmetric equivalent quaternions - pole = q.conjugated()*axis # align crystal direction to axis - if self.symmetry.inSST(pole): break # found SST version - else: - pole = self.quaternion.conjugated()*axis # align crystal direction to axis - - return pole - - def IPFcolor(self,axis): - ''' TSL color of inverse pole figure for given axis ''' - color = np.zeros(3,'d') - for q in self.symmetry.equivalentQuaternions(self.quaternion): - pole = q.conjugated()*axis # align crystal direction to axis - inSST,color = self.symmetry.inSST(pole,color=True) - if inSST: break - - return color - - @staticmethod - def getAverageOrientation(orientationList): - """ - RETURN THE AVERAGE ORIENTATION - ref: F. Landis Markley, Yang Cheng, John Lucas Crassidis, and Yaakov Oshman. - Averaging Quaternions, - Journal of Guidance, Control, and Dynamics, Vol. 30, No. 4 (2007), pp. 1193-1197. - doi: 10.2514/1.28949 - sample usage: - a = Orientation(Eulers=np.radians([10, 10, 0]), symmetry=3) - b = Orientation(Eulers=np.radians([20, 0, 0]), symmetry=3) - avg = Orientation.getAverageOrientation([a,b]) - NOTE - ---- - No symmetry information is available for the average orientation. - """ - - if not all(isinstance(item, Orientation) for item in orientationList): - raise TypeError("Only instances of Orientation can be averaged.") - - N = len(orientationList) - M = orientationList.pop(0).quaternion.asM() - for o in orientationList: - M += o.quaternion.asM() - eig, vec = np.linalg.eig(M/N) - - return Orientation(quaternion = Quaternion(vec.T[eig.argmax()])) - - def related(self, relationModel, direction, targetSymmetry = None): - - if relationModel not in ['KS','GT','GTdash','NW','Pitsch','Bain']: return None - if int(direction) == 0: return None - - # KS from S. Morito et al./Journal of Alloys and Compounds 5775 (2013) S587-S592 - # GT from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81 - # GT' from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81 - # NW from H. Kitahara et al./Materials Characterization 54 (2005) 378-386 - # Pitsch from Y. He et al./Acta Materialia 53 (2005) 1179-1190 - # Bain from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81 - - variant = int(abs(direction))-1 - (me,other) = (0,1) if direction > 0 else (1,0) - - planes = {'KS': \ - np.array([[[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]],\ - [[ 1, 1, -1],[ 0, 1, 1]]]), - 'GT': \ - np.array([[[ 1, 1, 1],[ 1, 0, 1]],\ - [[ 1, 1, 1],[ 1, 1, 0]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ -1, -1, 1],[ -1, 0, 1]],\ - [[ -1, -1, 1],[ -1, -1, 0]],\ - [[ -1, -1, 1],[ 0, -1, 1]],\ - [[ -1, 1, 1],[ -1, 0, 1]],\ - [[ -1, 1, 1],[ -1, 1, 0]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 1, 0, 1]],\ - [[ 1, -1, 1],[ 1, -1, 0]],\ - [[ 1, -1, 1],[ 0, -1, 1]],\ - [[ 1, 1, 1],[ 1, 1, 0]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 1, 0, 1]],\ - [[ -1, -1, 1],[ -1, -1, 0]],\ - [[ -1, -1, 1],[ 0, -1, 1]],\ - [[ -1, -1, 1],[ -1, 0, 1]],\ - [[ -1, 1, 1],[ -1, 1, 0]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ -1, 0, 1]],\ - [[ 1, -1, 1],[ 1, -1, 0]],\ - [[ 1, -1, 1],[ 0, -1, 1]],\ - [[ 1, -1, 1],[ 1, 0, 1]]]), - 'GTdash': \ - np.array([[[ 7, 17, 17],[ 12, 5, 17]],\ - [[ 17, 7, 17],[ 17, 12, 5]],\ - [[ 17, 17, 7],[ 5, 17, 12]],\ - [[ -7,-17, 17],[-12, -5, 17]],\ - [[-17, -7, 17],[-17,-12, 5]],\ - [[-17,-17, 7],[ -5,-17, 12]],\ - [[ 7,-17,-17],[ 12, -5,-17]],\ - [[ 17, -7,-17],[ 17,-12, -5]],\ - [[ 17,-17, -7],[ 5,-17,-12]],\ - [[ -7, 17,-17],[-12, 5,-17]],\ - [[-17, 7,-17],[-17, 12, -5]],\ - [[-17, 17, -7],[ -5, 17,-12]],\ - [[ 7, 17, 17],[ 12, 17, 5]],\ - [[ 17, 7, 17],[ 5, 12, 17]],\ - [[ 17, 17, 7],[ 17, 5, 12]],\ - [[ -7,-17, 17],[-12,-17, 5]],\ - [[-17, -7, 17],[ -5,-12, 17]],\ - [[-17,-17, 7],[-17, -5, 12]],\ - [[ 7,-17,-17],[ 12,-17, -5]],\ - [[ 17, -7,-17],[ 5, -12,-17]],\ - [[ 17,-17, 7],[ 17, -5,-12]],\ - [[ -7, 17,-17],[-12, 17, -5]],\ - [[-17, 7,-17],[ -5, 12,-17]],\ - [[-17, 17, -7],[-17, 5,-12]]]), - 'NW': \ - np.array([[[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ 1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ -1, 1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ 1, -1, 1],[ 0, 1, 1]],\ - [[ -1, -1, 1],[ 0, 1, 1]],\ - [[ -1, -1, 1],[ 0, 1, 1]],\ - [[ -1, -1, 1],[ 0, 1, 1]]]), - 'Pitsch': \ - np.array([[[ 0, 1, 0],[ -1, 0, 1]],\ - [[ 0, 0, 1],[ 1, -1, 0]],\ - [[ 1, 0, 0],[ 0, 1, -1]],\ - [[ 1, 0, 0],[ 0, -1, -1]],\ - [[ 0, 1, 0],[ -1, 0, -1]],\ - [[ 0, 0, 1],[ -1, -1, 0]],\ - [[ 0, 1, 0],[ -1, 0, -1]],\ - [[ 0, 0, 1],[ -1, -1, 0]],\ - [[ 1, 0, 0],[ 0, -1, -1]],\ - [[ 1, 0, 0],[ 0, -1, 1]],\ - [[ 0, 1, 0],[ 1, 0, -1]],\ - [[ 0, 0, 1],[ -1, 1, 0]]]), - 'Bain': \ - np.array([[[ 1, 0, 0],[ 1, 0, 0]],\ - [[ 0, 1, 0],[ 0, 1, 0]],\ - [[ 0, 0, 1],[ 0, 0, 1]]]), - } - - normals = {'KS': \ - np.array([[[ -1, 0, 1],[ -1, -1, 1]],\ - [[ -1, 0, 1],[ -1, 1, -1]],\ - [[ 0, 1, -1],[ -1, -1, 1]],\ - [[ 0, 1, -1],[ -1, 1, -1]],\ - [[ 1, -1, 0],[ -1, -1, 1]],\ - [[ 1, -1, 0],[ -1, 1, -1]],\ - [[ 1, 0, -1],[ -1, -1, 1]],\ - [[ 1, 0, -1],[ -1, 1, -1]],\ - [[ -1, -1, 0],[ -1, -1, 1]],\ - [[ -1, -1, 0],[ -1, 1, -1]],\ - [[ 0, 1, 1],[ -1, -1, 1]],\ - [[ 0, 1, 1],[ -1, 1, -1]],\ - [[ 0, -1, 1],[ -1, -1, 1]],\ - [[ 0, -1, 1],[ -1, 1, -1]],\ - [[ -1, 0, -1],[ -1, -1, 1]],\ - [[ -1, 0, -1],[ -1, 1, -1]],\ - [[ 1, 1, 0],[ -1, -1, 1]],\ - [[ 1, 1, 0],[ -1, 1, -1]],\ - [[ -1, 1, 0],[ -1, -1, 1]],\ - [[ -1, 1, 0],[ -1, 1, -1]],\ - [[ 0, -1, -1],[ -1, -1, 1]],\ - [[ 0, -1, -1],[ -1, 1, -1]],\ - [[ 1, 0, 1],[ -1, -1, 1]],\ - [[ 1, 0, 1],[ -1, 1, -1]]]), - 'GT': \ - np.array([[[ -5,-12, 17],[-17, -7, 17]],\ - [[ 17, -5,-12],[ 17,-17, -7]],\ - [[-12, 17, -5],[ -7, 17,-17]],\ - [[ 5, 12, 17],[ 17, 7, 17]],\ - [[-17, 5,-12],[-17, 17, -7]],\ - [[ 12,-17, -5],[ 7,-17,-17]],\ - [[ -5, 12,-17],[-17, 7,-17]],\ - [[ 17, 5, 12],[ 17, 17, 7]],\ - [[-12,-17, 5],[ -7,-17, 17]],\ - [[ 5,-12,-17],[ 17, -7,-17]],\ - [[-17, -5, 12],[-17,-17, 7]],\ - [[ 12, 17, 5],[ 7, 17, 17]],\ - [[ -5, 17,-12],[-17, 17, -7]],\ - [[-12, -5, 17],[ -7,-17, 17]],\ - [[ 17,-12, -5],[ 17, -7,-17]],\ - [[ 5,-17,-12],[ 17,-17, -7]],\ - [[ 12, 5, 17],[ 7, 17, 17]],\ - [[-17, 12, -5],[-17, 7,-17]],\ - [[ -5,-17, 12],[-17,-17, 7]],\ - [[-12, 5,-17],[ -7, 17,-17]],\ - [[ 17, 12, 5],[ 17, 7, 17]],\ - [[ 5, 17, 12],[ 17, 17, 7]],\ - [[ 12, -5,-17],[ 7,-17,-17]],\ - [[-17,-12, 5],[-17, 7, 17]]]), - 'GTdash': \ - np.array([[[ 0, 1, -1],[ 1, 1, -1]],\ - [[ -1, 0, 1],[ -1, 1, 1]],\ - [[ 1, -1, 0],[ 1, -1, 1]],\ - [[ 0, -1, -1],[ -1, -1, -1]],\ - [[ 1, 0, 1],[ 1, -1, 1]],\ - [[ 1, -1, 0],[ 1, -1, -1]],\ - [[ 0, 1, -1],[ -1, 1, -1]],\ - [[ 1, 0, 1],[ 1, 1, 1]],\ - [[ -1, -1, 0],[ -1, -1, 1]],\ - [[ 0, -1, -1],[ 1, -1, -1]],\ - [[ -1, 0, 1],[ -1, -1, 1]],\ - [[ -1, -1, 0],[ -1, -1, -1]],\ - [[ 0, -1, 1],[ 1, -1, 1]],\ - [[ 1, 0, -1],[ 1, 1, -1]],\ - [[ -1, 1, 0],[ -1, 1, 1]],\ - [[ 0, 1, 1],[ -1, 1, 1]],\ - [[ -1, 0, -1],[ -1, -1, -1]],\ - [[ -1, 1, 0],[ -1, 1, -1]],\ - [[ 0, -1, 1],[ -1, -1, 1]],\ - [[ -1, 0, -1],[ -1, 1, -1]],\ - [[ 1, 1, 0],[ 1, 1, 1]],\ - [[ 0, 1, 1],[ 1, 1, 1]],\ - [[ 1, 0, -1],[ 1, -1, -1]],\ - [[ 1, 1, 0],[ 1, 1, -1]]]), - 'NW': \ - np.array([[[ 2, -1, -1],[ 0, -1, 1]],\ - [[ -1, 2, -1],[ 0, -1, 1]],\ - [[ -1, -1, 2],[ 0, -1, 1]],\ - [[ -2, -1, -1],[ 0, -1, 1]],\ - [[ 1, 2, -1],[ 0, -1, 1]],\ - [[ 1, -1, 2],[ 0, -1, 1]],\ - [[ 2, 1, -1],[ 0, -1, 1]],\ - [[ -1, -2, -1],[ 0, -1, 1]],\ - [[ -1, 1, 2],[ 0, -1, 1]],\ - [[ -1, 2, 1],[ 0, -1, 1]],\ - [[ -1, 2, 1],[ 0, -1, 1]],\ - [[ -1, -1, -2],[ 0, -1, 1]]]), - 'Pitsch': \ - np.array([[[ 1, 0, 1],[ 1, -1, 1]],\ - [[ 1, 1, 0],[ 1, 1, -1]],\ - [[ 0, 1, 1],[ -1, 1, 1]],\ - [[ 0, 1, -1],[ -1, 1, -1]],\ - [[ -1, 0, 1],[ -1, -1, 1]],\ - [[ 1, -1, 0],[ 1, -1, -1]],\ - [[ 1, 0, -1],[ 1, -1, -1]],\ - [[ -1, 1, 0],[ -1, 1, -1]],\ - [[ 0, -1, 1],[ -1, -1, 1]],\ - [[ 0, 1, 1],[ -1, 1, 1]],\ - [[ 1, 0, 1],[ 1, -1, 1]],\ - [[ 1, 1, 0],[ 1, 1, -1]]]), - 'Bain': \ - np.array([[[ 0, 1, 0],[ 0, 1, 1]], - [[ 0, 0, 1],[ 1, 0, 1]], - [[ 1, 0, 0],[ 1, 1, 0]]]), - } - myPlane = [float(i) for i in planes[relationModel][variant,me]] # map(float, planes[...]) does not work in python 3 - myPlane /= np.linalg.norm(myPlane) - myNormal = [float(i) for i in normals[relationModel][variant,me]] # map(float, planes[...]) does not work in python 3 - myNormal /= np.linalg.norm(myNormal) - myMatrix = np.array([myPlane,myNormal,np.cross(myPlane,myNormal)]) - - otherPlane = [float(i) for i in planes[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3 - otherPlane /= np.linalg.norm(otherPlane) - otherNormal = [float(i) for i in normals[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3 - otherNormal /= np.linalg.norm(otherNormal) - otherMatrix = np.array([otherPlane,otherNormal,np.cross(otherPlane,otherNormal)]) - - rot=np.dot(otherMatrix.T,myMatrix) - - return Orientation(matrix=np.dot(rot,self.asMatrix())) # no symmetry information ?? \ No newline at end of file diff --git a/lib/damask/environment.py b/lib/damask/environment.py index 8ceb093dd..a37f9dc5c 100644 --- a/lib/damask/environment.py +++ b/lib/damask/environment.py @@ -1,16 +1,13 @@ # -*- coding: UTF-8 no BOM -*- - -import os,subprocess,shlex +import os,subprocess,shlex,re class Environment(): __slots__ = [ \ - 'rootRelation', 'options', ] - def __init__(self,rootRelation = '.'): - self.rootRelation = rootRelation + def __init__(self): self.options = {} self.get_options() @@ -21,17 +18,14 @@ class Environment(): return os.path.normpath(os.path.join(os.path.realpath(__file__),'../../../')) def get_options(self): - if os.path.isfile(os.path.join(os.getenv('HOME'),'.damask/damask.conf')): - configFile = os.path.join(os.getenv('HOME'),'.damask/damask.conf') - else: - configFile = '/etc/damask.conf' - with open(self.relPath(configFile)) as file: - for line in file: - l = line.strip() - if not (l.startswith('#') or l == ''): - items = l.split('=') + ['',''] - if items[1] != '': # nothing specified - self.options[items[0].upper()] = items[1] + with open(self.relPath(self.rootDir()+'/CONFIG')) as configFile: + for line in configFile: + l = re.sub('^set ', '', line).strip() # remove "set" (tcsh) when setting variables + if l and not l.startswith('#'): + items = re.split(r'\s*=\s*',l) + if len(items) == 2: + self.options[items[0].upper()] = \ + re.sub('\$\{*DAMASK_ROOT\}*',self.rootDir(),os.path.expandvars(items[1])) # expand all shell variables and DAMASK_ROOT def isAvailable(self,software,Nneeded =-1): licensesNeeded = {'abaqus' :5, @@ -41,7 +35,7 @@ class Environment(): try: cmd = """ ssh mulicense2 "/Stat_Flexlm | grep 'Users of %s: ' | cut -d' ' -f7,13" """%software process = subprocess.Popen(shlex.split(cmd),stdout = subprocess.PIPE,stderr = subprocess.PIPE) - licenses = map(int, process.stdout.readline().split()) + licenses = list(map(int, process.stdout.readline().split())) try: if licenses[0]-licenses[1] >= Nneeded: return 0 diff --git a/lib/damask/geometry/geometry.py b/lib/damask/geometry/geometry.py index cfefa51aa..0976299e3 100644 --- a/lib/damask/geometry/geometry.py +++ b/lib/damask/geometry/geometry.py @@ -15,7 +15,7 @@ class Geometry(): 'spectral': damask.geometry.Spectral, 'marc': damask.geometry.Marc, } - if solver.lower() in solverClass.keys(): + if solver.lower() in list(solverClass.keys()): self.__class__=solverClass[solver.lower()] self.__init__() diff --git a/lib/damask/h5table.py b/lib/damask/h5table.py new file mode 100644 index 000000000..67d5853b6 --- /dev/null +++ b/lib/damask/h5table.py @@ -0,0 +1,146 @@ +# -*- coding: UTF-8 no BOM -*- + +# ----------------------------------------------------------- # +# Ideally the h5py should be enough to serve as the data # +# interface for future DAMASK, but since we are still not # +# sure when this major shift will happen, it seems to be a # +# good idea to provide a interface class that help user ease # +# into using HDF5 as the new daily storage driver. # +# ----------------------------------------------------------- # + +import os +import h5py +import numpy as np +import xml.etree.cElementTree as ET + +# ---------------------------------------------------------------- # +# python 3 has no unicode object, this ensures that the code works # +# on Python 2&3 # +# ---------------------------------------------------------------- # +try: + test = isinstance('test', unicode) +except(NameError): + unicode = str + + +def lables_to_path(label, dsXMLPath=None): + """Read the XML definition file and return the path.""" + if dsXMLPath is None: + # use the default storage layout in DS_HDF5.xml + if "h5table.pyc" in __file__: + dsXMLPath = os.path.abspath(__file__).replace("h5table.pyc", + "DS_HDF5.xml") + else: + dsXMLPath = os.path.abspath(__file__).replace("h5table.py", + "DS_HDF5.xml") + # This current implementation requires that all variables + # stay under the root node, the nesting is defined through the + # h5path. + # Allow new derived data to be put under the root + tree = ET.parse(dsXMLPath) + try: + dataType = tree.find('{}/type'.format(label)).text + h5path = tree.find('{}/h5path'.format(label)).text + except: + dataType = "Scalar" + h5path = "/{}".format(label) # just put it under root + return (dataType, h5path) + + +class H5Table(object): + """ + Lightweight interface class for h5py + + DESCRIPTION + ----------- + Interface/wrapper class for manipulating data in HDF5 with DAMASK + specialized data structure. + --> try to maintain a minimal API design. + PARAMETERS + ---------- + h5f_path: str + Absolute path of the HDF5 file + METHOD + ------ + del_entry() -- Force delete attributes/group/datasets (dangerous) + get_attr() -- Return attributes if possible + add_attr() -- Add NEW attributes to dataset/group (no force overwrite) + get_data() -- Retrieve data in numpy.ndarray + add_data() -- Add dataset to H5 file + get_cmdlog() -- Return the command used to generate the data if possible + NOTE + ---- + 1. As an interface class, it uses the lazy evaluation design + that reads the data only when it is absolutely necessary. + 2. The command line used to generate each new feature is stored with + each dataset as dataset attribute. + + """ + + def __init__(self, h5f_path, new_file=False, dsXMLFile=None): + self.h5f_path = h5f_path + self.dsXMLFile = dsXMLFile + msg = 'Created by H5Talbe from DAMASK' + mode = 'w' if new_file else 'a' + with h5py.File(self.h5f_path, mode) as h5f: + h5f['/'].attrs['description'] = msg + + def del_entry(self, feature_name): + """Delete entry in HDF5 table""" + dataType, h5f_path = lables_to_path(feature_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + del h5f[h5f_path] + + def get_attr(self, attr_name): + dataType, h5f_path = lables_to_path(attr_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + rst_attr = h5f[h5f_path].attrs[attr_name] + return rst_attr + + def add_attr(self, attr_name, attr_data): + dataType, h5f_path = lables_to_path(attr_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + h5f[h5f_path].attrs[attr_name] = attr_data + h5f.flush() + + def get_data(self, feature_name=None): + """Extract dataset from HDF5 table and return it in a numpy array""" + dataType, h5f_path = lables_to_path(feature_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + h5f_dst = h5f[h5f_path] # get the handle for target dataset(table) + rst_data = np.zeros(h5f_dst.shape) + h5f_dst.read_direct(rst_data) + return rst_data + + def add_data(self, feature_name, dataset, cmd_log=None): + """Adding new feature into existing HDF5 file""" + dataType, h5f_path = lables_to_path(feature_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + # NOTE: + # --> If dataset exists, delete the old one so as to write + # a new one. For brand new dataset. For brand new one, + # record its state as fresh in the cmd log. + try: + del h5f[h5f_path] + print("***deleting old {} from {}".format(feature_name,self.h5f_path)) + except: + # if no cmd log, None will used + cmd_log = str(cmd_log) + " [FRESH]" + h5f.create_dataset(h5f_path, data=dataset) + # store the cmd in log is possible + if cmd_log is not None: + h5f[h5f_path].attrs['log'] = str(cmd_log) + h5f.flush() + + def get_cmdlog(self, feature_name): + """Get cmd history used to generate the feature""" + dataType, h5f_path = lables_to_path(feature_name, + dsXMLPath=self.dsXMLFile) + with h5py.File(self.h5f_path, 'a') as h5f: + cmd_logs = h5f[h5f_path].attrs['log'] + return cmd_logs diff --git a/lib/damask/orientation.py b/lib/damask/orientation.py index 886cd5a36..7d97d2c81 100644 --- a/lib/damask/orientation.py +++ b/lib/damask/orientation.py @@ -28,21 +28,21 @@ class Rodrigues: # ****************************************************************************************** class Quaternion: """ - Orientation represented as unit quaternion + Orientation represented as unit quaternion. - All methods and naming conventions based on http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions + All methods and naming conventions based on http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions. - w is the real part, (x, y, z) are the imaginary parts + w is the real part, (x, y, z) are the imaginary parts. Representation of rotation is in ACTIVE form! - (derived directly or through angleAxis, Euler angles, or active matrix) - vector "a" (defined in coordinate system "A") is actively rotated to new coordinates "b" + (Derived directly or through angleAxis, Euler angles, or active matrix) + Vector "a" (defined in coordinate system "A") is actively rotated to new coordinates "b". b = Q * a b = np.dot(Q.asMatrix(),a) """ def __init__(self, quatArray = [1.0,0.0,0.0,0.0]): - """initializes to identity if not given""" + """Initializes to identity if not given""" self.w, \ self.x, \ self.y, \ @@ -50,23 +50,23 @@ class Quaternion: self.homomorph() def __iter__(self): - """components""" + """Components""" return iter([self.w,self.x,self.y,self.z]) def __copy__(self): - """create copy""" + """Create copy""" Q = Quaternion([self.w,self.x,self.y,self.z]) return Q copy = __copy__ def __repr__(self): - """readbable string""" + """Readbable string""" return 'Quaternion(real=%+.6f, imag=<%+.6f, %+.6f, %+.6f>)' % \ (self.w, self.x, self.y, self.z) def __pow__(self, exponent): - """power""" + """Power""" omega = math.acos(self.w) vRescale = math.sin(exponent*omega)/math.sin(omega) Q = Quaternion() @@ -77,7 +77,7 @@ class Quaternion: return Q def __ipow__(self, exponent): - """in place power""" + """In-place power""" omega = math.acos(self.w) vRescale = math.sin(exponent*omega)/math.sin(omega) self.w = np.cos(exponent*omega) @@ -87,7 +87,7 @@ class Quaternion: return self def __mul__(self, other): - """multiplication""" + """Multiplication""" try: # quaternion Aw = self.w Ax = self.x @@ -135,26 +135,26 @@ class Quaternion: return self.copy() def __imul__(self, other): - """in place multiplication""" + """In-place multiplication""" try: # Quaternion + Aw = self.w Ax = self.x Ay = self.y Az = self.z - Aw = self.w + Bw = other.w Bx = other.x By = other.y Bz = other.z - Bw = other.w - self.x = Ax * Bw + Ay * Bz - Az * By + Aw * Bx - self.y = -Ax * Bz + Ay * Bw + Az * Bx + Aw * By - self.z = Ax * By - Ay * Bx + Az * Bw + Aw * Bz - self.w = -Ax * Bx - Ay * By - Az * Bz + Aw * Bw + self.w = - Ax * Bx - Ay * By - Az * Bz + Aw * Bw + self.x = + Ax * Bw + Ay * Bz - Az * By + Aw * Bx + self.y = - Ax * Bz + Ay * Bw + Az * Bx + Aw * By + self.z = + Ax * By - Ay * Bx + Az * Bw + Aw * Bz except: pass return self def __div__(self, other): - """division""" - if isinstance(other, (int,float,long)): + """Division""" + if isinstance(other, (int,float)): w = self.w / other x = self.x / other y = self.y / other @@ -164,8 +164,8 @@ class Quaternion: return NotImplemented def __idiv__(self, other): - """in place division""" - if isinstance(other, (int,float,long)): + """In-place division""" + if isinstance(other, (int,float)): self.w /= other self.x /= other self.y /= other @@ -173,7 +173,7 @@ class Quaternion: return self def __add__(self, other): - """addition""" + """Addition""" if isinstance(other, Quaternion): w = self.w + other.w x = self.x + other.x @@ -184,7 +184,7 @@ class Quaternion: return NotImplemented def __iadd__(self, other): - """in place division""" + """In-place addition""" if isinstance(other, Quaternion): self.w += other.w self.x += other.x @@ -193,7 +193,7 @@ class Quaternion: return self def __sub__(self, other): - """subtraction""" + """Subtraction""" if isinstance(other, Quaternion): Q = self.copy() Q.w -= other.w @@ -205,7 +205,7 @@ class Quaternion: return self.copy() def __isub__(self, other): - """in place subtraction""" + """In-place subtraction""" if isinstance(other, Quaternion): self.w -= other.w self.x -= other.x @@ -214,7 +214,7 @@ class Quaternion: return self def __neg__(self): - """additive inverse""" + """Additive inverse""" self.w = -self.w self.x = -self.x self.y = -self.y @@ -222,7 +222,7 @@ class Quaternion: return self def __abs__(self): - """norm""" + """Norm""" return math.sqrt(self.w ** 2 + \ self.x ** 2 + \ self.y ** 2 + \ @@ -231,7 +231,7 @@ class Quaternion: magnitude = __abs__ def __eq__(self,other): - """equal at e-8 precision""" + """Equal at e-8 precision""" return (abs(self.w-other.w) < 1e-8 and \ abs(self.x-other.x) < 1e-8 and \ abs(self.y-other.y) < 1e-8 and \ @@ -243,12 +243,12 @@ class Quaternion: abs(-self.z-other.z) < 1e-8) def __ne__(self,other): - """not equal at e-8 precision""" + """Not equal at e-8 precision""" return not self.__eq__(self,other) def __cmp__(self,other): - """linear ordering""" - return cmp(self.Rodrigues(),other.Rodrigues()) + """Linear ordering""" + return (self.Rodrigues()>other.Rodrigues()) - (self.Rodrigues() otherOrder) - (myOrder < otherOrder) def symmetryQuats(self,who = []): """List of symmetry operations as quaternions.""" @@ -650,8 +655,8 @@ class Symmetry: [ 1.0,0.0,0.0,0.0 ], ] - return map(Quaternion, - np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else xrange(len(symQuats))]) + return list(map(Quaternion, + np.array(symQuats)[np.atleast_1d(np.array(who)) if who != [] else range(len(symQuats))])) def equivalentQuaternions(self, @@ -739,56 +744,53 @@ class Symmetry: if self.lattice == 'cubic': basis = {'improper':np.array([ [-1. , 0. , 1. ], - [ np.sqrt(2.) , -np.sqrt(2.) , 0. ], - [ 0. , np.sqrt(3.) , 0. ] ]), - 'proper':np.array([ [ 0. , -1. , 1. ], - [-np.sqrt(2.) , np.sqrt(2.) , 0. ], - [ np.sqrt(3.) , 0. , 0. ] ]), + [ np.sqrt(2.) , -np.sqrt(2.) , 0. ], + [ 0. , np.sqrt(3.) , 0. ] ]), + 'proper':np.array([ [ 0. , -1. , 1. ], + [-np.sqrt(2.) , np.sqrt(2.) , 0. ], + [ np.sqrt(3.) , 0. , 0. ] ]), } elif self.lattice == 'hexagonal': basis = {'improper':np.array([ [ 0. , 0. , 1. ], - [ 1. , -np.sqrt(3.), 0. ], - [ 0. , 2. , 0. ] ]), - 'proper':np.array([ [ 0. , 0. , 1. ], - [-1. , np.sqrt(3.) , 0. ], - [ np.sqrt(3) , -1. , 0. ] ]), + [ 1. , -np.sqrt(3.) , 0. ], + [ 0. , 2. , 0. ] ]), + 'proper':np.array([ [ 0. , 0. , 1. ], + [-1. , np.sqrt(3.) , 0. ], + [ np.sqrt(3.) , -1. , 0. ] ]), } elif self.lattice == 'tetragonal': basis = {'improper':np.array([ [ 0. , 0. , 1. ], - [ 1. , -1. , 0. ], - [ 0. , np.sqrt(2.), 0. ] ]), - 'proper':np.array([ [ 0. , 0. , 1. ], - [-1. , 1. , 0. ], - [ np.sqrt(2.) , 0. , 0. ] ]), + [ 1. , -1. , 0. ], + [ 0. , np.sqrt(2.) , 0. ] ]), + 'proper':np.array([ [ 0. , 0. , 1. ], + [-1. , 1. , 0. ], + [ np.sqrt(2.) , 0. , 0. ] ]), } elif self.lattice == 'orthorhombic': basis = {'improper':np.array([ [ 0., 0., 1.], - [ 1., 0., 0.], - [ 0., 1., 0.] ]), - 'proper':np.array([ [ 0., 0., 1.], - [-1., 0., 0.], - [ 0., 1., 0.] ]), - } - else: - basis = {'improper':np.zeros((3,3),dtype=float), - 'proper':np.zeros((3,3),dtype=float), + [ 1., 0., 0.], + [ 0., 1., 0.] ]), + 'proper':np.array([ [ 0., 0., 1.], + [-1., 0., 0.], + [ 0., 1., 0.] ]), } + else: # direct exit for unspecified symmetry + if color: + return (True,np.zeros(3,'d')) + else: + return True - if np.all(basis == 0.0): - theComponents = -np.ones(3,'d') + v = np.array(vector,dtype = float) + if proper: # check both improper ... + theComponents = np.dot(basis['improper'],v) inSST = np.all(theComponents >= 0.0) - else: - v = np.array(vector,dtype = float) - if proper: # check both improper ... - theComponents = np.dot(basis['improper'],v) - inSST = np.all(theComponents >= 0.0) - if not inSST: # ... and proper SST - theComponents = np.dot(basis['proper'],v) - inSST = np.all(theComponents >= 0.0) - else: - v[2] = abs(v[2]) # z component projects identical - theComponents = np.dot(basis['improper'],v) # for positive and negative values + if not inSST: # ... and proper SST + theComponents = np.dot(basis['proper'],v) inSST = np.all(theComponents >= 0.0) + else: + v[2] = abs(v[2]) # z component projects identical + theComponents = np.dot(basis['improper'],v) # for positive and negative values + inSST = np.all(theComponents >= 0.0) if color: # have to return color array if inSST: @@ -801,7 +803,7 @@ class Symmetry: else: return inSST -# code derived from http://pyeuclid.googlecode.com/svn/trunk/euclid.py +# code derived from https://github.com/ezag/pyeuclid # suggested reading: http://web.mit.edu/2.998/www/QuaternionReport1.pdf @@ -819,6 +821,7 @@ class Orientation: Eulers = None, random = False, # integer to have a fixed seed or True for real random symmetry = None, + degrees = False, ): if random: # produce random orientation if isinstance(random, bool ): @@ -826,29 +829,29 @@ class Orientation: else: self.quaternion = Quaternion.fromRandom(randomSeed=random) elif isinstance(Eulers, np.ndarray) and Eulers.shape == (3,): # based on given Euler angles - self.quaternion = Quaternion.fromEulers(Eulers,'bunge') + self.quaternion = Quaternion.fromEulers(Eulers,type='bunge',degrees=degrees) elif isinstance(matrix, np.ndarray) : # based on given rotation matrix self.quaternion = Quaternion.fromMatrix(matrix) elif isinstance(angleAxis, np.ndarray) and angleAxis.shape == (4,): # based on given angle and rotation axis - self.quaternion = Quaternion.fromAngleAxis(angleAxis[0],angleAxis[1:4]) + self.quaternion = Quaternion.fromAngleAxis(angleAxis[0],angleAxis[1:4],degrees=degrees) elif isinstance(Rodrigues, np.ndarray) and Rodrigues.shape == (3,): # based on given Rodrigues vector self.quaternion = Quaternion.fromRodrigues(Rodrigues) elif isinstance(quaternion, Quaternion): # based on given quaternion self.quaternion = quaternion.homomorphed() - elif isinstance(quaternion, np.ndarray) and quaternion.shape == (4,): # based on given quaternion + elif isinstance(quaternion, np.ndarray) and quaternion.shape == (4,): # based on given quaternion-like array self.quaternion = Quaternion(quaternion).homomorphed() self.symmetry = Symmetry(symmetry) def __copy__(self): - """copy""" + """Copy""" return self.__class__(quaternion=self.quaternion,symmetry=self.symmetry.lattice) copy = __copy__ def __repr__(self): - """value as all implemented representations""" + """Value as all implemented representations""" return 'Symmetry: %s\n' % (self.symmetry) + \ 'Quaternion: %s\n' % (self.quaternion) + \ 'Matrix:\n%s\n' % ( '\n'.join(['\t'.join(map(str,self.asMatrix()[i,:])) for i in range(3)]) ) + \ @@ -887,8 +890,7 @@ class Orientation: def equivalentOrientations(self, who = []): - return map(lambda q: Orientation(quaternion = q, symmetry = self.symmetry.lattice), - self.equivalentQuaternions(who)) + return [Orientation(quaternion = q, symmetry = self.symmetry.lattice) for q in self.equivalentQuaternions(who)] def reduced(self): """Transform orientation to fall into fundamental zone according to symmetry""" @@ -917,7 +919,7 @@ class Orientation: for i,sA in enumerate(mySymQs): for j,sB in enumerate(otherSymQs): theQ = sA.conjugated()*misQ*sB - for k in xrange(2): + for k in range(2): theQ.conjugate() breaker = self.symmetry.inFZ(theQ) \ and (not SST or other.symmetry.inDisorientationSST(theQ)) @@ -934,7 +936,7 @@ class Orientation: axis, proper = False, SST = True): - """axis rotated according to orientation (using crystal symmetry to ensure location falls into SST)""" + """Axis rotated according to orientation (using crystal symmetry to ensure location falls into SST)""" if SST: # pole requested to be within SST for i,q in enumerate(self.symmetry.equivalentQuaternions(self.quaternion)): # test all symmetric equivalent quaternions pole = q.conjugated()*axis # align crystal direction to axis @@ -960,7 +962,7 @@ class Orientation: orientations, multiplicity = []): """ - average orientation + Average orientation ref: F. Landis Markley, Yang Cheng, John Lucas Crassidis, and Yaakov Oshman. Averaging Quaternions, @@ -991,12 +993,18 @@ class Orientation: def related(self, relationModel, direction, - targetSymmetry = None): + targetSymmetry = 'cubic'): + """ + Orientation relationship + positive number: fcc --> bcc + negative number: bcc --> fcc + """ if relationModel not in ['KS','GT','GTdash','NW','Pitsch','Bain']: return None if int(direction) == 0: return None - # KS from S. Morito et al./Journal of Alloys and Compounds 5775 (2013) S587-S592 DOES THIS PAPER EXISTS? + # KS from S. Morito et al./Journal of Alloys and Compounds 5775 (2013) S587-S592 + # for KS rotation matrices also check K. Kitahara et al./Acta Materialia 54 (2006) 1279-1288 # GT from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81 # GT' from Y. He et al./Journal of Applied Crystallography (2006). 39, 72-81 # NW from H. Kitahara et al./Materials Characterization 54 (2005) 378-386 @@ -1223,14 +1231,14 @@ class Orientation: myPlane /= np.linalg.norm(myPlane) myNormal = [float(i) for i in normals[relationModel][variant,me]] # map(float, planes[...]) does not work in python 3 myNormal /= np.linalg.norm(myNormal) - myMatrix = np.array([myPlane,myNormal,np.cross(myPlane,myNormal)]) + myMatrix = np.array([myNormal,np.cross(myPlane,myNormal),myPlane]).T otherPlane = [float(i) for i in planes[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3 otherPlane /= np.linalg.norm(otherPlane) otherNormal = [float(i) for i in normals[relationModel][variant,other]] # map(float, planes[...]) does not work in python 3 otherNormal /= np.linalg.norm(otherNormal) - otherMatrix = np.array([otherPlane,otherNormal,np.cross(otherPlane,otherNormal)]) + otherMatrix = np.array([otherNormal,np.cross(otherPlane,otherNormal),otherPlane]).T - rot=np.dot(otherMatrix.T,myMatrix) + rot=np.dot(otherMatrix,myMatrix.T) - return Orientation(matrix=np.dot(rot,self.asMatrix())) # no symmetry information ?? + return Orientation(matrix=np.dot(rot,self.asMatrix()),symmetry=targetSymmetry) diff --git a/lib/damask/result.py b/lib/damask/result.py index 350495a33..234e317db 100644 --- a/lib/damask/result.py +++ b/lib/damask/result.py @@ -1,8 +1,6 @@ # -*- coding: UTF-8 no BOM -*- - import numpy as np -#import sys try: import h5py @@ -19,19 +17,19 @@ class Result(): def __init__(self,resultsFile): self.data=h5py.File(resultsFile,"r") self.Npoints=self.data.attrs['Number of Materialpoints'] - print("Opened "+resultsFile+" with %i points"%self.Npoints) + print("Opened {} with {} points".format(resultsFile,self.Npoints)) def getCrystallite(self,labels,inc,constituent=1,points=None): - if points is None: points = np.array(np.array(xrange(self.Npoints))) + if points is None: points = np.array(np.array(range(self.Npoints))) results = {} mapping=self.data['mapping/crystallite'] for instance in self.data['increments/%s/crystallite/'%inc]: - dsets = self.data['increments/%s/crystallite/%s'%(inc,instance)].keys() + dsets = list(self.data['increments/%s/crystallite/%s'%(inc,instance)].keys()) for label in labels: if label in dsets and label not in results: shape = np.shape(self.data['increments/%s/crystallite/%s/%s'%(inc,instance,label)])[1:] results[label] = np.nan*np.ones(np.array((self.Npoints,)+shape)) - for myPoint in xrange(len(points)): + for myPoint in range(len(points)): matPoint = points[myPoint] pos = mapping[matPoint,constituent-1] if pos[0] != 0: @@ -41,5 +39,3 @@ class Result(): except: pass return results - - diff --git a/lib/damask/result/marc2vtk.py b/lib/damask/result/marc2vtk.py index a04c710d7..f712bd963 100644 --- a/lib/damask/result/marc2vtk.py +++ b/lib/damask/result/marc2vtk.py @@ -13,7 +13,6 @@ import numpy as np import py_post # MSC closed source module to access marc result files class MARC_POST(): - import re def __init__(self): self.projdir='./' @@ -383,7 +382,6 @@ class VTK_WRITER(): to plot semi-transparent iso-surfaces. """ - import re def __init__(self): self.p=MARC_POST() # self.p diff --git a/lib/damask/setup_corientation.py b/lib/damask/setup_corientation.py deleted file mode 100755 index 2cf0be196..000000000 --- a/lib/damask/setup_corientation.py +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 no BOM -*- - -from distutils.core import setup -from distutils.extension import Extension -from Cython.Distutils import build_ext -import numpy as np - -ext = [Extension("corientation", ["corientation.pyx"], - include_dirs=[np.get_include()])] - -setup( - name="corientation", - include_dirs=[np.get_include()], - cmdclass = {'build_ext': build_ext}, - ext_modules=ext -) \ No newline at end of file diff --git a/lib/damask/solver/abaqus.py b/lib/damask/solver/abaqus.py index 0a872bc7a..c1777b4bf 100644 --- a/lib/damask/solver/abaqus.py +++ b/lib/damask/solver/abaqus.py @@ -1,19 +1,14 @@ # -*- coding: UTF-8 no BOM -*- - from .solver import Solver - +import damask class Abaqus(Solver): - def __init__(self,version='',solver=''): # example version string: 6.12-2, solver: std or exp self.solver='Abaqus' if version =='': - import subprocess - process = subprocess.Popen(['abaqus', 'information=release'],stdout = subprocess.PIPE,stderr = subprocess.PIPE) - self.version = process.stdout.readlines()[1].split()[1] - print self.version + version = damask.Environment().options['ABAQUS_VERSION'] else: self.version = version @@ -27,7 +22,6 @@ class Abaqus(Solver): def return_run_command(self,model): import subprocess import re - import damask env=damask.Environment() shortVersion = re.sub('[\.,-]', '',self.version) try: @@ -40,6 +34,3 @@ class Abaqus(Solver): if self.version != detectedVersion: raise Exception('found Abaqus version %s, but requested %s'%(detectedVersion,self.version)) return '%s -job %s -user %s/code/DAMASK_abaqus_%s interactive'%(cmd,model,env.rootDir(),self.solver) - - - diff --git a/lib/damask/solver/marc.py b/lib/damask/solver/marc.py index e693783f6..873d08cdb 100644 --- a/lib/damask/solver/marc.py +++ b/lib/damask/solver/marc.py @@ -9,23 +9,23 @@ class Marc(Solver): def __init__(self): self.solver = 'Marc' self.releases = { \ + '2016': ['linux64',''], '2015': ['linux64',''], '2014.2':['linux64',''], '2014' :['linux64',''], '2013.1':['linux64',''], '2013': ['linux64',''], '2012': ['linux64',''], - '2011': ['linux64',''], } #-------------------------- - def version(self,rootRelation = ''): + def version(self): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] - for release,subdirs in sorted(self.releases.items(),reverse=True): + for release,subdirs in sorted(list(self.releases.items()),reverse=True): for subdir in subdirs: path = '%s/mentat%s/shlib/%s'%(MSCpath,release,subdir) if os.path.exists(path): return release @@ -35,12 +35,12 @@ class Marc(Solver): #-------------------------- - def libraryPath(self,rootRelation = '',releases = []): + def libraryPath(self,releases = []): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] - if len(releases) == 0: releases = self.releases.keys() + if len(releases) == 0: releases = list(self.releases.keys()) if type(releases) is not list: releases = [releases] for release in sorted(releases,reverse=True): if release not in self.releases: continue @@ -53,12 +53,12 @@ class Marc(Solver): #-------------------------- - def toolsPath(self,rootRelation = '',release = ''): + def toolsPath(self,release = ''): import os,damask.environment - MSCpath = damask.environment.Environment(rootRelation).options['MSC_ROOT'] + MSCpath = damask.environment.Environment().options['MSC_ROOT'] - if len(release) == 0: release = self.version(rootRelation) + if len(release) == 0: release = self.version() path = '%s/marc%s/tools'%(MSCpath,release) if os.path.exists(path): return path else: return '' @@ -66,7 +66,6 @@ class Marc(Solver): #-------------------------- def submit_job(self, - rootRelation = '', release = '', model = 'model', job = 'job1', @@ -79,13 +78,13 @@ class Marc(Solver): import os,damask.environment import subprocess,shlex - if len(release) == 0: release = self.version(rootRelation) + if len(release) == 0: release = self.version() if release not in self.releases: raise Exception("Unknown MSC.Marc Version %s"%release) - damaskEnv = damask.environment.Environment(rootRelation) + damaskEnv = damask.environment.Environment() user = os.path.join(damaskEnv.relPath('code/'),'DAMASK_marc') # might be updated if special version (symlink) is found if compile: @@ -99,7 +98,7 @@ class Marc(Solver): script = 'run_damask%s'%({False:'',True:'_'}[optimization!='' or openMP]) script = script+'%s%s'%({False:'',True:optimization}[optimization!=''],{False:'',True:'mp'}[openMP]) - cmd = os.path.join(self.toolsPath(rootRelation,release),script) + \ + cmd = os.path.join(self.toolsPath(release),script) + \ ' -jid ' + model + '_' + job + \ ' -nprocd 1 -autorst 0 -ci n -cr n -dcoup 0 -b no -v no' diff --git a/lib/damask/solver/solver.py b/lib/damask/solver/solver.py index 175a86cd6..d210595b5 100644 --- a/lib/damask/solver/solver.py +++ b/lib/damask/solver/solver.py @@ -15,7 +15,7 @@ class Solver(): 'spectral': damask.solver.Spectral, 'marc': damask.solver.Marc, } - if solver.lower() in solverClass.keys(): + if solver.lower() in list(solverClass.keys()): self.__class__=solverClass[solver.lower()] self.__init__() diff --git a/lib/damask/test/test.py b/lib/damask/test/test.py index c05a6474d..5445ee443 100644 --- a/lib/damask/test/test.py +++ b/lib/damask/test/test.py @@ -1,6 +1,5 @@ # -*- coding: UTF-8 no BOM -*- - import os,sys,shutil import logging,logging.config import damask @@ -17,92 +16,113 @@ class Test(): variants = [] - def __init__(self,test_description): + def __init__(self, **kwargs): + + defaults = {'description': '', + 'keep': False, + 'accept': False, + 'updateRequest': False, + 'show': False, + 'select': None, + } + for arg in defaults.keys(): + setattr(self,arg,kwargs.get(arg) if kwargs.get(arg) else defaults[arg]) + + fh = logging.FileHandler('test.log') # create file handler which logs even debug messages + fh.setLevel(logging.DEBUG) + fh.setFormatter(logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s')) + + ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level + ch.setLevel(logging.INFO) + ch.setFormatter(logging.Formatter('%(message)s')) logger = logging.getLogger() - logger.setLevel(0) - fh = logging.FileHandler('test.log') # create file handler which logs even debug messages - fh.setLevel(logging.DEBUG) - full = logging.Formatter('%(asctime)s - %(levelname)s: \n%(message)s') - fh.setFormatter(full) - ch = logging.StreamHandler(stream=sys.stdout) # create console handler with a higher log level - ch.setLevel(logging.INFO) -# create formatter and add it to the handlers - plain = logging.Formatter('%(message)s') - ch.setFormatter(plain) -# add the handlers to the logger logger.addHandler(fh) logger.addHandler(ch) + logger.setLevel(0) + + logging.info('\n'.join(['+'*40, + '-'*40, + '| '+self.description, + '-'*40, + ])) - logging.info('!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n' \ - +'----------------------------------------------------------------\n' \ - +'| '+test_description+'\n' \ - +'----------------------------------------------------------------') self.dirBase = os.path.dirname(os.path.realpath(sys.modules[self.__class__.__module__].__file__)) - self.parser = OptionParser( - description = test_description+' (using class: {})'.format(damask.version), - usage='./test.py [options]') - self.updateRequested = False - self.parser.add_option("-d", "--debug", action="store_true",\ - dest="debug",\ - help="debug run, don't calculate but use existing results") - self.parser.add_option("-p", "--pass", action="store_true",\ - dest="accept",\ - help="calculate results but always consider test as successfull") - self.parser.set_defaults(debug=False, - accept=False) + self.parser = OptionParser(description = '{} (Test class version: {})'.format(self.description,damask.version), + usage = './test.py [options]') + self.parser.add_option("-k", "--keep", + action = "store_true", + dest = "keep", + help = "keep current results, just run postprocessing") + self.parser.add_option("--ok", "--accept", + action = "store_true", + dest = "accept", + help = "calculate results but always consider test as successful") + self.parser.add_option("-l", "--list", + action = "store_true", + dest = "show", + help = "show all test variants without actual calculation") + self.parser.add_option("-s", "--select", + dest = "select", + help = "run test of given name only") + self.parser.set_defaults(keep = self.keep, + accept = self.accept, + update = self.updateRequest, + show = self.show, + select = self.select, + ) + + def execute(self): """Run all variants and report first failure.""" - if self.options.debug: - for variant in xrange(len(self.variants)): - try: - self.postprocess(variant) - if not self.compare(variant): - return variant+1 # return culprit - except Exception as e : - logging.critical('\nWARNING:\n {}\n'.format(e)) - return variant+1 # return culprit - return 0 - else: - if not self.testPossible(): return -1 + if not self.options.keep: + if not self.feasible(): return -1 self.clean() self.prepareAll() - for variant in xrange(len(self.variants)): + + for variant,name in enumerate(self.variants): + if self.options.show: + logging.critical('{}: {}'.format(variant+1,name)) + elif self.options.select is not None \ + and not (name == self.options.select or str(variant+1) == self.options.select): + pass + else: try: - self.prepare(variant) - self.run(variant) + if not self.options.keep: + self.prepare(variant) + self.run(variant) + self.postprocess(variant) - if self.updateRequested: # update requested - self.update(variant) - elif not (self.options.accept or self.compare(variant)): # no update, do comparison - return variant+1 # return culprit - except Exception as e : - logging.critical('\nWARNING:\n {}\n'.format(e)) + self.compare(variant) + + if self.options.update: + if self.update(variant) != 0: logging.critical('update for "{}" failed.'.format(name)) + elif not (self.options.accept or self.compare(variant)): # no update, do comparison + return variant+1 # return culprit + + except Exception as e: + logging.critical('exception during variant execution: "{}"'.format(e.message)) return variant+1 # return culprit - return 0 + return 0 - def testPossible(self): - """Check if test is possible or not (e.g. no license available).""" + def feasible(self): + """Check whether test is possible or not (e.g. no license available).""" return True - + def clean(self): """Delete directory tree containing current results.""" - status = True - try: shutil.rmtree(self.dirCurrent()) except: logging.warning('removal of directory "{}" not possible...'.format(self.dirCurrent())) - status = status and False try: os.mkdir(self.dirCurrent()) + return True except: - logging.critical('creation of directory "{}" failed...'.format(self.dirCurrent())) - status = status and False - - return status + logging.critical('creation of directory "{}" failed.'.format(self.dirCurrent())) + return False def prepareAll(self): """Do all necessary preparations for the whole test""" @@ -111,7 +131,7 @@ class Test(): def prepare(self,variant): """Do all necessary preparations for the run of each test variant""" return True - + def run(self,variant): """Execute the requested test variant.""" @@ -130,8 +150,8 @@ class Test(): def update(self,variant): """Update reference with current results.""" - logging.debug('Update not necessary') - return True + logging.critical('update not supported.') + return 1 def dirReference(self): @@ -143,17 +163,17 @@ class Test(): """Directory containing current results of the test.""" return os.path.normpath(os.path.join(self.dirBase,'current/')) - + def dirProof(self): """Directory containing human readable proof of correctness for the test.""" return os.path.normpath(os.path.join(self.dirBase,'proof/')) - + def fileInRoot(self,dir,file): """Path to a file in the root directory of DAMASK.""" return os.path.join(damask.Environment().rootDir(),dir,file) - + def fileInReference(self,file): """Path to a file in the refrence directory for the test.""" return os.path.join(self.dirReference(),file) @@ -163,7 +183,7 @@ class Test(): """Path to a file in the current results directory for the test.""" return os.path.join(self.dirCurrent(),file) - + def fileInProof(self,file): """Path to a file in the proof directory for the test.""" return os.path.join(self.dirProof(),file) @@ -172,66 +192,66 @@ class Test(): def copy(self, mapA, mapB, A = [], B = []): """ - copy list of files from (mapped) source to target. + Copy list of files from (mapped) source to target. mapA/B is one of self.fileInX. """ if not B or len(B) == 0: B = A - for source,target in zip(map(mapA,A),map(mapB,B)): + for source,target in zip(list(map(mapA,A)),list(map(mapB,B))): try: - shutil.copy2(source,target) + shutil.copy2(source,target) except: logging.critical('error copying {} to {}'.format(source,target)) def copy_Reference2Current(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Reference2Current: Unable to copy file "{}"'.format(file)) - + def copy_Base2Current(self,sourceDir,sourcefiles=[],targetfiles=[]): - + source=os.path.normpath(os.path.join(self.dirBase,'../../..',sourceDir)) if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(os.path.join(source,file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(os.path.join(source,file),self.fileInCurrent(targetfiles[i])) except: logging.error(os.path.join(source,file)) logging.critical('Base2Current: Unable to copy file "{}"'.format(file)) def copy_Current2Reference(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInCurrent(file),self.fileInReference(targetfiles[i])) + shutil.copy2(self.fileInCurrent(file),self.fileInReference(targetfiles[i])) except: logging.critical('Current2Reference: Unable to copy file "{}"'.format(file)) - + def copy_Proof2Current(self,sourcefiles=[],targetfiles=[]): - + if len(targetfiles) == 0: targetfiles = sourcefiles for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInProof(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInProof(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Proof2Current: Unable to copy file "{}"'.format(file)) - + def copy_Current2Current(self,sourcefiles=[],targetfiles=[]): - + for i,file in enumerate(sourcefiles): try: - shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) + shutil.copy2(self.fileInReference(file),self.fileInCurrent(targetfiles[i])) except: logging.critical('Current2Current: Unable to copy file "{}"'.format(file)) @@ -243,11 +263,11 @@ class Test(): logging.info(error) logging.debug(out) - - return out,error - - + return out,error + + + def compare_Array(self,File1,File2): import numpy as np @@ -278,49 +298,49 @@ class Test(): def compare_ArrayRefCur(self,ref,cur=''): - + if cur =='': cur = ref refName = self.fileInReference(ref) curName = self.fileInCurrent(cur) return self.compare_Array(refName,curName) - + def compare_ArrayCurCur(self,cur0,cur1): - + cur0Name = self.fileInCurrent(cur0) cur1Name = self.fileInCurrent(cur1) return self.compare_Array(cur0Name,cur1Name) def compare_Table(self,headings0,file0,headings1,file1,normHeadings='',normType=None, absoluteTolerance=False,perLine=False,skipLines=[]): - + import numpy as np logging.info('\n '.join(['comparing ASCII Tables',file0,file1])) if normHeadings == '': normHeadings = headings0 # check if comparison is possible and determine lenght of columns - if len(headings0) == len(headings1) == len(normHeadings): + if len(headings0) == len(headings1) == len(normHeadings): dataLength = len(headings0) - length = [1 for i in xrange(dataLength)] - shape = [[] for i in xrange(dataLength)] - data = [[] for i in xrange(dataLength)] - maxError = [0.0 for i in xrange(dataLength)] - absTol = [absoluteTolerance for i in xrange(dataLength)] - column = [[1 for i in xrange(dataLength)] for j in xrange(2)] - - norm = [[] for i in xrange(dataLength)] - normLength = [1 for i in xrange(dataLength)] - normShape = [[] for i in xrange(dataLength)] - normColumn = [1 for i in xrange(dataLength)] + length = [1 for i in range(dataLength)] + shape = [[] for i in range(dataLength)] + data = [[] for i in range(dataLength)] + maxError = [0.0 for i in range(dataLength)] + absTol = [absoluteTolerance for i in range(dataLength)] + column = [[1 for i in range(dataLength)] for j in range(2)] - for i in xrange(dataLength): - if headings0[i]['shape'] != headings1[i]['shape']: + norm = [[] for i in range(dataLength)] + normLength = [1 for i in range(dataLength)] + normShape = [[] for i in range(dataLength)] + normColumn = [1 for i in range(dataLength)] + + for i in range(dataLength): + if headings0[i]['shape'] != headings1[i]['shape']: raise Exception('shape mismatch between {} and {} '.format(headings0[i]['label'],headings1[i]['label'])) shape[i] = headings0[i]['shape'] - for j in xrange(np.shape(shape[i])[0]): + for j in range(np.shape(shape[i])[0]): length[i] *= shape[i][j] normShape[i] = normHeadings[i]['shape'] - for j in xrange(np.shape(normShape[i])[0]): + for j in range(np.shape(normShape[i])[0]): normLength[i] *= normShape[i][j] else: raise Exception('trying to compare {} with {} normed by {} data sets'.format(len(headings0), @@ -330,9 +350,9 @@ class Test(): table0 = damask.ASCIItable(name=file0,readonly=True) table0.head_read() table1 = damask.ASCIItable(name=file1,readonly=True) - table1.head_read() + table1.head_read() - for i in xrange(dataLength): + for i in range(dataLength): key0 = ('1_' if length[i]>1 else '') + headings0[i]['label'] key1 = ('1_' if length[i]>1 else '') + headings1[i]['label'] normKey = ('1_' if normLength[i]>1 else '') + normHeadings[i]['label'] @@ -346,11 +366,11 @@ class Test(): column[0][i] = table0.label_index(key0) column[1][i] = table1.label_index(key1) normColumn[i] = table0.label_index(normKey) - + line0 = 0 while table0.data_read(): # read next data line of ASCII table if line0 not in skipLines: - for i in xrange(dataLength): + for i in range(dataLength): myData = np.array(map(float,table0.data[column[0][i]:\ column[0][i]+length[i]]),'d') normData = np.array(map(float,table0.data[normColumn[i]:\ @@ -361,12 +381,12 @@ class Test(): else: norm[i] = np.append(norm[i],np.linalg.norm(np.reshape(normData,normShape[i]),normType)) line0 += 1 - - for i in xrange(dataLength): - if not perLine: norm[i] = [np.max(norm[i]) for j in xrange(line0-len(skipLines))] + + for i in range(dataLength): + if not perLine: norm[i] = [np.max(norm[i]) for j in range(line0-len(skipLines))] data[i] = np.reshape(data[i],[line0-len(skipLines),length[i]]) if any(norm[i]) == 0.0 or absTol[i]: - norm[i] = [1.0 for j in xrange(line0-len(skipLines))] + norm[i] = [1.0 for j in range(line0-len(skipLines))] absTol[i] = True if perLine: logging.warning('At least one norm of {} in 1. table is 0.0, using absolute tolerance'.format(headings0[i]['label'])) @@ -376,9 +396,9 @@ class Test(): line1 = 0 while table1.data_read(): # read next data line of ASCII table if line1 not in skipLines: - for i in xrange(dataLength): + for i in range(dataLength): myData = np.array(map(float,table1.data[column[1][i]:\ - column[1][i]+length[i]]),'d') + column[1][i]+length[i]]),'d') maxError[i] = max(maxError[i],np.linalg.norm(np.reshape(myData-data[i][line1-len(skipLines),:],shape[i]))/ norm[i][line1-len(skipLines)]) line1 +=1 @@ -386,7 +406,7 @@ class Test(): if (line0 != line1): raise Exception('found {} lines in 1. table but {} in 2. table'.format(line0,line1)) logging.info(' ********') - for i in xrange(dataLength): + for i in range(dataLength): if absTol[i]: logging.info(' * maximum absolute error {} between {} and {}'.format(maxError[i], headings0[i]['label'], @@ -406,7 +426,7 @@ class Test(): stdTol = 1.0e-6, preFilter = 1.0e-9): """ - calculate statistics of tables + Calculate statistics of tables threshold can be used to ignore small values (a negative number disables this feature) """ @@ -424,7 +444,7 @@ class Test(): if column is None: columns[i] = tables[i].labels(raw = True) # if no column is given, read all logging.info('comparing ASCIItables statistically') - for i in xrange(len(columns)): + for i in range(len(columns)): columns[i] = columns[0] if not columns[i] else \ ([columns[i]] if not (isinstance(columns[i], Iterable) and not isinstance(columns[i], str)) else \ columns[i] @@ -432,43 +452,39 @@ class Test(): logging.info(files[i]+':'+','.join(columns[i])) if len(files) < 2: return True # single table is always close to itself... - + data = [] for table,labels in zip(tables,columns): table.data_readArray(labels) data.append(table.data) table.close() - - - for i in xrange(1,len(data)): + + + for i in range(1,len(data)): delta = data[i]-data[i-1] normBy = (np.abs(data[i]) + np.abs(data[i-1]))*0.5 normedDelta = np.where(normBy>preFilter,delta/normBy,0.0) mean = np.amax(np.abs(np.mean(normedDelta,0))) std = np.amax(np.std(normedDelta,0)) logging.info('mean: {:f}'.format(mean)) - logging.info('std: {:f}'.format(std)) - + logging.info('std: {:f}'.format(std)) + return (mean0.0, maximum, 1) # avoid div by zero for empty columns - for i in xrange(len(data)): - data[i] /= maximum - - mask = np.zeros_like(table.data,dtype='bool') + dimensions = tables[0].label_dimension(columns[0]) # width of each requested column + maximum = np.zeros_like(columns[0],dtype=float) # one magnitude per column entry + data = [] # list of feature table extracted from each file (ASCII table) + + for i,(table,labels) in enumerate(zip(tables,columns)): + if np.any(dimensions != table.label_dimension(labels)): # check data object consistency + logging.critical('Table {} differs in data layout.'.format(files[i])) + return False + table.data_readArray(labels) # read data, ... + data.append(table.data) # ... store, ... + table.close() # ... close + + for j,label in enumerate(labels): # iterate over object labels + maximum[j] = np.maximum( + maximum[j], + np.amax(np.linalg.norm(table.data[:,table.label_indexrange(label)], + axis=1)) + ) # find maximum Euclidean norm across rows + + maximum = np.where(maximum > 0.0, maximum, 1.0) # avoid div by zero for zero columns + maximum = np.repeat(maximum,dimensions) # spread maximum over columns of each object + + for i in range(len(data)): + data[i] /= maximum # normalize each table + logging.info('shape of data {}: {}'.format(i,data[i].shape)) + + if debug: + violators = np.absolute(data[0]-data[1]) > atol + rtol*np.absolute(data[1]) + logging.info('shape of violators: {}'.format(violators.shape)) + for j,culprits in enumerate(violators): + goodguys = np.logical_not(culprits) + if culprits.any(): + logging.info('{} has {}'.format(j,np.sum(culprits))) + logging.info('deviation: {}'.format(np.absolute(data[0][j]-data[1][j])[culprits])) + logging.info('data : {}'.format(np.absolute(data[1][j])[culprits])) + logging.info('deviation: {}'.format(np.absolute(data[0][j]-data[1][j])[goodguys])) + logging.info('data : {}'.format(np.absolute(data[1][j])[goodguys])) +# for ok,valA,valB in zip(allclose,data[0],data[1]): +# logging.debug('{}:\n{}\n{}'.format(ok,valA,valB)) - for table in data: - mask |= np.where(np.abs(table) + + + + + image/svg+xml + + + + + + + + diff --git a/processing/misc/DREAM3D_toTable.py b/processing/misc/DREAM3D_toTable.py new file mode 100755 index 000000000..c09a77717 --- /dev/null +++ b/processing/misc/DREAM3D_toTable.py @@ -0,0 +1,84 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os,h5py +import numpy as np +from optparse import OptionParser +import damask + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName,damask.version]) + + +#-------------------------------------------------------------------------------------------------- +# MAIN +#-------------------------------------------------------------------------------------------------- + +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [dream3dfile[s]]', description = """ +Convert DREAM3D file to ASCIItable. Works for 3D datasets, but, hey, its not called DREAM2D ;) + +""", version = scriptID) + +parser.add_option('-d','--data', + dest = 'data', + action = 'extend', metavar = '', + help = 'data to extract from DREAM3D file') +parser.add_option('-c','--container', + dest = 'container', metavar = 'string', + help = 'root container(group) in which data is stored [%default]') + +parser.set_defaults(container="ImageDataContainer", + ) + +(options, filenames) = parser.parse_args() + +if options.data is None: + parser.error('No data selected') + +rootDir ='DataContainers/'+options.container + +# --- loop over input files ------------------------------------------------------------------------- + +if filenames == []: parser.error('no input file specified.') + +for name in filenames: + try: + table = damask.ASCIItable(outname = os.path.splitext(name)[0]+'.txt', + buffered = False + ) + except: continue + damask.util.report(scriptName,name) + + inFile = h5py.File(name, 'r') + try: + grid = inFile[rootDir+'/_SIMPL_GEOMETRY/DIMENSIONS'][...] + except: + damask.util.croak('Group {} not found'.format(options.container)) + table.close(dismiss = True) + continue + +# --- read comments -------------------------------------------------------------------------------- + + coords = (np.mgrid[0:grid[2], 0:grid[1], 0: grid[0]]).reshape(3, -1).T + table.data = (np.fliplr(coords)*inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...] \ + + inFile[rootDir+'/_SIMPL_GEOMETRY/ORIGIN'][...] \ + + inFile[rootDir+'/_SIMPL_GEOMETRY/SPACING'][...]*0.5) + labels = ['1_pos','2_pos','3_pos'] + for data in options.data: + try: + l = np.prod(inFile[rootDir+'/CellData/'+data].shape[3:]) + labels+=['{}_{}'.format(i+1,data.replace(' ','')) for i in range(l)] if l >1 else [data.replace(' ','')] + except KeyError: + damask.util.croak('Data {} not found'.format(data)) + pass + table.data = np.hstack((table.data, + inFile[rootDir+'/CellData/'+data][...].reshape(grid.prod(),l))) + +# ------------------------------------------ assemble header --------------------------------------- + table.labels_clear() + table.labels_append(labels,reset = True) + table.head_write() + +# ------------------------------------------ finalize output --------------------------------------- + table.data_writeArray() + table.close() diff --git a/processing/pre/table_fromOIMgrainFile.py b/processing/misc/OIMgrainFile_toTable.py similarity index 70% rename from processing/pre/table_fromOIMgrainFile.py rename to processing/misc/OIMgrainFile_toTable.py index 30cfee2f4..063adb0db 100755 --- a/processing/pre/table_fromOIMgrainFile.py +++ b/processing/misc/OIMgrainFile_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -12,19 +12,11 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Adds header to OIM grain file to make it accesible as ASCII table +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [file[s]]', description = """ +Adds header to OIM grain file type 1 to make it accesible as ASCII table """, version = scriptID) -parser.add_option('-l', '--labels', - dest = 'labels', - action = 'extend', metavar = '', - help = 'lables of requested columns') - -parser.set_defaults(labels = ['1_euler','2_euler','3_euler', - '1_pos','2_pos', 'IQ', 'CI', 'Fit', 'GrainID',], - ) (options, filenames) = parser.parse_args() @@ -42,10 +34,10 @@ for name in filenames: table.head_read() data = [] while table.data_read(): - data.append(table.data[0:len(options.labels)]) + data.append(table.data[0:9]) table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(options.labels) + table.labels_append(['1_euler','2_euler','3_euler','1_pos','2_pos','IQ','CI','Fit','GrainID']) table.head_write() for i in data: table.data = i diff --git a/processing/misc/ang_toTable.py b/processing/misc/ang_toTable.py index 110ea6ddf..19fdcd55b 100755 --- a/processing/misc/ang_toTable.py +++ b/processing/misc/ang_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os @@ -13,7 +13,7 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN #-------------------------------------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog [geomfile[s]]', description = """ +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [angfile[s]]', description = """ Convert TSL/EDAX *.ang file to ASCIItable """, version = scriptID) @@ -30,7 +30,7 @@ for name in filenames: outname = os.path.splitext(name)[0]+'.txt' if name else name, buffered = False, labeled = False) except: continue - table.croak('\033[1m'+scriptName+'\033[0m'+(': '+name if name else '')) + damask.util.report(scriptName,name) # --- interpret header ----------------------------------------------------------------------------- diff --git a/processing/misc/calculateAnisotropy.py b/processing/misc/calculateAnisotropy.py deleted file mode 100644 index a88b39b74..000000000 --- a/processing/misc/calculateAnisotropy.py +++ /dev/null @@ -1,236 +0,0 @@ -# -*- coding: UTF-8 no BOM -*- - -import threading,os,string -import numpy as np -from optparse import OptionParser -from shutil import copy2 -from re import split -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -def list_split(option, opt, value, parser): - setattr(parser.values, option.dest, value.split(',')) - -#--------------------------------------------------------------------------------------------------- -class myThread (threading.Thread): - """Runner""" - - def __init__(self, threadID): - threading.Thread.__init__(self) - self.threadID = threadID - def run(self): - s.acquire() - conv=isFinished() - s.release() - while conv: - doSim(4.,self.name) - s.acquire() - conv=isFinished() - s.release() - -def doSim(delay,thread): - global dirCurrent - s.acquire() - delta_angle = offsetPhi() - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - dire = dirCurrent+'/'+file_angle - - if not os.path.isdir(dire): - os.mkdir(dire,0755) - for file in [options.geometry+'.geom',options.load+'.load','numerics.config']: - copy2(dirCurrent+'/'+file, dire) - newMaterialConfig(dirCurrent,delta_angle) - - os.chdir(dire) - if not os.path.isfile('%s_%s.spectralOut'%(options.geometry,options.load)): - print('starting uniaxial tension in direction of angle %s from %s'%(file_angle,thread)) - s.release() - damask.util.execute('DAMASK_spectral -g %s -l %s'%(options.geometry,options.load)) - else: s.release() - - s.acquire() - if not os.path.isfile('./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)): - print('starting post processing for angle %s from %s'%(file_angle,thread)) - s.release() - damask.util.execute('postResults --cr f,p -d %s %s_%s.spectralOut'%('Rvalues',options.geometry,options.load)) - damask.util.execute('addCauchy ./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)) - damask.util.execute('addStrainTensors -l -v ./%s/%s_%s.txt'%('Rvalues',options.geometry,options.load)) - print('post processing for angle %s from %s is finished'%(file_angle,thread)) - - else: - s.release() - os.chdir(dirCurrent) - -def isFinished(): - global N_simulations - - if N_simulations < options.number: - return True - else: - return False - -def offsetPhi(): - global N_simulations #, N_tensile - N_simulations+=1 - return np.linspace(0,90,options.number)[N_simulations-1] - -def newMaterialConfig(dire,angle): - filename = '/material.config' - if len(str(angle)) > 5: - file_angle = str(angle)[:5] - else: - file_angle = str(angle) - f = open(dire+'/'+file_angle+filename,'w') - data = open(dire+filename, 'r').readlines() - - for line in data: - if '(gauss)' in line: - linesplit = split(r'[;,\s,\t]\s*',line) - index = linesplit.index('phi1') - phi = float(linesplit[index+1]) - angle - if phi > 360. : - phi = phi-360.0 - elif phi < 0.0: - phi = phi+360.0 - index2 = line.index(linesplit[index+1]) - line2 = line[:index2]+str(phi)+line[index2+len(str(float(linesplit[index+1]))):] - else: - line2 = line - f.write(line2) - f.close() - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Calculate the deformation anisotropic coefficients (r values) and -strength anisotropic coefficients (normalized yield stress) - -""", version=string.replace(scriptID,'\n','\\n') -) - -parser.add_option('-l','--load' , - dest='load', type='string', - help='name of the load file [%default]', metavar='string') -parser.add_option('-g','--geometry', - dest='geometry', type='string', - help='name of the geometry file [%default]', metavar='string') -parser.add_option('-s', '--strain', - dest='strain', type='string', action='callback', callback=list_split, - help='threshold strains, using comma to seperate multiple strains [%default]', metavar='string') -parser.add_option('-t','--threads', - dest='threads', type='int', - help='number of parallel executions [%default]', metavar='int') -parser.add_option('-n','--number', - dest='number', type='int', - help='Number of uni-axial tensile tests [%default]', metavar='int') - -parser.set_defaults(geometry = '20grains16x16x16') -parser.set_defaults(load = 'tensionX') -parser.set_defaults(threads = 1) -parser.set_defaults(number = 7) -parser.set_defaults(strain = ('0.0025','0.025')) - -options = parser.parse_args()[0] - -if not os.path.isfile(options.geometry+'.geom'): - parser.error('geometry file %s.geom not found'%options.geometry) -if not os.path.isfile('material.config'): - parser.error('material.config file not found') - -thresStrain = [float(i) for i in options.strain] - -if not os.path.isfile(options.load+'.load'): - maxstrain = max(thresStrain) - f11 = str(1.2*maxstrain + 1.0) - if maxstrain < 0.05: - maxincs = '60'; maxtime = '30' - else: - maxincs = str(int(maxstrain*3000)); maxtime = str(maxstrain*600) - - f=open('tensionX.load','w') - uniaxial_load = 'f ' +f11+ ' 0 0 0 * 0 0 0 * ' + \ - 'stress ' +'* * * * 0 * * * 0 ' + \ - 'time '+ maxtime + ' incs ' + maxincs + ' freq 3' - f.write(uniaxial_load) - f.close() - -N_simulations=0 -s=threading.Semaphore(1) -threads=[] -dirCurrent = os.getcwd() -for i in range(options.threads): - threads.append(myThread(i)) - threads[i].start() - -for i in range(options.threads): - threads[i].join() - -anisotropy = {} -for i,delta_angle in enumerate(np.linspace(0,90,options.number)): - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - refFile = dirCurrent+'/'+file_angle+'/Rvalues/%s_%s.txt'%(options.geometry,options.load) - if not os.path.isfile(refFile): - print('post processing file is not found for the angle %s'%file_angle) - else: - File = open(refFile) - table = damask.ASCIItable(File) - table.head_read() - if not set(['1_ln(V)','5_ln(V)','9_ln(V)','1_Cauchy']).issubset(set(table.labels)): - print 'data missing in direction %s'%str(delta_angle) - table.data_readArray(['%i_Cauchy'%(i+1) for i in xrange(9)]+['%i_ln(V)'%(i+1) for i in xrange(9)]) - line, lines = 0, np.shape(table.data)[0] - aniso_thres = {} - for threshold in thresStrain: - while line < lines: - if abs(table.data[line,9])>= threshold: # 1_ln(V), e_xx - upper,lower = abs(table.data[line,9]),abs(table.data[line-1,9]) # values for linear interpolation - interplate = lambda x_d, x_u : x_d * (upper-threshold)/(upper-lower) + x_u * (threshold-lower)/(upper-lower) - e_yy = interplate (table.data[line-1,13], table.data[line,13]) - e_zz = interplate (table.data[line-1,17], table.data[line,17]) - s_xx = interplate (table.data[line-1,0 ], table.data[line,0 ]) - aniso_thres[str(threshold)] = [e_yy/e_zz, s_xx] - break - else: - line+=1 - anisotropy[file_angle] = aniso_thres - -f = open('./anisotropy.txt','w') -f.write('4 header \n') -f.write('#the first row mean the threshold strain e_xx \n#the first column means loading directions \n') -f.write('#none means the data is unavailable\n# \n') -title = ['*R values (Lankford coefficients) \n', '# \n*Normalized yield stress \n'] -for i in xrange(2): - f.write(title[i]) - f.write(' '*10+len(thresStrain)*'%-12.4f'%tuple(thresStrain)+'\n') - for j,delta_angle in enumerate(np.linspace(0,90,options.number)): - if len(str(delta_angle)) > 5: - file_angle = str(delta_angle)[:5] - else: - file_angle = str(delta_angle) - - if file_angle in anisotropy.keys(): - aniso_dic_ang = anisotropy[file_angle] - aniso_list_ang_strain = []; writeformat = '' - for threshold in thresStrain: - if str(threshold) in aniso_dic_ang.keys(): - if i == 1: # extract the normalized stress - aniso = aniso_dic_ang[str(threshold)][i]/anisotropy['0.0'][str(threshold)][i] - else: # extract r value - aniso = aniso_dic_ang[str(threshold)][i] - aniso_list_ang_strain.append(aniso) - writeformat = writeformat+'%-12.6f' - else: - aniso_list_ang_strain.append('none') - writeformat = writeformat+'%-12s' - f.write('%-10s'%file_angle + writeformat%(tuple(aniso_list_ang_strain))+'\n') -f.close() diff --git a/processing/misc/gwyddion_filter.py b/processing/misc/gwyddion_filter.py index fd4df19a0..d5b1e39f0 100755 --- a/processing/misc/gwyddion_filter.py +++ b/processing/misc/gwyddion_filter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,scipy diff --git a/processing/misc/vtk_fromGwyddion.py b/processing/misc/vtk_fromGwyddion.py index 8fa206074..e64bf4393 100755 --- a/processing/misc/vtk_fromGwyddion.py +++ b/processing/misc/vtk_fromGwyddion.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,vtk diff --git a/processing/misc/yieldSurface.py b/processing/misc/yieldSurface.py index d636c37f3..28f52062f 100755 --- a/processing/misc/yieldSurface.py +++ b/processing/misc/yieldSurface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import threading,time,os @@ -11,15 +11,10 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) def runFit(exponent, eqStress, dimension, criterion): - global s, threads, myFit, myLoad - global fitResults, fitErrors, fitResidual, stressAll, strainAll - global N_simulations, Guess, dDim - - fitResults = [] - fitErrors = [] - fitResidual = [] - Guess = [] - threads=[] + global threads, myFit, myLoad + global fitResidual + global Guess, dDim + dDim = dimension - 3 nParas = len(fitCriteria[criterion]['bound'][dDim]) nExpo = fitCriteria[criterion]['nExpo'] @@ -28,7 +23,7 @@ def runFit(exponent, eqStress, dimension, criterion): nParas = nParas-nExpo fitCriteria[criterion]['bound'][dDim] = fitCriteria[criterion]['bound'][dDim][:nParas] - for i in xrange(nParas): + for i in range(nParas): temp = fitCriteria[criterion]['bound'][dDim][i] if fitCriteria[criterion]['bound'][dDim][i] == (None,None): Guess.append(1.0) @@ -37,13 +32,9 @@ def runFit(exponent, eqStress, dimension, criterion): if g == 0: g = temp[1]*0.5 Guess.append(g) - N_simulations=0 - s=threading.Semaphore(1) myLoad = Loadcase(options.load[0],options.load[1],options.load[2], nSet = 10, dimension = dimension, vegter = options.criterion=='vegter') - stressAll= [np.zeros(0,'d').reshape(0,0) for i in xrange(int(options.yieldValue[2]))] - strainAll= [np.zeros(0,'d').reshape(0,0) for i in xrange(int(options.yieldValue[2]))] myFit = Criterion(exponent,eqStress, dimension, criterion) for t in range(options.threads): @@ -57,12 +48,12 @@ def runFit(exponent, eqStress, dimension, criterion): def principalStresses(sigmas): """ - computes principal stresses (i.e. eigenvalues) for a set of Cauchy stresses. + Computes principal stresses (i.e. eigenvalues) for a set of Cauchy stresses. sorted in descending order. """ lambdas=np.zeros(0,'d') - for i in xrange(np.shape(sigmas)[1]): + for i in range(np.shape(sigmas)[1]): eigenvalues = np.linalg.eigvalsh(sym6toT33(sigmas[:,i])) lambdas = np.append(lambdas,np.sort(eigenvalues)[::-1]) #append eigenvalues in descending order lambdas = np.transpose(lambdas.reshape(np.shape(sigmas)[1],3)) @@ -82,7 +73,7 @@ def principalStress(p): t1 + t2*np.cos(phi+np.pi*2.0/3.0), t1 + t2*np.cos(phi+np.pi*4.0/3.0)]) -def principalStrs_Der(p, (s1, s2, s3, s4, s5, s6), dim, Karafillis=False): +def principalStrs_Der(p, s, dim, Karafillis=False): """Derivative of principal stress with respect to stress""" third = 1.0/3.0 third2 = 2.0*third @@ -111,31 +102,31 @@ def principalStrs_Der(p, (s1, s2, s3, s4, s5, s6), dim, Karafillis=False): dSdI = np.array([dSidIj(phi),dSidIj(phi+np.pi*2.0/3.0),dSidIj(phi+np.pi*4.0/3.0)]) # i=1,2,3; j=1,2,3 # calculate the derivation of principal stress with regards to the anisotropic coefficients - one = np.ones_like(s1); zero = np.zeros_like(s1); num = len(s1) + one = np.ones_like(s); zero = np.zeros_like(s); num = len(s) dIdp = np.array([[one, one, one, zero, zero, zero], [p[1]+p[2], p[2]+p[0], p[0]+p[1], -2.0*p[3], -2.0*p[4], -2.0*p[5]], [p[1]*p[2]-p[4]**2, p[2]*p[0]-p[5]**2, p[0]*p[1]-p[3]**2, -2.0*p[3]*p[2]+2.0*p[4]*p[5], -2.0*p[4]*p[0]+2.0*p[5]*p[3], -2.0*p[5]*p[1]+2.0*p[3]*p[4]] ]) if Karafillis: - dpdc = np.array([[zero,s1-s3,s1-s2], [s2-s3,zero,s2-s1], [s3-s2,s3-s1,zero]])/3.0 - dSdp = np.array([np.dot(dSdI[:,:,i],dIdp[:,:,i]).T for i in xrange(num)]).T + dpdc = np.array([[zero,s[0]-s[2],s[0]-s[1]], [s[1]-s[2],zero,s[1]-s[0]], [s[2]-s[1],s[2]-s[0],zero]])/3.0 + dSdp = np.array([np.dot(dSdI[:,:,i],dIdp[:,:,i]).T for i in range(num)]).T if dim == 2: - temp = np.vstack([dSdp[:,3]*s4]).T.reshape(num,1,3).T + temp = np.vstack([dSdp[:,3]*s[3]]).T.reshape(num,1,3).T else: - temp = np.vstack([dSdp[:,3]*s4,dSdp[:,4]*s5,dSdp[:,5]*s6]).T.reshape(num,3,3).T + temp = np.vstack([dSdp[:,3]*s[3],dSdp[:,4]*s[4],dSdp[:,5]*s[5]]).T.reshape(num,3,3).T - return np.concatenate((np.array([np.dot(dSdp[:,0:3,i], dpdc[:,:,i]).T for i in xrange(num)]).T, + return np.concatenate((np.array([np.dot(dSdp[:,0:3,i], dpdc[:,:,i]).T for i in range(num)]).T, temp), axis=1) else: if dim == 2: - dIdc=np.array([[-dIdp[i,0]*s2, -dIdp[i,1]*s1, -dIdp[i,1]*s3, - -dIdp[i,2]*s2, -dIdp[i,2]*s1, -dIdp[i,0]*s3, - dIdp[i,3]*s4 ] for i in xrange(3)]) + dIdc=np.array([[-dIdp[i,0]*s[1], -dIdp[i,1]*s[0], -dIdp[i,1]*s[2], + -dIdp[i,2]*s[1], -dIdp[i,2]*s[0], -dIdp[i,0]*s[2], + dIdp[i,3]*s[3] ] for i in range(3)]) else: - dIdc=np.array([[-dIdp[i,0]*s2, -dIdp[i,1]*s1, -dIdp[i,1]*s3, - -dIdp[i,2]*s2, -dIdp[i,2]*s1, -dIdp[i,0]*s3, - dIdp[i,3]*s4, dIdp[i,4]*s5, dIdp[i,5]*s6 ] for i in xrange(3)]) - return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in xrange(num)]).T + dIdc=np.array([[-dIdp[i,0]*s[1], -dIdp[i,1]*s[0], -dIdp[i,1]*s[2], + -dIdp[i,2]*s[1], -dIdp[i,2]*s[0], -dIdp[i,0]*s[2], + dIdp[i,3]*s[3], dIdp[i,4]*s[4], dIdp[i,5]*s[5] ] for i in range(3)]) + return np.array([np.dot(dSdI[:,:,i],dIdc[:,:,i]).T for i in range(num)]).T def invariant(sigmas): I = np.zeros(3) @@ -194,7 +185,7 @@ class Vegter(object): refNormals = np.empty([13,2]) refPts[12] = refPtsQtr[0] refNormals[12] = refNormalsQtr[0] - for i in xrange(3): + for i in range(3): refPts[i] = refPtsQtr[i] refPts[i+3] = refPtsQtr[3-i][::-1] refPts[i+6] =-refPtsQtr[i] @@ -207,7 +198,7 @@ class Vegter(object): def _getHingePoints(self): """ - calculate the hinge point B according to the reference points A,C and the normals n,m + Calculate the hinge point B according to the reference points A,C and the normals n,m refPoints = np.array([[p1_x, p1_y], [p2_x, p2_y]]); refNormals = np.array([[n1_x, n1_y], [n2_x, n2_y]]) @@ -220,7 +211,7 @@ class Vegter(object): B1 = (m2*(n1*A1 + n2*A2) - n2*(m1*C1 + m2*C2))/(n1*m2-m1*n2) B2 = (n1*(m1*C1 + m2*C2) - m1*(n1*A1 + n2*A2))/(n1*m2-m1*n2) return np.array([B1,B2]) - return np.array([hingPoint(self.refPts[i:i+2],self.refNormals[i:i+2]) for i in xrange(len(self.refPts)-1)]) + return np.array([hingPoint(self.refPts[i:i+2],self.refNormals[i:i+2]) for i in range(len(self.refPts)-1)]) def getBezier(self): def bezier(R,H): @@ -228,7 +219,7 @@ class Vegter(object): for mu in np.linspace(0.0,1.0,self.nspace): b.append(np.array(R[0]*np.ones_like(mu) + 2.0*mu*(H - R[0]) + mu**2*(R[0]+R[1] - 2.0*H))) return b - return np.array([bezier(self.refPts[i:i+2],self.hingePts[i]) for i in xrange(len(self.refPts)-1)]) + return np.array([bezier(self.refPts[i:i+2],self.hingePts[i]) for i in range(len(self.refPts)-1)]) def VetgerCriterion(stress,lankford, rhoBi0, theta=0.0): """0-pure shear; 1-uniaxial; 2-plane strain; 3-equi-biaxial""" @@ -238,7 +229,7 @@ def VetgerCriterion(stress,lankford, rhoBi0, theta=0.0): lmatrix = np.empty([nset,nset]) theta = np.linspace(0.0,np.pi/2,nset) for i,th in enumerate(theta): - lmatrix[i] = np.array([np.cos(2*j*th) for j in xrange(nset)]) + lmatrix[i] = np.array([np.cos(2*j*th) for j in range(nset)]) return np.linalg.solve(lmatrix, r) nps = len(stress) @@ -250,10 +241,10 @@ def VetgerCriterion(stress,lankford, rhoBi0, theta=0.0): strsSet = stress.reshape(nset,4,2) refPts = np.empty([4,2]) - fouriercoeffs = np.array([np.cos(2.0*i*theta) for i in xrange(nset)]) - for i in xrange(2): + fouriercoeffs = np.array([np.cos(2.0*i*theta) for i in range(nset)]) + for i in range(2): refPts[3,i] = sum(strsSet[:,3,i])/nset - for j in xrange(3): + for j in range(3): refPts[j,i] = np.dot(getFourierParas(strsSet[:,j,i]), fouriercoeffs) @@ -752,9 +743,9 @@ def Yld2000(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): (4.0*D[0]-4.0*D[2]-4.0*D[1]+ D[3])*s11 + (8.0*D[1]-2.0*D[3]-2.0*D[0]+2.0*D[2])*s22, 9.0*D[4]*s12 ])/9.0 - def priStrs((sx,sy,sxy)): - temp = np.sqrt( (sx-sy)**2 + 4.0*sxy**2 ) - return 0.5*(sx+sy + temp), 0.5*(sx+sy - temp) + def priStrs(s): + temp = np.sqrt( (s[0]-s[1])**2 + 4.0*s[2]**2 ) + return 0.5*(s[0]+s[1] + temp), 0.5*(s[0]+s[1] - temp) m2 = m/2.0; m21 = m2 - 1.0 (X1,X2), (Y1,Y2) = priStrs(X), priStrs(Y) # Principal values of X, Y phi1s, phi21s, phi22s = (X1-X2)**2, (2.0*Y2+Y1)**2, (2.0*Y1+Y2)**2 @@ -768,10 +759,11 @@ def Yld2000(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): drdl, drdm = r/m/left, r*math_ln(0.5*left)*(-1.0/m/m) #/(-m*m) dldm = ( phi1*math_ln(phi1s) + phi21*math_ln(phi21s) + phi22*math_ln(phi22s) )*0.5 zero = np.zeros_like(s11); num = len(s11) - def dPrincipalds((X1,X2,X12)): # derivative of principla with respect to stress - temp = 1.0/np.sqrt( (X1-X2)**2 + 4.0*X12**2 ) - dP1dsi = 0.5*np.array([ 1.0+temp*(X1-X2), 1.0-temp*(X1-X2), temp*4.0*X12]) - dP2dsi = 0.5*np.array([ 1.0-temp*(X1-X2), 1.0+temp*(X1-X2), -temp*4.0*X12]) + def dPrincipalds(X): + """Derivative of principla with respect to stress""" + temp = 1.0/np.sqrt( (X[0]-X[1])**2 + 4.0*X[2]**2 ) + dP1dsi = 0.5*np.array([ 1.0+temp*(X[0]-X[1]), 1.0-temp*(X[0]-X[1]), temp*4.0*X[2]]) + dP2dsi = 0.5*np.array([ 1.0-temp*(X[0]-X[1]), 1.0+temp*(X[0]-X[1]), -temp*4.0*X[2]]) return np.array([dP1dsi, dP2dsi]) dXdXi, dYdYi = dPrincipalds(X), dPrincipalds(Y) @@ -782,14 +774,14 @@ def Yld2000(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): [ 4.0*s11-2.0*s22, -4.0*s11+8.0*s22, -4.0*s11+2.0*s22, s11-2.0*s22, zero ], #dY22dD [ zero, zero, zero, zero, 9.0*s12 ] ])/9.0 #dY12dD - dXdC=np.array([np.dot(dXdXi[:,:,i], dXidC[:,:,i]).T for i in xrange(num)]).T - dYdD=np.array([np.dot(dYdYi[:,:,i], dYidD[:,:,i]).T for i in xrange(num)]).T + dXdC=np.array([np.dot(dXdXi[:,:,i], dXidC[:,:,i]).T for i in range(num)]).T + dYdD=np.array([np.dot(dYdYi[:,:,i], dYidD[:,:,i]).T for i in range(num)]).T dldX = m*np.array([ phi1s**m21*(X1-X2), phi1s**m21*(X2-X1)]) dldY = m*np.array([phi21s**m21*(2.0*Y2+Y1) + 2.0*phi22s**m21*(2.0*Y1+Y2), \ phi22s**m21*(2.0*Y1+Y2) + 2.0*phi21s**m21*(2.0*Y2+Y1) ]) - jC = drdl*np.array([np.dot(dldX[:,i], dXdC[:,:,i]) for i in xrange(num)]).T - jD = drdl*np.array([np.dot(dldY[:,i], dYdD[:,:,i]) for i in xrange(num)]).T + jC = drdl*np.array([np.dot(dldX[:,i], dXdC[:,:,i]) for i in range(num)]).T + jD = drdl*np.array([np.dot(dldY[:,i], dYdD[:,:,i]) for i in range(num)]).T jm = drdl*dldm + drdm if mFix[0]: return np.vstack((jC,jD)).T @@ -817,7 +809,7 @@ def Yld200418p(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): p,q = ys(sdev, C), ys(sdev, D) pLambdas, qLambdas = principalStress(p), principalStress(q) # no sort - m2 = m/2.0; x3 = xrange(3); num = len(sv) + m2 = m/2.0; x3 = range(3); num = len(sv) PiQj = np.array([(pLambdas[i,:]-qLambdas[j,:]) for i in x3 for j in x3]) QiPj = np.array([(qLambdas[i,:]-pLambdas[j,:]) for i in x3 for j in x3]).reshape(3,3,num) PiQjs = PiQj**2 @@ -831,8 +823,8 @@ def Yld200418p(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): dldm = np.sum(PiQjs**m2*math_ln(PiQjs),axis=0)*0.5 dPdc, dQdd = principalStrs_Der(p, sdev, dim), principalStrs_Der(q, sdev, dim) PiQjs3d = ( PiQjs**(m2-1.0) ).reshape(3,3,num) - dldP = -m*np.array([np.diag(np.dot(PiQjs3d[:,:,i], QiPj [:,:,i])) for i in xrange(num)]).T - dldQ = m*np.array([np.diag(np.dot(QiPj [:,:,i], PiQjs3d[:,:,i])) for i in xrange(num)]).T + dldP = -m*np.array([np.diag(np.dot(PiQjs3d[:,:,i], QiPj [:,:,i])) for i in range(num)]).T + dldQ = m*np.array([np.diag(np.dot(QiPj [:,:,i], PiQjs3d[:,:,i])) for i in range(num)]).T jm = drdl*dldm + drdm jc = drdl*np.sum([dldP[i]*dPdc[i] for i in x3],axis=0) @@ -851,9 +843,9 @@ def KarafillisBoyce(eqStress, paras, sigmas, mFix, criteria, dim, Jac=False): 0 1: - dim[i] = (max(map(float,tempGrid[i].keys()))-min(map(float,tempGrid[i].keys())))*r/(r-1.0) - if grid[2]==1: # for 2D case set undefined dimension to given unitlength or alternatively give it the length of the smallest element - if options.unitlength == 0.0: - dim[2] = min(dim/grid) - else: - dim[2] = options.unitlength - print dim - if options.undeformed: - Favg = np.eye(3) - else: - Favg = damask.core.math.tensorAvg( - np.reshape(np.transpose(values[:,column['tensor'][options.defgrad]: - column['tensor'][options.defgrad]+9]), - (3,3,grid[0],grid[1],grid[2]))) - - F = np.reshape(np.transpose(values[:,column['tensor'][options.defgrad]: - column['tensor'][options.defgrad]+9]), - (3,3,grid[0],grid[1],grid[2])) - centroids = damask.core.mesh.deformedCoordsFFT(dim,F,Favg,options.scaling) - nodes = damask.core.mesh.nodesAroundCentres(dim,Favg,centroids) - - fields = {\ - 'tensor': {},\ - 'vector': {},\ - 'scalar': {},\ - 'double': {},\ - 'triple': {},\ - 'quadruple': {},\ - } - reshape = {\ - 'tensor': [3,3],\ - 'vector': [3],\ - 'scalar': [],\ - 'double': [2],\ - 'triple': [3],\ - 'quadruple': [4],\ - } - length = {\ - 'tensor': 9,\ - 'vector': 3,\ - 'scalar': 1,\ - 'double': 2,\ - 'triple': 3,\ - 'quadruple': 4,\ - } - - -# vtk lib out - if False: - points = vtk.vtkPoints() - for z in range (grid[2]+1): - for y in range (grid[1]+1): - for x in range (grid[0]+1): - points.InsertNextPoint(nodes[:,x,y,z]) - - data=[] - j=0 - for datatype in fields.keys(): - for what in eval('options.'+datatype): - for label in matches[datatype][what]: - col = column[datatype][label] - if col != -1: - data.append(vtk.vtkFloatArray()) - data[j].SetNumberOfComponents(length[datatype]) - for i in xrange(grid[2]*grid[1]*grid[0]): - for k in xrange(length[datatype]): - data[j].InsertNextValue(values2[i,col+k]) - data[j].SetName(label) - j+=1 - - if options.output_mesh: - hexs = vtk.vtkCellArray() - i = 0 - elems=[] - for z in range (grid[2]): - for y in range (grid[1]): - for x in range (grid[0]): - - elems.append(vtk.vtkHexahedron()) - base = z*(grid[1]+1)*(grid[0]+1)+y*(grid[0]+1)+x - elems[i].GetPointIds().SetId(0, base) - elems[i].GetPointIds().SetId(1, base+1) - elems[i].GetPointIds().SetId(2, base+grid[0]+2) - elems[i].GetPointIds().SetId(3, base+grid[0]+1) - elems[i].GetPointIds().SetId(4, base+(grid[1]+1)*(grid[0]+1)) - elems[i].GetPointIds().SetId(5, base+(grid[1]+1)*(grid[0]+1)+1) - elems[i].GetPointIds().SetId(6, base+(grid[1]+1)*(grid[0]+1)+grid[0]+2) - elems[i].GetPointIds().SetId(7, base+(grid[1]+1)*(grid[0]+1)+grid[0]+1) - hexs.InsertNextCell(elems[i]) - i+=1 - - uGrid = vtk.vtkUnstructuredGrid() - uGrid.SetPoints(points) - i = 0 - for z in range (grid[2]): - for y in range (grid[1]): - for x in range (grid[0]): - uGrid.InsertNextCell(elems[i].GetCellType(), elems[i].GetPointIds()) - i+=1 - - for i in xrange(len(data)): - uGrid.GetCellData().AddArray(data[i]) - - outWriter = vtk.vtkXMLUnstructuredGridWriter() - outWriter.SetDataModeToBinary() - outWriter.SetCompressorTypeToZLib() - (head,tail) = os.path.split(filename) - outWriter.SetFileName(os.path.join(head,'mesh_'+os.path.splitext(tail)[0]+'.vtu')) - outWriter.SetInput(uGrid) - outWriter.Write() - - - for datatype in fields.keys(): - print '\n%s:'%datatype, - fields[datatype]['_order_'] = [] - for what in eval('options.'+datatype): - for label in matches[datatype][what]: - col = column[datatype][label] - if col != -1: - print label, - fields[datatype][label] = np.reshape(values[:,col:col+length[datatype]],[grid[0],grid[1],grid[2]]+reshape[datatype]) - fields[datatype]['_order_'] += [label] - print '\n' - - out = {} - if options.output_mesh: out['mesh'] = vtk_writeASCII_mesh(nodes,fields,grid,sep[options.separator]) - if options.output_points: out['points'] = vtk_writeASCII_points(centroids,fields,grid,sep[options.separator]) - - for what in out.keys(): - print what - (head,tail) = os.path.split(filename) - vtk = open(os.path.join(head,what+'_'+os.path.splitext(tail)[0]+'.vtk'), 'w') - output(out[what],{'filepointer':vtk},'File') - vtk.close() - print diff --git a/processing/post/addAPS34IDEstrainCoords.py b/processing/post/addAPS34IDEstrainCoords.py index 7ba976478..8a793a8cf 100755 --- a/processing/post/addAPS34IDEstrainCoords.py +++ b/processing/post/addAPS34IDEstrainCoords.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -69,7 +69,7 @@ for name in filenames: if columnMissing: continue # ------------------------------------------ assemble header --------------------------------------- - table.labels_append(['%i_coord'%(i+1) for i in xrange(3)]) # extend ASCII header with new labels + table.labels_append(['%i_coord'%(i+1) for i in range(3)]) # extend ASCII header with new labels table.head_write() # ------------------------------------------ process data ------------------------------------------ @@ -94,4 +94,4 @@ for name in filenames: table.input_close() # close input ASCII table (works for stdin) table.output_close() # close output ASCII table (works for stdout) if file['name'] != 'STDIN': - os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new \ No newline at end of file + os.rename(file['name']+'_tmp',file['name']) # overwrite old one with tmp new diff --git a/processing/post/addCalculation.py b/processing/post/addCalculation.py index 8bfc7692f..fd8707414 100755 --- a/processing/post/addCalculation.py +++ b/processing/post/addCalculation.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import os,re,sys +import os,re,sys,collections import math # noqa import numpy as np from optparse import OptionParser @@ -10,6 +10,10 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) +def listify(x): + return x if isinstance(x, collections.Iterable) else [x] + + # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- @@ -17,10 +21,12 @@ scriptID = ' '.join([scriptName,damask.version]) parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ Add or alter column(s) with derived values according to user-defined arithmetic operation between column(s). Column labels are tagged by '#label#' in formulas. Use ';' for ',' in functions. -Numpy is available as np. +Numpy is available as 'np'. Special variables: #_row_# -- row index -Examples: (1) magnitude of vector -- "np.linalg.norm(#vec#)" (2) rounded root of row number -- "round(math.sqrt(#_row_#);3)" +Examples: +(1) magnitude of vector -- "np.linalg.norm(#vec#)" +(2) rounded root of row number -- "round(math.sqrt(#_row_#);3)" """, version = scriptID) @@ -47,60 +53,54 @@ if options.labels is None or options.formulas is None: if len(options.labels) != len(options.formulas): parser.error('number of labels ({}) and formulas ({}) do not match.'.format(len(options.labels),len(options.formulas))) -for i in xrange(len(options.formulas)): +for i in range(len(options.formulas)): options.formulas[i] = options.formulas[i].replace(';',',') -# --- loop over input files ------------------------------------------------------------------------- +# ------------------------------------- loop over input files -------------------------------------- if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) - output = damask.ASCIItable(name = name, - buffered = False) - except: - continue + try: table = damask.ASCIItable(name = name, + buffered = False) + except: continue damask.util.report(scriptName,name) # ------------------------------------------ read header ------------------------------------------- table.head_read() -# ----------------------------------------------------------------------------------------------------- +# -------------------------------------------------------------------------------------------------- specials = { \ '_row_': 0, } -# ------------------------------------------ Evaluate condition --------------------------------------- - if options.condition: +# --------------------------------------- evaluate condition --------------------------------------- + if options.condition is not None: interpolator = [] - condition = options.condition # copy per file, since might be altered inline + condition = options.condition # copy per file, since might be altered inline breaker = False - for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups + for position,operand in enumerate(set(re.findall(r'#(([s]#)?(.+?))#',condition))): # find three groups condition = condition.replace('#'+operand[0]+'#', { '': '{%i}'%position, 's#':'"{%i}"'%position}[operand[1]]) - if operand[2] in specials: # special label + if operand[2] in specials: # special label interpolator += ['specials["%s"]'%operand[2]] else: try: interpolator += ['%s(table.data[%i])'%({ '':'float', 's#':'str'}[operand[1]], - table.label_index(operand[2]))] # ccould be generalized to indexrange as array lookup + table.label_index(operand[2]))] # could be generalized to indexrange as array lookup except: damask.util.croak('column "{}" not found.'.format(operand[2])) breaker = True - if breaker: continue # found mistake in condition evaluation --> next file + if breaker: continue # found mistake in condition evaluation --> next file evaluator_condition = "'" + condition + "'.format(" + ','.join(interpolator) + ")" - else: condition = '' - -# ------------------------------------------ build formulae ---------------------------------------- +# ------------------------------------------ build formulas ---------------------------------------- evaluator = {} @@ -123,6 +123,10 @@ for name in filenames: evaluator[label] = formula +# ---------------------------- separate requested labels into old and new -------------------------- + + veterans = list(set(options.labels)&set(table.labels(raw=False)+table.labels(raw=True)) ) # intersection of requested and existing + newbies = list(set(options.labels)-set(table.labels(raw=False)+table.labels(raw=True)) ) # requested but not existing # ------------------------------------------ process data ------------------------------------------ @@ -131,53 +135,45 @@ for name in filenames: while outputAlive and table.data_read(): # read next data line of ASCII table specials['_row_'] += 1 # count row - output.data_clear() -# ------------------------------------------ calculate one result to get length of labels --------- - if firstLine: firstLine = False - labelDim = {} - for label in [x for x in options.labels]: - labelDim[label] = np.size(eval(evaluator[label])) - if labelDim[label] == 0: options.labels.remove(label) -# ------------------------------------------ assemble header --------------------------------------- +# ---------------------------- line 1: determine dimension of formulas ----------------------------- - output.labels_clear() - tabLabels = table.labels() - for label in tabLabels: - dim = labelDim[label] if label in options.labels \ - else table.label_dimension(label) - output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(dim)] if dim > 1 else label) + resultDim = {} + for label in list(options.labels): # iterate over stable copy + resultDim[label] = np.size(eval(evaluator[label])) # get dimension of formula[label] + if resultDim[label] == 0: options.labels.remove(label) # remove label if invalid result + + for veteran in list(veterans): + if resultDim[veteran] != table.label_dimension(veteran): + damask.util.croak('skipping {} due to inconsistent dimension...'.format(veteran)) + veterans.remove(veteran) # discard culprit - for label in options.labels: - if label in tabLabels: continue - output.labels_append(['{}_{}'.format(i+1,label) for i in xrange(labelDim[label])] - if labelDim[label] > 1 - else label) +# ----------------------------------- line 1: assemble header -------------------------------------- - output.info = table.info - output.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - output.head_write() + for newby in newbies: + table.labels_append(['{}_{}'.format(i+1,newby) for i in range(resultDim[newby])] + if resultDim[newby] > 1 else newby) -# ------------------------------------------ process data ------------------------------------------ + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) + table.head_write() - for label in output.labels(): - oldIndices = table.label_indexrange(label) - Nold = max(1,len(oldIndices)) # Nold could be zero for new columns - Nnew = len(output.label_indexrange(label)) - output.data_append(eval(evaluator[label]) if label in options.labels and - (condition == '' or eval(eval(evaluator_condition))) - else np.tile([table.data[i] for i in oldIndices] - if label in tabLabels - else np.nan, - np.ceil(float(Nnew)/Nold))[:Nnew]) # spread formula result into given number of columns +# -------------------------------------- evaluate formulas ----------------------------------------- - outputAlive = output.data_write() # output processed line + if options.condition is None or eval(eval(evaluator_condition)): # condition for veteran replacement fulfilled + for veteran in veterans: # evaluate formulas that overwrite + table.data[table.label_index(veteran): + table.label_index(veteran)+table.label_dimension(veteran)] = \ + listify(eval(evaluator[veteran])) + + for newby in newbies: # evaluate formulas that append + table.data_append(listify(eval(evaluator[newby]))) -# ------------------------------------------ output finalization ----------------------------------- + outputAlive = table.data_write() # output processed line + +# ------------------------------------- output finalization ---------------------------------------- + + table.close() # close ASCII table - table.input_close() # close ASCII tables - output.close() # close ASCII tables - diff --git a/processing/post/addCauchy.py b/processing/post/addCauchy.py index beebb0422..ab619722e 100755 --- a/processing/post/addCauchy.py +++ b/processing/post/addCauchy.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -68,7 +68,7 @@ for name in filenames: # ------------------------------------------ assemble header -------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['%i_Cauchy'%(i+1) for i in xrange(9)]) # extend ASCII header with new labels + table.labels_append(['{}_Cauchy'.format(i+1) for i in range(9)]) # extend ASCII header with new labels table.head_write() # ------------------------------------------ process data ------------------------------------------ diff --git a/processing/post/addCompatibilityMismatch.py b/processing/post/addCompatibilityMismatch.py index e4fc4a145..51e5f5eab 100755 --- a/processing/post/addCompatibilityMismatch.py +++ b/processing/post/addCompatibilityMismatch.py @@ -1,14 +1,210 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import os,sys +import os +import math import numpy as np +import scipy.ndimage from optparse import OptionParser import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) +#-------------------------------------------------------------------------------------------------- +def cell2node(cellData,grid): + + nodeData = 0.0 + datalen = np.array(cellData.shape[3:]).prod() + + for i in range(datalen): + node = scipy.ndimage.convolve(cellData.reshape(tuple(grid[::-1])+(datalen,))[...,i], + np.ones((2,2,2))/8., # 2x2x2 neighborhood of cells + mode = 'wrap', + origin = -1, # offset to have cell origin as center + ) # now averaged at cell origins + node = np.append(node,node[np.newaxis,0,:,:,...],axis=0) # wrap along z + node = np.append(node,node[:,0,np.newaxis,:,...],axis=1) # wrap along y + node = np.append(node,node[:,:,0,np.newaxis,...],axis=2) # wrap along x + + nodeData = node[...,np.newaxis] if i==0 else np.concatenate((nodeData,node[...,np.newaxis]),axis=-1) + + return nodeData + +#-------------------------------------------------------------------------------------------------- +def deformationAvgFFT(F,grid,size,nodal=False,transformed=False): + """Calculate average cell center (or nodal) deformation for deformation gradient field specified in each grid cell""" + if nodal: + x, y, z = np.meshgrid(np.linspace(0,size[2],1+grid[2]), + np.linspace(0,size[1],1+grid[1]), + np.linspace(0,size[0],1+grid[0]), + indexing = 'ij') + else: + x, y, z = np.meshgrid(np.linspace(size[2]/grid[2]/2.,size[2]-size[2]/grid[2]/2.,grid[2]), + np.linspace(size[1]/grid[1]/2.,size[1]-size[1]/grid[1]/2.,grid[1]), + np.linspace(size[0]/grid[0]/2.,size[0]-size[0]/grid[0]/2.,grid[0]), + indexing = 'ij') + + origCoords = np.concatenate((z[:,:,:,None],y[:,:,:,None],x[:,:,:,None]),axis = 3) + + F_fourier = F if transformed else np.fft.rfftn(F,axes=(0,1,2)) # transform or use provided data + Favg = np.real(F_fourier[0,0,0,:,:])/grid.prod() # take zero freq for average + avgDeformation = np.einsum('ml,ijkl->ijkm',Favg,origCoords) # dX = Favg.X + + return avgDeformation + +#-------------------------------------------------------------------------------------------------- +def displacementFluctFFT(F,grid,size,nodal=False,transformed=False): + """Calculate cell center (or nodal) displacement for deformation gradient field specified in each grid cell""" + integrator = 0.5j * size / math.pi + + kk, kj, ki = np.meshgrid(np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2])), + np.where(np.arange(grid[1])>grid[1]//2,np.arange(grid[1])-grid[1],np.arange(grid[1])), + np.arange(grid[0]//2+1), + indexing = 'ij') + k_s = np.concatenate((ki[:,:,:,None],kj[:,:,:,None],kk[:,:,:,None]),axis = 3) + k_sSquared = np.einsum('...l,...l',k_s,k_s) + k_sSquared[0,0,0] = 1.0 # ignore global average frequency + +#-------------------------------------------------------------------------------------------------- +# integration in Fourier space + + displacement_fourier = -np.einsum('ijkml,ijkl,l->ijkm', + F if transformed else np.fft.rfftn(F,axes=(0,1,2)), + k_s, + integrator, + ) / k_sSquared[...,np.newaxis] + +#-------------------------------------------------------------------------------------------------- +# backtransformation to real space + + displacement = np.fft.irfftn(displacement_fourier,grid[::-1],axes=(0,1,2)) + + return cell2node(displacement,grid) if nodal else displacement + + +def volTetrahedron(coords): + """ + Return the volume of the tetrahedron with given vertices or sides. + + Ifvertices are given they must be in a NumPy array with shape (4,3): the + position vectors of the 4 vertices in 3 dimensions; if the six sides are + given, they must be an array of length 6. If both are given, the sides + will be used in the calculation. + + This method implements + Tartaglia's formula using the Cayley-Menger determinant: + |0 1 1 1 1 | + |1 0 s1^2 s2^2 s3^2| + 288 V^2 = |1 s1^2 0 s4^2 s5^2| + |1 s2^2 s4^2 0 s6^2| + |1 s3^2 s5^2 s6^2 0 | + where s1, s2, ..., s6 are the tetrahedron side lengths. + + from http://codereview.stackexchange.com/questions/77593/calculating-the-volume-of-a-tetrahedron + """ + # The indexes of rows in the vertices array corresponding to all + # possible pairs of vertices + vertex_pair_indexes = np.array(((0, 1), (0, 2), (0, 3), + (1, 2), (1, 3), (2, 3))) + + # Get all the squares of all side lengths from the differences between + # the 6 different pairs of vertex positions + vertices = np.concatenate((coords[0],coords[1],coords[2],coords[3])).reshape([4,3]) + vertex1, vertex2 = vertex_pair_indexes[:,0], vertex_pair_indexes[:,1] + sides_squared = np.sum((vertices[vertex1] - vertices[vertex2])**2,axis=-1) + + + # Set up the Cayley-Menger determinant + M = np.zeros((5,5)) + # Fill in the upper triangle of the matrix + M[0,1:] = 1 + # The squared-side length elements can be indexed using the vertex + # pair indices (compare with the determinant illustrated above) + M[tuple(zip(*(vertex_pair_indexes + 1)))] = sides_squared + + # The matrix is symmetric, so we can fill in the lower triangle by + # adding the transpose + M = M + M.T + return np.sqrt(np.linalg.det(M) / 288) + + +def volumeMismatch(size,F,nodes): + """ + Calculates the volume mismatch + + volume mismatch is defined as the difference between volume of reconstructed + (compatible) cube and determinant of defgrad at the FP + """ + coords = np.empty([8,3]) + vMismatch = np.empty(grid[::-1]) + volInitial = size.prod()/grid.prod() + +#-------------------------------------------------------------------------------------------------- +# calculate actual volume and volume resulting from deformation gradient + for k in range(grid[2]): + for j in range(grid[1]): + for i in range(grid[0]): + coords[0,0:3] = nodes[k, j, i ,0:3] + coords[1,0:3] = nodes[k ,j, i+1,0:3] + coords[2,0:3] = nodes[k ,j+1,i+1,0:3] + coords[3,0:3] = nodes[k, j+1,i ,0:3] + coords[4,0:3] = nodes[k+1,j, i ,0:3] + coords[5,0:3] = nodes[k+1,j, i+1,0:3] + coords[6,0:3] = nodes[k+1,j+1,i+1,0:3] + coords[7,0:3] = nodes[k+1,j+1,i ,0:3] + vMismatch[k,j,i] = \ + ( abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[3,0:3]])) \ + + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[7,0:3],coords[4,0:3]])) \ + + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[3,0:3]])) \ + + abs(volTetrahedron([coords[6,0:3],coords[0,0:3],coords[2,0:3],coords[1,0:3]])) \ + + abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[5,0:3]])) \ + + abs(volTetrahedron([coords[6,0:3],coords[4,0:3],coords[1,0:3],coords[0,0:3]]))) \ + /np.linalg.det(F[k,j,i,0:3,0:3]) + return vMismatch/volInitial + + + +def shapeMismatch(size,F,nodes,centres): + """ + Routine to calculate the shape mismatch + + shape mismatch is defined as difference between the vectors from the central point to + the corners of reconstructed (combatible) volume element and the vectors calculated by deforming + the initial volume element with the current deformation gradient + """ + coordsInitial = np.empty([8,3]) + sMismatch = np.empty(grid[::-1]) + +#-------------------------------------------------------------------------------------------------- +# initial positions + coordsInitial[0,0:3] = [-size[0]/grid[0],-size[1]/grid[1],-size[2]/grid[2]] + coordsInitial[1,0:3] = [+size[0]/grid[0],-size[1]/grid[1],-size[2]/grid[2]] + coordsInitial[2,0:3] = [+size[0]/grid[0],+size[1]/grid[1],-size[2]/grid[2]] + coordsInitial[3,0:3] = [-size[0]/grid[0],+size[1]/grid[1],-size[2]/grid[2]] + coordsInitial[4,0:3] = [-size[0]/grid[0],-size[1]/grid[1],+size[2]/grid[2]] + coordsInitial[5,0:3] = [+size[0]/grid[0],-size[1]/grid[1],+size[2]/grid[2]] + coordsInitial[6,0:3] = [+size[0]/grid[0],+size[1]/grid[1],+size[2]/grid[2]] + coordsInitial[7,0:3] = [-size[0]/grid[0],+size[1]/grid[1],+size[2]/grid[2]] + coordsInitial = coordsInitial/2.0 + +#-------------------------------------------------------------------------------------------------- +# compare deformed original and deformed positions to actual positions + for k in range(grid[2]): + for j in range(grid[1]): + for i in range(grid[0]): + sMismatch[k,j,i] = \ + + np.linalg.norm(nodes[k, j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[0,0:3]))\ + + np.linalg.norm(nodes[k, j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[1,0:3]))\ + + np.linalg.norm(nodes[k, j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[2,0:3]))\ + + np.linalg.norm(nodes[k, j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[3,0:3]))\ + + np.linalg.norm(nodes[k+1,j, i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[4,0:3]))\ + + np.linalg.norm(nodes[k+1,j, i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[5,0:3]))\ + + np.linalg.norm(nodes[k+1,j+1,i+1,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[6,0:3]))\ + + np.linalg.norm(nodes[k+1,j+1,i ,0:3] - centres[k,j,i,0:3] - np.dot(F[k,j,i,:,:], coordsInitial[7,0:3])) + return sMismatch + + # -------------------------------------------------------------------- # MAIN # -------------------------------------------------------------------- @@ -64,79 +260,78 @@ for name in filenames: errors = [] remarks = [] - if table.label_dimension(options.pos) != 3: - errors.append('coordinates "{}" are not a vector.'.format(options.pos)) - else: colCoord = table.label_index(options.pos) - if table.label_dimension(options.defgrad) != 9: - errors.append('deformation gradient "{}" is not a tensor.'.format(options.defgrad)) - else: colF = table.label_index(options.defgrad) + errors.append('deformation gradient "{}" is not a 3x3 tensor.'.format(options.defgrad)) + + coordDim = table.label_dimension(options.pos) + if not 3 >= coordDim >= 1: + errors.append('coordinates "{}" need to have one, two, or three dimensions.'.format(options.pos)) + elif coordDim < 3: + remarks.append('appending {} dimension{} to coordinates "{}"...'.format(3-coordDim, + 's' if coordDim < 2 else '', + options.pos)) if remarks != []: damask.util.croak(remarks) if errors != []: damask.util.croak(errors) - table.close(dismiss = True) + table.close(dismiss=True) continue -# ------------------------------------------ assemble header -------------------------------------- - - table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - if options.shape: table.labels_append('shapeMismatch({})'.format(options.defgrad)) - if options.volume: table.labels_append('volMismatch({})'.format(options.defgrad)) - # --------------- figure out size and grid --------------------------------------------------------- - table.data_readArray() + table.data_readArray([options.defgrad,options.pos]) + table.data_rewind() - coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] + if len(table.data.shape) < 2: table.data.shape += (1,) # expand to 2D shape + if table.data[:,9:].shape[1] < 3: + table.data = np.hstack((table.data, + np.zeros((table.data.shape[0], + 3-table.data[:,9:].shape[1]),dtype='f'))) # fill coords up to 3D with zeros + + coords = [np.unique(table.data[:,9+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') size = grid/np.maximum(np.ones(3,'d'), grid-1.0) * (maxcorner-mincorner) # size from edge to edge = dim * n/(n-1) - size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # grid==1 spacing set to smallest among other ones + size = np.where(grid > 1, size, min(size[grid > 1]/grid[grid > 1])) # spacing for grid==1 set to smallest among other spacings N = grid.prod() - -# --------------- figure out columns to process --------------------------------------------------- - key = '1_'+options.defgrad - if table.label_index(key) == -1: - damask.util.croak('column "{}" not found...'.format(key)) + + if N != len(table.data): errors.append('data count {} does not match grid {}x{}x{}.'.format(N,*grid)) + if errors != []: + damask.util.croak(errors) + table.close(dismiss = True) continue - else: - column = table.label_index(key) # remember columns of requested data - -# ------------------------------------------ assemble header --------------------------------------- - if options.shape: table.labels_append(['shapeMismatch({})'.format(options.defgrad)]) - if options.volume: table.labels_append(['volMismatch({})'.format(options.defgrad)]) - table.head_write() - -# ------------------------------------------ read deformation gradient field ----------------------- - table.data_rewind() - F = np.zeros(N*9,'d').reshape([3,3]+list(grid)) - idx = 0 - while table.data_read(): - (x,y,z) = damask.util.gridLocation(idx,grid) # figure out (x,y,z) position from line count - idx += 1 - F[0:3,0:3,x,y,z] = np.array(map(float,table.data[column:column+9]),'d').reshape(3,3) - - Favg = damask.core.math.tensorAvg(F) - centres = damask.core.mesh.deformedCoordsFFT(size,F,Favg,[1.0,1.0,1.0]) - nodes = damask.core.mesh.nodesAroundCentres(size,Favg,centres) - if options.shape: shapeMismatch = damask.core.mesh.shapeMismatch( size,F,nodes,centres) - if options.volume: volumeMismatch = damask.core.mesh.volumeMismatch(size,F,nodes) +# -----------------------------process data and assemble header ------------------------------------- -# ------------------------------------------ process data ------------------------------------------ - table.data_rewind() - idx = 0 - outputAlive = True - while outputAlive and table.data_read(): # read next data line of ASCII table - (x,y,z) = damask.util.gridLocation(idx,grid) # figure out (x,y,z) position from line count - idx += 1 - if options.shape: table.data_append( shapeMismatch[x,y,z]) - if options.volume: table.data_append(volumeMismatch[x,y,z]) - outputAlive = table.data_write() + F_fourier = np.fft.rfftn(table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),axes=(0,1,2)) # perform transform only once... + nodes = displacementFluctFFT(F_fourier,grid,size,True,transformed=True)\ + + deformationAvgFFT (F_fourier,grid,size,True,transformed=True) -# ------------------------------------------ output finalization ----------------------------------- + if options.shape: + table.labels_append(['shapeMismatch({})'.format(options.defgrad)]) + centres = displacementFluctFFT(F_fourier,grid,size,False,transformed=True)\ + + deformationAvgFFT (F_fourier,grid,size,False,transformed=True) + + if options.volume: + table.labels_append(['volMismatch({})'.format(options.defgrad)]) + + table.head_write() + if options.shape: + shapeMismatch = shapeMismatch( size,table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),nodes,centres) + if options.volume: + volumeMismatch = volumeMismatch(size,table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),nodes) + +# ------------------------------------------ output data ------------------------------------------- + for i in range(grid[2]): + for j in range(grid[1]): + for k in range(grid[0]): + table.data_read() + if options.shape: table.data_append(shapeMismatch[i,j,k]) + if options.volume: table.data_append(volumeMismatch[i,j,k]) + table.data_write() + +# ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables diff --git a/processing/post/addCumulative.py b/processing/post/addCumulative.py index a577b68fe..71fb1effc 100755 --- a/processing/post/addCumulative.py +++ b/processing/post/addCumulative.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -59,7 +59,7 @@ for name in filenames: dims.append(dim) columns.append(table.label_index(what)) table.labels_append('cum({})'.format(what) if dim == 1 else - ['{}_cum({})'.format(i+1,what) for i in xrange(dim)] ) # extend ASCII header with new labels + ['{}_cum({})'.format(i+1,what) for i in range(dim)] ) # extend ASCII header with new labels if remarks != []: damask.util.croak(remarks) if errors != []: diff --git a/processing/post/addCurl.py b/processing/post/addCurl.py index 3afec570a..98a00197c 100755 --- a/processing/post/addCurl.py +++ b/processing/post/addCurl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -12,51 +12,38 @@ scriptID = ' '.join([scriptName,damask.version]) def curlFFT(geomdim,field): shapeFFT = np.array(np.shape(field))[0:3] grid = np.array(np.shape(field)[2::-1]) - N = grid.prod() # field size - n = np.array(np.shape(field)[3:]).prod() # data size + N = grid.prod() # field size + n = np.array(np.shape(field)[3:]).prod() # data size if n == 3: dataType = 'vector' elif n == 9: dataType = 'tensor' - field_fourier = np.fft.fftpack.rfftn(field,axes=(0,1,2),s=shapeFFT) + field_fourier = np.fft.rfftn(field,axes=(0,1,2),s=shapeFFT) curl_fourier = np.empty(field_fourier.shape,'c16') # differentiation in Fourier space - k_s = np.zeros([3],'i') TWOPIIMG = 2.0j*math.pi - for i in xrange(grid[2]): - k_s[0] = i - if grid[2]%2 == 0 and i == grid[2]//2: k_s[0] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif i > grid[2]//2: k_s[0] -= grid[2] + k_sk = np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2]))/geomdim[0] + if grid[2]%2 == 0: k_sk[grid[2]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) + + k_sj = np.where(np.arange(grid[1])>grid[1]//2,np.arange(grid[1])-grid[1],np.arange(grid[1]))/geomdim[1] + if grid[1]%2 == 0: k_sj[grid[1]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - for j in xrange(grid[1]): - k_s[1] = j - if grid[1]%2 == 0 and j == grid[1]//2: k_s[1] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif j > grid[1]//2: k_s[1] -= grid[1] + k_si = np.arange(grid[0]//2+1)/geomdim[2] + + kk, kj, ki = np.meshgrid(k_sk,k_sj,k_si,indexing = 'ij') + k_s = np.concatenate((ki[:,:,:,None],kj[:,:,:,None],kk[:,:,:,None]),axis = 3).astype('c16') + + e = np.zeros((3, 3, 3)) + e[0, 1, 2] = e[1, 2, 0] = e[2, 0, 1] = 1.0 # Levi-Civita symbols + e[0, 2, 1] = e[2, 1, 0] = e[1, 0, 2] = -1.0 + + if dataType == 'tensor': # tensor, 3x3 -> 3x3 + curl_fourier = np.einsum('slm,ijkl,ijknm->ijksn',e,k_s,field_fourier)*TWOPIIMG + elif dataType == 'vector': # vector, 3 -> 3 + curl_fourier = np.einsum('slm,ijkl,ijkm->ijks',e,k_s,field_fourier)*TWOPIIMG - for k in xrange(grid[0]//2+1): - k_s[2] = k - if grid[0]%2 == 0 and k == grid[0]//2: k_s[2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - - xi = (k_s/geomdim)[2::-1].astype('c16') # reversing the field input order - - if dataType == 'tensor': - for l in xrange(3): - curl_fourier[i,j,k,0,l] = ( field_fourier[i,j,k,l,2]*xi[1]\ - -field_fourier[i,j,k,l,1]*xi[2]) *TWOPIIMG - curl_fourier[i,j,k,1,l] = (-field_fourier[i,j,k,l,2]*xi[0]\ - +field_fourier[i,j,k,l,0]*xi[2]) *TWOPIIMG - curl_fourier[i,j,k,2,l] = ( field_fourier[i,j,k,l,1]*xi[0]\ - -field_fourier[i,j,k,l,0]*xi[1]) *TWOPIIMG - elif dataType == 'vector': - curl_fourier[i,j,k,0] = ( field_fourier[i,j,k,2]*xi[1]\ - -field_fourier[i,j,k,1]*xi[2]) *TWOPIIMG - curl_fourier[i,j,k,1] = (-field_fourier[i,j,k,2]*xi[0]\ - +field_fourier[i,j,k,0]*xi[2]) *TWOPIIMG - curl_fourier[i,j,k,2] = ( field_fourier[i,j,k,1]*xi[0]\ - -field_fourier[i,j,k,0]*xi[1]) *TWOPIIMG - - return np.fft.fftpack.irfftn(curl_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,n]) + return np.fft.irfftn(curl_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,n]) # -------------------------------------------------------------------- @@ -136,14 +123,14 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for type, data in items.iteritems(): for label in data['active']: - table.labels_append(['{}_curlFFT({})'.format(i+1,label) for i in xrange(data['dim'])]) # extend ASCII header with new labels + table.labels_append(['{}_curlFFT({})'.format(i+1,label) for i in range(data['dim'])]) # extend ASCII header with new labels table.head_write() # --------------- figure out size and grid --------------------------------------------------------- table.data_readArray() - coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] + coords = [np.unique(table.data[:,colCoord+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -158,7 +145,7 @@ for name in filenames: # we need to reverse order here, because x is fastest,ie rightmost, but leftmost in our x,y,z notation stack.append(curlFFT(size[::-1], table.data[:,data['column'][i]:data['column'][i]+data['dim']]. - reshape([grid[2],grid[1],grid[0]]+data['shape']))) + reshape(grid[::-1].tolist()+data['shape']))) # ------------------------------------------ output result ----------------------------------------- diff --git a/processing/post/addDeterminant.py b/processing/post/addDeterminant.py index dc04dd8ff..1f721c27e 100755 --- a/processing/post/addDeterminant.py +++ b/processing/post/addDeterminant.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addDeviator.py b/processing/post/addDeviator.py index d96564d4c..471c2635f 100755 --- a/processing/post/addDeviator.py +++ b/processing/post/addDeviator.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -85,7 +85,7 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for type, data in items.iteritems(): for label in data['active']: - table.labels_append(['{}_dev({})'.format(i+1,label) for i in xrange(data['dim'])] + \ + table.labels_append(['{}_dev({})'.format(i+1,label) for i in range(data['dim'])] + \ (['sph({})'.format(label)] if options.spherical else [])) # extend ASCII header with new labels table.head_write() @@ -101,4 +101,4 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- - table.close() # close input ASCII table (works for stdin) \ No newline at end of file + table.close() # close input ASCII table (works for stdin) diff --git a/processing/post/addDisplacement.py b/processing/post/addDisplacement.py index b421979c4..bc1d7377b 100755 --- a/processing/post/addDisplacement.py +++ b/processing/post/addDisplacement.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -17,8 +17,8 @@ def cell2node(cellData,grid): nodeData = 0.0 datalen = np.array(cellData.shape[3:]).prod() - for i in xrange(datalen): - node = scipy.ndimage.convolve(cellData.reshape(tuple(grid)+(datalen,))[...,i], + for i in range(datalen): + node = scipy.ndimage.convolve(cellData.reshape(tuple(grid[::-1])+(datalen,))[...,i], np.ones((2,2,2))/8., # 2x2x2 neighborhood of cells mode = 'wrap', origin = -1, # offset to have cell origin as center @@ -33,16 +33,16 @@ def cell2node(cellData,grid): #-------------------------------------------------------------------------------------------------- def displacementAvgFFT(F,grid,size,nodal=False,transformed=False): - """calculate average cell center (or nodal) displacement for deformation gradient field specified in each grid cell""" + """Calculate average cell center (or nodal) displacement for deformation gradient field specified in each grid cell""" if nodal: - x, y, z = np.meshgrid(np.linspace(0,size[0],1+grid[0]), + x, y, z = np.meshgrid(np.linspace(0,size[2],1+grid[2]), np.linspace(0,size[1],1+grid[1]), - np.linspace(0,size[2],1+grid[2]), + np.linspace(0,size[0],1+grid[0]), indexing = 'ij') else: - x, y, z = np.meshgrid(np.linspace(0,size[0],grid[0],endpoint=False), + x, y, z = np.meshgrid(np.linspace(0,size[2],grid[2],endpoint=False), np.linspace(0,size[1],grid[1],endpoint=False), - np.linspace(0,size[2],grid[2],endpoint=False), + np.linspace(0,size[0],grid[0],endpoint=False), indexing = 'ij') origCoords = np.concatenate((z[:,:,:,None],y[:,:,:,None],x[:,:,:,None]),axis = 3) @@ -55,7 +55,7 @@ def displacementAvgFFT(F,grid,size,nodal=False,transformed=False): #-------------------------------------------------------------------------------------------------- def displacementFluctFFT(F,grid,size,nodal=False,transformed=False): - """calculate cell center (or nodal) displacement for deformation gradient field specified in each grid cell""" + """Calculate cell center (or nodal) displacement for deformation gradient field specified in each grid cell""" integrator = 0.5j * size / math.pi kk, kj, ki = np.meshgrid(np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2])), @@ -78,7 +78,7 @@ def displacementFluctFFT(F,grid,size,nodal=False,transformed=False): #-------------------------------------------------------------------------------------------------- # backtransformation to real space - displacement = np.fft.irfftn(displacement_fourier,grid,axes=(0,1,2)) + displacement = np.fft.irfftn(displacement_fourier,grid[::-1],axes=(0,1,2)) return cell2node(displacement,grid) if nodal else displacement @@ -107,7 +107,7 @@ parser.add_option('-p', parser.add_option('--nodal', dest = 'nodal', action = 'store_true', - help = 'output nodal (instad of cell-centered) displacements') + help = 'output nodal (instead of cell-centered) displacements') parser.set_defaults(defgrad = 'f', pos = 'pos', @@ -128,7 +128,8 @@ for name in filenames: outname = outname, buffered = False) except: continue - damask.util.report(scriptName,'{}{}'.format(name,' --> {}'.format(outname) if outname else '')) + damask.util.report(scriptName,'{}{}'.format(name if name else '', + ' --> {}'.format(outname) if outname else '')) # ------------------------------------------ read header ------------------------------------------ @@ -167,7 +168,7 @@ for name in filenames: np.zeros((table.data.shape[0], 3-table.data[:,9:].shape[1]),dtype='f'))) # fill coords up to 3D with zeros - coords = [np.unique(table.data[:,9+i]) for i in xrange(3)] + coords = [np.unique(table.data[:,9+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -186,8 +187,8 @@ for name in filenames: F_fourier = np.fft.rfftn(table.data[:,:9].reshape(grid[2],grid[1],grid[0],3,3),axes=(0,1,2)) # perform transform only once... - displacement = displacementFluctFFT(F_fourier,grid,size,options.nodal,transformed=True) - avgDisplacement = displacementAvgFFT (F_fourier,grid,size,options.nodal,transformed=True) + fluctDisplacement = displacementFluctFFT(F_fourier,grid,size,options.nodal,transformed=True) + avgDisplacement = displacementAvgFFT (F_fourier,grid,size,options.nodal,transformed=True) # ------------------------------------------ assemble header --------------------------------------- @@ -196,25 +197,25 @@ for name in filenames: table.labels_clear() table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append((['{}_pos' .format(i+1) for i in xrange(3)] if options.nodal else []) + - ['{}_avg({}).{}' .format(i+1,options.defgrad,options.pos) for i in xrange(3)] + - ['{}_fluct({}).{}'.format(i+1,options.defgrad,options.pos) for i in xrange(3)] ) + table.labels_append((['{}_pos' .format(i+1) for i in range(3)] if options.nodal else []) + + ['{}_avg({}).{}' .format(i+1,options.defgrad,options.pos) for i in range(3)] + + ['{}_fluct({}).{}'.format(i+1,options.defgrad,options.pos) for i in range(3)] ) table.head_write() # ------------------------------------------ output data ------------------------------------------- - zrange = np.linspace(0,size[2],1+grid[2]) if options.nodal else xrange(grid[2]) - yrange = np.linspace(0,size[1],1+grid[1]) if options.nodal else xrange(grid[1]) - xrange = np.linspace(0,size[0],1+grid[0]) if options.nodal else xrange(grid[0]) + Zrange = np.linspace(0,size[2],1+grid[2]) if options.nodal else range(grid[2]) + Yrange = np.linspace(0,size[1],1+grid[1]) if options.nodal else range(grid[1]) + Xrange = np.linspace(0,size[0],1+grid[0]) if options.nodal else range(grid[0]) - for i,z in enumerate(zrange): - for j,y in enumerate(yrange): - for k,x in enumerate(xrange): + for i,z in enumerate(Zrange): + for j,y in enumerate(Yrange): + for k,x in enumerate(Xrange): if options.nodal: table.data_clear() else: table.data_read() table.data_append([x,y,z] if options.nodal else []) - table.data_append(list(avgDisplacement[i,j,k,:])) - table.data_append(list( displacement[i,j,k,:])) + table.data_append(list( avgDisplacement[i,j,k,:])) + table.data_append(list(fluctDisplacement[i,j,k,:])) table.data_write() # ------------------------------------------ output finalization ----------------------------------- diff --git a/processing/post/addDivergence.py b/processing/post/addDivergence.py index 56ccb1b07..232b5bc21 100755 --- a/processing/post/addDivergence.py +++ b/processing/post/addDivergence.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -12,37 +12,33 @@ scriptID = ' '.join([scriptName,damask.version]) def divFFT(geomdim,field): shapeFFT = np.array(np.shape(field))[0:3] grid = np.array(np.shape(field)[2::-1]) - N = grid.prod() # field size - n = np.array(np.shape(field)[3:]).prod() # data size + N = grid.prod() # field size + n = np.array(np.shape(field)[3:]).prod() # data size - field_fourier = np.fft.fftpack.rfftn(field,axes=(0,1,2),s=shapeFFT) - div_fourier = np.empty(field_fourier.shape[0:len(np.shape(field))-1],'c16') # size depents on whether tensor or vector + if n == 3: dataType = 'vector' + elif n == 9: dataType = 'tensor' + + field_fourier = np.fft.rfftn(field,axes=(0,1,2),s=shapeFFT) + div_fourier = np.empty(field_fourier.shape[0:len(np.shape(field))-1],'c16') # differentiation in Fourier space - k_s = np.zeros([3],'i') TWOPIIMG = 2.0j*math.pi - for i in xrange(grid[2]): - k_s[0] = i - if grid[2]%2 == 0 and i == grid[2]//2: k_s[0] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif i > grid[2]//2: k_s[0] -= grid[2] + k_sk = np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2]))/geomdim[0] + if grid[2]%2 == 0: k_sk[grid[2]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) + + k_sj = np.where(np.arange(grid[1])>grid[1]//2,np.arange(grid[1])-grid[1],np.arange(grid[1]))/geomdim[1] + if grid[1]%2 == 0: k_sj[grid[1]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - for j in xrange(grid[1]): - k_s[1] = j - if grid[1]%2 == 0 and j == grid[1]//2: k_s[1] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif j > grid[1]//2: k_s[1] -= grid[1] - - for k in xrange(grid[0]//2+1): - k_s[2] = k - if grid[0]%2 == 0 and k == grid[0]//2: k_s[2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - - xi = (k_s/geomdim)[2::-1].astype('c16') # reversing the field input order - if n == 9: # tensor, 3x3 -> 3 - for l in xrange(3): - div_fourier[i,j,k,l] = sum(field_fourier[i,j,k,l,0:3]*xi) *TWOPIIMG - elif n == 3: # vector, 3 -> 1 - div_fourier[i,j,k] = sum(field_fourier[i,j,k,0:3]*xi) *TWOPIIMG - - return np.fft.fftpack.irfftn(div_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,n/3]) + k_si = np.arange(grid[0]//2+1)/geomdim[2] + + kk, kj, ki = np.meshgrid(k_sk,k_sj,k_si,indexing = 'ij') + k_s = np.concatenate((ki[:,:,:,None],kj[:,:,:,None],kk[:,:,:,None]),axis = 3).astype('c16') + if dataType == 'tensor': # tensor, 3x3 -> 3 + div_fourier = np.einsum('ijklm,ijkm->ijkl',field_fourier,k_s)*TWOPIIMG + elif dataType == 'vector': # vector, 3 -> 1 + div_fourier = np.einsum('ijkl,ijkl->ijk',field_fourier,k_s)*TWOPIIMG + + return np.fft.irfftn(div_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,n/3]) # -------------------------------------------------------------------- @@ -123,14 +119,14 @@ for name in filenames: for type, data in items.iteritems(): for label in data['active']: table.labels_append(['divFFT({})'.format(label) if type == 'vector' else - '{}_divFFT({})'.format(i+1,label) for i in xrange(data['dim']//3)]) # extend ASCII header with new labels + '{}_divFFT({})'.format(i+1,label) for i in range(data['dim']//3)]) # extend ASCII header with new labels table.head_write() # --------------- figure out size and grid --------------------------------------------------------- table.data_readArray() - coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] + coords = [np.unique(table.data[:,colCoord+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -145,7 +141,7 @@ for name in filenames: # we need to reverse order here, because x is fastest,ie rightmost, but leftmost in our x,y,z notation stack.append(divFFT(size[::-1], table.data[:,data['column'][i]:data['column'][i]+data['dim']]. - reshape([grid[2],grid[1],grid[0]]+data['shape']))) + reshape(grid[::-1].tolist()+data['shape']))) # ------------------------------------------ output result ----------------------------------------- diff --git a/processing/post/addEhkl.py b/processing/post/addEhkl.py index 7b745526a..f7a143466 100755 --- a/processing/post/addEhkl.py +++ b/processing/post/addEhkl.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/addEuclideanDistance.py b/processing/post/addEuclideanDistance.py index 8cb6c3b83..b83c36b6c 100755 --- a/processing/post/addEuclideanDistance.py +++ b/processing/post/addEuclideanDistance.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,itertools @@ -20,13 +20,13 @@ def periodic_3Dpad(array, rimdim=(1,1,1)): rimdim[2]:rimdim[2]+size[2]] = array p = np.zeros(3,'i') - for side in xrange(3): - for p[(side+2)%3] in xrange(padded.shape[(side+2)%3]): - for p[(side+1)%3] in xrange(padded.shape[(side+1)%3]): - for p[side%3] in xrange(rimdim[side%3]): + for side in range(3): + for p[(side+2)%3] in range(padded.shape[(side+2)%3]): + for p[(side+1)%3] in range(padded.shape[(side+1)%3]): + for p[side%3] in range(rimdim[side%3]): spot = (p-rimdim)%size padded[p[0],p[1],p[2]] = array[spot[0],spot[1],spot[2]] - for p[side%3] in xrange(rimdim[side%3]+size[side%3],size[side%3]+2*rimdim[side%3]): + for p[side%3] in range(rimdim[side%3]+size[side%3],size[side%3]+2*rimdim[side%3]): spot = (p-rimdim)%size padded[p[0],p[1],p[2]] = array[spot[0],spot[1],spot[2]] return padded @@ -178,7 +178,7 @@ for name in filenames: table.data_readArray() - coords = [np.unique(table.data[:,coordCol+i]) for i in xrange(coordDim)] + coords = [np.unique(table.data[:,coordCol+i]) for i in range(coordDim)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords)+[1]*(3-len(coords)),'i') @@ -215,7 +215,7 @@ for name in filenames: # ...reflects number of unique neighbors uniques = np.where(diffToNeighbor[1:-1,1:-1,1:-1,0] != 0, 1,0) # initialize unique value counter (exclude myself [= 0]) - for i in xrange(1,len(neighborhood)): # check remaining points in neighborhood + for i in range(1,len(neighborhood)): # check remaining points in neighborhood uniques += np.where(np.logical_and( diffToNeighbor[1:-1,1:-1,1:-1,i] != 0, # not myself? diffToNeighbor[1:-1,1:-1,1:-1,i] != diffToNeighbor[1:-1,1:-1,1:-1,i-1], @@ -229,7 +229,7 @@ for name in filenames: distance[i,:,:,:] = ndimage.morphology.distance_transform_edt(distance[i,:,:,:])*[options.scale]*3 distance = distance.reshape([len(feature_list),grid.prod(),1],order='F') - for i in xrange(len(feature_list)): + for i in range(len(feature_list)): stack.append(distance[i,:]) # ------------------------------------------ output result ----------------------------------------- @@ -239,4 +239,4 @@ for name in filenames: # ------------------------------------------ output finalization ----------------------------------- - table.close() # close input ASCII table (works for stdin) \ No newline at end of file + table.close() # close input ASCII table (works for stdin) diff --git a/processing/post/addGradient.py b/processing/post/addGradient.py index 66018a890..fefe8f84e 100755 --- a/processing/post/addGradient.py +++ b/processing/post/addGradient.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -12,41 +12,33 @@ scriptID = ' '.join([scriptName,damask.version]) def gradFFT(geomdim,field): shapeFFT = np.array(np.shape(field))[0:3] grid = np.array(np.shape(field)[2::-1]) - N = grid.prod() # field size - n = np.array(np.shape(field)[3:]).prod() # data size + N = grid.prod() # field size + n = np.array(np.shape(field)[3:]).prod() # data size if n == 3: dataType = 'vector' elif n == 1: dataType = 'scalar' - field_fourier = np.fft.fftpack.rfftn(field,axes=(0,1,2),s=shapeFFT) + field_fourier = np.fft.rfftn(field,axes=(0,1,2),s=shapeFFT) grad_fourier = np.empty(field_fourier.shape+(3,),'c16') # differentiation in Fourier space - k_s = np.zeros([3],'i') TWOPIIMG = 2.0j*math.pi - for i in xrange(grid[2]): - k_s[0] = i - if grid[2]%2 == 0 and i == grid[2]//2: k_s[0] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif i > grid[2]//2: k_s[0] -= grid[2] + k_sk = np.where(np.arange(grid[2])>grid[2]//2,np.arange(grid[2])-grid[2],np.arange(grid[2]))/geomdim[0] + if grid[2]%2 == 0: k_sk[grid[2]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) + + k_sj = np.where(np.arange(grid[1])>grid[1]//2,np.arange(grid[1])-grid[1],np.arange(grid[1]))/geomdim[1] + if grid[1]%2 == 0: k_sj[grid[1]//2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - for j in xrange(grid[1]): - k_s[1] = j - if grid[1]%2 == 0 and j == grid[1]//2: k_s[1] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - elif j > grid[1]//2: k_s[1] -= grid[1] + k_si = np.arange(grid[0]//2+1)/geomdim[2] + + kk, kj, ki = np.meshgrid(k_sk,k_sj,k_si,indexing = 'ij') + k_s = np.concatenate((ki[:,:,:,None],kj[:,:,:,None],kk[:,:,:,None]),axis = 3).astype('c16') + if dataType == 'vector': # vector, 3 -> 3x3 + grad_fourier = np.einsum('ijkl,ijkm->ijklm',field_fourier,k_s)*TWOPIIMG + elif dataType == 'scalar': # scalar, 1 -> 3 + grad_fourier = np.einsum('ijkl,ijkl->ijkl',field_fourier,k_s)*TWOPIIMG - for k in xrange(grid[0]//2+1): - k_s[2] = k - if grid[0]%2 == 0 and k == grid[0]//2: k_s[2] = 0 # for even grid, set Nyquist freq to 0 (Johnson, MIT, 2011) - - xi = (k_s/geomdim)[2::-1].astype('c16') # reversing the field order - - grad_fourier[i,j,k,0,:] = field_fourier[i,j,k,0]*xi *TWOPIIMG # vector field from scalar data - - if dataType == 'vector': - grad_fourier[i,j,k,1,:] = field_fourier[i,j,k,1]*xi *TWOPIIMG # tensor field from vector data - grad_fourier[i,j,k,2,:] = field_fourier[i,j,k,2]*xi *TWOPIIMG - - return np.fft.fftpack.irfftn(grad_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,3*n]) + return np.fft.irfftn(grad_fourier,axes=(0,1,2),s=shapeFFT).reshape([N,3*n]) # -------------------------------------------------------------------- @@ -126,14 +118,14 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for type, data in items.iteritems(): for label in data['active']: - table.labels_append(['{}_gradFFT({})'.format(i+1,label) for i in xrange(3 * data['dim'])]) # extend ASCII header with new labels + table.labels_append(['{}_gradFFT({})'.format(i+1,label) for i in range(3 * data['dim'])]) # extend ASCII header with new labels table.head_write() # --------------- figure out size and grid --------------------------------------------------------- table.data_readArray() - coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] + coords = [np.unique(table.data[:,colCoord+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -148,7 +140,7 @@ for name in filenames: # we need to reverse order here, because x is fastest,ie rightmost, but leftmost in our x,y,z notation stack.append(gradFFT(size[::-1], table.data[:,data['column'][i]:data['column'][i]+data['dim']]. - reshape([grid[2],grid[1],grid[0]]+data['shape']))) + reshape(grid[::-1].tolist()+data['shape']))) # ------------------------------------------ output result ----------------------------------------- diff --git a/processing/post/addGrainID.py b/processing/post/addGrainID.py index 232790580..c39d67983 100755 --- a/processing/post/addGrainID.py +++ b/processing/post/addGrainID.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,time,copy diff --git a/processing/post/addIPFcolor.py b/processing/post/addIPFcolor.py index 6a9e39e18..2fcc000e1 100755 --- a/processing/post/addIPFcolor.py +++ b/processing/post/addIPFcolor.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -108,7 +108,7 @@ for name in filenames: # ------------------------------------------ assemble header --------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['{}_IPF_{:g}{:g}{:g}_{sym}'.format(i+1,*options.pole,sym = options.symmetry.lower()) for i in xrange(3)]) + table.labels_append(['{}_IPF_{:g}{:g}{:g}_{sym}'.format(i+1,*options.pole,sym = options.symmetry.lower()) for i in range(3)]) table.head_write() # ------------------------------------------ process data ------------------------------------------ diff --git a/processing/post/addMapped.py b/processing/post/addIndexed.py similarity index 60% rename from processing/post/addMapped.py rename to processing/post/addIndexed.py index da36097d4..a713ac4f5 100755 --- a/processing/post/addMapped.py +++ b/processing/post/addIndexed.py @@ -1,7 +1,8 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys +import numpy as np from optparse import OptionParser import damask @@ -13,26 +14,27 @@ scriptID = ' '.join([scriptName,damask.version]) # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add data in column(s) of second ASCIItable selected from row that is given by the value in a mapping column. +Add data in column(s) of mapped ASCIItable selected from the row indexed by the value in a mapping column. +Row numbers start at 1. """, version = scriptID) -parser.add_option('-c','--map', - dest = 'map', +parser.add_option('--index', + dest = 'index', type = 'string', metavar = 'string', - help = 'heading of column containing row mapping') + help = 'column label containing row index') parser.add_option('-o','--offset', dest = 'offset', type = 'int', metavar = 'int', - help = 'offset between mapping column value and actual row in mapped table [%default]') + help = 'constant offset for index column value [%default]') parser.add_option('-l','--label', dest = 'label', action = 'extend', metavar = '', - help='heading of column(s) to be mapped') + help = 'column label(s) to be appended') parser.add_option('-a','--asciitable', dest = 'asciitable', type = 'string', metavar = 'string', - help = 'mapped ASCIItable') + help = 'indexed ASCIItable') parser.set_defaults(offset = 0, ) @@ -41,32 +43,33 @@ parser.set_defaults(offset = 0, if options.label is None: parser.error('no data columns specified.') -if options.map is None: - parser.error('no mapping column given.') +if options.index is None: + parser.error('no index column given.') -# ------------------------------------------ process mapping ASCIItable --------------------------- +# ------------------------------------------ process indexed ASCIItable --------------------------- if options.asciitable is not None and os.path.isfile(options.asciitable): - mappedTable = damask.ASCIItable(name = options.asciitable, - buffered = False, readonly = True) - mappedTable.head_read() # read ASCII header info of mapped table - missing_labels = mappedTable.data_readArray(options.label) + indexedTable = damask.ASCIItable(name = options.asciitable, + buffered = False, + readonly = True) + indexedTable.head_read() # read ASCII header info of indexed table + missing_labels = indexedTable.data_readArray(options.label) + indexedTable.close() # close input ASCII table if len(missing_labels) > 0: - mappedTable.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) + damask.util.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) else: - parser.error('no mapped ASCIItable given.') + parser.error('no indexed ASCIItable given.') # --- loop over input files ------------------------------------------------------------------------- if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) + try: table = damask.ASCIItable(name = name, + buffered = False) except: continue damask.util.report(scriptName,name) @@ -78,8 +81,8 @@ for name in filenames: errors = [] - mappedColumn = table.label_index(options.map) - if mappedColumn < 0: errors.append('mapping column {} not found.'.format(options.map)) + indexColumn = table.label_index(options.index) + if indexColumn < 0: errors.append('index column {} not found.'.format(options.index)) if errors != []: damask.util.croak(errors) @@ -89,18 +92,19 @@ for name in filenames: # ------------------------------------------ assemble header -------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(mappedTable.labels(raw = True)) # extend ASCII header with new labels + table.labels_append(indexedTable.labels(raw = True)) # extend ASCII header with new labels table.head_write() # ------------------------------------------ process data ------------------------------------------ outputAlive = True while outputAlive and table.data_read(): # read next data line of ASCII table - table.data_append(mappedTable.data[int(round(float(table.data[mappedColumn])))+options.offset-1]) # add all mapped data types + try: + table.data_append(indexedTable.data[int(round(float(table.data[indexColumn])))+options.offset-1]) # add all mapped data types + except IndexError: + table.data_append(np.nan*np.ones_like(indexedTable.data[0])) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- table.close() # close ASCII tables - -mappedTable.close() # close mapped input ASCII table diff --git a/processing/post/addInfo.py b/processing/post/addInfo.py index 2c8749d0c..50f003d6b 100755 --- a/processing/post/addInfo.py +++ b/processing/post/addInfo.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/post/addLinked.py b/processing/post/addLinked.py new file mode 100755 index 000000000..5ea9abe43 --- /dev/null +++ b/processing/post/addLinked.py @@ -0,0 +1,110 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os,sys +import numpy as np +from optparse import OptionParser +import damask + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName,damask.version]) + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- + +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ +Add data of selected column(s) from (first) row of second ASCIItable that shares the linking column value. + +""", version = scriptID) + +parser.add_option('--link', + dest = 'link', nargs = 2, + type = 'string', metavar = 'string string', + help = 'column labels containing linked values') +parser.add_option('-l','--label', + dest = 'label', + action = 'extend', metavar = '', + help = 'column label(s) to be appended') +parser.add_option('-a','--asciitable', + dest = 'asciitable', + type = 'string', metavar = 'string', + help = 'linked ASCIItable') + +parser.set_defaults() + +(options,filenames) = parser.parse_args() + +if options.label is None: + parser.error('no data columns specified.') +if options.link is None: + parser.error('no linking columns given.') + +# -------------------------------------- process linked ASCIItable -------------------------------- + +if options.asciitable is not None and os.path.isfile(options.asciitable): + + linkedTable = damask.ASCIItable(name = options.asciitable, + buffered = False, + readonly = True) + linkedTable.head_read() # read ASCII header info of linked table + if linkedTable.label_dimension(options.link[1]) != 1: + parser.error('linking column {} needs to be scalar valued.'.format(options.link[1])) + + missing_labels = linkedTable.data_readArray([options.link[1]]+options.label) + linkedTable.close() # close linked ASCII table + + if len(missing_labels) > 0: + damask.util.croak('column{} {} not found...'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) + + index = linkedTable.data[:,0] + data = linkedTable.data[:,1:] +else: + parser.error('no linked ASCIItable given.') + +# --- loop over input files ----------------------------------------------------------------------- + +if filenames == []: filenames = [None] + +for name in filenames: + try: table = damask.ASCIItable(name = name, + buffered = False) + except: continue + damask.util.report(scriptName,name) + +# ------------------------------------------ read header ------------------------------------------ + + table.head_read() + +# ------------------------------------------ sanity checks ---------------------------------------- + + errors = [] + + linkColumn = table.label_index(options.link[0]) + if linkColumn < 0: errors.append('linking column {} not found.'.format(options.link[0])) + + if errors != []: + damask.util.croak(errors) + table.close(dismiss = True) + continue + +# ------------------------------------------ assemble header -------------------------------------- + + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) + table.labels_append(linkedTable.labels(raw = True)[1:]) # extend with new labels (except for linked column) + + table.head_write() + +# ------------------------------------------ process data ------------------------------------------ + + outputAlive = True + while outputAlive and table.data_read(): # read next data line of ASCII table + try: + table.data_append(data[np.argwhere(index == float(table.data[linkColumn]))[0]]) # add data from first matching line + except IndexError: + table.data_append(np.nan*np.ones_like(data[0])) # or add NaNs + outputAlive = table.data_write() # output processed line + +# ------------------------------------------ output finalization ----------------------------------- + + table.close() # close ASCII tables diff --git a/processing/post/addMises.py b/processing/post/addMises.py index 9d6a9f9db..2ce350dbd 100755 --- a/processing/post/addMises.py +++ b/processing/post/addMises.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addNorm.py b/processing/post/addNorm.py index 0911e5784..68249379a 100755 --- a/processing/post/addNorm.py +++ b/processing/post/addNorm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/addOrientations.py b/processing/post/addOrientations.py index 2f88107df..2c70b5db0 100755 --- a/processing/post/addOrientations.py +++ b/processing/post/addOrientations.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -17,6 +17,7 @@ parser = OptionParser(option_class=damask.extendableOption, usage='%prog options Add quaternion and/or Bunge Euler angle representation of crystal lattice orientation. Orientation is given by quaternion, Euler angles, rotation matrix, or crystal frame coordinates (i.e. component vectors of rotation matrix). +Additional (globally fixed) rotations of the lab frame and/or crystal frame can be applied. """, version = scriptID) @@ -24,24 +25,27 @@ outputChoices = ['quaternion','rodrigues','eulers'] parser.add_option('-o', '--output', dest = 'output', action = 'extend', metavar = '', - help = 'output orientation formats {%s}'%(','.join(outputChoices))) -parser.add_option('-r', '--rotation', - dest='rotation', - type = 'float', nargs = 4, metavar = ' '.join(['float']*4), - help = 'angle and axis to (pre)rotate orientation') - + help = 'output orientation formats {{{}}}'.format(', '.join(outputChoices))) parser.add_option('-s', '--symmetry', dest = 'symmetry', type = 'choice', choices = damask.Symmetry.lattices[1:], metavar='string', help = 'crystal symmetry [%default] {{{}}} '.format(', '.join(damask.Symmetry.lattices[1:]))) +parser.add_option('-d', '--degrees', + dest = 'degrees', + action = 'store_true', + help = 'angles are given in degrees [%default]') +parser.add_option('-R', '--labrotation', + dest='labrotation', + type = 'float', nargs = 4, metavar = ' '.join(['float']*4), + help = 'angle and axis of additional lab frame rotation') +parser.add_option('-r', '--crystalrotation', + dest='crystalrotation', + type = 'float', nargs = 4, metavar = ' '.join(['float']*4), + help = 'angle and axis of additional crystal frame rotation') parser.add_option('-e', '--eulers', dest = 'eulers', type = 'string', metavar = 'string', help = 'Euler angles label') -parser.add_option('-d', '--degrees', - dest = 'degrees', - action = 'store_true', - help = 'Euler angles are given in degrees [%default]') parser.add_option('-m', '--matrix', dest = 'matrix', type = 'string', metavar = 'string', @@ -65,7 +69,8 @@ parser.add_option('-q', '--quaternion', parser.set_defaults(output = [], symmetry = damask.Symmetry.lattices[-1], - rotation = (0.,1.,1.,1.), # no rotation about 1,1,1 + labrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 + crystalrotation = (0.,1.,1.,1.), # no rotation about 1,1,1 degrees = False, ) @@ -91,16 +96,16 @@ if np.sum(input) != 1: parser.error('needs exactly one input format.') (options.quaternion,4,'quaternion'), ][np.where(input)[0][0]] # select input label that was requested toRadians = math.pi/180.0 if options.degrees else 1.0 # rescale degrees to radians -r = damask.Quaternion().fromAngleAxis(toRadians*options.rotation[0],options.rotation[1:]) # pre-rotation +r = damask.Quaternion().fromAngleAxis(toRadians*options.crystalrotation[0],options.crystalrotation[1:]) # crystal frame rotation +R = damask.Quaternion().fromAngleAxis(toRadians*options. labrotation[0],options. labrotation[1:]) # lab frame rotation # --- loop over input files ------------------------------------------------------------------------ if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) + try: table = damask.ASCIItable(name = name, + buffered = False) except: continue damask.util.report(scriptName,name) @@ -126,9 +131,9 @@ for name in filenames: table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) for output in options.output: - if output == 'quaternion': table.labels_append(['{}_quat({})'.format( i+1,options.symmetry) for i in xrange(4)]) - if output == 'rodrigues': table.labels_append(['{}_rodrigues({})'.format(i+1,options.symmetry) for i in xrange(3)]) - if output == 'eulers': table.labels_append(['{}_eulers({})'.format( i+1,options.symmetry) for i in xrange(3)]) + if output == 'quaternion': table.labels_append(['{}_{}_{}({})'.format(i+1,'quat',options.symmetry,label) for i in range(4)]) + elif output == 'rodrigues': table.labels_append(['{}_{}_{}({})'.format(i+1,'rodr',options.symmetry,label) for i in range(3)]) + elif output == 'eulers': table.labels_append(['{}_{}_{}({})'.format(i+1,'eulr',options.symmetry,label) for i in range(3)]) table.head_write() # ------------------------------------------ process data ------------------------------------------ @@ -150,12 +155,12 @@ for name in filenames: o = damask.Orientation(quaternion = np.array(map(float,table.data[column:column+4])), symmetry = options.symmetry).reduced() - o.quaternion = r*o.quaternion + o.quaternion = r*o.quaternion*R # apply additional lab and crystal frame rotations for output in options.output: - if output == 'quaternion': table.data_append(o.asQuaternion()) - if output == 'rodrigues': table.data_append(o.asRodrigues()) - if output == 'eulers': table.data_append(o.asEulers('Bunge', degrees=options.degrees)) + if output == 'quaternion': table.data_append(o.asQuaternion()) + elif output == 'rodrigues': table.data_append(o.asRodrigues()) + elif output == 'eulers': table.data_append(o.asEulers('Bunge', degrees=options.degrees)) outputAlive = table.data_write() # output processed line # ------------------------------------------ output finalization ----------------------------------- diff --git a/processing/post/addPK2.py b/processing/post/addPK2.py index 59084a88c..9e6308c39 100755 --- a/processing/post/addPK2.py +++ b/processing/post/addPK2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -69,7 +69,7 @@ for name in filenames: # ------------------------------------------ assemble header -------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['%i_S'%(i+1) for i in xrange(9)]) # extend ASCII header with new labels + table.labels_append(['{}_S'.format(i+1) for i in range(9)]) # extend ASCII header with new labels table.head_write() # ------------------------------------------ process data ------------------------------------------ diff --git a/processing/post/addPole.py b/processing/post/addPole.py index 6cbd26880..10c5cce67 100755 --- a/processing/post/addPole.py +++ b/processing/post/addPole.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -113,7 +113,7 @@ for name in filenames: # ------------------------------------------ assemble header --------------------------------------- table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.labels_append(['{}_pole_{}{}{}'.format(i+1,*options.pole) for i in xrange(2)]) + table.labels_append(['{}_pole_{}{}{}'.format(i+1,*options.pole) for i in range(2)]) table.head_write() # ------------------------------------------ process data ------------------------------------------ diff --git a/processing/post/addSchmidfactors.py b/processing/post/addSchmidfactors.py index 828132471..4f34621b7 100755 --- a/processing/post/addSchmidfactors.py +++ b/processing/post/addSchmidfactors.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -167,7 +167,6 @@ force = np.array(options.force) force /= np.linalg.norm(force) if options.normal: - damask.util.croak('got normal') normal = np.array(options.normal) normal /= np.linalg.norm(normal) if abs(np.dot(force,normal)) > 1e-3: @@ -200,7 +199,7 @@ if options.lattice in latticeChoices[:2]: c_normal = slipSystems[options.lattice][:,3:] elif options.lattice == latticeChoices[2]: # convert 4 Miller index notation of hex to orthogonal 3 Miller index notation - for i in xrange(len(c_direction)): + for i in range(len(c_direction)): c_direction[i] = np.array([slipSystems['hex'][i,0]*1.5, (slipSystems['hex'][i,0] + 2.*slipSystems['hex'][i,1])*0.5*np.sqrt(3), slipSystems['hex'][i,3]*options.CoverA, diff --git a/processing/post/addSpectralDecomposition.py b/processing/post/addSpectralDecomposition.py index 2f8f32fd7..3c44a16bc 100755 --- a/processing/post/addSpectralDecomposition.py +++ b/processing/post/addSpectralDecomposition.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -57,8 +57,8 @@ for name in filenames: if dim != data['dim']: remarks.append('column {} is not a {}...'.format(what,type)) else: items[type]['column'].append(table.label_index(what)) - table.labels_append(['{}_eigval({})'.format(i+1,what) for i in xrange(3)]) # extend ASCII header with new labels - table.labels_append(['{}_eigvec({})'.format(i+1,what) for i in xrange(9)]) # extend ASCII header with new labels + table.labels_append(['{}_eigval({})'.format(i+1,what) for i in range(3)]) # extend ASCII header with new labels + table.labels_append(['{}_eigvec({})'.format(i+1,what) for i in range(9)]) # extend ASCII header with new labels if remarks != []: damask.util.croak(remarks) if errors != []: @@ -78,6 +78,7 @@ for name in filenames: for type, data in items.iteritems(): for column in data['column']: (u,v) = np.linalg.eigh(np.array(map(float,table.data[column:column+data['dim']])).reshape(data['shape'])) + if np.dot(np.cross(v[:,0], v[:,1]), v[:,2]) < 0.0 : v[:, 2] *= -1.0 # ensure right-handed coordinate system table.data_append(list(u)) table.data_append(list(v.transpose().reshape(data['dim']))) outputAlive = table.data_write() # output processed line diff --git a/processing/post/addStrainTensors.py b/processing/post/addStrainTensors.py index 654d7583a..447ae03ba 100755 --- a/processing/post/addStrainTensors.py +++ b/processing/post/addStrainTensors.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -112,7 +112,7 @@ for name in filenames: table.labels_append(['{}_{}({}){}'.format(i+1, # extend ASCII header with new labels theStrain, theStretch, - what if what != 'f' else '') for i in xrange(9)]) + what if what != 'f' else '') for i in range(9)]) if remarks != []: damask.util.croak(remarks) if errors != []: diff --git a/processing/post/addTable.py b/processing/post/addTable.py index 53774b5d7..82799b4f5 100755 --- a/processing/post/addTable.py +++ b/processing/post/addTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/ascii2hdf5.py b/processing/post/ascii2hdf5.py new file mode 100755 index 000000000..effac981b --- /dev/null +++ b/processing/post/ascii2hdf5.py @@ -0,0 +1,142 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +# ------------------------------------------------------------------- # +# NOTE: # +# 1. Not all output is defined in the DS_HDF5.xml, please add new # +# new one to the system wide definition file # +# /lib/damask/DS_HDF5.xml # +# or specify your own when initializing HDF5 class # +# 2. Somehow the point cloud structure cannot be properly handled # +# by Xdmf, which is a descriptive wrapper for visualizing HDF5 # +# using Paraview. The current solution is using cell structured # +# HDF5 so that Xdmf can describe the data shape as a rectangular # +# mesh rather than polyvertex. # +# TODO: # +# 1. remove the ._tmp file, basically need a way to # +# just load data from ASCII table. # +# 2. a progress monitor when transferring data from ASCII table # +# to HDF5. # +# 3. a more flexible way handle the data structure rather than a # +# xml file. # +# ------------------------------------------------------------------- # + +import os +import damask +import numpy as np +from optparse import OptionParser + + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# ----- helper function ----- # +def get_rectMshVectors(xyz_array, posNum): + """Get Vx, Vy, Vz for rectLinear grid""" + # need some improvement, and only works for rectangular grid + v = sorted(list(set(xyz_array[:, posNum]))) + v_interval = (v[2]+v[1])/2.0 - (v[1]+v[0])/2.0 + v_start = (v[1]+v[0])/2.0 - v_interval + v_end = (v[-1]+v[-2])/2.0 + v_interval + V = np.linspace(v_start, v_end, len(v)+1) + return V + + +# ----- MAIN ---- # +desp_msg = "Convert DAMASK ascii table to HDF5 file" +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=desp_msg, + version=scriptID) +parser.add_option('-D', '--DefinitionFile', + dest='storage definition file', + type='string', + metavar='string', + help='definition file for H5 data storage') +parser.add_option('-p', '--pos', '--position', + dest='pos', + type='string', metavar='string', + help='label of coordinates [%default]') + +parser.set_defaults(DefinitionFile='default', + pos='pos') + +(options, filenames) = parser.parse_args() + +filename = filenames[0] + +if options.DefinitionFile == 'default': + defFile = None +else: + defFile = options.DefinitionFile + +# ----- read in data using DAMASK ASCII table class ----- # +asciiTable = damask.ASCIItable(name=filename, buffered=False) +asciiTable.head_read() +asciiTable.data_readArray() +incNum = int(asciiTable.data[asciiTable.label_index('inc'), 0]) +fullTable = np.copy(asciiTable.data) # deep copy all data, just to be safe +labels = asciiTable.labels() +labels_idx = [asciiTable.label_index(label) for label in labels] +featuresDim = [labels_idx[i+1] - labels_idx[i] for i in range(len(labels)-1)] +featuresDim.append(fullTable.shape[1] - labels_idx[-1]) + +# ----- figure out size and grid ----- # +pos_idx = asciiTable.label_index('pos') +xyz_array = asciiTable.data[:, pos_idx:pos_idx+3] +Vx = get_rectMshVectors(xyz_array, 0) +Vy = get_rectMshVectors(xyz_array, 1) +Vz = get_rectMshVectors(xyz_array, 2) +# use the dimension of the rectangular grid to reshape all other data +mshGridDim = [len(Vx)-1, len(Vy)-1, len(Vz)-1] + +# ----- compose cmd log ----- # +cmd_log = " ".join([scriptID, filename]) + +# ----- create a new HDF5 file and save the data -----# +# force remove existing HDF5 file +h5fName = filename.replace(".txt", ".h5") +try: + os.remove(h5fName) +except OSError: + pass +h5f = damask.H5Table(h5fName, + new_file=True, + dsXMLFile=defFile) +# adding increment number as root level attributes +h5f.add_attr('inc', incNum) +# add the mesh grid data now +h5f.add_data("Vx", Vx, cmd_log=cmd_log) +h5f.add_data("Vy", Vy, cmd_log=cmd_log) +h5f.add_data("Vz", Vz, cmd_log=cmd_log) + +# add the rest of data from table +labelsProcessed = ['inc'] +for fi in range(len(labels)): + featureName = labels[fi] + # remove trouble maker "("" and ")" from label/feature name + if "(" in featureName: + featureName = featureName.replace("(", "") + if ")" in featureName: + featureName = featureName.replace(")", "") + # skip increment and duplicated columns in the ASCII table + if featureName in labelsProcessed: + continue + + featureIdx = labels_idx[fi] + featureDim = featuresDim[fi] + # grab the data hook + dataset = fullTable[:, featureIdx:featureIdx+featureDim] + # mapping 2D data onto a 3D rectangular mesh to get 4D data + # WARNING: In paraview, the data for a recmesh is mapped as: + # --> len(z), len(y), len(x), size(data) + # dataset = dataset.reshape((mshGridDim[0], + # mshGridDim[1], + # mshGridDim[2], + # dataset.shape[1])) + # write out data + print("adding {}...".format(featureName)) + h5f.add_data(featureName, dataset, cmd_log=cmd_log) + # write down the processed label + labelsProcessed.append(featureName) diff --git a/processing/post/averageDown.py b/processing/post/averageDown.py index ec8e6e8ed..886083428 100755 --- a/processing/post/averageDown.py +++ b/processing/post/averageDown.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -94,7 +94,7 @@ for name in filenames: table.data_readArray() if (any(options.grid) == 0 or any(options.size) == 0.0): - coords = [np.unique(table.data[:,colCoord+i]) for i in xrange(3)] + coords = [np.unique(table.data[:,colCoord+i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') diff --git a/processing/post/averageTable.py b/processing/post/averageTable.py deleted file mode 100755 index b059404c9..000000000 --- a/processing/post/averageTable.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 no BOM -*- - -import os,sys -import numpy as np -from optparse import OptionParser -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Replace all rows for which column 'label' has identical values by a single row containing their average. -Output table will contain as many rows as there are different (unique) values in the grouping column. - -Examples: -For grain averaged values, replace all rows of particular 'texture' with a single row containing their average. -""", version = scriptID) - -parser.add_option('-l','--label', - dest = 'label', - type = 'string', metavar = 'string', - help = 'column label for grouping rows') - -(options,filenames) = parser.parse_args() - -if options.label is None: - parser.error('no grouping column specified.') - - -# --- loop over input files ------------------------------------------------------------------------- - -if filenames == []: filenames = [None] - -for name in filenames: - try: table = damask.ASCIItable(name = name, - outname = os.path.join( - os.path.split(name)[0], - options.label+'_averaged_'+os.path.split(name)[1] - ) if name else name, - buffered = False) - except: continue - damask.util.report(scriptName,name) - -# ------------------------------------------ sanity checks --------------------------------------- - - table.head_read() - if table.label_dimension(options.label) != 1: - damask.util.croak('column {} is not of scalar dimension.'.format(options.label)) - table.close(dismiss = True) # close ASCIItable and remove empty file - continue - -# ------------------------------------------ assemble info --------------------------------------- - - table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) - table.head_write() - -# ------------------------------------------ process data -------------------------------- - - table.data_readArray() - rows,cols = table.data.shape - - table.data = table.data[np.lexsort([table.data[:,table.label_index(options.label)]])] - - values,index = np.unique(table.data[:,table.label_index(options.label)], return_index = True) - index = np.append(index,rows) - avgTable = np.empty((len(values), cols)) - - for j in xrange(cols) : - for i in xrange(len(values)) : - avgTable[i,j] = np.average(table.data[index[i]:index[i+1],j]) - - table.data = avgTable - -# ------------------------------------------ output result ------------------------------- - - table.data_writeArray() - table.close() # close ASCII table diff --git a/processing/post/binXY.py b/processing/post/binXY.py index 693b71e59..aac9aaffa 100755 --- a/processing/post/binXY.py +++ b/processing/post/binXY.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -20,7 +20,7 @@ Produces a binned grid of two columns from an ASCIItable, i.e. a two-dimensional parser.add_option('-d','--data', dest = 'data', - type='string', nargs = 2, metavar = 'string string', + type = 'string', nargs = 2, metavar = 'string string', help = 'column labels containing x and y ') parser.add_option('-w','--weight', dest = 'weight', @@ -49,15 +49,15 @@ parser.add_option('-z','--zrange', parser.add_option('-i','--invert', dest = 'invert', action = 'store_true', - help = 'invert probability density [%default]') + help = 'invert probability density') parser.add_option('-r','--rownormalize', dest = 'normRow', action = 'store_true', - help = 'normalize probability density in each row [%default]') + help = 'normalize probability density in each row') parser.add_option('-c','--colnormalize', dest = 'normCol', action = 'store_true', - help = 'normalize probability density in each column [%default]') + help = 'normalize probability density in each column') parser.set_defaults(bins = (10,10), type = ('linear','linear','linear'), @@ -79,7 +79,8 @@ result = np.zeros((options.bins[0],options.bins[1],3),'f') if options.data is None: parser.error('no data columns specified.') -labels = options.data +labels = list(options.data) + if options.weight is not None: labels += [options.weight] # prevent character splitting of single string value @@ -88,15 +89,13 @@ if options.weight is not None: labels += [options.weight] if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - outname = os.path.join(os.path.dirname(name), - 'binned-{}-{}_'.format(*options.data)+ \ - ('weighted-{}_'.format(options.weight) if options.weight else '') + \ - os.path.basename(name)) if name else name, - buffered = False) - except: - continue + try: table = damask.ASCIItable(name = name, + outname = os.path.join(os.path.dirname(name), + 'binned-{}-{}_'.format(*options.data) + + ('weighted-{}_'.format(options.weight) if options.weight else '') + + os.path.basename(name)) if name else name, + buffered = False) + except: continue damask.util.report(scriptName,name) # ------------------------------------------ read header ------------------------------------------ @@ -106,7 +105,7 @@ for name in filenames: # ------------------------------------------ sanity checks ---------------------------------------- missing_labels = table.data_readArray(labels) - + if len(missing_labels) > 0: damask.util.croak('column{} {} not found.'.format('s' if len(missing_labels) > 1 else '',', '.join(missing_labels))) table.close(dismiss = True) @@ -119,24 +118,23 @@ for name in filenames: minmax[c] = np.log(minmax[c]) # change minmax to log, too delta = minmax[:,1]-minmax[:,0] - - for i in xrange(len(table.data)): - x = int(options.bins[0]*(table.data[i,0]-minmax[0,0])/delta[0]) - y = int(options.bins[1]*(table.data[i,1]-minmax[1,0])/delta[1]) - if x >= 0 and x < options.bins[0] and y >= 0 and y < options.bins[1]: - grid[x,y] += 1. if options.weight is None else table.data[i,2] # count (weighted) occurrences + + (grid,xedges,yedges) = np.histogram2d(table.data[:,0],table.data[:,1], + bins=options.bins, + range=minmax, + weights=None if options.weight is None else table.data[:,2]) if options.normCol: - for x in xrange(options.bins[0]): + for x in range(options.bins[0]): sum = np.sum(grid[x,:]) if sum > 0.0: grid[x,:] /= sum if options.normRow: - for y in xrange(options.bins[1]): + for y in range(options.bins[1]): sum = np.sum(grid[:,y]) if sum > 0.0: grid[:,y] /= sum - + if (minmax[2] == 0.0).all(): minmax[2] = [grid.min(),grid.max()] # auto scale from data if minmax[2,0] == minmax[2,1]: minmax[2,0] -= 1. @@ -147,11 +145,11 @@ for name in filenames: if options.type[2].lower() == 'log': grid = np.log(grid) minmax[2] = np.log(minmax[2]) - + delta[2] = minmax[2,1]-minmax[2,0] - for x in xrange(options.bins[0]): - for y in xrange(options.bins[1]): + for x in range(options.bins[0]): + for y in range(options.bins[1]): result[x,y,:] = [minmax[0,0]+delta[0]/options.bins[0]*(x+0.5), minmax[1,0]+delta[1]/options.bins[1]*(y+0.5), min(1.0,max(0.0,(grid[x,y]-minmax[2,0])/delta[2]))] diff --git a/processing/post/blowUp.py b/processing/post/blowUp.py index 430a4f388..0642deab1 100755 --- a/processing/post/blowUp.py +++ b/processing/post/blowUp.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -79,7 +79,7 @@ for name in filenames: table.data_readArray(options.pos) table.data_rewind() - coords = [np.unique(table.data[:,i]) for i in xrange(3)] + coords = [np.unique(table.data[:,i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -99,9 +99,9 @@ for name in filenames: data = np.zeros(outSize.tolist()+[len(table.labels(raw = True))]) p = np.zeros(3,'i') - for p[2] in xrange(grid[2]): - for p[1] in xrange(grid[1]): - for p[0] in xrange(grid[0]): + for p[2] in range(grid[2]): + for p[1] in range(grid[1]): + for p[0] in range(grid[0]): d = p*packing table.data_read() data[d[0]:d[0]+packing[0], @@ -110,9 +110,9 @@ for name in filenames: : ] = np.tile(np.array(table.data_asFloat(),'d'),packing.tolist()+[1]) # tile to match blowUp voxel size elementSize = size/grid/packing elem = 1 - for c in xrange(outSize[2]): - for b in xrange(outSize[1]): - for a in xrange(outSize[0]): + for c in range(outSize[2]): + for b in range(outSize[1]): + for a in range(outSize[0]): data[a,b,c,colCoord:colCoord+3] = [a+0.5,b+0.5,c+0.5]*elementSize if colElem != -1: data[a,b,c,colElem] = elem table.data = data[a,b,c,:].tolist() diff --git a/processing/post/filterTable.py b/processing/post/filterTable.py index 41a0634f3..52d23194b 100755 --- a/processing/post/filterTable.py +++ b/processing/post/filterTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re,sys,fnmatch @@ -61,9 +61,8 @@ parser.set_defaults(condition = '', if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False) + try: table = damask.ASCIItable(name = name, + buffered = False) except: continue damask.util.report(scriptName,name) diff --git a/processing/post/groupTable.py b/processing/post/groupTable.py new file mode 100755 index 000000000..67d07a7d1 --- /dev/null +++ b/processing/post/groupTable.py @@ -0,0 +1,129 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os,sys +import math # noqa +import numpy as np +from optparse import OptionParser, OptionGroup +import damask + +def periodicAverage(coords, limits): + """Centroid in periodic domain, see https://en.wikipedia.org/wiki/Center_of_mass#Systems_with_periodic_boundary_conditions""" + theta = 2.0*np.pi * (coords - limits[0])/(limits[1] - limits[0]) + theta_avg = np.pi + np.arctan2(-np.sin(theta).mean(axis=0), -np.cos(theta).mean(axis=0)) + return limits[0] + theta_avg * (limits[1] - limits[0])/2.0/np.pi + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName,damask.version]) + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- + +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ +Apply a user-specified function to condense all rows for which column 'label' has identical values into a single row. +Output table will contain as many rows as there are different (unique) values in the grouping column. +Periodic domain averaging of coordinate values is supported. + +Examples: +For grain averaged values, replace all rows of particular 'texture' with a single row containing their average. +""", version = scriptID) + +parser.add_option('-l','--label', + dest = 'label', + type = 'string', metavar = 'string', + help = 'column label for grouping rows') +parser.add_option('-f','--function', + dest = 'function', + type = 'string', metavar = 'string', + help = 'mapping function [%default]') +parser.add_option('-a','--all', + dest = 'all', + action = 'store_true', + help = 'apply mapping function also to grouping column') + +group = OptionGroup(parser, "periodic averaging", "") + +group.add_option ('-p','--periodic', + dest = 'periodic', + action = 'extend', metavar = '', + help = 'coordinate label(s) to average across periodic domain') +group.add_option ('--limits', + dest = 'boundary', + type = 'float', metavar = 'float float', nargs = 2, + help = 'min and max of periodic domain %default') + +parser.add_option_group(group) + +parser.set_defaults(function = 'np.average', + all = False, + boundary = [0.0, 1.0]) + +(options,filenames) = parser.parse_args() + +funcModule,funcName = options.function.split('.') + +try: + mapFunction = getattr(locals().get(funcModule) or + globals().get(funcModule) or + __import__(funcModule), + funcName) +except: + mapFunction = None + +if options.label is None: + parser.error('no grouping column specified.') +if not hasattr(mapFunction,'__call__'): + parser.error('function "{}" is not callable.'.format(options.function)) + + +# --- loop over input files ------------------------------------------------------------------------- + +if filenames == []: filenames = [None] + +for name in filenames: + try: table = damask.ASCIItable(name = name, + buffered = False) + except: continue + damask.util.report(scriptName,name) + +# ------------------------------------------ sanity checks --------------------------------------- + + table.head_read() + if table.label_dimension(options.label) != 1: + damask.util.croak('column {} is not of scalar dimension.'.format(options.label)) + table.close(dismiss = True) # close ASCIItable and remove empty file + continue + else: + grpColumn = table.label_index(options.label) + +# ------------------------------------------ assemble info --------------------------------------- + + table.info_append(scriptID + '\t' + ' '.join(sys.argv[1:])) + table.head_write() + +# ------------------------------------------ process data -------------------------------- + + table.data_readArray() + indexrange = table.label_indexrange(options.periodic) if options.periodic is not None else [] + rows,cols = table.data.shape + + table.data = table.data[np.lexsort([table.data[:,grpColumn]])] # sort data by grpColumn + + values,index = np.unique(table.data[:,grpColumn], return_index = True) # unique grpColumn values and their positions + index = np.append(index,rows) # add termination position + grpTable = np.empty((len(values), cols)) # initialize output + + for i in range(len(values)): # iterate over groups (unique values in grpColumn) + grpTable[i] = np.apply_along_axis(mapFunction,0,table.data[index[i]:index[i+1]]) # apply (general) mapping function + grpTable[i,indexrange] = \ + periodicAverage(table.data[index[i]:index[i+1],indexrange],options.boundary) # apply periodicAverage mapping function + + if not options.all: grpTable[i,grpColumn] = table.data[index[i],grpColumn] # restore grouping column value + + table.data = grpTable + +# ------------------------------------------ output result ------------------------------- + + table.data_writeArray() + table.close() # close ASCII table diff --git a/processing/post/h5_addCalculation.py b/processing/post/h5_addCalculation.py new file mode 100755 index 000000000..0ce1981a1 --- /dev/null +++ b/processing/post/h5_addCalculation.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +# import re +# import sys +import collections +# import math +import damask +# import numpy as np +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# ----- Helper functions ----- # +def listify(x): + return x if isinstance(x, collections.Iterable) else [x] + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +usageEx = """ +usage_in_details: + Column labels are tagged by '#label#' in formulas. + Use ';' for ',' in functions. Numpy is available as 'np'. + Special variables: #_row_# -- row index + + Examples: + (1) magnitude of vector -- "np.linalg.norm(#vec#)" + (2) rounded root of row number -- "round(math.sqrt(#_row_#);3)" +""" +desp = "Add or alter column(s) with derived values according to " +desp += "user-defined arithmetic operation between column(s)." + +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]' + usageEx, + description=desp, + version=scriptID) +parser.add_option('-l', '--label', + dest='labels', + action='extend', metavar='', + help='(list of) new column labels') +parser.add_option('-f', '--formula', + dest='formulas', + action='extend', metavar='', + help='(list of) formulas corresponding to labels') +parser.add_option('-c', '--condition', + dest='condition', metavar='string', + help='condition to filter rows') + +parser.set_defaults(condition=None) + +(options, filenames) = parser.parse_args() + +# ----- parse formulas ----- # +for i in range(len(options.formulas)): + options.formulas[i] = options.formulas[i].replace(';', ',') + +# ----- loop over input files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + print("!!!Cannot process {}".format(name)) + continue + damask.util.report(scriptName, name) + +# Note: +# --> not immediately needed, come back later diff --git a/processing/post/h5_addCauchy.py b/processing/post/h5_addCauchy.py new file mode 100755 index 000000000..84145d99d --- /dev/null +++ b/processing/post/h5_addCauchy.py @@ -0,0 +1,61 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +import damask +import numpy as np +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +def getCauchy(f, p): + """Return Cauchy stress for given f and p""" + # [Cauchy] = (1/det(F)) * [P].[F_transpose] + f = f.reshape((3, 3)) + p = p.reshape((3, 3)) + return 1.0/np.linalg.det(f)*np.dot(p, f.T).reshape(9) + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +desp = "Add column(s) containing Cauchy stress based on given column(s)" +desp += "of deformation gradient and first Piola--Kirchhoff stress." +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=desp, + version=scriptID) +parser.add_option('-f', '--defgrad', + dest='defgrad', + type='string', metavar='string', + help='heading for deformation gradient [%default]') +parser.add_option('-p', '--stress', + dest='stress', + type='string', metavar='string', + help='heading for first Piola--Kirchhoff stress [%default]') + +parser.set_defaults(defgrad='f', + stress='p') + +(options, filenames) = parser.parse_args() + +# ----- loop over input H5 files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + continue + damask.util.report(scriptName, name) + + # ----- read in data ----- # + f = h5f.get_data("f") + p = h5f.get_data("p") + + # ----- calculate Cauchy stress ----- # + cauchy = [getCauchy(f_i, p_i) for f_i, p_i in zip(f, p)] + + # ----- write to HDF5 file ----- # + cmd_log = " ".join([scriptID, name]) + h5f.add_data('Cauchy', np.array(cauchy), cmd_log=cmd_log) diff --git a/processing/post/h5_addIPFcolor.py b/processing/post/h5_addIPFcolor.py new file mode 100755 index 000000000..c92483fa5 --- /dev/null +++ b/processing/post/h5_addIPFcolor.py @@ -0,0 +1,145 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +import sys +import math +import damask +import numpy as np +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + +# TODO +# This implementation will have to iterate through the array one +# element at a time, maybe there are some other ways to make this +# faster. + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +desp = "Add RGB color value corresponding to TSL-OIM scheme for IPF." +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=desp, + version=scriptID) +parser.add_option('-p', '--pole', + dest='pole', + type='float', nargs=3, metavar='float float float', + help='lab frame direction for IPF [%default]') +msg = ', '.join(damask.Symmetry.lattices[1:]) +parser.add_option('-s', '--symmetry', + dest='symmetry', + type='choice', choices=damask.Symmetry.lattices[1:], + metavar='string', + help='crystal symmetry [%default] {{{}}} '.format(msg)) +parser.add_option('-e', '--eulers', + dest='eulers', + type='string', metavar='string', + help='Euler angles label') +parser.add_option('-d', '--degrees', + dest='degrees', + action='store_true', + help='Euler angles are given in degrees [%default]') +parser.add_option('-m', '--matrix', + dest='matrix', + type='string', metavar='string', + help='orientation matrix label') +parser.add_option('-a', + dest='a', + type='string', metavar='string', + help='crystal frame a vector label') +parser.add_option('-b', + dest='b', + type='string', metavar='string', + help='crystal frame b vector label') +parser.add_option('-c', + dest='c', + type='string', metavar='string', + help='crystal frame c vector label') +parser.add_option('-q', '--quaternion', + dest='quaternion', + type='string', metavar='string', + help='quaternion label') + +parser.set_defaults(pole=(0.0, 0.0, 1.0), + symmetry=damask.Symmetry.lattices[-1], + degrees=False) + +(options, filenames) = parser.parse_args() + +# safe guarding to have only one orientation representation +# use dynamic typing to group a,b,c into frame +options.frame = [options.a, options.b, options.c] +input = [options.eulers is not None, + all(options.frame), + options.matrix is not None, + options.quaternion is not None] + +if np.sum(input) != 1: + parser.error('needs exactly one input format.') + +# select input label that was requested (active) +label_active = np.where(input)[0][0] +(label, dim, inputtype) = [(options.eulers, 3, 'eulers'), + (options.frame, [3, 3, 3], 'frame'), + (options.matrix, 9, 'matrix'), + (options.quaternion, 4, 'quaternion')][label_active] + +# rescale degrees to radians +toRadians = math.pi/180.0 if options.degrees else 1.0 + +# only use normalized pole +pole = np.array(options.pole) +pole /= np.linalg.norm(pole) + +# ----- Loop over input files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + continue + damask.util.report(scriptName, name) + + # extract data from HDF5 file + if inputtype == 'eulers': + orieData = h5f.get_data(label) + elif inputtype == 'matrix': + orieData = h5f.get_data(label) + orieData = orieData.reshape(orieData.shape[0], 3, 3) + elif inputtype == 'frame': + vctr_a = h5f.get_data(label[0]) + vctr_b = h5f.get_data(label[1]) + vctr_c = h5f.get_data(label[2]) + frame = np.column_stack((vctr_a, vctr_b, vctr_c)) + orieData = frame.reshape(frame.shape[0], 3, 3) + elif inputtype == 'quaternion': + orieData = h5f.get_data(label) + + # calculate the IPF color + rgbArrays = np.zeros((orieData.shape[0], 3)) + for ci in range(rgbArrays.shape[0]): + if inputtype == 'eulers': + o = damask.Orientation(Eulers=np.array(orieData[ci, :])*toRadians, + symmetry=options.symmetry).reduced() + elif inputtype == 'matrix': + o = damask.Orientation(matrix=orieData[ci, :, :].transpose(), + symmetry=options.symmetry).reduced() + elif inputtype == 'frame': + o = damask.Orientation(matrix=orieData[ci, :, :], + symmetry=options.symmetry).reduced() + elif inputtype == 'quaternion': + o = damask.Orientation(quaternion=orieData[ci, :], + symmetry=options.symmetry).reduced() + rgbArrays[ci, :] = o.IPFcolor(pole) + + # compose labels/headers for IPF color (RGB) + labelIPF = 'IPF_{:g}{:g}{:g}_{sym}'.format(*options.pole, + sym=options.symmetry.lower()) + + # compose cmd history (go with dataset) + cmd_log = scriptID + '\t' + ' '.join(sys.argv[1:]) + + # write data to HDF5 file + h5f.add_data(labelIPF, rgbArrays, cmd_log=cmd_log) diff --git a/processing/post/h5_addMises.py b/processing/post/h5_addMises.py new file mode 100755 index 000000000..99367cd80 --- /dev/null +++ b/processing/post/h5_addMises.py @@ -0,0 +1,85 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +import sys +import math +import damask +import numpy as np +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# ----- Helper functions ----- # +def calcMises(what, tensor): + """Calculate von Mises equivalent""" + dev = tensor - np.trace(tensor)/3.0*np.eye(3) + symdev = 0.5*(dev+dev.T) + return math.sqrt(np.sum(symdev*symdev.T) * + { + 'stress': 3.0/2.0, + 'strain': 2.0/3.0, + }[what.lower()]) + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +desp = "Add von Mises equivalent values for symmetric part of requested" +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=desp, + version=scriptID) +parser.add_option('-e', '--strain', + dest='strain', + metavar='string', + help='name of dataset containing strain tensors') +parser.add_option('-s', '--stress', + dest='stress', + metavar='string', + help='name of dataset containing stress tensors') + +parser.set_defaults(strain=None, stress=None) + +(options, filenames) = parser.parse_args() + +# ----- Loop over input files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + continue + damask.util.report(scriptName, name) + + # TODO: + # Could use some refactoring here + if options.stress is not None: + # extract stress tensor from HDF5 + tnsr = h5f.get_data(options.stress) + + # calculate von Mises equivalent row by row + vmStress = np.zeros(tnsr.shape[0]) + for ri in range(tnsr.shape[0]): + stressTnsr = tnsr[ri, :].reshape(3, 3) + vmStress[ri] = calcMises('stress', stressTnsr) + + # compose label + label = "Mises{}".format(options.stress) + + # prepare log info + cmd_log = scriptID + '\t' + ' '.join(sys.argv[1:]) + + # write data to HDF5 file + h5f.add_data(label, vmStress, cmd_log=cmd_log) + + if options.strain is not None: + tnsr = h5f.get_data(options.strain) + vmStrain = np.zeros(tnsr.shape[0]) + for ri in range(tnsr.shape[0]): + strainTnsr = tnsr[ri, :].reshape(3, 3) + vmStrain[ri] = calcMises('strain', strainTnsr) + label = "Mises{}".format(options.strain) + cmd_log = scriptID + '\t' + ' '.join(sys.argv[1:]) + h5f.add_data(label, vmStrain, cmd_log=cmd_log) diff --git a/processing/post/h5_addStrainTensors.py b/processing/post/h5_addStrainTensors.py new file mode 100755 index 000000000..9e3f49233 --- /dev/null +++ b/processing/post/h5_addStrainTensors.py @@ -0,0 +1,156 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +import sys +import damask +import numpy as np +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# ----- Helper functions ----- # +def operator(stretch, strain, eigenvalues): + # Albrecht Bertram: Elasticity and Plasticity of Large Deformations + # An Introduction (3rd Edition, 2012), p. 102 + return {'V#ln': np.log(eigenvalues), + 'U#ln': np.log(eigenvalues), + 'V#Biot': (np.ones(3, 'd') - 1.0/eigenvalues), + 'U#Biot': (eigenvalues - np.ones(3, 'd')), + 'V#Green': (np.ones(3, 'd') - 1.0/eigenvalues/eigenvalues)*0.5, + 'U#Green': (eigenvalues*eigenvalues - np.ones(3, 'd'))*0.5, + }[stretch+'#'+strain] + + +def calcEPS(defgrads, stretchType, strainType): + """Calculate specific type of strain tensor""" + eps = np.zeros(defgrads.shape) # initialize container + + # TODO: + # this loop can use some performance boost + # (multi-threading?) + for ri in range(defgrads.shape[0]): + f = defgrads[ri, :].reshape(3, 3) + U, S, Vh = np.linalg.svd(f) + R = np.dot(U, Vh) # rotation of polar decomposition + if stretchType == 'U': + stretch = np.dot(np.linalg.inv(R), f) # F = RU + elif stretchType == 'V': + stretch = np.dot(f, np.linalg.inv(R)) # F = VR + + # kill nasty noisy data + stretch = np.where(abs(stretch) < 1e-12, 0, stretch) + + (D, V) = np.linalg.eig(stretch) + # flip principal component with negative Eigen values + neg = np.where(D < 0.0) + D[neg] *= -1. + V[:, neg] *= -1. + + # check each vector for orthogonality + # --> brutal force enforcing orthogonal base + # and re-normalize + for i, eigval in enumerate(D): + if np.dot(V[:, i], V[:, (i+1) % 3]) != 0.0: + V[:, (i+1) % 3] = np.cross(V[:, (i+2) % 3], V[:, i]) + V[:, (i+1) % 3] /= np.sqrt(np.dot(V[:, (i+1) % 3], + V[:, (i+1) % 3].conj())) + + # calculate requested version of strain tensor + d = operator(stretchType, strainType, D) + eps[ri] = (np.dot(V, np.dot(np.diag(d), V.T)).real).reshape(9) + + return eps + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +desp = "Add column(s) containing given strains based on given stretches" +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=desp, + version=scriptID) +msg = 'material strains based on right Cauchy-Green deformation, i.e., C and U' +parser.add_option('-u', '--right', + dest='right', + action='store_true', + help=msg) +msg = 'spatial strains based on left Cauchy--Green deformation, i.e., B and V' +parser.add_option('-v', '--left', + dest='left', + action='store_true', + help=msg) +parser.add_option('-0', '--logarithmic', + dest='logarithmic', + action='store_true', + help='calculate logarithmic strain tensor') +parser.add_option('-1', '--biot', + dest='biot', + action='store_true', + help='calculate biot strain tensor') +parser.add_option('-2', '--green', + dest='green', + action='store_true', + help='calculate green strain tensor') +# NOTE: +# It might be easier to just calculate one type of deformation gradient +# at a time. +msg = 'heading(s) of columns containing deformation tensor values' +parser.add_option('-f', '--defgrad', + dest='defgrad', + action='extend', + metavar='', + help=msg) + +parser.set_defaults(right=False, left=False, + logarithmic=False, biot=False, green=False, + defgrad='f') + +(options, filenames) = parser.parse_args() + +stretches = [] +strains = [] + +if options.right: + stretches.append('U') +if options.left: + stretches.append('V') + +if options.logarithmic: + strains.append('ln') +if options.biot: + strains.append('Biot') +if options.green: + strains.append('Green') + +if options.defgrad is None: + parser.error('no data column specified.') + +# ----- Loop over input files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + continue + damask.util.report(scriptName, name) + + # extract defgrads from HDF5 storage + F = h5f.get_data(options.defgrad) + + # allow calculate multiple types of strain within the + # same cmd call + for stretchType in stretches: + for strainType in strains: + # calculate strain tensor for this type + eps = calcEPS(F, stretchType, strainType) + + # compose labels/headers for this strain tensor + labelsStrain = strainType + stretchType + + # prepare log info + cmd_log = scriptID + '\t' + ' '.join(sys.argv[1:]) + + # write data to HDF5 file + h5f.add_data(labelsStrain, eps, cmd_log=cmd_log) diff --git a/processing/post/h5_addXdmfWapper.py b/processing/post/h5_addXdmfWapper.py new file mode 100755 index 000000000..e5588a069 --- /dev/null +++ b/processing/post/h5_addXdmfWapper.py @@ -0,0 +1,130 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +# ------------------------------------------------------------------- # +# NOTE: # +# 1. Current Xdmf rendering in Paraview has some memory issue where # +# large number of polyvertices will cause segmentation fault. By # +# default, paraview output a cell based xdmf description, which # +# is working for small and medium mesh (<10,000) points. Hence a # +# rectangular mesh is used as the de facto Geometry description # +# here. # +# 2. Due to the unstable state Xdmf, it is safer to use port data # +# to VTR rather than using xdmf as interpretive layer for data # +# visualization. # +# ------------------------------------------------------------------- # + + +import os +import damask +import h5py +import xml.etree.cElementTree as ET +from optparse import OptionParser +from xml.dom import minidom +from damask.h5table import lables_to_path + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName,damask.version]) + + +# ----- HELPER FUNCTIONS -----# +def addTopLvlCmt(xmlstr, topLevelCmt): + """Add top level comment to string from ET""" + # a quick hack to add the top level comment to XML file + # --> somehow Elementtree does not provide this functionality + # --> by default + strList = xmlstr.split("\n") + strList[0] += "\n"+topLevelCmt + return "\n".join(strList) + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- + +msg = 'Generate Xdmf wrapper for HDF5 file.' +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description = msg, + version = scriptID) + +(options, filenames) = parser.parse_args() + +h5f = filenames[0] +h5f_base = h5f.split("/")[-1] + +# ----- parse HDF5 file ----- # +h5f_dataDim = {} +h5f_dataPath = {} +h5f_dataType = {} +with h5py.File(h5f, 'a') as f: + labels = f.keys() + labels += f['/Constitutive'].keys() + labels += f['/Crystallite'].keys() + labels += ['Vx', 'Vy', "Vz"] + # remove group names as they do not contain real data + # TODO: use h5py/H5table API to detect dataset name to + # avoid necessary name space pruning. + labels.remove('Constitutive') + labels.remove('Crystallite') + labels.remove('Geometry') + # loop through remaining labels + for label in labels: + dataType, h5Path = lables_to_path(label) + h5f_dataType[label] = dataType + h5f_dataDim[label] = " ".join(map(str,f[h5Path].shape)) + h5f_dataPath[label] = h5Path + +# ----- constructing xdmf elements ----- # +root = ET.Element("Xdmf", version='3.3') +root.set('xmlns:xi', "http://www.w3.org/2001/XInclude") +root.append(ET.Comment('Generated Xdmf wapper for DAMASH H5 output')) + +# usually there should only be ONE domain +domain = ET.SubElement(root, 'Domain', + Name=h5f_base.split(".")[0]) + +# use global topology through reference +grid = ET.SubElement(domain, 'Grid', GridType="Uniform") +# geometry section +geometry = ET.SubElement(grid, 'Geometry', GeometryType="VXVYVZ") +for vector in ["Vz", "Vy", "Vx"]: + dataitem = ET.SubElement(geometry, "DataItem", + DataType="Float", + Dimensions=h5f_dataDim[vector], + Name=vector, + Format="HDF") + dataitem.text = h5f_base.split("/")[-1] + ":{}".format(h5f_dataPath[vector]) +# topology section +# TODO: support for other format based on given option +meshDim = [h5f_dataDim["Vz"], h5f_dataDim["Vy"], h5f_dataDim["Vx"]] +topology = ET.SubElement(grid, 'Topology', + TopologyType="3DRectMesh", + Dimensions=" ".join(map(str, meshDim))) + +# attributes section +# Question: how to properly handle data mapping for multiphase situations +labelsProcessed = ['Vx', 'Vy', 'Vz'] +# walk through each attributes +for label in labels: + if label in labelsProcessed: continue + print("adding {}...".format(label)) + attr = ET.SubElement(grid, 'Attribute', + Name=label, + Type="None", + Center="Cell") + dataitem = ET.SubElement(attr, 'DataItem', + Name=label, + Format='HDF', + Dimensions=h5f_dataDim[label]) + dataitem.text = h5f_base + ":" + h5f_dataPath[label] + # update progress list + labelsProcessed.append(label) + + +# pretty print the xdmf(xml) file content +xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent="\t") +xmlstr = addTopLvlCmt(xmlstr, '') +# write str to file through native python API +with open(h5f.replace(".h5", ".xmf"), 'w') as f: + f.write(xmlstr) diff --git a/processing/post/h5_vtkAddRectilinearGridData.py b/processing/post/h5_vtkAddRectilinearGridData.py new file mode 100755 index 000000000..1c0492f53 --- /dev/null +++ b/processing/post/h5_vtkAddRectilinearGridData.py @@ -0,0 +1,191 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os +import vtk +import damask +from vtk.util import numpy_support +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- +msg = "Add scalars, vectors, and/or an RGB tuple from" +msg += "an HDF5 to existing VTK rectilinear grid (.vtr/.vtk)." +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=msg, + version=scriptID) +parser.add_option('--vtk', + dest='vtk', + type='string', metavar='string', + help='VTK file name') +parser.add_option('--inplace', + dest='inplace', + action='store_true', + help='modify VTK file in-place') +parser.add_option('-r', '--render', + dest='render', + action='store_true', + help='open output in VTK render window') +parser.add_option('-d', '--data', + dest='data', + action='extend', metavar='', + help='scalar/vector value(s) label(s)') +parser.add_option('-t', '--tensor', + dest='tensor', + action='extend', metavar='', + help='tensor (3x3) value label(s)') +parser.add_option('-c', '--color', + dest='color', + action='extend', metavar='', + help='RGB color tuple label') +parser.add_option('-m', + '--mode', + dest='mode', + metavar='string', + type='choice', choices=['cell', 'point'], + help='cell-centered or point-centered coordinates') + +parser.set_defaults(data=[], + tensor=[], + color=[], + mode='cell', + inplace=False, + render=False) + +(options, filenames) = parser.parse_args() + +# ----- Legacy VTK format support ----- # +if os.path.splitext(options.vtk)[1] == '.vtr': + reader = vtk.vtkXMLRectilinearGridReader() + reader.SetFileName(options.vtk) + reader.Update() + rGrid = reader.GetOutput() +elif os.path.splitext(options.vtk)[1] == '.vtk': + reader = vtk.vtkGenericDataObjectReader() + reader.SetFileName(options.vtk) + reader.Update() + rGrid = reader.GetRectilinearGridOutput() +else: + parser.error('Unsupported VTK file type extension.') + +Npoints = rGrid.GetNumberOfPoints() +Ncells = rGrid.GetNumberOfCells() + +# ----- Summary output (Sanity Check) ----- # +msg = '{}: {} points and {} cells...'.format(options.vtk, + Npoints, + Ncells) +damask.util.croak(msg) + +# ----- Read HDF5 file ----- # +# NOTE: +# --> It is possible in the future we are trying to add data +# from different increment into the same VTK file, but +# this feature is not supported for the moment. +# --> Let it fail, if the HDF5 is invalid, python interpretor +# --> should be able to catch this error. +h5f = damask.H5Table(filenames[0], new_file=False) + +# ----- Process data ----- # +featureToAdd = {'data': options.data, + 'tensor': options.tensor, + 'color': options.color} +VTKarray = {} # store all vtkData in dict, then ship them to file +for dataType in featureToAdd.keys(): + featureNames = featureToAdd[dataType] + for featureName in featureNames: + VTKtype = vtk.VTK_DOUBLE + VTKdata = h5f.get_data(featureName) + if dataType == 'color': + VTKtype = vtk.VTK_UNSIGNED_CHAR + VTKdata = (VTKdata*255).astype(int) + elif dataType == 'tensor': + # Force symmetries tensor type data + VTKdata[:, 1] = VTKdata[:, 3] = 0.5*(VTKdata[:, 1]+VTKdata[:, 3]) + VTKdata[:, 2] = VTKdata[:, 6] = 0.5*(VTKdata[:, 2]+VTKdata[:, 6]) + VTKdata[:, 5] = VTKdata[:, 7] = 0.5*(VTKdata[:, 5]+VTKdata[:, 7]) + # use vtk build-in numpy support to add data (much faster) + # NOTE: + # --> deep copy is necessary here, otherwise memory leak could occur + VTKarray[featureName] = numpy_support.numpy_to_vtk(num_array=VTKdata, + deep=True, + array_type=VTKtype) + VTKarray[featureName].SetName(featureName) + +# ----- ship data to vtkGrid ----- # +mode = options.mode +damask.util.croak('{} mode...'.format(mode)) + +# NOTE: +# --> For unknown reason, Paraview only recognize one +# tensor attributes per cell, thus it would be safe +# to only add one attributes as tensor. +for dataType in featureToAdd.keys(): + featureNames = featureToAdd[dataType] + for featureName in featureNames: + if dataType == 'color': + if mode == 'cell': + rGrid.GetCellData().SetScalars(VTKarray[featureName]) + elif mode == 'point': + rGrid.GetPointData().SetScalars(VTKarray[featureName]) + elif dataType == 'tensor': + if mode == 'cell': + rGrid.GetCellData().SetTensors(VTKarray[featureName]) + elif mode == 'point': + rGrid.GetPointData().SetTensors(VTKarray[featureName]) + else: + if mode == 'cell': + rGrid.GetCellData().AddArray(VTKarray[featureName]) + elif mode == 'point': + rGrid.GetPointData().AddArray(VTKarray[featureName]) + +rGrid.Modified() +if vtk.VTK_MAJOR_VERSION <= 5: + rGrid.Update() + +# ----- write Grid to VTK file ----- # +writer = vtk.vtkXMLRectilinearGridWriter() +writer.SetDataModeToBinary() +writer.SetCompressorTypeToZLib() +vtkFileN = os.path.splitext(options.vtk)[0] +vtkExtsn = '.vtr' if options.inplace else '_added.vtr' +writer.SetFileName(vtkFileN+vtkExtsn) +if vtk.VTK_MAJOR_VERSION <= 5: + writer.SetInput(rGrid) +else: + writer.SetInputData(rGrid) +writer.Write() + +# ----- render results from script ----- # +if options.render: + mapper = vtk.vtkDataSetMapper() + mapper.SetInputData(rGrid) + actor = vtk.vtkActor() + actor.SetMapper(mapper) + + # Create the graphics structure. The renderer renders into the + # render window. The render window interactor captures mouse events + # and will perform appropriate camera or actor manipulation + # depending on the nature of the events. + + ren = vtk.vtkRenderer() + + renWin = vtk.vtkRenderWindow() + renWin.AddRenderer(ren) + + ren.AddActor(actor) + ren.SetBackground(1, 1, 1) + renWin.SetSize(200, 200) + + iren = vtk.vtkRenderWindowInteractor() + iren.SetRenderWindow(renWin) + + iren.Initialize() + renWin.Render() + iren.Start() diff --git a/processing/post/h5_vtkRectilinearGrid.py b/processing/post/h5_vtkRectilinearGrid.py new file mode 100755 index 000000000..b08070b84 --- /dev/null +++ b/processing/post/h5_vtkRectilinearGrid.py @@ -0,0 +1,135 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +# ------------------------------------------------------------------ # +# NOTE: # +# 1. It might be a good idea to separate IO and calculation. # +# 2. Some of the calculation could be useful in other situations, # +# why not build a math_util, or math_sup module that contains # +# all the useful functions. # +# ------------------------------------------------------------------ # + +import os +import vtk +import numpy as np +import damask +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName, damask.version]) + + +# ----- HELPER FUNCTION ----- # +def getMeshFromXYZ(xyzArray, mode): + """Calc Vx,Vy,Vz vectors for vtk rectangular mesh""" + # NOTE: + # --> np.unique will automatically sort the list + # --> although not exactly n(1), but since mesh dimension should + # small anyway, so this is still light weight. + dim = xyzArray.shape[1] # 2D:2, 3D:3 + coords = [np.unique(xyzArray[:, i]) for i in range(dim)] + + if mode == 'cell': + # since x, y, z might now have the same number of elements, + # we have to deal with them individually + for ri in range(dim): + vctr_pt = coords[ri] + vctr_cell = np.empty(len(vctr_pt)+1) + # calculate first and last end point + vctr_cell[0] = vctr_pt[0] - 0.5*abs(vctr_pt[1] - vctr_pt[0]) + vctr_cell[-1] = vctr_pt[-1] + 0.5*abs(vctr_pt[-2] - vctr_pt[-1]) + for cj in range(1, len(vctr_cell)-1): + vctr_cell[cj] = 0.5*(vctr_pt[cj-1] + vctr_pt[cj]) + # update the coords + coords[ri] = vctr_cell + + if dim < 3: + coords.append([0]) # expand to a 3D with 0 for z + + # auxiliary description + grid = np.array(map(len, coords), 'i') + N = grid.prod() if mode == 'point' else (grid-1).prod() + return coords, grid, N + +# -------------------------------------------------------------------- +# MAIN +# -------------------------------------------------------------------- + +msg = "Create regular voxel grid from points in an ASCIItable." +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description=msg, + version=scriptID) + +parser.add_option('-m', + '--mode', + dest='mode', + metavar='string', + type='choice', choices=['cell', 'point'], + help='cell-centered or point-centered coordinates') +parser.add_option('-p', + '--pos', '--position', + dest='pos', + type='string', metavar='string', + help='label of coordinates [%default]') + +parser.set_defaults(mode='cell', + pos='pos') + +(options, filenames) = parser.parse_args() + +# ----- loop over input files ----- # +for name in filenames: + try: + h5f = damask.H5Table(name, new_file=False) + except: + continue + damask.util.report(scriptName, name) + + # ----- read xyzArray from HDF5 file ----- # + xyzArray = h5f.get_data(options.pos) + + # ----- figure out size and grid ----- # + coords, grid, N = getMeshFromXYZ(xyzArray, options.mode) + + # ----- process data ----- # + rGrid = vtk.vtkRectilinearGrid() + # WARNING: list expansion does not work here as these are + # just pointers for a vtk instance. Simply put, + # DON't USE + # [] * + coordArray = [vtk.vtkDoubleArray(), + vtk.vtkDoubleArray(), + vtk.vtkDoubleArray()] + + rGrid.SetDimensions(*grid) + for i, points in enumerate(coords): + for point in points: + coordArray[i].InsertNextValue(point) + + rGrid.SetXCoordinates(coordArray[0]) + rGrid.SetYCoordinates(coordArray[1]) + rGrid.SetZCoordinates(coordArray[2]) + + # ----- output result ----- # + dirPath = os.path.split(name)[0] + if name: + writer = vtk.vtkXMLRectilinearGridWriter() + writer.SetCompressorTypeToZLib() + writer.SetDataModeToBinary() + # getting the name is a little bit tricky + vtkFileName = os.path.splitext(os.path.split(name)[1])[0] + vtkFileName += '_{}({})'.format(options.pos, options.mode) + vtkFileName += '.' + writer.GetDefaultFileExtension() + writer.SetFileName(os.path.join(dirPath, vtkFileName)) + else: + writer = vtk.vtkDataSetWriter() + writer.SetHeader('# powered by '+scriptID) + writer.WriteToOutputStringOn() + + if vtk.VTK_MAJOR_VERSION <= 5: + writer.SetInput(rGrid) + else: + writer.SetInputData(rGrid) + + writer.Write() diff --git a/processing/post/histogram.py b/processing/post/histogram.py index ea67aa770..0f7d73fdc 100755 --- a/processing/post/histogram.py +++ b/processing/post/histogram.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/imageData.py b/processing/post/imageData.py index b1afcb3de..41996a3c6 100755 --- a/processing/post/imageData.py +++ b/processing/post/imageData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/imageDataDeformed.py b/processing/post/imageDataDeformed.py index a15839b22..5436e1fbd 100755 --- a/processing/post/imageDataDeformed.py +++ b/processing/post/imageDataDeformed.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -168,8 +168,8 @@ for name in filenames: im = Image.new('RGBA',imagesize) draw = ImageDraw.Draw(im) - for y in xrange(options.dimension[1]): - for x in xrange(options.dimension[0]): + for y in range(options.dimension[1]): + for x in range(options.dimension[0]): draw.polygon([nodes[0,x ,y ,options.z], nodes[1,x ,y ,options.z], nodes[0,x+1,y ,options.z], diff --git a/processing/post/imageDataRGB.py b/processing/post/imageDataRGB.py index 4d4aa1f8d..4f124507e 100755 --- a/processing/post/imageDataRGB.py +++ b/processing/post/imageDataRGB.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/mentat_colorMap.py b/processing/post/mentat_colorMap.py index 79ea35a39..4fad5cd8f 100755 --- a/processing/post/mentat_colorMap.py +++ b/processing/post/mentat_colorMap.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -27,9 +27,9 @@ def outStdout(cmd,locals): exec(cmd[3:]) elif cmd[0:3] == '(?)': cmd = eval(cmd[3:]) - print cmd + print(cmd) else: - print cmd + print(cmd) return @@ -121,17 +121,17 @@ if options.inverse: theMap = theMap.invert() if options.palettef: - print theMap.export(format='raw',steps=options.colorcount) + print(theMap.export(format='raw',steps=options.colorcount)) elif options.palette: for theColor in theMap.export(format='list',steps=options.colorcount): - print '\t'.join(map(lambda x: str(int(255*x)),theColor)) + print('\t'.join(map(lambda x: str(int(255*x)),theColor))) else: # connect to Mentat and change colorMap - sys.path.append(damask.solver.Marc().libraryPath('../../')) + sys.path.append(damask.solver.Marc().libraryPath()) try: import py_mentat - print 'waiting to connect...' + print('waiting to connect...') py_mentat.py_connect('',options.port) - print 'connected...' + print('connected...') mentat = True except: sys.stderr.write('warning: no valid Mentat release found\n') diff --git a/processing/post/perceptualUniformColorMap.py b/processing/post/perceptualUniformColorMap.py index 0bf655f2a..96e676337 100755 --- a/processing/post/perceptualUniformColorMap.py +++ b/processing/post/perceptualUniformColorMap.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os @@ -49,7 +49,7 @@ parser.set_defaults(right = (0.0,0.0,0.0)) (options,filename) = parser.parse_args() if options.format not in outtypes: - parser.error('invalid format: "%s" (can be %s).'%(options.format,', '.join(outtypes))) + parser.error('invalid format: "{}" (choices: {}).'.format(options.format,', '.join(outtypes))) if options.N < 2: parser.error('too few steps (need at least 2).') @@ -59,10 +59,9 @@ if options.trim[0] < -1.0 or \ options.trim[0] >= options.trim[1]: parser.error('invalid trim range (-1 +1).') - -name = options.format if filename[0] is None\ +name = options.format if filename == [] \ else filename[0] -output = sys.stdout if filename[0] is None\ +output = sys.stdout if filename == [] \ else open(os.path.basename(filename[0])+extensions[outtypes.index(options.format)],'w') colorLeft = damask.Color(options.colormodel.upper(), list(options.left)) diff --git a/processing/post/permuteData.py b/processing/post/permuteData.py index 54a18576f..0cbf6039a 100755 --- a/processing/post/permuteData.py +++ b/processing/post/permuteData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/postResults.py b/processing/post/postResults.py index 28a2b40ac..a3501bc81 100755 --- a/processing/post/postResults.py +++ b/processing/post/postResults.py @@ -1,7 +1,7 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -import os,sys,math,re,time,struct,string +import os,sys,math,re,time,struct import damask from optparse import OptionParser, OptionGroup @@ -18,7 +18,7 @@ fileExtensions = { \ # ----------------------------- class vector: # mimic py_post node object x,y,z = [None,None,None] - + def __init__(self,coords): self.x = coords[0] self.y = coords[1] @@ -102,7 +102,7 @@ class MPIEspectral_result: # mimic py_post result object self._frequencies = self._keyedPackedArray('frequencies:',count=self.N_loadcases,type='i') if all ( i is None for i in self._frequencies): self._frequencies = self._keyedPackedArray('frequencies',count=self.N_loadcases,type='i') - + self._increments = self._keyedPackedArray('increments:',count=self.N_loadcases,type='i') if all (i is None for i in self._increments): self._increments = self._keyedPackedArray('increments',count=self.N_loadcases,type='i') @@ -111,7 +111,7 @@ class MPIEspectral_result: # mimic py_post result object if self.startingIncrement is None: self.startingIncrement = self._keyedPackedArray('startingIncrement',count=1,type='i')[0] - + self._times = self._keyedPackedArray('times:',count=self.N_loadcases,type='d') if all (i is None for i in self._times): self._times = self._keyedPackedArray('times',count=self.N_loadcases,type='d') @@ -119,15 +119,15 @@ class MPIEspectral_result: # mimic py_post result object self._logscales = self._keyedPackedArray('logscales:',count=self.N_loadcases,type='i') if all (i is None for i in self._logscales): self._logscales = self._keyedPackedArray('logscales',count=self.N_loadcases,type='i') - + self.size = self._keyedPackedArray('size:',count=3,type='d') if self.size == [None,None,None]: # no 'size' found, try legacy alias 'dimension' self.size = self._keyedPackedArray('dimension',count=3,type='d') - + self.grid = self._keyedPackedArray('grid:',count=3,type='i') if self.grid == [None,None,None]: # no 'grid' found, try legacy alias 'resolution' self.grid = self._keyedPackedArray('resolution',count=3,type='i') - + self.N_nodes = (self.grid[0]+1)*(self.grid[1]+1)*(self.grid[2]+1) self.N_elements = self.grid[0] * self.grid[1] * self.grid[2] @@ -139,7 +139,7 @@ class MPIEspectral_result: # mimic py_post result object self.N_increments = 1 # add zero'th entry for i in range(self.N_loadcases): self.N_increments += self._increments[i]//self._frequencies[i] - + # parameters for file handling depending on output format if options.legacy: @@ -150,7 +150,7 @@ class MPIEspectral_result: # mimic py_post result object self.expectedFileSize = self.dataOffset+self.N_increments*(self.tagLen+self.N_elements*self.N_element_scalars*8) if options.legacy: self.expectedFileSize+=self.expectedFileSize//self.fourByteLimit*8 # add extra 8 bytes for additional headers at 4 GB limits if self.expectedFileSize != self.filesize: - print '\n**\n* Unexpected file size. Incomplete simulation or file corrupted!\n**' + print('\n**\n* Unexpected file size. Incomplete simulation or file corrupted!\n**') def __str__(self): """Summary of results file""" @@ -176,17 +176,17 @@ class MPIEspectral_result: # mimic py_post result object name = '' filepos=0 # start at the beginning while name != identifier and filepos < self.dataOffset: # stop searching when found or when reached end of header - self.file.seek(filepos) + self.file.seek(filepos) # read the starting tag in front of the keyword (Fortran indicates start and end of writing by a 4 byte tag indicating the length of the following data) dataLen=struct.unpack('i',self.file.read(4))[0] name = self.file.read(len(identifier)) # anticipate identifier - start=filepos+(4+len(identifier)) # position of the values for the found key + start=filepos+(4+len(identifier)) # position of the values for the found key filepos=filepos+(4+dataLen+4) # forward to next keyword - + if name==identifier: # found the correct name key['pos'] = start # save position key['name'] = name - return key + return key def _keyedPackedArray(self,identifier,count = 3,type = 'd',default = None): bytecount = {'d': 8,'i': 4} @@ -251,10 +251,10 @@ class MPIEspectral_result: # mimic py_post result object def element_sequence(self,e): return e-1 - + def element_id(self,e): return e+1 - + def element(self,e): a = self.grid[0]+1 b = self.grid[1]+1 @@ -288,10 +288,10 @@ class MPIEspectral_result: # mimic py_post result object self.file.seek(incStart+where) value = struct.unpack('d',self.file.read(8))[0] except: - print 'seeking',incStart+where - print 'e',e,'idx',idx + print('seeking {}'.format(incStart+where)) + print('e {} idx {}'.format(e,idx)) sys.exit(1) - + else: self.fourByteLimit = 2**31 -1 -8 # header & footer + extra header and footer for 4 byte int range (Fortran) @@ -304,17 +304,17 @@ class MPIEspectral_result: # mimic py_post result object try: if where%self.fourByteLimit + 8 >= self.fourByteLimit: # danger of reading into fortran record footer at 4 byte limit data='' - for i in xrange(8): + for i in range(8): self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4) data += self.file.read(1) where += 1 value = struct.unpack('d',data)[0] - else: + else: self.file.seek(incStart+where+(where//self.fourByteLimit)*8+4) value = struct.unpack('d',self.file.read(8))[0] except: - print 'seeking',incStart+where+(where//self.fourByteLimit)*8+4 - print 'e',e,'idx',idx + print('seeking {}'.format(incStart+where+(where//self.fourByteLimit)*8+4)) + print('e {} idx {}'.format(e,idx)) sys.exit(1) return [elemental_scalar(node,value) for node in self.element(e).items] @@ -327,40 +327,40 @@ class MPIEspectral_result: # mimic py_post result object # ----------------------------- def ipCoords(elemType, nodalCoordinates): - """returns IP coordinates for a given element""" - nodeWeightsPerNode = { - 7: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], - [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], - [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], - [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], - [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], - [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], - [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], - [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], - 57: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], - [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], - [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], - [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], - [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], - [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], - [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], - [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], - 117: [ [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ], + """Returns IP coordinates for a given element""" + nodeWeightsPerNode = { + 7: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], + [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], + [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], + [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], + [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], + [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], + [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], + [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], + 57: [ [27.0, 9.0, 3.0, 9.0, 9.0, 3.0, 1.0, 3.0], + [ 9.0, 27.0, 9.0, 3.0, 3.0, 9.0, 3.0, 1.0], + [ 3.0, 9.0, 27.0, 9.0, 1.0, 3.0, 9.0, 3.0], + [ 9.0, 3.0, 9.0, 27.0, 3.0, 1.0, 3.0, 9.0], + [ 9.0, 3.0, 1.0, 3.0, 27.0, 9.0, 3.0, 9.0], + [ 3.0, 9.0, 3.0, 1.0, 9.0, 27.0, 9.0, 3.0], + [ 1.0, 3.0, 9.0, 3.0, 3.0, 9.0, 27.0, 9.0], + [ 3.0, 1.0, 3.0, 9.0, 9.0, 3.0, 9.0, 27.0] ], + 117: [ [ 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0] ], 125: [ [ 3.0, 0.0, 0.0, 4.0, 1.0, 4.0], [ 0.0, 3.0, 0.0, 4.0, 4.0, 1.0], - [ 0.0, 0.0, 3.0, 1.0, 4.0, 4.0],], + [ 0.0, 0.0, 3.0, 1.0, 4.0, 4.0],], 127: [ [ 45.0, 17.0, 17.0, 17.0], [ 17.0, 45.0, 17.0, 17.0], [ 17.0, 17.0, 45.0, 17.0], - [ 17.0, 17.0, 17.0, 45.0],], - 136: [ [42.0, 15.0, 15.0, 14.0, 5.0, 5.0], - [15.0, 42.0, 15.0, 5.0, 14.0, 5.0], - [15.0, 15.0, 42.0, 5.0, 5.0, 14.0], - [14.0, 5.0, 5.0, 42.0, 15.0, 15.0], - [ 5.0, 14.0, 5.0, 15.0, 42.0, 15.0], - [ 5.0, 5.0, 14.0, 15.0, 15.0, 42.0] ], + [ 17.0, 17.0, 17.0, 45.0],], + 136: [ [42.0, 15.0, 15.0, 14.0, 5.0, 5.0], + [15.0, 42.0, 15.0, 5.0, 14.0, 5.0], + [15.0, 15.0, 42.0, 5.0, 5.0, 14.0], + [14.0, 5.0, 5.0, 42.0, 15.0, 15.0], + [ 5.0, 14.0, 5.0, 15.0, 42.0, 15.0], + [ 5.0, 5.0, 14.0, 15.0, 15.0, 42.0] ], } - + Nips = len(nodeWeightsPerNode[elemType]) ipCoordinates = [[0.0,0.0,0.0] for i in range(Nips)] for ip in range(Nips): @@ -369,30 +369,30 @@ def ipCoords(elemType, nodalCoordinates): ipCoordinates[ip][i] += nodeWeightsPerNode[elemType][ip][node] * nodalCoordinates[node][i] for i in range(3): ipCoordinates[ip][i] /= sum(nodeWeightsPerNode[elemType][ip]) - + return ipCoordinates # ----------------------------- def ipIDs(elemType): - """returns IP numbers for given element type""" - ipPerNode = { - 7: [ 1, 2, 4, 3, 5, 6, 8, 7 ], - 57: [ 1, 2, 4, 3, 5, 6, 8, 7 ], + """Returns IP numbers for given element type""" + ipPerNode = { + 7: [ 1, 2, 4, 3, 5, 6, 8, 7 ], + 57: [ 1, 2, 4, 3, 5, 6, 8, 7 ], 117: [ 1 ], - 125: [ 1, 2, 3 ], - 127: [ 1, 2, 3, 4 ], - 136: [ 1, 2, 3, 4, 5, 6 ], + 125: [ 1, 2, 3 ], + 127: [ 1, 2, 3, 4 ], + 136: [ 1, 2, 3, 4, 5, 6 ], } - + return ipPerNode[elemType] # ----------------------------- def substituteLocation(string, mesh, coords): - """do variable interpolation in group and filter strings""" + """Do variable interpolation in group and filter strings""" substitute = string substitute = substitute.replace('elem', str(mesh[0])) substitute = substitute.replace('node', str(mesh[1])) @@ -407,7 +407,7 @@ def substituteLocation(string, mesh, coords): # ----------------------------- def heading(glue,parts): - """joins pieces from parts by glue. second to last entry in pieces tells multiplicity""" + """Joins pieces from parts by glue. second to last entry in pieces tells multiplicity""" header = [] for pieces in parts: if pieces[-2] == 0: @@ -420,7 +420,7 @@ def heading(glue,parts): # ----------------------------- def mapIncremental(label, mapping, N, base, new): """ - applies the function defined by "mapping" + Applies the function defined by "mapping" (can be either 'min','max','avg', 'sum', or user specified) to a list of data @@ -450,20 +450,20 @@ def mapIncremental(label, mapping, N, base, new): # ----------------------------- def OpenPostfile(name,type,nodal = False): - """open postfile with extrapolation mode 'translate'""" + """Open postfile with extrapolation mode 'translate'""" p = {\ 'spectral': MPIEspectral_result,\ 'marc': post_open,\ }[type](name) p.extrapolation({True:'linear',False:'translate'}[nodal]) p.moveto(1) - + return p # ----------------------------- def ParseOutputFormat(filename,what,me): - """parse .output* files in order to get a list of outputs""" + """Parse .output* files in order to get a list of outputs""" content = [] format = {'outputs':{},'specials':{'brothers':[]}} for prefix in ['']+map(str,range(1,17)): @@ -475,9 +475,9 @@ def ParseOutputFormat(filename,what,me): break except: pass - + if content == []: return format # nothing found... - + tag = '' tagID = 0 for line in content: @@ -508,7 +508,7 @@ def ParseOutputFormat(filename,what,me): # ----------------------------- def ParsePostfile(p,filename, outputFormat): """ - parse postfile in order to get position and labels of outputs + Parse postfile in order to get position and labels of outputs needs "outputFormat" for mapping of output names to postfile output indices """ @@ -527,7 +527,7 @@ def ParsePostfile(p,filename, outputFormat): 'LabelOfElementalTensor': [None]*p.element_tensors(), \ } -# --- find labels +# --- find labels for labelIndex in range(stat['NumberOfNodalScalars']): label = p.node_scalar_label(labelIndex) @@ -543,17 +543,17 @@ def ParsePostfile(p,filename, outputFormat): label = p.element_tensor_label(labelIndex) stat['IndexOfLabel'][label] = labelIndex stat['LabelOfElementalTensor'][labelIndex] = label - + if 'User Defined Variable 1' in stat['IndexOfLabel']: # output format without dedicated names? stat['IndexOfLabel']['HomogenizationCount'] = stat['IndexOfLabel']['User Defined Variable 1'] # adjust first named entry - + if 'HomogenizationCount' in stat['IndexOfLabel']: # does the result file contain relevant user defined output at all? startIndex = stat['IndexOfLabel']['HomogenizationCount'] stat['LabelOfElementalScalar'][startIndex] = 'HomogenizationCount' - + # We now have to find a mapping for each output label as defined in the .output* files to the output position in the post file # Since we know where the user defined outputs start ("startIndex"), we can simply assign increasing indices to the labels -# given in the .output* file +# given in the .output* file offset = 1 for (name,N) in outputFormat['Homogenization']['outputs']: @@ -592,10 +592,10 @@ def ParsePostfile(p,filename, outputFormat): try: stat['LabelOfElementalScalar'][startIndex + offset] = label except IndexError: - print 'trying to assign %s at position %i+%i'%(label,startIndex,offset) + print('trying to assign {} at position {}+{}'.format(label,startIndex,offset)) sys.exit(1) offset += 1 - + return stat @@ -614,7 +614,7 @@ def SummarizePostfile(stat,where=sys.stdout,format='marc'): + '\n '.join(stat['LabelOfElementalScalar']) + '\n\n') where.write('elemental tensors:\t%i'%stat['NumberOfElementalTensors'] + '\n\n '\ + '\n '.join(stat['LabelOfElementalTensor']) + '\n\n') - + return True @@ -625,9 +625,9 @@ def SummarizePostfile(stat,where=sys.stdout,format='marc'): # --- input parsing parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Extract data from a .t16 (MSC.Marc) or .spectralOut results file. +Extract data from a .t16 (MSC.Marc) or .spectralOut results file. -List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'. +List of output variables is given by options '--ns','--es','--et','--ho','--cr','--co'. Filters and separations use 'elem','node','ip','grain', and 'x','y','z' as key words. Example: @@ -751,12 +751,12 @@ if options.filetype is None: if ext in fileExtensions[theType]: options.filetype = theType break - + if options.filetype is not None: options.filetype = options.filetype.lower() if options.filetype == 'marc': offset_pos = 1 else: offset_pos = 0 - + # --- more sanity checks @@ -765,8 +765,8 @@ if options.filetype not in ['marc','spectral']: parser.error('file type "%s" not supported...'%options.filetype) if options.filetype == 'marc': - sys.path.append(damask.solver.Marc().libraryPath('../../')) - + sys.path.append(damask.solver.Marc().libraryPath()) + try: from py_post import post_open except: @@ -810,7 +810,7 @@ else: extension = os.path.splitext(files[0])[1] outputFormat = {} -me = { +me = { 'Homogenization': options.homog, 'Crystallite': options.cryst, 'Constitutive': options.phase, @@ -821,9 +821,9 @@ bg.set_message('parsing .output files...') for what in me: outputFormat[what] = ParseOutputFormat(filename, what, me[what]) if '_id' not in outputFormat[what]['specials']: - print "\nsection '%s' not found in <%s>"%(me[what], what) - print '\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers'])) - + print("\nsection '{}' not found in <{}>".format(me[what], what)) + print('\n'.join(map(lambda x:' [%s]'%x, outputFormat[what]['specials']['brothers']))) + bg.set_message('opening result file...') p = OpenPostfile(filename+extension,options.filetype,options.nodal) bg.set_message('parsing result file...') @@ -834,7 +834,7 @@ if options.filetype == 'marc': # --- sanity check for output variables # for mentat variables (nodalScalar,elemScalar,elemTensor) we simply have to check whether the label # is found in the stat[indexOfLabel] dictionary for user defined variables (homogenizationResult, -# crystalliteResult,constitutiveResult) we have to check the corresponding outputFormat, since the +# crystalliteResult,constitutiveResult) we have to check the corresponding outputFormat, since the # namescheme in stat['IndexOfLabel'] is different for opt in ['nodalScalar','elemScalar','elemTensor','homogenizationResult','crystalliteResult','constitutiveResult']: @@ -851,25 +851,25 @@ for opt in ['nodalScalar','elemScalar','elemTensor','homogenizationResult','crys if options.info: if options.filetype == 'marc': - print '\n\nMentat release %s'%damask.solver.Marc().version('../../') + print('\n\nMentat release {}'.format(damask.solver.Marc().version('../../'))) if options.filetype == 'spectral': - print '\n\n',p + print('\n\n{}'.format(p)) SummarizePostfile(stat) - - print '\nUser Defined Outputs' + + print('\nUser Defined Outputs') for what in me: - print '\n ',what,':' + print('\n {}:'.format(what)) for output in outputFormat[what]['outputs']: - print ' ',output - + print(' {}'.format(output)) + sys.exit(0) # --- build connectivity maps elementsOfNode = {} -for e in xrange(stat['NumberOfElements']): +for e in range(stat['NumberOfElements']): if e%1000 == 0: bg.set_message('connect elem %i...'%e) for n in map(p.node_sequence,p.element(e).items): @@ -892,7 +892,7 @@ groupCount = 0 memberCount = 0 if options.nodalScalar: - for n in xrange(stat['NumberOfNodes']): + for n in range(stat['NumberOfNodes']): if n%1000 == 0: bg.set_message('scan node %i...'%n) myNodeID = p.node_id(n) @@ -900,12 +900,12 @@ if options.nodalScalar: myElemID = 0 myIpID = 0 myGrainID = 0 - + # generate an expression that is only true for the locations specified by options.filter filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) if filter != '' and not eval(filter): # for all filter expressions that are not true:... continue # ... ignore this data point and continue with next - + # --- group data locations # generate a unique key for a group of separated data based on the separation criterium for the location grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myNodeCoordinates) @@ -925,9 +925,9 @@ if options.nodalScalar: myNodeCoordinates) # incrementally update average location groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,0]) # append a new list defining each group member memberCount += 1 - + else: - for e in xrange(stat['NumberOfElements']): + for e in range(stat['NumberOfElements']): if e%1000 == 0: bg.set_message('scan elem %i...'%e) myElemID = p.element_id(e) @@ -943,31 +943,31 @@ else: and int(p.element_scalar(e, stat['IndexOfLabel']['GrainCount'])[0].value))\ or 1): myGrainID = g + 1 - + # --- filter valid locations # generates an expression that is only true for the locations specified by options.filter - filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) - if filter != '' and not eval(filter): # for all filter expressions that are not true:... - continue # ... ignore this data point and continue with next - + filter = substituteLocation(options.filter, [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) + if filter != '' and not eval(filter): # for all filter expressions that are not true:... + continue # ... ignore this data point and continue with next + # --- group data locations # generates a unique key for a group of separated data based on the separation criterium for the location - grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) - - if grp not in index: # create a new group if not yet present + grp = substituteLocation('#'.join(options.sep), [myElemID,myNodeID,myIpID,myGrainID], myIpCoordinates[n]) + + if grp not in index: # create a new group if not yet present index[grp] = groupCount - groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location + groups.append([[0,0,0,0,0.0,0.0,0.0]]) # initialize with avg location groupCount += 1 - + groups[index[grp]][0][:4] = mapIncremental('','unique', len(groups[index[grp]])-1, groups[index[grp]][0][:4], - [myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location + [myElemID,myNodeID,myIpID,myGrainID]) # keep only if unique average location groups[index[grp]][0][4:] = mapIncremental('','avg', len(groups[index[grp]])-1, groups[index[grp]][0][4:], - myIpCoordinates[n]) # incrementally update average location - groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member + myIpCoordinates[n]) # incrementally update average location + groups[index[grp]].append([myElemID,myNodeID,myIpID,myGrainID,n]) # append a new list defining each group member memberCount += 1 @@ -996,14 +996,14 @@ if 'none' not in map(str.lower, options.sort): sortKeys = eval('lambda x:(%s)'%(','.join(theKeys))) bg.set_message('sorting groups...') -groups.sort(key = sortKeys) # in-place sorting to save mem +groups.sort(key = sortKeys) # in-place sorting to save mem # --------------------------- create output dir -------------------------------- dirname = os.path.abspath(os.path.join(os.path.dirname(filename),options.dir)) if not os.path.isdir(dirname): - os.mkdir(dirname,0755) + os.mkdir(dirname,0o755) fileOpen = False assembleHeader = True @@ -1049,19 +1049,18 @@ for incCount,position in enumerate(locations): # walk through locations if options.separateFiles: if fileOpen: - file.close() + file.close() # noqa fileOpen = False outFilename = eval('"'+eval("'%%s_inc%%0%ii%%s.txt'%(math.log10(max(increments+[1]))+1)")\ +'"%(dirname + os.sep + options.prefix + os.path.split(filename)[1],increments[incCount],options.suffix)') else: outFilename = '%s.txt'%(dirname + os.sep + options.prefix + os.path.split(filename)[1] + options.suffix) - + if not fileOpen: file = open(outFilename,'w') fileOpen = True file.write('2\theader\n') - file.write(string.replace('$Id$','\n','\\n')+ - '\t' + ' '.join(sys.argv[1:]) + '\n') + file.write(scriptID + '\t' + ' '.join(sys.argv[1:]) + '\n') headerWritten = False file.flush() @@ -1071,15 +1070,15 @@ for incCount,position in enumerate(locations): # walk through locations member = 0 for group in groups: - N = 0 # group member counter - for (e,n,i,g,n_local) in group[1:]: # loop over group members + N = 0 # group member counter + for (e,n,i,g,n_local) in group[1:]: # loop over group members member += 1 if member%1000 == 0: time_delta = ((len(locations)*memberCount)/float(member+incCount*memberCount)-1.0)*(time.time()-time_start) bg.set_message('(%02i:%02i:%02i) processing point %i of %i from increment %i (position %i)...' %(time_delta//3600,time_delta%3600//60,time_delta%60,member,memberCount,increments[incCount],position)) - newby = [] # current member's data + newby = [] # current member's data if options.nodalScalar: for label in options.nodalScalar: @@ -1098,7 +1097,7 @@ for incCount,position in enumerate(locations): # walk through locations if options.elemScalar: for label in options.elemScalar: - if assembleHeader: + if assembleHeader: header += [''.join( label.split() )] newby.append({'label':label, 'len':1, @@ -1106,17 +1105,17 @@ for incCount,position in enumerate(locations): # walk through locations if options.elemTensor: for label in options.elemTensor: - if assembleHeader: + if assembleHeader: header += heading('.',[[''.join( label.split() ),component] for component in ['intensity','t11','t22','t33','t12','t23','t13']]) myTensor = p.element_tensor(p.element_sequence(e),stat['IndexOfLabel'][label])[n_local] newby.append({'label':label, 'len':7, - 'content':[ myTensor.intensity, + 'content':[ myTensor.intensity, myTensor.t11, myTensor.t22, myTensor.t33, myTensor.t12, myTensor.t23, myTensor.t13, ]}) - + if options.homogenizationResult or \ options.crystalliteResult or \ options.constitutiveResult: @@ -1127,7 +1126,7 @@ for incCount,position in enumerate(locations): # walk through locations ['Crystallite']*len(options.crystalliteResult) + ['Constitutive']*len(options.constitutiveResult) ): - outputIndex = list(zip(*outputFormat[resultType]['outputs'])[0]).index(label) # find the position of this output in the outputFormat + outputIndex = list(zip(*outputFormat[resultType]['outputs'])[0]).index(label) # find the position of this output in the outputFormat length = int(outputFormat[resultType]['outputs'][outputIndex][1]) thisHead = heading('_',[[component,''.join( label.split() )] for component in range(int(length>1),length+int(length>1))]) if assembleHeader: header += thisHead @@ -1136,16 +1135,16 @@ for incCount,position in enumerate(locations): # walk through locations try: newby.append({'label':label, 'len':length, - 'content':[ p.element_scalar(p.element_sequence(e),stat['IndexOfLabel'][head])[n_local].value + 'content':[ p.element_scalar(p.element_sequence(e),stat['IndexOfLabel'][head])[n_local].value for head in thisHead ]}) except KeyError: - print '\nDAMASK outputs seem missing from "post" section of the *.dat file!' + print('\nDAMASK outputs seem missing from "post" section of the *.dat file!') sys.exit() assembleHeader = False if N == 0: - mappedResult = [float(x) for x in xrange(len(header))] # initialize with debug data (should get deleted by *N at N=0) + mappedResult = [float(x) for x in range(len(header))] # init with debug data (should get deleted by *N at N=0) pos = 0 for chunk in newby: @@ -1166,7 +1165,7 @@ for incCount,position in enumerate(locations): # walk through locations group[0] + \ mappedResult) ) + '\n') - + if fileOpen: file.close() diff --git a/processing/post/reLabel.py b/processing/post/reLabel.py index b704a2ee5..753e1bc1e 100755 --- a/processing/post/reLabel.py +++ b/processing/post/reLabel.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,re @@ -67,7 +67,7 @@ for name in filenames: if index == -1: remarks.append('label "{}" not present...'.format(options.label[i])) else: m = pattern[dimensions[i]>1].match(table.tags[index]) # isolate label name - for j in xrange(dimensions[i]): + for j in range(dimensions[i]): table.tags[index+j] = table.tags[index+j].replace(m.group(2),options.substitute[i]) # replace name with substitute if remarks != []: damask.util.croak(remarks) diff --git a/processing/post/rotateData.py b/processing/post/rotateData.py index 32eaaad13..08958cc86 100755 --- a/processing/post/rotateData.py +++ b/processing/post/rotateData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/post/scaleData.py b/processing/post/scaleData.py index 18883eb0b..d33efa268 100755 --- a/processing/post/scaleData.py +++ b/processing/post/scaleData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/shiftData.py b/processing/post/shiftData.py index 4052d83d9..cac0e54f0 100755 --- a/processing/post/shiftData.py +++ b/processing/post/shiftData.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/showTable.py b/processing/post/showTable.py index c65b4519f..918256af9 100755 --- a/processing/post/showTable.py +++ b/processing/post/showTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os diff --git a/processing/post/sortTable.py b/processing/post/sortTable.py index f1298af86..92fa81672 100755 --- a/processing/post/sortTable.py +++ b/processing/post/sortTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/post/vtk2ang.py b/processing/post/vtk2ang.py index bc8e23097..6da07bc02 100755 --- a/processing/post/vtk2ang.py +++ b/processing/post/vtk2ang.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,string,math,sys @@ -12,7 +12,7 @@ scriptID = ' '.join([scriptName,damask.version]) # ----------------------------- def getHeader(filename,sizeFastIndex,sizeSlowIndex,stepsize): - """returns header for ang file step size in micrometer""" + """Returns header for ang file step size in micrometer""" return '\n'.join([ \ '# TEM_PIXperUM 1.000000', \ '# x-star 1.000000', \ @@ -48,7 +48,7 @@ def getHeader(filename,sizeFastIndex,sizeSlowIndex,stepsize): # ----------------------------- def positiveRadians(angle): - """returns positive angle in radians from angle in degrees""" + """Returns positive angle in radians from angle in degrees""" angle = math.radians(float(angle)) while angle < 0.0: angle += 2.0 * math.pi @@ -59,9 +59,9 @@ def positiveRadians(angle): # ----------------------------- def getDataLine(angles,x,y,validData=True): """ - returns string of one line in ang file + Returns string of one line in ang file. - convention in ang file: y coordinate comes first and is fastest index + Convention in ang file: y coordinate comes first and is fastest index positions in micrometer """ info = {True: (9999.9, 1.0, 0,99999,0.0), @@ -295,13 +295,13 @@ for filename in filenames: if options.verbose: sys.stdout.write("\nGENERATING POINTS FOR POINT GRID") points = vtk.vtkPoints() - for k in xrange(Npoints[2]): - for j in xrange(Npoints[0]): - for i in xrange(Npoints[1]): # y is fastest index + for k in range(Npoints[2]): + for j in range(Npoints[0]): + for i in range(Npoints[1]): # y is fastest index rotatedpoint = np.array([rotatedbox[0][0] + (float(j) + 0.5) * options.resolution, rotatedbox[1][0] + (float(i) + 0.5) * options.resolution, - rotatedbox[2][0] + (float(k) + 0.5) * options.distance ]) # point in rotated system - point = np.dot(R.T,rotatedpoint) # point in mesh system + rotatedbox[2][0] + (float(k) + 0.5) * options.distance ]) # point in rotated system + point = np.dot(R.T,rotatedpoint) # point in mesh system points.InsertNextPoint(list(point)) if options.verbose: sys.stdout.write("\rGENERATING POINTS FOR POINT GRID %d%%" %(100*(Npoints[1]*(k*Npoints[0]+j)+i+1)/totalNpoints)) @@ -315,7 +315,7 @@ for filename in filenames: if options.verbose: sys.stdout.write("\nGENERATING VERTICES FOR POINT GRID") vertices = vtk.vtkCellArray() - for i in xrange(totalNpoints): + for i in range(totalNpoints): vertex = vtk.vtkVertex() vertex.GetPointIds().SetId(0,i) # each vertex consists of exactly one (index 0) point with ID "i" vertices.InsertNextCell(vertex) @@ -378,7 +378,7 @@ for filename in filenames: with open(angfilename,'w') as angfile: if options.verbose: sys.stdout.write(" %s\n"%angfilename) angfile.write(getHeader(filename,Npoints[1],Npoints[0],options.resolution*options.scale)) - for i in xrange(sliceN*NpointsPerSlice,(sliceN+1)*NpointsPerSlice): # Iterate over points on slice + for i in range(sliceN*NpointsPerSlice,(sliceN+1)*NpointsPerSlice): # Iterate over points on slice # Get euler angles of closest IDs diff --git a/processing/post/vtk_addPointcloudData.py b/processing/post/vtk_addPointcloudData.py index 3590a436e..bc76c7e72 100755 --- a/processing/post/vtk_addPointcloudData.py +++ b/processing/post/vtk_addPointcloudData.py @@ -1,10 +1,11 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,vtk import damask from collections import defaultdict from optparse import OptionParser +from vtk.util import numpy_support scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -13,10 +14,10 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN # -------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add scalar and RGB tuples from ASCIItable to existing VTK point cloud (.vtp). - -""", version = scriptID) +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description = """Add scalar and RGB tuples from ASCIItable to existing VTK point cloud (.vtp).""", + version = scriptID) parser.add_option( '--vtk', dest = 'vtk', @@ -30,19 +31,20 @@ parser.add_option('-r', '--render', dest = 'render', action = 'store_true', help = 'open output in VTK render window') -parser.add_option('-s', '--scalar', dest='scalar', action='extend', - metavar ='', - help = 'scalar values') -parser.add_option('-v', '--vector', - dest = 'vector', +parser.add_option('-d', '--data', + dest = 'data', action = 'extend', metavar = '', - help = 'vector value label(s)') + help = 'scalar/vector value(s) label(s)') +parser.add_option('-t', '--tensor', + dest = 'tensor', + action = 'extend', metavar = '', + help = 'tensor (3x3) value label(s)') parser.add_option('-c', '--color', dest='color', action='extend', metavar ='', help = 'RGB color tuples') -parser.set_defaults(scalar = [], - vector = [], +parser.set_defaults(data = [], + tensor = [], color = [], inplace = False, render = False, @@ -94,59 +96,60 @@ for name in filenames: errors = [] VTKarray = {} active = defaultdict(list) - - for datatype,dimension,label in [['scalar',1,options.scalar], - ['vector',3,options.vector], - ['color',3,options.color], + + for datatype,dimension,label in [['data',99,options.data], + ['tensor',9,options.tensor], + ['color' ,3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): me = label[i] - if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) - elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) + if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) + elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) else: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector']: VTKarray[me] = vtk.vtkDoubleArray() - elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() - - VTKarray[me].SetNumberOfComponents(dimension) - VTKarray[me].SetName(label[i]) - if remarks != []: damask.util.croak(remarks) if errors != []: damask.util.croak(errors) table.close(dismiss = True) continue -# ------------------------------------------ process data --------------------------------------- +# --------------------------------------- process and add data ----------------------------------- - while table.data_read(): # read next data line of ASCII table - - for datatype,labels in active.items(): # loop over scalar,color - for me in labels: # loop over all requested items - theData = [table.data[i] for i in table.label_indexrange(me)] # read strings - if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) - elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) + table.data_readArray([item for sublist in active.values() for item in sublist]) # read all requested data - table.input_close() # close input ASCII table + for datatype,labels in active.items(): # loop over scalar,color + for me in labels: # loop over all requested items + VTKtype = vtk.VTK_DOUBLE + VTKdata = table.data[:, table.label_indexrange(me)].copy() # copy to force contiguous layout -# ------------------------------------------ add data --------------------------------------- + if datatype == 'color': + VTKtype = vtk.VTK_UNSIGNED_CHAR + VTKdata = (VTKdata*255).astype(int) # translate to 0..255 UCHAR + elif datatype == 'tensor': + VTKdata[:,1] = VTKdata[:,3] = 0.5*(VTKdata[:,1]+VTKdata[:,3]) + VTKdata[:,2] = VTKdata[:,6] = 0.5*(VTKdata[:,2]+VTKdata[:,6]) + VTKdata[:,5] = VTKdata[:,7] = 0.5*(VTKdata[:,5]+VTKdata[:,7]) - for datatype,labels in active.items(): # loop over scalar,color - if datatype == 'color': - Polydata.GetPointData().SetScalars(VTKarray[active['color'][0]]) - Polydata.GetCellData().SetScalars(VTKarray[active['color'][0]]) - for me in labels: # loop over all requested items - Polydata.GetPointData().AddArray(VTKarray[me]) - Polydata.GetCellData().AddArray(VTKarray[me]) + VTKarray[me] = numpy_support.numpy_to_vtk(num_array=VTKdata,deep=True,array_type=VTKtype) + VTKarray[me].SetName(me) + + if datatype == 'color': + Polydata.GetPointData().SetScalars(VTKarray[me]) + Polydata.GetCellData().SetScalars(VTKarray[me]) + else: + Polydata.GetPointData().AddArray(VTKarray[me]) + Polydata.GetCellData().AddArray(VTKarray[me]) + + + table.input_close() # close input ASCII table + +# ------------------------------------------ output result --------------------------------------- Polydata.Modified() if vtk.VTK_MAJOR_VERSION <= 5: Polydata.Update() -# ------------------------------------------ output result --------------------------------------- - writer = vtk.vtkXMLPolyDataWriter() writer.SetDataModeToBinary() writer.SetCompressorTypeToZLib() @@ -155,7 +158,7 @@ for name in filenames: else: writer.SetInputData(Polydata) writer.Write() -# ------------------------------------------ render result --------------------------------------- +# ------------------------------------------ render result --------------------------------------- if options.render: mapper = vtk.vtkDataSetMapper() @@ -164,7 +167,7 @@ if options.render: actor.SetMapper(mapper) # Create the graphics structure. The renderer renders into the -# render window. The render window interactor captures mouse events +# render window. The render window interactively captures mouse events # and will perform appropriate camera or actor manipulation # depending on the nature of the events. @@ -179,7 +182,7 @@ if options.render: iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) - + iren.Initialize() renWin.Render() iren.Start() diff --git a/processing/post/vtk_addRectilinearGridData.py b/processing/post/vtk_addRectilinearGridData.py index 76eed6aec..4c068b19d 100755 --- a/processing/post/vtk_addRectilinearGridData.py +++ b/processing/post/vtk_addRectilinearGridData.py @@ -1,8 +1,9 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,vtk import damask +from vtk.util import numpy_support from collections import defaultdict from optparse import OptionParser @@ -13,10 +14,12 @@ scriptID = ' '.join([scriptName,damask.version]) # MAIN # -------------------------------------------------------------------- -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Add scalars, vectors, and/or an RGB tuple from an ASCIItable to existing VTK rectilinear grid (.vtr/.vtk). - -""", version = scriptID) +msg = "Add scalars, vectors, and/or an RGB tuple from" +msg += "an ASCIItable to existing VTK rectilinear grid (.vtr/.vtk)." +parser = OptionParser(option_class=damask.extendableOption, + usage='%prog options [file[s]]', + description = msg, + version = scriptID) parser.add_option( '--vtk', dest = 'vtk', @@ -30,21 +33,21 @@ parser.add_option('-r', '--render', dest = 'render', action = 'store_true', help = 'open output in VTK render window') -parser.add_option('-s', '--scalar', - dest = 'scalar', +parser.add_option('-d', '--data', + dest = 'data', action = 'extend', metavar = '', - help = 'scalar value label(s)') -parser.add_option('-v', '--vector', - dest = 'vector', + help = 'scalar/vector value(s) label(s)') +parser.add_option('-t', '--tensor', + dest = 'tensor', action = 'extend', metavar = '', - help = 'vector value label(s)') + help = 'tensor (3x3) value label(s)') parser.add_option('-c', '--color', dest = 'color', action = 'extend', metavar = '', help = 'RGB color tuple label') -parser.set_defaults(scalar = [], - vector = [], +parser.set_defaults(data = [], + tensor = [], color = [], inplace = False, render = False, @@ -92,51 +95,51 @@ for name in filenames: errors = [] VTKarray = {} active = defaultdict(list) - - for datatype,dimension,label in [['scalar',1,options.scalar], - ['vector',3,options.vector], - ['color',3,options.color], + + for datatype,dimension,label in [['data',99,options.data], + ['tensor',9,options.tensor], + ['color' ,3,options.color], ]: for i,dim in enumerate(table.label_dimension(label)): me = label[i] - if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) + if dim == -1: remarks.append('{} "{}" not found...'.format(datatype,me)) elif dim > dimension: remarks.append('"{}" not of dimension {}...'.format(me,dimension)) else: remarks.append('adding {} "{}"...'.format(datatype,me)) active[datatype].append(me) - if datatype in ['scalar','vector']: VTKarray[me] = vtk.vtkDoubleArray() - elif datatype == 'color': VTKarray[me] = vtk.vtkUnsignedCharArray() - - VTKarray[me].SetNumberOfComponents(dimension) - VTKarray[me].SetName(label[i]) - if remarks != []: damask.util.croak(remarks) if errors != []: damask.util.croak(errors) table.close(dismiss = True) continue -# ------------------------------------------ process data --------------------------------------- +# ------------------------------------------ process data --------------------------------------- - datacount = 0 + table.data_readArray([item for sublist in active.values() for item in sublist]) # read all requested data - while table.data_read(): # read next data line of ASCII table + for datatype,labels in active.items(): # loop over scalar,color + for me in labels: # loop over all requested items + VTKtype = vtk.VTK_DOUBLE + VTKdata = table.data[:, table.label_indexrange(me)].copy() # copy to force contiguous layout - datacount += 1 # count data lines - for datatype,labels in active.items(): # loop over scalar,color - for me in labels: # loop over all requested items - theData = [table.data[i] for i in table.label_indexrange(me)] # read strings - if datatype == 'color': VTKarray[me].InsertNextTuple3(*map(lambda x: int(255.*float(x)),theData)) - elif datatype == 'vector': VTKarray[me].InsertNextTuple3(*map(float,theData)) - elif datatype == 'scalar': VTKarray[me].InsertNextValue(float(theData[0])) + if datatype == 'color': + VTKtype = vtk.VTK_UNSIGNED_CHAR + VTKdata = (VTKdata*255).astype(int) # translate to 0..255 UCHAR + elif datatype == 'tensor': + VTKdata[:,1] = VTKdata[:,3] = 0.5*(VTKdata[:,1]+VTKdata[:,3]) + VTKdata[:,2] = VTKdata[:,6] = 0.5*(VTKdata[:,2]+VTKdata[:,6]) + VTKdata[:,5] = VTKdata[:,7] = 0.5*(VTKdata[:,5]+VTKdata[:,7]) + + VTKarray[me] = numpy_support.numpy_to_vtk(num_array=VTKdata,deep=True,array_type=VTKtype) + VTKarray[me].SetName(me) table.close() # close input ASCII table -# ------------------------------------------ add data --------------------------------------- +# ------------------------------------------ add data --------------------------------------- - if datacount == Npoints: mode = 'point' - elif datacount == Ncells: mode = 'cell' + if len(table.data) == Npoints: mode = 'point' + elif len(table.data) == Ncells: mode = 'cell' else: damask.util.croak('Data count is incompatible with grid...') continue @@ -154,7 +157,7 @@ for name in filenames: rGrid.Modified() if vtk.VTK_MAJOR_VERSION <= 5: rGrid.Update() -# ------------------------------------------ output result --------------------------------------- +# ------------------------------------------ output result --------------------------------------- writer = vtk.vtkXMLRectilinearGridWriter() writer.SetDataModeToBinary() @@ -164,7 +167,7 @@ for name in filenames: else: writer.SetInputData(rGrid) writer.Write() -# ------------------------------------------ render result --------------------------------------- +# ------------------------------------------ render result --------------------------------------- if options.render: mapper = vtk.vtkDataSetMapper() @@ -188,7 +191,7 @@ if options.render: iren = vtk.vtkRenderWindowInteractor() iren.SetRenderWindow(renWin) - + iren.Initialize() renWin.Render() iren.Start() diff --git a/processing/post/vtk_pointcloud.py b/processing/post/vtk_pointcloud.py index 995f5a216..5779b7540 100755 --- a/processing/post/vtk_pointcloud.py +++ b/processing/post/vtk_pointcloud.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,vtk @@ -34,10 +34,9 @@ parser.set_defaults(pos = 'pos', if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False, - readonly = True) + try: table = damask.ASCIItable(name = name, + buffered = False, + readonly = True) except: continue damask.util.report(scriptName,name) diff --git a/processing/post/vtk_rectilinearGrid.py b/processing/post/vtk_rectilinearGrid.py index 32ea2c11c..cc6c01711 100755 --- a/processing/post/vtk_rectilinearGrid.py +++ b/processing/post/vtk_rectilinearGrid.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,vtk @@ -76,12 +76,12 @@ for name in filenames: np.zeros((table.data.shape[0], 3-table.data.shape[1]),dtype='f'))) # fill coords up to 3D with zeros - coords = [np.unique(table.data[:,i]) for i in xrange(3)] + coords = [np.unique(table.data[:,i]) for i in range(3)] if options.mode == 'cell': - coords = [0.5 * np.array([3.0 * coords[i][0] - coords[i][0 + len(coords[i]) > 1]] + \ - [coords[i][j-1] + coords[i][j] for j in xrange(1,len(coords[i]))] + \ - [3.0 * coords[i][-1] - coords[i][-1 - (len(coords[i]) > 1)]]) for i in xrange(3)] + coords = [0.5 * np.array([3.0 * coords[i][0] - coords[i][0 + int(len(coords[i]) > 1)]] + \ + [coords[i][j-1] + coords[i][j] for j in range(1,len(coords[i]))] + \ + [3.0 * coords[i][-1] - coords[i][-1 - int(len(coords[i]) > 1)]]) for i in range(3)] grid = np.array(map(len,coords),'i') N = grid.prod() if options.mode == 'point' else (grid-1).prod() diff --git a/processing/pre/OIMlinear2linearODF.py b/processing/pre/OIMlinear2linearODF.py deleted file mode 100755 index cbcbcc7ec..000000000 --- a/processing/pre/OIMlinear2linearODF.py +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env python2 -# -*- coding: UTF-8 no BOM -*- - -import os,sys -from optparse import OptionParser -import numpy as np -import damask - -scriptName = os.path.splitext(os.path.basename(__file__))[0] -scriptID = ' '.join([scriptName,damask.version]) - -sampleSym = { 'Orthotropic' : (90,90,90), - 'Triclinic' : (360,180,360) - } - -# -------------------------------------------------------------------- -# MAIN -# -------------------------------------------------------------------- - -parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [file[s]]', description = """ -Transform the binned texture data from "TSL OIM Analysis" into linear ODF data, - -""", version = scriptID) - -parser.add_option('-s', '--symmetry', dest='symmetry', choices=sampleSym.keys(), - metavar = 'string', - help='Sample symmetry {%s} [Triclinic]'%(' '.join(sampleSym.keys()))) - -parser.set_defaults(symmetry = 'Triclinic') - -(options,filenames) = parser.parse_args() - -#--- setup file handles --------------------------------------------------------------------------- -files = [] -if filenames == []: - files.append({'name':'STDIN', - 'input':sys.stdin, - 'output':sys.stdout, - 'croak':sys.stderr, - }) -else: - for name in filenames: - if os.path.exists(name): - files.append({'name':name, - 'input':open(name), - 'output':open(name+'_tmp','w'), - 'croak':sys.stdout, - }) - -#--- loop over input files ------------------------------------------------------------------------ -for file in files: - file['croak'].write('\033[1m' + scriptName + '\033[0m: ' + (file['name'] if file['name'] != 'STDIN' else '') + '\n') - - while True: # read header (forward and get bin Size) - line = file['input'].readline() - words = line.split() - if len(words)>=3: - if words[1]=='Bin' and words[2]=='Size:': binSize=float(words[3][:-1]) - if not line.startswith('#'): break - - delta = [sampleSym[options.symmetry][i]/binSize for i in xrange(3)] - - nPhi1,nPHI,nPhi2 = map(int,delta) - dPhi1,dPHI,dPhi2 = [sampleSym[options.symmetry][i]/delta[i] for i in xrange(3)] - - N = (nPhi1-1)*(nPHI-1)*(nPhi2-1) - - - ODF = [[[[None] for k in range(nPhi2)] for j in range(nPHI)] for i in range(nPhi1)] - linear = [None]*N - - ODF = np.empty([nPhi1,nPHI,nPhi2],'d') - - for iPhi1 in range(nPhi1): - for iPHI in range(nPHI): - for iPhi2 in range(nPhi2): - ODF[iPhi1,iPHI,iPhi2] = float(line.split()[3])*0.125 # extract intensity (in column 4) and weight by 1/8 - line = file['input'].readline() - - for iPhi1 in range(nPhi1-1): - for iPHI in range(nPHI-1): - for iPhi2 in range(nPhi2-1): - linear[iPhi1*(nPHI-1)*(nPhi2-1)+iPHI*(nPhi2-1)+iPhi2] =\ - ODF[iPhi1 ,iPHI ,iPhi2 ] +\ - ODF[iPhi1 ,iPHI ,iPhi2+1] +\ - ODF[iPhi1 ,iPHI+1,iPhi2 ] +\ - ODF[iPhi1 ,iPHI+1,iPhi2+1] +\ - ODF[iPhi1+1,iPHI ,iPhi2 ] +\ - ODF[iPhi1+1,iPHI ,iPhi2+1] +\ - ODF[iPhi1+1,iPHI+1,iPhi2 ] +\ - ODF[iPhi1+1,iPHI+1,iPhi2+1] - - - file['output'].write('4 header\n') - file['output'].write('limit phi1 %-6.2f Phi %-6.2f phi2 %-6.2f\n'%sampleSym[options.symmetry]) - file['output'].write('delta phi1 %-6.2f Phi %-6.2f phi2 %-6.2f\n'%(dPhi1,dPHI,dPhi2)) - file['output'].write('centration cell-centered\n') - file['output'].write('density\n') - - for i in range(N): - file['output'].write('%g\n'%(linear[i])) - -#--- output finalization -------------------------------------------------------------------------- - if file['name'] != 'STDIN': - file['output'].close() - os.rename(file['name']+'_tmp',os.path.splitext(file['name'])[0] +'.linearODF') diff --git a/processing/pre/abq_addUserOutput.py b/processing/pre/abq_addUserOutput.py index 4528537d9..6df80ee82 100755 --- a/processing/pre/abq_addUserOutput.py +++ b/processing/pre/abq_addUserOutput.py @@ -1,9 +1,9 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os,re from optparse import OptionParser -import damask +import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) @@ -14,13 +14,13 @@ def ParseOutputFormat(filename,what,me): outputmetafile = filename+'.output'+what try: - file = open(outputmetafile) + myFile = open(outputmetafile) except: print('Could not open file %s'%outputmetafile) raise else: - content = file.readlines() - file.close() + content = myFile.readlines() + myFile.close() tag = '' tagID = 0 @@ -51,7 +51,7 @@ def ParseOutputFormat(filename,what,me): parser = OptionParser(option_class=damask.extendableOption, usage='%prog [option(s)] Abaqus.Inputfile(s)', description = """ Transfer the output variables requested in the material.config to -properly labelled user defined variables within the Abaqus input file (*.inp). +properly labelled user-defined variables within the Abaqus input file (*.inp). Requires the files .output @@ -60,7 +60,7 @@ that are written during the first run of the model. Specify which user block format you want to apply by stating the homogenization, crystallite, and phase identifiers. Or have an existing set of user variables copied over from another *.inp file. -""", version= scriptID) +""", version = scriptID) parser.add_option('-m', dest='number', type='int', metavar = 'int', help='maximum requested User Defined Variable [%default]') @@ -84,7 +84,7 @@ parser.set_defaults(number = 0, (options, files) = parser.parse_args() if not files: - parser.error('no file(s) specified...') + parser.error('no file(s) specified.') me = { 'Homogenization': options.homog, 'Crystallite': options.cryst, @@ -92,18 +92,18 @@ me = { 'Homogenization': options.homog, } -for file in files: - print '\033[1m'+scriptName+'\033[0m: '+file+'\n' - if options.useFile: +for myFile in files: + damask.util.report(scriptName,myFile) + if options.useFile is not None: formatFile = os.path.splitext(options.useFile)[0] else: - formatFile = os.path.splitext(file)[0] - file = os.path.splitext(file)[0]+'.inp' - if not os.path.lexists(file): - print file,'not found' + formatFile = os.path.splitext(myFile)[0] + myFile = os.path.splitext(myFile)[0]+'.inp' + if not os.path.lexists(myFile): + print('{} not found'.format(myFile)) continue - print('Scanning format files of: %s'%formatFile) + print('Scanning format files of: {}'.format(formatFile)) if options.number < 1: outputFormat = {} @@ -111,8 +111,8 @@ for file in files: for what in me: outputFormat[what] = ParseOutputFormat(formatFile,what,me[what]) if '_id' not in outputFormat[what]['specials']: - print "'%s' not found in <%s>"%(me[what],what) - print '\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers'])) + print("'{}' not found in <{}>".format(me[what],what)) + print('\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers']))) sys.exit(1) UserVars = ['HomogenizationCount'] @@ -140,13 +140,13 @@ for file in files: UserVars += ['%i_%s'%(grain+1,var[0]) for i in range(var[1])] # Now change *.inp file(s) - print('Adding labels to: %s'%file) - inFile = open(file) + print('Adding labels to: {}'.format(myFile)) + inFile = open(myFile) input = inFile.readlines() inFile.close() - output = open(file,'w') + output = open(myFile,'w') thisSection = '' - if options.damaskOption: + if options.damaskOption is not None: output.write('$damask {0}\n'.format(options.damaskOption)) for line in input: #Abaqus keyword line begins with: *keyword, argument1, ... @@ -154,11 +154,11 @@ for file in files: if m: lastSection = thisSection thisSection = m.group(1) - if (lastSection.upper() == '*DEPVAR' and thisSection.upper() == '*USER'): #Abaqus keyword can be upper or lower case + if (lastSection.upper() == '*DEPVAR' and thisSection.upper() == '*USER'): # Abaqus keyword can be upper or lower case if options.number > 0: - output.write('%i\n'%options.number) #Abaqus needs total number of SDVs in the line after *Depvar keyword + output.write('{}\n'.format(options.number)) # Abaqus needs total number of SDVs in the line after *Depvar keyword else: - output.write('%i\n'%len(UserVars)) + output.write('{}\n'.format(len(UserVars))) for i in range(len(UserVars)): output.write('%i,"%i%s","%i%s"\n'%(i+1,0,UserVars[i],0,UserVars[i])) #index,output variable key,output variable description diff --git a/processing/pre/geom_addPrimitive.py b/processing/pre/geom_addPrimitive.py index 8976a9e3d..8d934368f 100755 --- a/processing/pre/geom_addPrimitive.py +++ b/processing/pre/geom_addPrimitive.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -82,7 +82,7 @@ for name in filenames: table.head_read() info,extra_header = table.head_getGeom() - + damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))), 'size x y z: %s'%(' x '.join(map(str,info['size']))), 'origin x y z: %s'%(' : '.join(map(str,info['origin']))), @@ -126,9 +126,9 @@ for name in filenames: primPos = invRotation*gridpos # rotate back to primitive coordinate system if np.dot(mask*primPos/dim,mask*primPos/dim) <= 0.25 and \ np.all(abs((1.-mask)*primPos/dim) <= 0.5): # inside ellipsoid and inside box - microstructure[(gridpos[0]+options.center[0])%info['grid'][0], - (gridpos[1]+options.center[1])%info['grid'][1], - (gridpos[2]+options.center[2])%info['grid'][2]] = options.fill # assign microstructure index + microstructure[int((gridpos[0]+options.center[0])%info['grid'][0]), + int((gridpos[1]+options.center[1])%info['grid'][1]), + int((gridpos[2]+options.center[2])%info['grid'][2])] = options.fill # assign microstructure index newInfo['microstructures'] = microstructure.max() @@ -153,7 +153,7 @@ for name in filenames: table.labels_clear() table.head_write() table.output_flush() - + # --- write microstructure information ------------------------------------------------------------ formatwidth = int(math.floor(math.log10(microstructure.max())+1)) diff --git a/processing/pre/geom_canvas.py b/processing/pre/geom_canvas.py index 4b482d641..427ab8cad 100755 --- a/processing/pre/geom_canvas.py +++ b/processing/pre/geom_canvas.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -93,12 +93,12 @@ for name in filenames: microstructure_cropped = np.zeros(newInfo['grid'],datatype) microstructure_cropped.fill(options.fill if options.real or options.fill > 0 else microstructure.max()+1) - xindex = list(set(xrange(options.offset[0],options.offset[0]+newInfo['grid'][0])) & \ - set(xrange(info['grid'][0]))) - yindex = list(set(xrange(options.offset[1],options.offset[1]+newInfo['grid'][1])) & \ - set(xrange(info['grid'][1]))) - zindex = list(set(xrange(options.offset[2],options.offset[2]+newInfo['grid'][2])) & \ - set(xrange(info['grid'][2]))) + xindex = list(set(range(options.offset[0],options.offset[0]+newInfo['grid'][0])) & \ + set(range(info['grid'][0]))) + yindex = list(set(range(options.offset[1],options.offset[1]+newInfo['grid'][1])) & \ + set(range(info['grid'][1]))) + zindex = list(set(range(options.offset[2],options.offset[2]+newInfo['grid'][2])) & \ + set(range(info['grid'][2]))) translate_x = [i - options.offset[0] for i in xindex] translate_y = [i - options.offset[1] for i in yindex] translate_z = [i - options.offset[2] for i in zindex] diff --git a/processing/pre/geom_check.sh b/processing/pre/geom_check.sh index 1eb85913c..4342f93e6 100755 --- a/processing/pre/geom_check.sh +++ b/processing/pre/geom_check.sh @@ -1,17 +1,24 @@ #!/usr/bin/env bash +if [[ "$1" == "-f" || "$1" == "--float" ]]; then + shift + arg='--float' +else + arg='' +fi + for geom in "$@" do - geom_toTable \ + geom_toTable $arg \ < $geom \ | \ vtk_rectilinearGrid > ${geom%.*}.vtk - geom_toTable \ + geom_toTable $arg \ < $geom \ | \ vtk_addRectilinearGridData \ - --scalar microstructure \ + --data microstructure \ --inplace \ --vtk ${geom%.*}.vtk rm ${geom%.*}.vtk diff --git a/processing/pre/geom_clean.py b/processing/pre/geom_clean.py index 1409a1366..408178c32 100755 --- a/processing/pre/geom_clean.py +++ b/processing/pre/geom_clean.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -11,7 +11,7 @@ scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) def mostFrequent(arr): - return np.argmax(np.bincount(arr)) + return np.argmax(np.bincount(arr.astype('int'))) #-------------------------------------------------------------------------------------------------- @@ -72,7 +72,13 @@ for name in filenames: # --- do work ------------------------------------------------------------------------------------ - microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,size=(options.stencil,)*3) + microstructure = ndimage.filters.generic_filter(microstructure,mostFrequent,size=(options.stencil,)*3).astype('int_') + newInfo = {'microstructures': microstructure.max()} + +# --- report --------------------------------------------------------------------------------------- + if ( newInfo['microstructures'] != info['microstructures']): + damask.util.croak('--> microstructures: %i'%newInfo['microstructures']) + info['microstructures'] == newInfo['microstructures'] # --- write header --------------------------------------------------------------------------------- diff --git a/processing/pre/geom_fromMinimalSurface.py b/processing/pre/geom_fromMinimalSurface.py index 1c4fc2eaa..22ab2f53d 100755 --- a/processing/pre/geom_fromMinimalSurface.py +++ b/processing/pre/geom_fromMinimalSurface.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -125,10 +125,10 @@ for name in filenames: Y = options.periods*2.0*math.pi*(np.arange(options.grid[1])+0.5)/options.grid[1] Z = options.periods*2.0*math.pi*(np.arange(options.grid[2])+0.5)/options.grid[2] - for z in xrange(options.grid[2]): - for y in xrange(options.grid[1]): + for z in range(options.grid[2]): + for y in range(options.grid[1]): table.data_clear() - for x in xrange(options.grid[0]): + for x in range(options.grid[0]): table.data_append(options.microstructure[options.threshold < surface[options.type](X[x],Y[y],Z[z])]) table.data_write() diff --git a/processing/pre/geom_fromOsteonGeometry.py b/processing/pre/geom_fromOsteonGeometry.py index 9a24b3e2d..716a43615 100755 --- a/processing/pre/geom_fromOsteonGeometry.py +++ b/processing/pre/geom_fromOsteonGeometry.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -105,8 +105,8 @@ microstructure = np.where(radius < float(options.canal),1,0) + np.where(radius > alphaOfGrain = np.zeros(info['grid'][0]*info['grid'][1],'d') betaOfGrain = np.zeros(info['grid'][0]*info['grid'][1],'d') -for y in xrange(info['grid'][1]): - for x in xrange(info['grid'][0]): +for y in range(info['grid'][1]): + for x in range(info['grid'][0]): if microstructure[y,x] == 0: microstructure[y,x] = info['microstructures'] alphaOfGrain[info['microstructures']] = alpha[y,x] @@ -129,7 +129,7 @@ header.append('(constituent)\tphase 1\ttexture 1\tfraction 1.0') header.append('[interstitial]') header.append('crystallite %i'%options.crystallite) header.append('(constituent)\tphase 2\ttexture 2\tfraction 1.0') -for i in xrange(3,info['microstructures']): +for i in range(3,info['microstructures']): header.append('[Grain%s]'%(str(i).zfill(formatwidth))) header.append('crystallite %i'%options.crystallite) header.append('(constituent)\tphase 3\ttexture %s\tfraction 1.0'%(str(i).rjust(formatwidth))) @@ -137,7 +137,7 @@ for i in xrange(3,info['microstructures']): header.append('') header.append('[canal]') header.append('[interstitial]') -for i in xrange(3,info['microstructures']): +for i in range(3,info['microstructures']): header.append('[Grain%s]'%(str(i).zfill(formatwidth))) header.append('(gauss)\tphi1 %g\tPhi %g\tphi2 0\tscatter 0.0\tfraction 1.0'\ %(alphaOfGrain[i],betaOfGrain[i])) diff --git a/processing/pre/geom_fromTable.py b/processing/pre/geom_fromTable.py index 91b4c2670..9af92888d 100755 --- a/processing/pre/geom_fromTable.py +++ b/processing/pre/geom_fromTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math,types,time @@ -163,7 +163,7 @@ for name in filenames: # --------------- figure out size and grid --------------------------------------------------------- - coords = [np.unique(table.data[:,i]) for i in xrange(3)] + coords = [np.unique(table.data[:,i]) for i in range(3)] mincorner = np.array(map(min,coords)) maxcorner = np.array(map(max,coords)) grid = np.array(map(len,coords),'i') @@ -217,9 +217,9 @@ for name in filenames: tick = time.clock() if options.verbose: bg.set_message('assigning grain IDs...') - for z in xrange(grid[2]): - for y in xrange(grid[1]): - for x in xrange(grid[0]): + for z in range(grid[2]): + for y in range(grid[1]): + for x in range(grid[0]): if (myPos+1)%(N/500.) < 1: time_delta = (time.clock()-tick) * (N - myPos) / myPos if options.verbose: bg.set_message('(%02i:%02i:%02i) processing point %i of %i (grain count %i)...' diff --git a/processing/pre/geom_fromVPSC.py b/processing/pre/geom_fromVPSC.py index 3f76ffe2e..a1208170b 100755 --- a/processing/pre/geom_fromVPSC.py +++ b/processing/pre/geom_fromVPSC.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_fromVoronoiTessellation.py b/processing/pre/geom_fromVoronoiTessellation.py index 903124385..95fb1cab7 100755 --- a/processing/pre/geom_fromVoronoiTessellation.py +++ b/processing/pre/geom_fromVoronoiTessellation.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -13,7 +13,7 @@ scriptID = ' '.join([scriptName,damask.version]) def meshgrid2(*arrs): - """code inspired by http://stackoverflow.com/questions/1827489/numpy-meshgrid-in-3d""" + """Code inspired by http://stackoverflow.com/questions/1827489/numpy-meshgrid-in-3d""" arrs = tuple(reversed(arrs)) arrs = tuple(arrs) lens = np.array(map(len, arrs)) @@ -31,9 +31,9 @@ def meshgrid2(*arrs): return tuple(ans) def findClosestSeed(fargs): - point, seeds, weightssquared = fargs + point, seeds, myWeights = fargs tmp = np.repeat(point.reshape(3,1), len(seeds), axis=1).T - dist = np.sum((tmp - seeds)*(tmp - seeds),axis=1) - weightssquared + dist = np.sum((tmp - seeds)**2,axis=1) -myWeights return np.argmin(dist) # seed point closest to point @@ -73,18 +73,17 @@ def laguerreTessellation(undeformed, coords, weights, grains, nonperiodic = Fals [ 1, 1, 1 ], ]).astype(float)*info['size'] - squaredweights = np.power(np.tile(weights,len(copies)),2) # Laguerre weights (squared, size N*n) - - for i,vec in enumerate(copies): # periodic copies of seed points (size N*n) - try: seeds = np.append(seeds, coords+vec, axis=0) + repeatweights = np.tile(weights,len(copies)).flatten(order='F') # Laguerre weights (1,2,3,1,2,3,...,1,2,3) + for i,vec in enumerate(copies): # periodic copies of seed points ... + try: seeds = np.append(seeds, coords+vec, axis=0) # ... (1+a,2+a,3+a,...,1+z,2+z,3+z) except NameError: seeds = coords+vec - if all(squaredweights == 0.0): # standard Voronoi (no weights, KD tree) + if (repeatweights == 0.0).all(): # standard Voronoi (no weights, KD tree) myKDTree = spatial.cKDTree(seeds) devNull,closestSeeds = myKDTree.query(undeformed) else: damask.util.croak('...using {} cpu{}'.format(options.cpus, 's' if options.cpus > 1 else '')) - arguments = [[arg] + [seeds,squaredweights] for arg in list(undeformed)] + arguments = [[arg,seeds,repeatweights] for arg in list(undeformed)] if cpus > 1: # use multithreading pool = multiprocessing.Pool(processes = cpus) # initialize workers @@ -134,12 +133,12 @@ group.add_option('-g', '--grid', dest = 'grid', type = 'int', nargs = 3, metavar = ' '.join(['int']*3), - help = 'a,b,c grid of hexahedral box [auto]') + help = 'a,b,c grid of hexahedral box') group.add_option('-s', '--size', dest = 'size', type = 'float', nargs = 3, metavar=' '.join(['float']*3), - help = 'x,y,z size of hexahedral box [auto]') + help = 'x,y,z size of hexahedral box') group.add_option('-o', '--origin', dest = 'origin', @@ -179,6 +178,10 @@ parser.add_option_group(group) group = OptionGroup(parser, "Configuration","") +group.add_option('--without-config', + dest = 'config', + action = 'store_false', + help = 'omit material configuration header') group.add_option('--homogenization', dest = 'homogenization', type = 'int', metavar = 'int', @@ -204,6 +207,7 @@ parser.set_defaults(pos = 'pos', cpus = 2, laguerre = False, nonperiodic = False, + config = True, ) (options,filenames) = parser.parse_args() @@ -241,7 +245,7 @@ for name in filenames: if np.any(info['size'] <= 0.0) \ and np.all(info['grid'] < 1): errors.append('invalid size x y z.') else: - for i in xrange(3): + for i in range(3): if info['size'][i] <= 0.0: # any invalid size? info['size'][i] = float(info['grid'][i])/max(info['grid']) # normalize to grid remarks.append('rescaling size {} to {}...'.format({0:'x',1:'y',2:'z'}[i],info['size'][i])) @@ -304,20 +308,21 @@ for name in filenames: config_header = [] formatwidth = 1+int(math.log10(NgrainIDs)) - config_header += [''] - for i,ID in enumerate(grainIDs): - config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), - 'crystallite {}'.format(options.crystallite), - '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,str(ID).rjust(formatwidth)), - ] - if hasEulers: - config_header += [''] - for ID in grainIDs: - eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id + if options.config: + config_header += [''] + for i,ID in enumerate(grainIDs): config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), - '(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID]) + 'crystallite {}'.format(options.crystallite), + '(constituent)\tphase {}\ttexture {}\tfraction 1.0'.format(options.phase,str(ID).rjust(formatwidth)), ] - if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes)) + if hasEulers: + config_header += [''] + for ID in grainIDs: + eulerID = np.nonzero(grains == ID)[0][0] # find first occurrence of this grain id + config_header += ['[Grain{}]'.format(str(ID).zfill(formatwidth)), + '(gauss)\tphi1 {:g}\tPhi {:g}\tphi2 {:g}\tscatter 0.0\tfraction 1.0'.format(*eulers[eulerID]) + ] + if options.axes is not None: config_header.append('axes\t{} {} {}'.format(*options.axes)) table.labels_clear() table.info_clear() diff --git a/processing/pre/geom_grainGrowth.py b/processing/pre/geom_grainGrowth.py index 9184bd226..90c24219c 100755 --- a/processing/pre/geom_grainGrowth.py +++ b/processing/pre/geom_grainGrowth.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -22,32 +22,46 @@ The final geometry is assembled by selecting at each voxel that grain index for """, version = scriptID) -parser.add_option('-d', '--distance', dest='d', type='int', metavar='int', - help='diffusion distance in voxels [%default]') -parser.add_option('-N', '--smooth', dest='N', type='int', metavar='int', - help='N for curvature flow [%default]') -parser.add_option('-r', '--renumber', dest='renumber', action='store_true', - help='renumber microstructure indices from 1...N [%default]') -parser.add_option('-i', '--immutable', action='extend', dest='immutable', metavar = '', - help='list of immutable microstructures') +parser.add_option('-d', '--distance', + dest = 'd', + type = 'float', metavar = 'float', + help = 'diffusion distance in voxels [%default]') +parser.add_option('-N', '--iterations', + dest = 'N', + type = 'int', metavar = 'int', + help = 'curvature flow iterations [%default]') +parser.add_option('-i', '--immutable', + action = 'extend', dest = 'immutable', metavar = '', + help = 'list of immutable microstructure indices') +parser.add_option('-r', '--renumber', + dest = 'renumber', action='store_true', + help = 'output consecutive microstructure indices') +parser.add_option('--ndimage', + dest = 'ndimage', action='store_true', + help = 'use ndimage.gaussian_filter in lieu of explicit FFT') -parser.set_defaults(d = 1) -parser.set_defaults(N = 1) -parser.set_defaults(renumber = False) -parser.set_defaults(immutable = []) +parser.set_defaults(d = 1, + N = 1, + immutable = [], + renumber = False, + ndimage = False, + ) (options, filenames) = parser.parse_args() options.immutable = map(int,options.immutable) -# --- loop over input files ------------------------------------------------------------------------- +getInterfaceEnergy = lambda A,B: np.float32((A*B != 0)*(A != B)*1.0) # 1.0 if A & B are distinct & nonzero, 0.0 otherwise +struc = ndimage.generate_binary_structure(3,1) # 3D von Neumann neighborhood + +# --- loop over input files ----------------------------------------------------------------------- if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False, labeled = False) + try: table = damask.ASCIItable(name = name, + buffered = False, + labeled = False) except: continue damask.util.report(scriptName,name) @@ -56,12 +70,12 @@ for name in filenames: table.head_read() info,extra_header = table.head_getGeom() - damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))), - 'size x y z: %s'%(' x '.join(map(str,info['size']))), - 'origin x y z: %s'%(' : '.join(map(str,info['origin']))), - 'homogenization: %i'%info['homogenization'], - 'microstructures: %i'%info['microstructures'], - ]) + damask.util.croak(['grid a b c: {}'.format(' x '.join(map(str,info['grid']))), + 'size x y z: {}'.format(' x '.join(map(str,info['size']))), + 'origin x y z: {}'.format(' : '.join(map(str,info['origin']))), + 'homogenization: {}'.format(info['homogenization']), + 'microstructures: {}'.format(info['microstructures']), + ]) errors = [] if np.any(info['grid'] < 1): errors.append('invalid grid a b c.') @@ -71,81 +85,112 @@ for name in filenames: table.close(dismiss = True) continue -# --- read data ------------------------------------------------------------------------------------ - microstructure = np.tile(np.array(table.microstructure_read(info['grid']),'i').reshape(info['grid'],order='F'), - np.where(info['grid'] == 1, 2,1)) # make one copy along dimensions with grid == 1 +# --- read data ----------------------------------------------------------------------------------- + microstructure = np.tile(table.microstructure_read(info['grid']).reshape(info['grid'],order='F'), + np.where(info['grid'] == 1, 2,1)) # make one copy along dimensions with grid == 1 grid = np.array(microstructure.shape) -#--- initialize support data ----------------------------------------------------------------------- +# --- initialize support data --------------------------------------------------------------------- - periodic_microstructure = np.tile(microstructure,(3,3,3))[grid[0]/2:-grid[0]/2, - grid[1]/2:-grid[1]/2, - grid[2]/2:-grid[2]/2] # periodically extend the microstructure # store a copy the initial microstructure to find locations of immutable indices microstructure_original = np.copy(microstructure) - X,Y,Z = np.mgrid[0:grid[0],0:grid[1],0:grid[2]] - gauss = np.exp(-(X*X + Y*Y + Z*Z)/(2.0*options.d*options.d))/math.pow(2.0*np.pi*options.d*options.d,1.5) - gauss[:,:,grid[2]/2::] = gauss[:,:,round(grid[2]/2.)-1::-1] # trying to cope with uneven (odd) grid size - gauss[:,grid[1]/2::,:] = gauss[:,round(grid[1]/2.)-1::-1,:] - gauss[grid[0]/2::,:,:] = gauss[round(grid[0]/2.)-1::-1,:,:] - gauss = np.fft.rfftn(gauss) + if not options.ndimage: + X,Y,Z = np.mgrid[0:grid[0],0:grid[1],0:grid[2]] + + # Calculates gaussian weights for simulating 3d diffusion + gauss = np.exp(-(X*X + Y*Y + Z*Z)/(2.0*options.d*options.d),dtype=np.float32) \ + /np.power(2.0*np.pi*options.d*options.d,(3.0 - np.count_nonzero(info['grid'] == 1))/2.,dtype=np.float32) + + gauss[:,:,:grid[2]/2:-1] = gauss[:,:,1:(grid[2]+1)/2] # trying to cope with uneven (odd) grid size + gauss[:,:grid[1]/2:-1,:] = gauss[:,1:(grid[1]+1)/2,:] + gauss[:grid[0]/2:-1,:,:] = gauss[1:(grid[0]+1)/2,:,:] + gauss = np.fft.rfftn(gauss).astype(np.complex64) - interfacialEnergy = lambda A,B: (A*B != 0)*(A != B)*1.0 - struc = ndimage.generate_binary_structure(3,1) # 3D von Neumann neighborhood + for smoothIter in range(options.N): + # replace immutable microstructures with closest mutable ones + index = ndimage.morphology.distance_transform_edt(np.in1d(microstructure,options.immutable).reshape(grid), + return_distances = False, + return_indices = True) + microstructure = microstructure[index[0], + index[1], + index[2]] - for smoothIter in xrange(options.N): - boundary = np.zeros(microstructure.shape) + interfaceEnergy = np.zeros(microstructure.shape,dtype=np.float32) for i in (-1,0,1): for j in (-1,0,1): for k in (-1,0,1): - # assign interfacial energy to all voxels that have a differing neighbor (in Moore neighborhood) - interfaceEnergy = np.maximum(boundary, - interfacialEnergy(microstructure,np.roll(np.roll(np.roll( - microstructure,i,axis=0), j,axis=1), k,axis=2))) + # assign interfacial energy to all voxels that have a differing neighbor (in Moore neighborhood) + interfaceEnergy = np.maximum(interfaceEnergy, + getInterfaceEnergy(microstructure,np.roll(np.roll(np.roll( + microstructure,i,axis=0), j,axis=1), k,axis=2))) + # periodically extend interfacial energy array by half a grid size in positive and negative directions periodic_interfaceEnergy = np.tile(interfaceEnergy,(3,3,3))[grid[0]/2:-grid[0]/2, - grid[1]/2:-grid[1]/2, - grid[2]/2:-grid[2]/2] - # transform bulk volume (i.e. where interfacial energy is zero) + grid[1]/2:-grid[1]/2, + grid[2]/2:-grid[2]/2] + + # transform bulk volume (i.e. where interfacial energy remained zero), store index of closest boundary voxel index = ndimage.morphology.distance_transform_edt(periodic_interfaceEnergy == 0., return_distances = False, return_indices = True) + # want array index of nearest voxel on periodically extended boundary periodic_bulkEnergy = periodic_interfaceEnergy[index[0], index[1], - index[2]].reshape(2*grid) # fill bulk with energy of nearest interface - diffusedEnergy = np.fft.irfftn(np.fft.rfftn( - np.where( - ndimage.morphology.binary_dilation(interfaceEnergy > 0., - structure = struc, - iterations = options.d/2 + 1), # fat boundary | PE: why 2d-1? I would argue for d/2 + 1 - periodic_bulkEnergy[grid[0]/2:-grid[0]/2, # retain filled energy on fat boundary... - grid[1]/2:-grid[1]/2, - grid[2]/2:-grid[2]/2], # ...and zero everywhere else - 0.))*gauss) - periodic_diffusedEnergy = np.tile(diffusedEnergy,(3,3,3))[grid[0]/2:-grid[0]/2, - grid[1]/2:-grid[1]/2, - grid[2]/2:-grid[2]/2] # periodically extend the smoothed bulk energy - # transform voxels close to interface region | question PE: what motivates 1/2 (could be any small number, or)? - index = ndimage.morphology.distance_transform_edt(periodic_diffusedEnergy >= 0.5, + index[2]].reshape(2*grid) # fill bulk with energy of nearest interface + + if options.ndimage: + periodic_diffusedEnergy = ndimage.gaussian_filter( + np.where(ndimage.morphology.binary_dilation(periodic_interfaceEnergy > 0., + structure = struc, + iterations = int(round(options.d*2.))-1, # fat boundary + ), + periodic_bulkEnergy, # ...and zero everywhere else + 0.), + sigma = options.d) + else: + diffusedEnergy = np.fft.irfftn(np.fft.rfftn( + np.where( + ndimage.morphology.binary_dilation(interfaceEnergy > 0., + structure = struc, + iterations = int(round(options.d*2.))-1),# fat boundary + periodic_bulkEnergy[grid[0]/2:-grid[0]/2, # retain filled energy on fat boundary... + grid[1]/2:-grid[1]/2, + grid[2]/2:-grid[2]/2], # ...and zero everywhere else + 0.)).astype(np.complex64) * + gauss).astype(np.float32) + + periodic_diffusedEnergy = np.tile(diffusedEnergy,(3,3,3))[grid[0]/2:-grid[0]/2, + grid[1]/2:-grid[1]/2, + grid[2]/2:-grid[2]/2] # periodically extend the smoothed bulk energy + + + # transform voxels close to interface region + index = ndimage.morphology.distance_transform_edt(periodic_diffusedEnergy >= 0.95*np.amax(periodic_diffusedEnergy), return_distances = False, - return_indices = True) # want index of closest bulk grain + return_indices = True) # want index of closest bulk grain + + periodic_microstructure = np.tile(microstructure,(3,3,3))[grid[0]/2:-grid[0]/2, + grid[1]/2:-grid[1]/2, + grid[2]/2:-grid[2]/2] # periodically extend the microstructure + microstructure = periodic_microstructure[index[0], index[1], index[2]].reshape(2*grid)[grid[0]/2:-grid[0]/2, grid[1]/2:-grid[1]/2, - grid[2]/2:-grid[2]/2] # extent grains into interface region + grid[2]/2:-grid[2]/2] # extent grains into interface region - immutable = np.zeros(microstructure.shape, dtype=bool) - # find locations where immutable microstructures have been or are now + immutable = np.zeros(microstructure.shape, dtype=np.bool) + # find locations where immutable microstructures have been (or are now) for micro in options.immutable: - immutable += np.logical_or(microstructure == micro, microstructure_original == micro) - # undo any changes involving immutable microstructures - microstructure = np.where(immutable, microstructure_original,microstructure) + immutable += microstructure_original == micro -# --- renumber to sequence 1...Ngrains if requested ------------------------------------------------ + # undo any changes involving immutable microstructures + microstructure = np.where(immutable, microstructure_original,microstructure) + +# --- renumber to sequence 1...Ngrains if requested ----------------------------------------------- # http://stackoverflow.com/questions/10741346/np-frequency-counts-for-unique-values-in-an-array if options.renumber: @@ -158,13 +203,14 @@ for name in filenames: newInfo = {'microstructures': 0,} newInfo['microstructures'] = microstructure.max() -# --- report --------------------------------------------------------------------------------------- +# --- report -------------------------------------------------------------------------------------- remarks = [] - if (newInfo['microstructures'] != info['microstructures']): remarks.append('--> microstructures: %i'%newInfo['microstructures']) + if newInfo['microstructures'] != info['microstructures']: + remarks.append('--> microstructures: {}'.format(newInfo['microstructures'])) if remarks != []: damask.util.croak(remarks) -# --- write header --------------------------------------------------------------------------------- +# --- write header -------------------------------------------------------------------------------- table.labels_clear() table.info_clear() @@ -181,8 +227,11 @@ for name in filenames: # --- write microstructure information ------------------------------------------------------------ formatwidth = int(math.floor(math.log10(microstructure.max())+1)) - table.data = microstructure.reshape((info['grid'][0],info['grid'][1]*info['grid'][2]),order='F').transpose() - table.data_writeArray('%%%ii'%(formatwidth),delimiter = ' ') + table.data = microstructure[::1 if info['grid'][0]>1 else 2, + ::1 if info['grid'][1]>1 else 2, + ::1 if info['grid'][2]>1 else 2,].\ + reshape((info['grid'][0],info['grid'][1]*info['grid'][2]),order='F').transpose() + table.data_writeArray('%{}i'.format(formatwidth),delimiter = ' ') # --- output finalization -------------------------------------------------------------------------- diff --git a/processing/pre/geom_mirror.py b/processing/pre/geom_mirror.py new file mode 100755 index 000000000..cc51749d4 --- /dev/null +++ b/processing/pre/geom_mirror.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python2.7 +# -*- coding: UTF-8 no BOM -*- + +import os,sys,math +import numpy as np +import damask +from optparse import OptionParser + +scriptName = os.path.splitext(os.path.basename(__file__))[0] +scriptID = ' '.join([scriptName,damask.version]) + +#-------------------------------------------------------------------------------------------------- +# MAIN +#-------------------------------------------------------------------------------------------------- + +validDirections = ['x','y','z'] +parser = OptionParser(option_class=damask.extendableOption, usage='%prog options [geomfile(s)]', description = """ +Mirrors spectral geometry description along given directions. + +""", version=scriptID) + +parser.add_option('-d','--direction', + dest = 'directions', + action = 'extend', metavar = '', + help = "directions in which to mirror {'x','y','z'}") + +(options, filenames) = parser.parse_args() + +if options.directions is None: + parser.error('no direction given.') +if not set(options.directions).issubset(validDirections): + invalidDirections = [str(e) for e in set(options.directions).difference(validDirections)] + parser.error('invalid directions {}. '.format(*invalidDirections)) + +# --- loop over input files ------------------------------------------------------------------------- + +if filenames == []: filenames = [None] + +for name in filenames: + try: + table = damask.ASCIItable(name = name, + buffered = False, labeled = False) + except: continue + damask.util.report(scriptName,name) + +# --- interpret header ---------------------------------------------------------------------------- + + table.head_read() + info,extra_header = table.head_getGeom() + + damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))), + 'size x y z: %s'%(' x '.join(map(str,info['size']))), + 'origin x y z: %s'%(' : '.join(map(str,info['origin']))), + 'homogenization: %i'%info['homogenization'], + 'microstructures: %i'%info['microstructures'], + ]) + + errors = [] + if np.any(info['grid'] < 1): errors.append('invalid grid a b c.') + if np.any(info['size'] <= 0.0): errors.append('invalid size x y z.') + if errors != []: + damask.util.croak(errors) + table.close(dismiss = True) + continue + +# --- read data ------------------------------------------------------------------------------------ + + microstructure = table.microstructure_read(info['grid']).reshape(info['grid'],order='F') # read microstructure + + if 'z' in options.directions: + microstructure = np.concatenate([microstructure,microstructure[:,:,::-1]],2) + if 'y' in options.directions: + microstructure = np.concatenate([microstructure,microstructure[:,::-1,:]],1) + if 'x' in options.directions: + microstructure = np.concatenate([microstructure,microstructure[::-1,:,:]],0) + +# --- do work ------------------------------------------------------------------------------------ + + newInfo = { + 'size': microstructure.shape*info['size']/info['grid'], + 'grid': microstructure.shape, + } + + +# --- report --------------------------------------------------------------------------------------- + + remarks = [] + if (any(newInfo['grid'] != info['grid'])): + remarks.append('--> grid a b c: %s'%(' x '.join(map(str,newInfo['grid'])))) + if (any(newInfo['size'] != info['size'])): + remarks.append('--> size x y z: %s'%(' x '.join(map(str,newInfo['size'])))) + if remarks != []: damask.util.croak(remarks) + +# --- write header --------------------------------------------------------------------------------- + + table.labels_clear() + table.info_clear() + table.info_append([ + scriptID + ' ' + ' '.join(sys.argv[1:]), + "grid\ta {grid[0]}\tb {grid[1]}\tc {grid[2]}".format(grid=newInfo['grid']), + "size\tx {size[0]}\ty {size[1]}\tz {size[2]}".format(size=newInfo['size']), + "origin\tx {origin[0]}\ty {origin[1]}\tz {origin[2]}".format(origin=info['origin']), + "homogenization\t{homog}".format(homog=info['homogenization']), + "microstructures\t{microstructures}".format(microstructures=info['microstructures']), + extra_header + ]) + table.head_write() + +# --- write microstructure information ------------------------------------------------------------ + + formatwidth = int(math.floor(math.log10(microstructure.max())+1)) + table.data = microstructure.reshape((newInfo['grid'][0],np.prod(newInfo['grid'][1:])),order='F').transpose() + table.data_writeArray('%%%ii'%(formatwidth),delimiter = ' ') + +# --- output finalization -------------------------------------------------------------------------- + + table.close() # close ASCII table diff --git a/processing/pre/geom_pack.py b/processing/pre/geom_pack.py index 168cfe1d6..4932b8795 100755 --- a/processing/pre/geom_pack.py +++ b/processing/pre/geom_pack.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -36,12 +36,12 @@ for name in filenames: table.head_read() info,extra_header = table.head_getGeom() - damask.util.croak(['grid a b c: %s'%(' x '.join(map(str,info['grid']))), - 'size x y z: %s'%(' x '.join(map(str,info['size']))), - 'origin x y z: %s'%(' : '.join(map(str,info['origin']))), - 'homogenization: %i'%info['homogenization'], - 'microstructures: %i'%info['microstructures'], - ]) + damask.util.croak(['grid a b c: {}'.format(' x '.join(map(str,info['grid']))), + 'size x y z: {}'.format(' x '.join(map(str,info['size']))), + 'origin x y z: {}'.format(' : '.join(map(str,info['origin']))), + 'homogenization: {}'.format(info['homogenization']), + 'microstructures: {}'.format(info['microstructures']), + ]) errors = [] if np.any(info['grid'] < 1): errors.append('invalid grid a b c.') @@ -67,7 +67,7 @@ for name in filenames: # --- write packed microstructure information ----------------------------------------------------- - type = '' + compressType = '' former = start = -1 reps = 0 @@ -76,30 +76,30 @@ for name in filenames: items = table.data if len(items) > 2: if items[1].lower() == 'of': items = [int(items[2])]*int(items[0]) - elif items[1].lower() == 'to': items = xrange(int(items[0]),1+int(items[2])) + elif items[1].lower() == 'to': items = range(int(items[0]),1+int(items[2])) else: items = map(int,items) else: items = map(int,items) for current in items: - if current == former+1 and start+reps == former+1: - type = 'to' + if abs(current - former) == 1 and (start - current) == reps*(former - current): + compressType = 'to' reps += 1 elif current == former and start == former: - type = 'of' + compressType = 'of' reps += 1 else: - if type == '': + if compressType == '': table.data = [] - elif type == '.': + elif compressType == '.': table.data = [former] - elif type == 'to': - table.data = [former-reps+1,'to',former] - elif type == 'of': + elif compressType == 'to': + table.data = [start,'to',former] + elif compressType == 'of': table.data = [reps,'of',former] outputAlive = table.data_write(delimiter = ' ') # output processed line - type = '.' + compressType = '.' start = current reps = 1 @@ -107,9 +107,9 @@ for name in filenames: table.data = { '.' : [former], - 'to': [former-reps+1,'to',former], + 'to': [start,'to',former], 'of': [reps,'of',former], - }[type] + }[compressType] outputAlive = table.data_write(delimiter = ' ') # output processed line diff --git a/processing/pre/geom_rescale.py b/processing/pre/geom_rescale.py index 2c779f3d3..976db9d5c 100755 --- a/processing/pre/geom_rescale.py +++ b/processing/pre/geom_rescale.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -92,10 +92,10 @@ for name in filenames: newInfo['size'] = np.where(newInfo['size'] <= 0.0, info['size'],newInfo['size']) multiplicity = [] - for j in xrange(3): + for j in range(3): multiplicity.append([]) last = 0 - for i in xrange(info['grid'][j]): + for i in range(info['grid'][j]): this = int((i+1)*float(newInfo['grid'][j])/info['grid'][j]) multiplicity[j].append(this-last) last = this diff --git a/processing/pre/geom_rotate.py b/processing/pre/geom_rotate.py index bb6acd35c..1e570ca70 100755 --- a/processing/pre/geom_rotate.py +++ b/processing/pre/geom_rotate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_toTable.py b/processing/pre/geom_toTable.py index 680b218cf..eb6bdde61 100755 --- a/processing/pre/geom_toTable.py +++ b/processing/pre/geom_toTable.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -19,8 +19,17 @@ Translate geom description into ASCIItable containing position and microstructur """, version = scriptID) +parser.add_option('--float', + dest = 'real', + action = 'store_true', + help = 'use float input') + +parser.set_defaults(real = False, + ) (options, filenames) = parser.parse_args() +datatype = 'f' if options.real else 'i' + # --- loop over input files ------------------------------------------------------------------------- if filenames == []: filenames = [None] @@ -56,14 +65,14 @@ for name in filenames: # --- read data ------------------------------------------------------------------------------------ - microstructure = table.microstructure_read(info['grid']) + microstructure = table.microstructure_read(info['grid'],datatype) # ------------------------------------------ assemble header --------------------------------------- table.info_clear() table.info_append(extra_header + [scriptID + '\t' + ' '.join(sys.argv[1:])]) table.labels_clear() - table.labels_append(['{}_{}'.format(1+i,'pos') for i in xrange(3)]+['microstructure']) + table.labels_append(['{}_{}'.format(1+i,'pos') for i in range(3)]+['microstructure']) table.head_write() table.output_flush() diff --git a/processing/pre/geom_translate.py b/processing/pre/geom_translate.py index 6c5eb5391..260f8326f 100755 --- a/processing/pre/geom_translate.py +++ b/processing/pre/geom_translate.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math @@ -30,30 +30,37 @@ parser.add_option('-s', '--substitute', dest = 'substitute', action = 'extend', metavar = '', help = 'substitutions of microstructure indices from,to,from,to,...') +parser.add_option('--float', + dest = 'real', + action = 'store_true', + help = 'use float input') parser.set_defaults(origin = (0.0,0.0,0.0), microstructure = 0, substitute = [], + real = False, ) (options, filenames) = parser.parse_args() +datatype = 'f' if options.real else 'i' + sub = {} -for i in xrange(len(options.substitute)/2): # split substitution list into "from" -> "to" +for i in range(len(options.substitute)/2): # split substitution list into "from" -> "to" sub[int(options.substitute[i*2])] = int(options.substitute[i*2+1]) -# --- loop over input files ------------------------------------------------------------------------- +# --- loop over input files ---------------------------------------------------------------------- if filenames == []: filenames = [None] for name in filenames: - try: - table = damask.ASCIItable(name = name, - buffered = False, labeled = False) + try: table = damask.ASCIItable(name = name, + buffered = False, + labeled = False) except: continue damask.util.report(scriptName,name) -# --- interpret header ---------------------------------------------------------------------------- +# --- interpret header --------------------------------------------------------------------------- table.head_read() info,extra_header = table.head_getGeom() @@ -73,9 +80,9 @@ for name in filenames: table.close(dismiss = True) continue -# --- read data ------------------------------------------------------------------------------------ +# --- read data ---------------------------------------------------------------------------------- - microstructure = table.microstructure_read(info['grid']) # read microstructure + microstructure = table.microstructure_read(info['grid'],datatype) # read microstructure # --- do work ------------------------------------------------------------------------------------ @@ -90,9 +97,9 @@ for name in filenames: substituted += options.microstructure # shift microstructure indices newInfo['origin'] = info['origin'] + options.origin - newInfo['microstructures'] = substituted.max() + newInfo['microstructures'] = len(np.unique(substituted)) -# --- report --------------------------------------------------------------------------------------- +# --- report ------------------------------------------------------------------------------------- remarks = [] if (any(newInfo['origin'] != info['origin'])): @@ -101,7 +108,7 @@ for name in filenames: remarks.append('--> microstructures: %i'%newInfo['microstructures']) if remarks != []: damask.util.croak(remarks) -# --- write header --------------------------------------------------------------------------------- +# --- write header ------------------------------------------------------------------------------- table.labels_clear() table.info_clear() @@ -116,12 +123,12 @@ for name in filenames: ]) table.head_write() -# --- write microstructure information ------------------------------------------------------------ +# --- write microstructure information ----------------------------------------------------------- - formatwidth = int(math.floor(math.log10(microstructure.max())+1)) + format = '%g' if options.real else '%{}i'.format(int(math.floor(math.log10(microstructure.max())+1))) table.data = substituted.reshape((info['grid'][0],info['grid'][1]*info['grid'][2]),order='F').transpose() - table.data_writeArray('%%%ii'%(formatwidth),delimiter = ' ') + table.data_writeArray(format,delimiter = ' ') -# --- output finalization -------------------------------------------------------------------------- +# --- output finalization ------------------------------------------------------------------------ - table.close() # close ASCII table + table.close() # close ASCII table diff --git a/processing/pre/geom_unpack.py b/processing/pre/geom_unpack.py index 508946d4e..530d3889e 100755 --- a/processing/pre/geom_unpack.py +++ b/processing/pre/geom_unpack.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/geom_vicinityOffset.py b/processing/pre/geom_vicinityOffset.py index 8ef96608e..06cb482c6 100755 --- a/processing/pre/geom_vicinityOffset.py +++ b/processing/pre/geom_vicinityOffset.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math diff --git a/processing/pre/gmsh_identifySurfaces.py b/processing/pre/gmsh_identifySurfaces.py index e42e352c8..642b0a71e 100755 --- a/processing/pre/gmsh_identifySurfaces.py +++ b/processing/pre/gmsh_identifySurfaces.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,re diff --git a/processing/pre/hybridIA_linODFsampling.py b/processing/pre/hybridIA_linODFsampling.py index 9ee4470b9..128d054e1 100755 --- a/processing/pre/hybridIA_linODFsampling.py +++ b/processing/pre/hybridIA_linODFsampling.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- from optparse import OptionParser @@ -19,7 +19,7 @@ def integerFactorization(i): return j def binAsBins(bin,intervals): - """explode compound bin into 3D bins list""" + """Explode compound bin into 3D bins list""" bins = [0]*3 bins[0] = (bin//(intervals[1] * intervals[2])) % intervals[0] bins[1] = (bin//intervals[2]) % intervals[1] @@ -27,17 +27,17 @@ def binAsBins(bin,intervals): return bins def binsAsBin(bins,intervals): - """implode 3D bins into compound bin""" + """Implode 3D bins into compound bin""" return (bins[0]*intervals[1] + bins[1])*intervals[2] + bins[2] def EulersAsBins(Eulers,intervals,deltas,center): - """return list of Eulers translated into 3D bins list""" + """Return list of Eulers translated into 3D bins list""" return [int((euler+(0.5-center)*delta)//delta)%interval \ for euler,delta,interval in zip(Eulers,deltas,intervals) \ ] def binAsEulers(bin,intervals,deltas,center): - """compound bin number translated into list of Eulers""" + """Compound bin number translated into list of Eulers""" Eulers = [0.0]*3 Eulers[2] = (bin%intervals[2] + center)*deltas[2] Eulers[1] = (bin//intervals[2]%intervals[1] + center)*deltas[1] @@ -45,7 +45,7 @@ def binAsEulers(bin,intervals,deltas,center): return Eulers def directInvRepetitions(probability,scale): - """calculate number of samples drawn by direct inversion""" + """Calculate number of samples drawn by direct inversion""" nDirectInv = 0 for bin in range(len(probability)): # loop over bins nDirectInv += int(round(probability[bin]*scale)) # calc repetition @@ -270,7 +270,7 @@ for name in filenames: ODF['limit'] = np.radians(limits[1,:]) # right hand limits in radians ODF['center'] = 0.0 if all(limits[0,:]<1e-8) else 0.5 # vertex or cell centered - ODF['interval'] = np.array(map(len,[np.unique(table.data[:,i]) for i in xrange(3)]),'i') # steps are number of distict values + ODF['interval'] = np.array(map(len,[np.unique(table.data[:,i]) for i in range(3)]),'i') # steps are number of distict values ODF['nBins'] = ODF['interval'].prod() ODF['delta'] = np.radians(np.array(limits[1,0:3]-limits[0,0:3])/(ODF['interval']-1)) # step size @@ -349,7 +349,7 @@ for name in filenames: '#-------------------#', ] - for i,ID in enumerate(xrange(nSamples)): + for i,ID in enumerate(range(nSamples)): materialConfig += ['[Grain%s]'%(str(ID+1).zfill(formatwidth)), 'crystallite %i'%options.crystallite, '(constituent) phase %i texture %s fraction 1.0'%(options.phase,str(ID+1).rjust(formatwidth)), @@ -361,7 +361,7 @@ for name in filenames: '#-------------------#', ] - for ID in xrange(nSamples): + for ID in range(nSamples): eulers = Orientations[ID] materialConfig += ['[Grain%s]'%(str(ID+1).zfill(formatwidth)), diff --git a/processing/pre/marc_addUserOutput.py b/processing/pre/marc_addUserOutput.py index 6f61b2d26..bf84b46aa 100755 --- a/processing/pre/marc_addUserOutput.py +++ b/processing/pre/marc_addUserOutput.py @@ -1,13 +1,6 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- -""" -Writes meaningful labels to the marc input file (*.dat) - -output is based on the files -.output -that are written during the first run of the model. -""" import sys,os,re from optparse import OptionParser import damask @@ -21,13 +14,13 @@ def ParseOutputFormat(filename,what,me): outputmetafile = filename+'.output'+what try: - file = open(outputmetafile) + myFile = open(outputmetafile) except: print('Could not open file %s'%outputmetafile) raise else: - content = file.readlines() - file.close() + content = myFile.readlines() + myFile.close() tag = '' tagID = 0 @@ -55,9 +48,9 @@ def ParseOutputFormat(filename,what,me): format['outputs'].append([output,length]) return format -parser = OptionParser(option_class=damask.extendableOption, usage='%prog [option(s)] Marc.Inputfile(s)', description=""" +parser = OptionParser(option_class=damask.extendableOption, usage='%prog [option(s)] Marc.Inputfile(s)', description = """ Transfer the output variables requested in the material.config to -properly labelled user defined variables within the Marc input file (*.dat). +properly labelled user-defined variables within the Marc input file (*.dat). Requires the files .output @@ -68,40 +61,29 @@ Or have an existing set of user variables copied over from another *.dat file. """, version = scriptID) - -parser.add_option('-n','--number', dest='number', type='int', \ - metavar='int', - help='maximum requested User Defined Variable [%default]') -parser.add_option('--homogenization', dest='homog', \ - metavar='string', - help='homogenization identifier (as string or integer [%default])') -parser.add_option('--crystallite', dest='cryst', \ - metavar='string', - help='crystallite identifier (as string or integer [%default])') -parser.add_option('--phase', dest='phase', \ - metavar='string', - help='phase identifier (as string or integer [%default])') -parser.add_option('--use', dest='useFile', \ - metavar='string', - help='Optionally parse output descriptors from '+ - 'different .outputZZZ file. Saves the effort '+ - 'to start a calculation for each job)') -parser.add_option('--option', dest='damaskOption', \ - metavar='string', - help='Add damask option to input file '+ - 'for example: "periodic x z"') -parser.set_defaults(number = 0) -parser.set_defaults(homog = '1') -parser.set_defaults(cryst = '1') -parser.set_defaults(phase = '1') -parser.set_defaults(useFile = '') -parser.set_defaults(damaskOption = '') +parser.add_option('-m', dest='number', type='int', metavar = 'int', + help='maximum requested User Defined Variable [%default]') +parser.add_option('--homogenization', dest='homog', metavar = 'string', + help='homogenization name or index [%default]') +parser.add_option('--crystallite', dest='cryst', metavar = 'string', + help='crystallite identifier name or index [%default]') +parser.add_option('--phase', dest='phase', metavar = 'string', + help='phase identifier name or index [%default]') +parser.add_option('--use', dest='useFile', metavar = 'string', + help='optionally parse output descriptors from '+ + 'outputXXX files of given name') +parser.add_option('--option', dest='damaskOption', metavar = 'string', + help='Add DAMASK option to input file, e.g. "periodic x z"') + +parser.set_defaults(number = 0, + homog = '1', + cryst = '1', + phase = '1') (options, files) = parser.parse_args() if not files: - parser.print_help() - parser.error('no file(s) specified...') + parser.error('no file(s) specified.') me = { 'Homogenization': options.homog, 'Crystallite': options.cryst, @@ -109,18 +91,18 @@ me = { 'Homogenization': options.homog, } -for file in files: - print '\033[1m'+scriptName+'\033[0m: '+file+'\n' - if options.useFile != '': +for myFile in files: + damask.util.report(scriptName,myFile) + if options.useFile is not None: formatFile = os.path.splitext(options.useFile)[0] else: - formatFile = os.path.splitext(file)[0] - file = os.path.splitext(file)[0]+'.dat' - if not os.path.lexists(file): - print file,'not found' + formatFile = os.path.splitext(myFile)[0] + myFile = os.path.splitext(myFile)[0]+'.dat' + if not os.path.lexists(myFile): + print('{} not found'.format(myFile)) continue - print('Scanning format files of: %s'%formatFile) + print('Scanning format files of: {}'.format(formatFile)) if options.number < 1: outputFormat = {} @@ -128,8 +110,8 @@ for file in files: for what in me: outputFormat[what] = ParseOutputFormat(formatFile,what,me[what]) if '_id' not in outputFormat[what]['specials']: - print "'%s' not found in <%s>"%(me[what],what) - print '\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers'])) + print("'{}' not found in <{}>".format(me[what],what)) + print('\n'.join(map(lambda x:' '+x,outputFormat[what]['specials']['brothers']))) sys.exit(1) UserVars = ['HomogenizationCount'] @@ -157,13 +139,13 @@ for file in files: UserVars += ['%i_%s'%(grain+1,var[0]) for i in range(var[1])] # Now change *.dat file(s) - print('Adding labels to: %s'%file) - inFile = open(file) + print('Adding labels to: {}'.format(myFile)) + inFile = open(myFile) input = inFile.readlines() inFile.close() - output = open(file,'w') + output = open(myFile,'w') thisSection = '' - if options.damaskOption: + if options.damaskOption is not None: output.write('$damask {0}\n'.format(options.damaskOption)) for line in input: m = re.match('(\w+)\s',line) diff --git a/processing/pre/mentat_pbcOnBoxMesh.py b/processing/pre/mentat_pbcOnBoxMesh.py index d355639e2..71bc0d121 100755 --- a/processing/pre/mentat_pbcOnBoxMesh.py +++ b/processing/pre/mentat_pbcOnBoxMesh.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os @@ -9,7 +9,7 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) active=[True,True,True] # directions on which to add PBC def outMentat(cmd,locals): @@ -58,14 +58,14 @@ def servoLink(): } Nnodes = py_mentat.py_get_int("nnodes()") NodeCoords = np.zeros((Nnodes,3),dtype='d') - for node in xrange(Nnodes): + for node in range(Nnodes): NodeCoords[node,0] = py_mentat.py_get_float("node_x(%i)"%(node+1)) NodeCoords[node,1] = py_mentat.py_get_float("node_y(%i)"%(node+1)) NodeCoords[node,2] = py_mentat.py_get_float("node_z(%i)"%(node+1)) - box['min'] = NodeCoords.min(axis=0) # find the bounding box + box['min'] = NodeCoords.min(axis=0) # find the bounding box box['max'] = NodeCoords.max(axis=0) box['delta'] = box['max']-box['min'] - for coord in xrange(3): # calc the dimension of the bounding box + for coord in range(3): # calc the dimension of the bounding box if box['delta'][coord] != 0.0: for extremum in ['min','max']: rounded = round(box[extremum][coord]*1e+15/box['delta'][coord]) * \ @@ -76,12 +76,12 @@ def servoLink(): #------------------------------------------------------------------------------------------------- # loop over all nodes - for node in xrange(Nnodes): + for node in range(Nnodes): key = {} maxFlag = [False, False, False] Nmax = 0 Nmin = 0 - for coord in xrange(3): # for each direction + for coord in range(3): # for each direction if box['delta'][coord] != 0.0: rounded = round(NodeCoords[node,coord]*1e+15/box['delta'][coord]) * \ 1e-15*box['delta'][coord] # rounding to 1e-15 of dimension @@ -102,18 +102,18 @@ def servoLink(): if key['z'] not in baseNode[key['x']][key['y']].keys(): baseNode[key['x']][key['y']][key['z']] = 0 - baseNode[key['x']][key['y']][key['z']] = node+1 # remember the base node id + baseNode[key['x']][key['y']][key['z']] = node+1 # remember the base node id - if Nmax > 0 and Nmax >= Nmin: # node is on at least as many front than back faces - if any([maxFlag[i] and active[i] for i in xrange(3)]): - linkNodes.append({'id': node+1,'coord': NodeCoords[node], 'faceMember': [maxFlag[i] and active[i] for i in xrange(3)]}) + if Nmax > 0 and Nmax >= Nmin: # node is on at least as many front than back faces + if any([maxFlag[i] and active[i] for i in range(3)]): + linkNodes.append({'id': node+1,'coord': NodeCoords[node], 'faceMember': [maxFlag[i] and active[i] for i in range(3)]}) baseCorner = baseNode["%.8e"%box['min'][0]]["%.8e"%box['min'][1]]["%.8e"%box['min'][2]] # detect ultimate base node for node in linkNodes: # loop over all linked nodes linkCoord = [node['coord']] # start list of control node coords with my coords - for dir in xrange(3): # check for each direction + for dir in range(3): # check for each direction if node['faceMember'][dir]: # me on this front face linkCoord[0][dir] = box['min'][dir] # project me onto rear face along dir linkCoord.append(np.array(box['min'])) # append base corner diff --git a/processing/pre/mentat_spectralBox.py b/processing/pre/mentat_spectralBox.py index 770db1279..681aca724 100755 --- a/processing/pre/mentat_spectralBox.py +++ b/processing/pre/mentat_spectralBox.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys @@ -8,7 +8,7 @@ import damask scriptName = os.path.splitext(os.path.basename(__file__))[0] scriptID = ' '.join([scriptName,damask.version]) -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) #------------------------------------------------------------------------------------------------- def outMentat(cmd,locals): diff --git a/processing/pre/patchFromReconstructedBoundaries.py b/processing/pre/patchFromReconstructedBoundaries.py index f0c68b5f7..a43ccc236 100755 --- a/processing/pre/patchFromReconstructedBoundaries.py +++ b/processing/pre/patchFromReconstructedBoundaries.py @@ -1,7 +1,8 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import sys,os,math,re +import numpy as np from optparse import OptionParser import damask @@ -12,15 +13,15 @@ scriptID = ' '.join([scriptName,damask.version]) try: # check for Python Image Lib from PIL import Image,ImageDraw ImageCapability = True -except: +except ImportError: ImageCapability = False -sys.path.append(damask.solver.Marc().libraryPath('../../')) +sys.path.append(damask.solver.Marc().libraryPath()) try: # check for MSC.Mentat Python interface import py_mentat MentatCapability = True -except: +except ImportError: MentatCapability = False @@ -41,9 +42,9 @@ def outStdout(cmd,locals): exec(cmd[3:]) elif cmd[0:3] == '(?)': cmd = eval(cmd[3:]) - print cmd + print(cmd) else: - print cmd + print(cmd) return @@ -63,9 +64,8 @@ def rcbOrientationParser(content,idcolumn): grains = [] myOrientation = [0.0,0.0,0.0] - for line in content: - m = re.match(r'\s*(#|$)',line) - if m: continue # skip comments and blank lines + for j,line in enumerate(content): + if re.match(r'^\s*(#|$)',line): continue # skip comments and blank lines for grain in range(2): myID = int(line.split()[idcolumn+grain]) # get grain id myOrientation = map(float,line.split())[3*grain:3+3*grain] # get orientation @@ -75,8 +75,8 @@ def rcbOrientationParser(content,idcolumn): try: grains[myID-1] = myOrientation # store Euler angles except IndexError: - message = 'You might not have chosen the correct column for the grain IDs! Please check the "--id" option.' - print '\033[1;31m'+message+'\033[0m\n' + damask.util.croak('You might not have chosen the correct column for the grain IDs! '+ + 'Please check the "--id" option.') raise except: raise @@ -84,20 +84,20 @@ def rcbOrientationParser(content,idcolumn): return grains def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): - """parser for TSL-OIM reconstructed boundary files""" + """Parser for TSL-OIM reconstructed boundary files""" # find bounding box boxX = [1.*sys.maxint,-1.*sys.maxint] boxY = [1.*sys.maxint,-1.*sys.maxint] x = [0.,0.] y = [0.,0.] for line in content: - m = re.match(r'\s*(#|$)',line) + m = re.match(r'^\s*(#|$)',line) if m: continue # skip comments and blank lines try: (x[0],y[0],x[1],y[1]) = map(float,line.split())[segmentcolumn:segmentcolumn+4] # get start and end coordinates of each segment. except IndexError: - message = 'You might not have chosen the correct column for the segment end points! Please check the "--segment" option.' - print '\033[1;31m'+message+'\033[0m\n' + damask.util.croak('You might not have chosen the correct column for the segment end points! '+ + 'Please check the "--segment" option.') raise except: raise @@ -110,6 +110,9 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): dX = boxX[1]-boxX[0] dY = boxY[1]-boxY[0] + damask.util.croak(' bounding box {},{} -- {},{}'.format(boxX[0],boxY[0],boxX[1],boxY[1])) + damask.util.croak(' dimension {} x {}'.format(dX,dY)) + if size > 0.0: scalePatch = size/dX else: scalePatch = 1.0 @@ -122,8 +125,7 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): grainNeighbors = [] for line in content: - m = re.match(r'\s*(#|$)',line) - if m: continue # skip comments and blank lines + if re.match(r'^\s*(#|$)',line): continue # skip comments and blank lines (x[0],y[0],x[1],y[1]) = map(float,line.split())[segmentcolumn:segmentcolumn+4] # get start and end coordinates of each segment. (x[0],y[0]) = (M[0]*x[0]+M[1]*y[0],M[2]*x[0]+M[3]*y[0]) # apply transformation to coordinates (x[1],y[1]) = (M[0]*x[1]+M[1]*y[1],M[2]*x[1]+M[3]*y[1]) # to get rcb --> Euler system @@ -133,8 +135,8 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): y[0] -= boxY[0] y[1] -= boxY[0] grainNeighbors.append(map(int,line.split()[idcolumn:idcolumn+2])) # remember right and left grain per segment - for i in range(2): # store segment to both points - match = False # check whether point is already known (within a small range) + for i in range(2): # store segment to both points + match = False # check whether point is already known (within a small range) for posX in connectivityXY.keys(): if (abs(float(posX)-x[i]) 0: + damask.util.croak(' culling {} duplicate segments...'.format(len(dupSegments))) + for rm in dupSegments: + segments[rm] = None + crappyData = False for pointId,point in enumerate(points): if len(point['segments']) < 2: # point marks a dead end! - print "Dead end at segment %i (%f,%f)"\ - %(1+point['segments'][0],boxX[0]+point['coords'][0]/scalePatch,boxY[0]+point['coords'][1]/scalePatch,) + damask.util.croak('dead end at segment {} for point {} ({},{}).' + .format(point['segments'][0], + pointId, + boxX[0]+point['coords'][0]/scalePatch,boxY[0]+point['coords'][1]/scalePatch,)) crappyData = True grains = {'draw': [], 'legs': []} @@ -249,77 +269,87 @@ def rcbParser(content,M,size,tolerance,idcolumn,segmentcolumn): innerAngleSum = 0.0 myWalk = point['segments'].pop() grainLegs = [myWalk] - if segments[myWalk][0] == myStart: - myEnd = segments[myWalk][1] - else: - myEnd = segments[myWalk][0] - + myEnd = segments[myWalk][1 if segments[myWalk][0] == myStart else 0] while (myEnd != pointId): - myV = [points[myEnd]['coords'][0]-points[myStart]['coords'][0],\ - points[myEnd]['coords'][1]-points[myStart]['coords'][1]] + myV = [points[myEnd]['coords'][0]-points[myStart]['coords'][0], + points[myEnd]['coords'][1]-points[myStart]['coords'][1]] myLen = math.sqrt(myV[0]**2+myV[1]**2) + if myLen == 0.0: damask.util.croak('mylen is zero: point {} --> {}'.format(myStart,myEnd)) best = {'product': -2.0, 'peek': -1, 'len': -1, 'point': -1} for peek in points[myEnd]['segments']: # trying in turn all segments emanating from current end if peek == myWalk: - continue - peekEnd = segments[peek][1] if segments[peek][0] == myEnd else segments[peek][0] - peekV = [points[myEnd]['coords'][0]-points[peekEnd]['coords'][0], - points[myEnd]['coords'][1]-points[peekEnd]['coords'][1]] + continue # do not go back same path + peekEnd = segments[peek][1 if segments[peek][0] == myEnd else 0] + peekV = [points[peekEnd]['coords'][0]-points[myEnd]['coords'][0], + points[peekEnd]['coords'][1]-points[myEnd]['coords'][1]] peekLen = math.sqrt(peekV[0]**2+peekV[1]**2) - crossproduct = (myV[0]*peekV[1]-myV[1]*peekV[0])/myLen/peekLen - dotproduct = (myV[0]*peekV[0]+myV[1]*peekV[1])/myLen/peekLen - if crossproduct*(dotproduct+1.0) >= best['product']: - best['product'] = crossproduct*(dotproduct+1.0) + if peekLen == 0.0: damask.util.croak('peeklen is zero: peek point {}'.format(peek)) + crossproduct = (myV[0]*peekV[1] - myV[1]*peekV[0])/myLen/peekLen + dotproduct = (myV[0]*peekV[0] + myV[1]*peekV[1])/myLen/peekLen + innerAngle = math.copysign(1.0,crossproduct)*(dotproduct-1.0) + if innerAngle >= best['product']: # takes sharpest left turn + best['product'] = innerAngle best['peek'] = peek best['point'] = peekEnd + innerAngleSum += best['product'] myWalk = best['peek'] myStart = myEnd myEnd = best['point'] + if myWalk in points[myStart]['segments']: points[myStart]['segments'].remove(myWalk) else: - sys.stderr.write(str(myWalk)+' not in segments of point '+str(myStart)+'\n') + damask.util.croak('{} not in segments of point {}'.format(myWalk,myStart)) grainDraw.append(points[myStart]['coords']) grainLegs.append(myWalk) + if innerAngleSum > 0.0: grains['draw'].append(grainDraw) grains['legs'].append(grainLegs) else: grains['box'] = grainLegs - # build overall data structure - rcData = {'dimension':[dX,dY], 'point': [],'segment': [], 'grain': [], 'grainMapping': []} - print " dimension %g x %g"%(dX,dY) + rcData = {'dimension':[dX,dY], + 'bounds': [[boxX[0],boxY[0]],[boxX[1],boxY[1]]], + 'scale': scalePatch, + 'point': [], + 'segment': [], + 'neighbors': [], + 'grain': [], + 'grainMapping': [], + } for point in points: rcData['point'].append(point['coords']) - print " found %i points"%(len(rcData['point'])) + damask.util.croak(' found {} points'.format(len(rcData['point']))) - for segment in segments: + for segment in segments: rcData['segment'].append(segment) - print " built %i segments"%(len(rcData['segment'])) + damask.util.croak(' built {} segments'.format(len(rcData['segment']))) - for legs in grains['legs']: # loop over grains - rcData['grain'].append(legs) # store list of boundary segments + for neighbors in grainNeighbors: + rcData['neighbors'].append(neighbors) + + for legs in grains['legs']: # loop over grains + rcData['grain'].append(legs) # store list of boundary segments myNeighbors = {} - for leg in legs: # test each boundary segment - if leg < len(grainNeighbors): # a valid segment index? - for side in range(2): # look at both sides of the segment - if grainNeighbors[leg][side] in myNeighbors: # count occurrence of grain IDs + for leg in legs: # test each boundary segment + if leg < len(grainNeighbors): # a valid segment index? + for side in range(2): # look at both sides of the segment + if grainNeighbors[leg][side] in myNeighbors: # count occurrence of grain IDs myNeighbors[grainNeighbors[leg][side]] += 1 else: myNeighbors[grainNeighbors[leg][side]] = 1 - if myNeighbors: # do I have any neighbors (i.e., non-bounding box segment) - candidateGrains = sorted(myNeighbors.iteritems(), key=lambda (k,v): (v,k), reverse=True) # sort grain counting - if candidateGrains[0][0] not in rcData['grainMapping']: # most frequent one not yet seen? - rcData['grainMapping'].append(candidateGrains[0][0]) # must be me then - else: - rcData['grainMapping'].append(candidateGrains[1][0]) # special case of bi-crystal situation... + if myNeighbors: # do I have any neighbors (i.e., non-bounding box segment) + candidateGrains = sorted(myNeighbors.iteritems(), key=lambda p: (p[1],p[0]), reverse=True) # sort grain counting + # most frequent one not yet seen? + rcData['grainMapping'].append(candidateGrains[0 if candidateGrains[0][0] not in rcData['grainMapping'] else 1][0]) # must be me then + # special case of bi-crystal situation... - print " found %i grains\n"%(len(rcData['grain'])) + damask.util.croak(' found {} grains'.format(len(rcData['grain']))) rcData['box'] = grains['box'] if 'box' in grains else [] @@ -617,7 +647,6 @@ def job(grainNumber,grainMapping,twoD): "*job_param univ_gas_const 8.314472", "*job_param planck_radiation_2 1.4387752e-2", "*job_param speed_light_vacuum 299792458", -# "*job_usersub_file /san/%s/FEM/DAMASK/code/mpie_cpfem_marc2010.f90 | subroutine definition"%(pwd.getpwuid(os.geteuid())[0].rpartition("\\")[2]), "*job_option user_source:compile_save", ] @@ -670,9 +699,10 @@ def image(name,imgsize,marginX,marginY,rcData): draw.text([offsetX+point[0]*scaleImg,sizeY-(offsetY+point[1]*scaleImg)],"%i"%id,fill=(0,0,0)) for id,vertex in enumerate(rcData['segment']): + if vertex: start = rcData['point'][vertex[0]] end = rcData['point'][vertex[1]] - draw.text([offsetX+(start[0]+end[0])/2.0*scaleImg,sizeY-(offsetY+(start[1]+end[1])/2.0*scaleImg)],"%i"%id,fill=(0,0,128)) + draw.text([offsetX+(start[0]+end[0])/2.0*scaleImg,sizeY-(offsetY+(start[1]+end[1])/2.0*scaleImg)],"%i"%id,fill=(255,0,128)) draw.line([offsetX+start[0]*scaleImg,sizeY-(offsetY+start[1]*scaleImg), offsetX+ end[0]*scaleImg,sizeY-(offsetY+ end[1]*scaleImg)],width=1,fill=(128,128,128)) @@ -698,7 +728,7 @@ def image(name,imgsize,marginX,marginY,rcData): # ------------------------- def inside(x,y,points): - """tests whether point(x,y) is within polygon described by points""" + """Tests whether point(x,y) is within polygon described by points""" inside = False npoints=len(points) (x1,y1) = points[npoints-1] # start with last point of points @@ -719,8 +749,8 @@ def inside(x,y,points): return inside # ------------------------- -def fftbuild(rcData,height,xframe,yframe,resolution,extrusion): - """build array of grain numbers""" +def fftbuild(rcData,height,xframe,yframe,grid,extrusion): + """Build array of grain numbers""" maxX = -1.*sys.maxint maxY = -1.*sys.maxint for line in rcData['point']: # find data range @@ -729,18 +759,18 @@ def fftbuild(rcData,height,xframe,yframe,resolution,extrusion): maxY = max(maxY, y) xsize = maxX+2*xframe # add framsize ysize = maxY+2*yframe - xres = int(round(resolution/2.0)*2) # use only even resolution - yres = int(round(xres/xsize*ysize/2.0)*2) # calculate other resolutions + xres = int(grid) + yres = int(xres/xsize*ysize) zres = extrusion zsize = extrusion*min([xsize/xres,ysize/yres]) fftdata = {'fftpoints':[], \ - 'resolution':(xres,yres,zres), \ - 'dimension':(xsize,ysize,zsize)} + 'grid':(xres,yres,zres), \ + 'size':(xsize,ysize,zsize)} frameindex=len(rcData['grain'])+1 # calculate frame index as largest grain index plus one - dx = xsize/(xres+1) # calculate step sizes - dy = ysize/(yres+1) + dx = xsize/(xres) # calculate step sizes + dy = ysize/(yres) grainpoints = [] for segments in rcData['grain']: # get segments of each grain @@ -755,11 +785,10 @@ def fftbuild(rcData,height,xframe,yframe,resolution,extrusion): grainpoints.append([]) # start out blank for current grain for p in sorted(points, key=points.get): # loop thru set of sorted points grainpoints[-1].append([rcData['point'][p][0],rcData['point'][p][1]]) # append x,y of point - bestGuess = 0 # assume grain 0 as best guess for i in range(int(xres*yres)): # walk through all points in xy plane xtest = -xframe+((i%xres)+0.5)*dx # calculate coordinates - ytest = -yframe+(int(i/xres)+0.5)*dy + ytest = -yframe+((i//xres)+0.5)*dy if(xtest < 0 or xtest > maxX): # check wether part of frame if( ytest < 0 or ytest > maxY): # part of edges fftdata['fftpoints'].append(frameindex+2) # append frameindex to result array @@ -789,7 +818,7 @@ reconstructed boundary file meshes=['dt_planar_trimesh','af_planar_trimesh','af_planar_quadmesh'] parser.add_option('-o', '--output', action='extend', dest='output', metavar = '', - help='types of output {image, mentat, procedure, spectral}') + help='types of output {rcb, image, mentat, procedure, spectral}') parser.add_option('-p', '--port', type='int', metavar = 'int', dest='port', help='Mentat connection port [%default]') parser.add_option('-2', '--twodimensional', action='store_true', @@ -811,8 +840,8 @@ parser.add_option('-x', '--xmargin', type='float', metavar = 'float', dest='xmargin',help='margin in x in units of patch size [%default]') parser.add_option('-y', '--ymargin', type='float', metavar = 'float', dest='ymargin', help='margin in y in units of patch size [%default]') -parser.add_option('-r', '--resolution', type='int', metavar = 'int', - dest='resolution',help='number of Fourier points/Finite Elements across patch size + x_margin [%default]') +parser.add_option('-g', '--grid', type='int', metavar = 'int', + dest='grid',help='number of Fourier points/Finite Elements across patch size + x_margin [%default]') parser.add_option('-z', '--extrusion', type='int', metavar = 'int', dest='extrusion', help='number of repetitions in z-direction [%default]') parser.add_option('-i', '--imagesize', type='int', metavar = 'int', @@ -831,7 +860,7 @@ parser.set_defaults(output = [], port = 40007, xmargin = 0.0, ymargin = 0.0, - resolution = 64, + grid = 64, extrusion = 2, imgsize = 512, M = (0.0,1.0,1.0,0.0), # M_11, M_12, M_21, M_22. x,y in RCB is y,x of Eulers!! @@ -847,16 +876,15 @@ parser.set_defaults(output = [], (options, args) = parser.parse_args() -print '\033[1m'+scriptName+'\033[0m\n' if not len(args): - parser.error('no boundary file specified') + parser.error('no boundary file specified.') try: boundaryFile = open(args[0]) boundarySegments = boundaryFile.readlines() boundaryFile.close() except: - print 'unable to read boundary file "%s"'%args[0] + damask.util.croak('unable to read boundary file "{}".'.format(args[0])) raise options.output = [s.lower() for s in options.output] # lower case @@ -864,40 +892,108 @@ options.idcolumn -= 1 # py options.segmentcolumn -= 1 # python indexing starts with 0 myName = os.path.splitext(args[0])[0] -print "%s\n"%myName +damask.util.report(scriptName,myName) orientationData = rcbOrientationParser(boundarySegments,options.idcolumn) rcData = rcbParser(boundarySegments,options.M,options.size,options.tolerance,options.idcolumn,options.segmentcolumn) +# ----- write corrected RCB ----- + +Minv = np.linalg.inv(np.array(options.M).reshape(2,2)) + +if 'rcb' in options.output: + print('# Header:\n'+ + '# \n'+ + '# Column 1-3: right hand average orientation (phi1, PHI, phi2 in radians)\n'+ + '# Column 4-6: left hand average orientation (phi1, PHI, phi2 in radians)\n'+ + '# Column 7: length (in microns)\n'+ + '# Column 8: trace angle (in degrees)\n'+ + '# Column 9-12: x,y coordinates of endpoints (in microns)\n'+ + '# Column 13-14: IDs of right hand and left hand grains') + for i,(left,right) in enumerate(rcData['neighbors']): + if rcData['segment'][i]: + first = np.dot(Minv,np.array([rcData['bounds'][0][0]+rcData['point'][rcData['segment'][i][0]][0]/rcData['scale'], + rcData['bounds'][0][1]+rcData['point'][rcData['segment'][i][0]][1]/rcData['scale'], + ])) + second = np.dot(Minv,np.array([rcData['bounds'][0][0]+rcData['point'][rcData['segment'][i][1]][0]/rcData['scale'], + rcData['bounds'][0][1]+rcData['point'][rcData['segment'][i][1]][1]/rcData['scale'], + ])) + print(' '.join(map(str,orientationData[left-1]+orientationData[right-1]))+ + str(np.linalg.norm(first-second))+ + '0'+ + ' '.join(map(str,first))+ + ' '.join(map(str,second))+ + ' '.join(map(str,[left,right]))) + # ----- write image ----- if 'image' in options.output and options.imgsize > 0: if ImageCapability: image(myName,options.imgsize,options.xmargin,options.ymargin,rcData) else: - print '...no image drawing possible (PIL missing)...' + damask.util.croak('...no image drawing possible (PIL missing)...') + +# ----- generate material.config ----- + +if any(output in options.output for output in ['spectral','mentat']): + config = [] + config.append('') + + for i,grain in enumerate(rcData['grainMapping']): + config+=['[grain{}]'.format(grain), + 'crystallite\t1', + '(constituent)\tphase 1\ttexture {}\tfraction 1.0'.format(i+1)] + if (options.xmargin > 0.0): + config+=['[x-margin]', + 'crystallite\t1', + '(constituent)\tphase 2\ttexture {}\tfraction 1.0\n'.format(len(rcData['grainMapping'])+1)] + if (options.ymargin > 0.0): + config+=['[y-margin]', + 'crystallite\t1', + '(constituent)\tphase 2\ttexture {}\tfraction 1.0\n'.format(len(rcData['grainMapping'])+1)] + if (options.xmargin > 0.0 and options.ymargin > 0.0): + config+=['[xy-margin]', + 'crystallite\t1', + '(constituent)\tphase 2\ttexture {}\tfraction 1.0\n'.format(len(rcData['grainMapping'])+1)] + + if (options.xmargin > 0.0 or options.ymargin > 0.0): + config.append('[margin]') + + config.append('') + for grain in rcData['grainMapping']: + config+=['[grain{}]'.format(grain), + '(gauss)\tphi1\t%f\tphi\t%f\tphi2\t%f\tscatter\t%f\tfraction\t1.0'\ + %(math.degrees(orientationData[grain-1][0]),math.degrees(orientationData[grain-1][1]),\ + math.degrees(orientationData[grain-1][2]),options.scatter)] + if (options.xmargin > 0.0 or options.ymargin > 0.0): + config+=['[margin]', + '(random)\t\tscatter\t0.0\tfraction\t1.0'] # ----- write spectral geom ----- if 'spectral' in options.output: - fftdata = fftbuild(rcData, options.size, options.xmargin, options.ymargin, options.resolution, options.extrusion) - - geomFile = open(myName+'_'+str(int(fftdata['resolution'][0]))+'.geom','w') # open geom file for writing - geomFile.write('3\theader\n') # write header info - geomFile.write('resolution a %i b %i c %i\n'%(fftdata['resolution'])) # resolution - geomFile.write('dimension x %f y %f z %f\n'%(fftdata['dimension'])) # size - geomFile.write('homogenization 1\n') # homogenization - for z in xrange(fftdata['resolution'][2]): # z repetions - for y in xrange(fftdata['resolution'][1]): # each x-row separately - geomFile.write('\t'.join(map(str,fftdata['fftpoints'][ y *fftdata['resolution'][0]: - (y+1)*fftdata['resolution'][0]]))+'\n') # grain indexes, x-row per line - geomFile.close() # close geom file - - print('assigned %i out of %i (2D) Fourier points.'\ - %(len(fftdata['fftpoints']), int(fftdata['resolution'][0])*int(fftdata['resolution'][1]))) + fftdata = fftbuild(rcData, options.size, options.xmargin, options.ymargin, options.grid, options.extrusion) + table = damask.ASCIItable(outname = myName+'_'+str(int(fftdata['grid'][0]))+'.geom', + labeled = False, + buffered = False) + table.labels_clear() + table.info_clear() + table.info_append([ + scriptID + ' ' + ' '.join(sys.argv[1:]), + "grid\ta {grid[0]}\tb {grid[1]}\tc {grid[2]}".format(grid=fftdata['grid']), + "size\tx {size[0]}\ty {size[1]}\tz {size[2]}".format(size=fftdata['size']), + "homogenization\t1", + ]) + table.info_append(config) + table.head_write() + + table.data = np.array(fftdata['fftpoints']*options.extrusion).\ + reshape(fftdata['grid'][1]*fftdata['grid'][2],fftdata['grid'][0]) + formatwidth = 1+int(math.log10(np.max(table.data))) + table.data_writeArray('%%%ii'%(formatwidth),delimiter=' ') + table.close() -# ----- write Mentat procedure ----- if 'mentat' in options.output: if MentatCapability: @@ -906,19 +1002,19 @@ if 'mentat' in options.output: cmds = [\ init(), - sample(options.size,rcData['dimension'][1]/rcData['dimension'][0],12,options.xmargin,options.ymargin), - patch(options.size,options.resolution,options.mesh,rcData), + sample(options.size,rcData['dimension'][1]/rcData['size'][0],12,options.xmargin,options.ymargin), + patch(options.size,options.grid,options.mesh,rcData), gage(options.mesh,rcData), ] if not options.twoD: - cmds += [expand3D(options.size*(1.0+2.0*options.xmargin)/options.resolution*options.extrusion,options.extrusion),] + cmds += [expand3D(options.size*(1.0+2.0*options.xmargin)/options.grid*options.extrusion,options.extrusion),] cmds += [\ cleanUp(options.size), materials(), initial_conditions(len(rcData['grain']),rcData['grainMapping']), - boundary_conditions(options.strainrate,options.size*(1.0+2.0*options.xmargin)/options.resolution*options.extrusion,\ + boundary_conditions(options.strainrate,options.size*(1.0+2.0*options.xmargin)/options.grid*options.extrusion,\ options.size,rcData['dimension'][1]/rcData['dimension'][0],options.xmargin,options.ymargin), loadcase(options.strain/options.strainrate,options.increments,0.01), job(len(rcData['grain']),rcData['grainMapping'],options.twoD), @@ -936,53 +1032,7 @@ if 'mentat' in options.output: if 'procedure' in options.output: output(outputLocals['log'],outputLocals,'Stdout') else: - print '...no interaction with Mentat possible...' + damask.util.croak('...no interaction with Mentat possible...') - -# ----- write config data to file ----- - -if 'mentat' in options.output or 'spectral' in options.output: - output = '' - output += '\n\n\n' + \ - '\n[SX]\n' + \ - 'type\tisostrain\n' + \ - 'Ngrains\t1\n' + \ - '\n\n\n' - - for i,grain in enumerate(rcData['grainMapping']): - output += '\n[grain %i]\n'%grain + \ - 'crystallite\t1\n' + \ - '(constituent)\tphase 1\ttexture %i\tfraction 1.0\n'%(i+1) - if (options.xmargin > 0.0): - output += '\n[x-margin]\n' + \ - 'crystallite\t1\n' + \ - '(constituent)\tphase 2\ttexture %i\tfraction 1.0\n'%(len(rcData['grainMapping'])+1) - if (options.ymargin > 0.0): - output += '\n[y-margin]\n' + \ - 'crystallite\t1\n' + \ - '(constituent)\tphase 2\ttexture %i\tfraction 1.0\n'%(len(rcData['grainMapping'])+1) - if (options.xmargin > 0.0 and options.ymargin > 0.0): - output += '\n[margin edge]\n' + \ - 'crystallite\t1\n' + \ - '(constituent)\tphase 2\ttexture %i\tfraction 1.0\n'%(len(rcData['grainMapping'])+1) - - output += '\n\n\n' + \ - '\n[fillMeIn]\n' + \ - '\n\n\n' + \ - '\n[patch]\n' - if (options.xmargin > 0.0 or options.ymargin > 0.0): - output += '\n[margin]\n' - - output += '\n\n\n\n' - for grain in rcData['grainMapping']: - output += '\n[grain %i]\n'%grain + \ - '(gauss)\tphi1\t%f\tphi\t%f\tphi2\t%f\tscatter\t%f\tfraction\t1.0\n'\ - %(math.degrees(orientationData[grain-1][0]),math.degrees(orientationData[grain-1][1]),\ - math.degrees(orientationData[grain-1][2]),options.scatter) - if (options.xmargin > 0.0 or options.ymargin > 0.0): - output += '\n[margin]\n' + \ - '(random)\t\tscatter\t0.0\tfraction\t1.0\n' - - configFile = open(myName+'.config','w') - configFile.write(output) - configFile.close() + with open(myName+'.config','w') as configFile: + configFile.write('\n'.join(config)) diff --git a/processing/pre/seeds_check.sh b/processing/pre/seeds_check.sh index a7d7f76ce..9bc054406 100755 --- a/processing/pre/seeds_check.sh +++ b/processing/pre/seeds_check.sh @@ -4,8 +4,8 @@ for seeds in "$@" do vtk_pointcloud $seeds - vtk_addPointCloudData $seeds \ - --scalar microstructure,weight \ + vtk_addPointcloudData $seeds \ + --data microstructure,weight \ --inplace \ --vtk ${seeds%.*}.vtp \ diff --git a/processing/pre/seeds_fromDistribution.py b/processing/pre/seeds_fromDistribution.py index 096fbdfd8..3b9005032 100755 --- a/processing/pre/seeds_fromDistribution.py +++ b/processing/pre/seeds_fromDistribution.py @@ -1,10 +1,9 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import threading,time,os,sys,random import numpy as np from optparse import OptionParser -from operator import mul from cStringIO import StringIO import damask @@ -65,7 +64,7 @@ class myThread (threading.Thread): NmoveGrains = random.randrange(1,maxSeeds) selectedMs = [] direction = [] - for i in xrange(NmoveGrains): + for i in range(NmoveGrains): selectedMs.append(random.randrange(1,nMicrostructures)) direction.append(np.array(((random.random()-0.5)*delta[0], @@ -110,7 +109,7 @@ class myThread (threading.Thread): currentData=np.bincount(perturbedGeomTable.data.astype(int).ravel())[1:]/points currentError=[] currentHist=[] - for i in xrange(nMicrostructures): # calculate the deviation in all bins per histogram + for i in range(nMicrostructures): # calculate the deviation in all bins per histogram currentHist.append(np.histogram(currentData,bins=target[i]['bins'])[0]) currentError.append(np.sqrt(np.square(np.array(target[i]['histogram']-currentHist[i])).sum())) @@ -122,12 +121,12 @@ class myThread (threading.Thread): bestMatch = match #--- count bin classes with no mismatch ---------------------------------------------------------------------- myMatch=0 - for i in xrange(nMicrostructures): + for i in range(nMicrostructures): if currentError[i] > 0.0: break myMatch = i+1 if myNmicrostructures == nMicrostructures: - for i in xrange(min(nMicrostructures,myMatch+options.bins)): + for i in range(min(nMicrostructures,myMatch+options.bins)): if currentError[i] > target[i]['error']: # worse fitting, next try randReset = True break @@ -146,7 +145,7 @@ class myThread (threading.Thread): for line in perturbedSeedsVFile: currentSeedsFile.write(line) bestSeedsVFile.write(line) - for j in xrange(nMicrostructures): # save new errors for all bins + for j in range(nMicrostructures): # save new errors for all bins target[j]['error'] = currentError[j] if myMatch > match: # one or more new bins have no deviation damask.util.croak( 'Stage {:d} cleared'.format(myMatch)) @@ -160,7 +159,7 @@ class myThread (threading.Thread): bestSeedsVFile = StringIO() for line in perturbedSeedsVFile: bestSeedsVFile.write(line) - for j in xrange(nMicrostructures): + for j in range(nMicrostructures): target[j]['error'] = currentError[j] randReset = True else: #--- not all grains are tessellated @@ -200,15 +199,15 @@ parser.add_option('--bins', dest='bins', type='int', metavar='int', parser.add_option('--maxseeds', dest='maxseeds', type='int', metavar='int', help='maximum number of seeds to move simulateneously [number of seeds]') -parser.set_defaults(seedFile = 'seeds') -parser.set_defaults(grid = (64,64,64)) -parser.set_defaults(threads = 2) -parser.set_defaults(randomSeed = None) -parser.set_defaults(target = 'geom') -parser.set_defaults(threshold = 20) -parser.set_defaults(bins = 15) -parser.set_defaults(scale = 1.0) -parser.set_defaults(maxseeds = 0) +parser.set_defaults(seedFile = 'seeds', + grid = (64,64,64), + threads = 2, + randomSeed = None, + target = 'geom', + threshold = 20, + bins = 15, + scale = 1.0, + maxseeds = 0) options = parser.parse_args()[0] @@ -219,8 +218,7 @@ if options.randomSeed is None: damask.util.croak(options.randomSeed) delta = (options.scale/options.grid[0],options.scale/options.grid[1],options.scale/options.grid[2]) baseFile=os.path.splitext(os.path.basename(options.seedFile))[0] -points = float(reduce(mul,options.grid)) - +points = np.array(options.grid).prod().astype('float') # ----------- calculate target distribution and bin edges targetGeomFile = os.path.splitext(os.path.basename(options.target))[0]+'.geom' @@ -231,7 +229,7 @@ nMicrostructures = info['microstructures'] targetVolFrac = np.bincount(targetGeomTable.microstructure_read(info['grid']))[1:nMicrostructures+1]/\ float(info['grid'].prod()) target=[] -for i in xrange(1,nMicrostructures+1): +for i in range(1,nMicrostructures+1): targetHist,targetBins = np.histogram(targetVolFrac,bins=i) #bin boundaries target.append({'histogram':targetHist,'bins':targetBins}) @@ -260,7 +258,7 @@ info,devNull = initialGeomTable.head_getGeom() if info['microstructures'] != nMicrostructures: damask.util.croak('error. Microstructure count mismatch') initialData = np.bincount(initialGeomTable.microstructure_read(info['grid']))/points -for i in xrange(nMicrostructures): +for i in range(nMicrostructures): initialHist = np.histogram(initialData,bins=target[i]['bins'])[0] target[i]['error']=np.sqrt(np.square(np.array(target[i]['histogram']-initialHist)).sum()) @@ -269,7 +267,7 @@ if target[0]['error'] > 0.0: target[0]['error'] *=((target[0]['bins'][0]-np.min(initialData))**2.0+ (target[0]['bins'][1]-np.max(initialData))**2.0)**0.5 match=0 -for i in xrange(nMicrostructures): +for i in range(nMicrostructures): if target[i]['error'] > 0.0: break match = i+1 diff --git a/processing/pre/seeds_fromGeom.py b/processing/pre/seeds_fromGeom.py index 1f1c2aeed..6a249065b 100755 --- a/processing/pre/seeds_fromGeom.py +++ b/processing/pre/seeds_fromGeom.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys diff --git a/processing/pre/seeds_fromPokes.py b/processing/pre/seeds_fromPokes.py index bf26591c1..3e831e906 100755 --- a/processing/pre/seeds_fromPokes.py +++ b/processing/pre/seeds_fromPokes.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,math,sys @@ -105,12 +105,11 @@ for name in filenames: grid = np.zeros(3,'i') n = 0 - for i in xrange(Nx): - for j in xrange(Ny): + for i in range(Nx): + for j in range(Ny): grid[0] = round((i+0.5)*box[0]*info['grid'][0]/Nx-0.5)+offset[0] grid[1] = round((j+0.5)*box[1]*info['grid'][1]/Ny-0.5)+offset[1] - damask.util.croak('x,y coord on surface: {},{}...'.format(*grid[:2])) - for k in xrange(Nz): + for k in range(Nz): grid[2] = k + offset[2] grid %= info['grid'] seeds[n,0:3] = (0.5+grid)/info['grid'] # normalize coordinates to box diff --git a/processing/pre/seeds_fromRandom.py b/processing/pre/seeds_fromRandom.py index cf3db1b36..0df292ed2 100755 --- a/processing/pre/seeds_fromRandom.py +++ b/processing/pre/seeds_fromRandom.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python2 +#!/usr/bin/env python2.7 # -*- coding: UTF-8 no BOM -*- import os,sys,math,random @@ -14,12 +14,12 @@ scriptID = ' '.join([scriptName,damask.version]) # ------------------------------------------ aux functions --------------------------------- def kdtree_search(cloud, queryPoints): - """find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d)""" + """Find distances to nearest neighbor among cloud (N,d) for each of the queryPoints (n,d)""" n = queryPoints.shape[0] distances = np.zeros(n,dtype=float) tree = spatial.cKDTree(cloud) - for i in xrange(n): + for i in range(n): distances[i], index = tree.query(queryPoints[i]) return distances @@ -29,7 +29,7 @@ def kdtree_search(cloud, queryPoints): # -------------------------------------------------------------------- parser = OptionParser(option_class=damask.extendableOption, usage='%prog [options]', description = """ -Distribute given number of points randomly within the three-dimensional cube [0.0,0.0,0.0]--[1.0,1.0,1.0]. +Distribute given number of points randomly within (a fraction of) the three-dimensional cube [0.0,0.0,0.0]--[1.0,1.0,1.0]. Reports positions with random crystal orientations in seeds file format to STDOUT. """, version = scriptID) @@ -38,6 +38,11 @@ parser.add_option('-N', dest = 'N', type = 'int', metavar = 'int', help = 'number of seed points [%default]') +parser.add_option('-f', + '--fraction', + dest = 'fraction', + type = 'float', nargs = 3, metavar = 'float float float', + help='fractions along x,y,z of unit cube to fill %default') parser.add_option('-g', '--grid', dest = 'grid', @@ -86,8 +91,7 @@ group.add_option( '-s', action = 'store_true', dest = 'selective', help = 'selective picking of seed points from random seed points [%default]') -group.add_option( '-f', - '--force', +group.add_option( '--force', action = 'store_true', dest = 'force', help = 'try selective picking despite large seed point number [%default]') @@ -103,6 +107,7 @@ parser.add_option_group(group) parser.set_defaults(randomSeed = None, grid = (16,16,16), + fraction = (1.0,1.0,1.0), N = 20, weights = False, max = 0.0, @@ -118,6 +123,7 @@ parser.set_defaults(randomSeed = None, (options,filenames) = parser.parse_args() +options.fraction = np.array(options.fraction) options.grid = np.array(options.grid) gridSize = options.grid.prod() @@ -160,16 +166,25 @@ for name in filenames: grainEuler[2,:] *= 360.0 # phi_2 is uniformly distributed if not options.selective: + seeds = np.array([]) + + while len(seeds) < options.N: - seeds = np.zeros((3,options.N),dtype='d') # seed positions array - gridpoints = random.sample(range(gridSize),options.N) # choose first N from random permutation of grid positions + theSeeds = np.zeros((options.N,3),dtype=float) # seed positions array + gridpoints = random.sample(range(gridSize),options.N) # choose first N from random permutation of grid positions - seeds[0,:] = (np.mod(gridpoints ,options.grid[0])\ - +np.random.random(options.N)) /options.grid[0] - seeds[1,:] = (np.mod(gridpoints// options.grid[0] ,options.grid[1])\ - +np.random.random(options.N)) /options.grid[1] - seeds[2,:] = (np.mod(gridpoints//(options.grid[1]*options.grid[0]),options.grid[2])\ - +np.random.random(options.N)) /options.grid[2] + theSeeds[:,0] = (np.mod(gridpoints ,options.grid[0])\ + +np.random.random(options.N)) /options.grid[0] + theSeeds[:,1] = (np.mod(gridpoints// options.grid[0] ,options.grid[1])\ + +np.random.random(options.N)) /options.grid[1] + theSeeds[:,2] = (np.mod(gridpoints//(options.grid[1]*options.grid[0]),options.grid[2])\ + +np.random.random(options.N)) /options.grid[2] + + goodSeeds = theSeeds[np.all(theSeeds<=options.fraction,axis=1)] # pick seeds within threshold fraction + seeds = goodSeeds if len(seeds) == 0 else np.vstack((seeds,goodSeeds)) + if len(seeds) > options.N: seeds = seeds[:min(options.N,len(seeds))] + + seeds = seeds.T # switch layout to point index as last index else: @@ -212,8 +227,8 @@ for name in filenames: "randomSeed\t{}".format(options.randomSeed), ]) table.labels_clear() - table.labels_append( ['{dim}_{label}'.format(dim = 1+k,label = 'pos') for k in xrange(3)] + - ['{dim}_{label}'.format(dim = 1+k,label = 'euler') for k in xrange(3)] + + table.labels_append( ['{dim}_{label}'.format(dim = 1+k,label = 'pos') for k in range(3)] + + ['{dim}_{label}'.format(dim = 1+k,label = 'euler') for k in range(3)] + ['microstructure'] + (['weight'] if options.weights else [])) table.head_write() diff --git a/src/CPFEM.f90 b/src/CPFEM.f90 index 0774fba86..a1dac9801 100644 --- a/src/CPFEM.f90 +++ b/src/CPFEM.f90 @@ -10,7 +10,6 @@ module CPFEM implicit none private -#if defined(Marc4DAMASK) || defined(Abaqus) real(pReal), parameter, private :: & CPFEM_odd_stress = 1e15_pReal, & !< return value for stress in case of ping pong dummy cycle CPFEM_odd_jacobian = 1e50_pReal !< return value for jacobian in case of ping pong dummy cycle @@ -20,7 +19,6 @@ module CPFEM CPFEM_dcsdE !< Cauchy stress tangent real(pReal), dimension (:,:,:,:), allocatable, private :: & CPFEM_dcsdE_knownGood !< known good tangent -#endif integer(pInt), public :: & cycleCounter = 0_pInt, & !< needs description theInc = -1_pInt, & !< needs description @@ -83,10 +81,6 @@ subroutine CPFEM_initAll(el,ip) use IO, only: & IO_init use DAMASK_interface -#ifdef FEM - use FEZoo, only: & - FEZoo_init -#endif implicit none integer(pInt), intent(in) :: el, & !< FE el number @@ -97,9 +91,6 @@ subroutine CPFEM_initAll(el,ip) call DAMASK_interface_init ! Spectral and FEM interface to commandline call prec_init call IO_init -#ifdef FEM - call FEZoo_init -#endif call numerics_init call debug_init call math_init @@ -138,16 +129,12 @@ subroutine CPFEM_init debug_levelBasic, & debug_levelExtensive use FEsolving, only: & -#if defined(Marc4DAMASK) || defined(Abaqus) symmetricSolver, & -#endif restartRead, & modelName -#if defined(Marc4DAMASK) || defined(Abaqus) use mesh, only: & mesh_NcpElems, & mesh_maxNips -#endif use material, only: & material_phase, & homogState, & @@ -173,12 +160,10 @@ subroutine CPFEM_init #include "compilation_info.f90" endif mainProcess -#if defined(Marc4DAMASK) || defined(Abaqus) ! initialize stress and jacobian to zero allocate(CPFEM_cs(6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_cs = 0.0_pReal allocate(CPFEM_dcsdE(6,6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_dcsdE = 0.0_pReal allocate(CPFEM_dcsdE_knownGood(6,6,mesh_maxNips,mesh_NcpElems)) ; CPFEM_dcsdE_knownGood = 0.0_pReal -#endif ! *** restore the last converged values of each essential variable from the binary file if (restartRead) then @@ -243,21 +228,17 @@ subroutine CPFEM_init enddo readHomogInstances close (777) -#if defined(Marc4DAMASK) || defined(Abaqus) call IO_read_realFile(777,'convergeddcsdE',modelName,size(CPFEM_dcsdE)) read (777,rec=1) CPFEM_dcsdE close (777) -#endif restartRead = .false. endif -#if defined(Marc4DAMASK) || defined(Abaqus) if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0) then write(6,'(a32,1x,6(i8,1x))') 'CPFEM_cs: ', shape(CPFEM_cs) write(6,'(a32,1x,6(i8,1x))') 'CPFEM_dcsdE: ', shape(CPFEM_dcsdE) write(6,'(a32,1x,6(i8,1x),/)') 'CPFEM_dcsdE_knownGood: ', shape(CPFEM_dcsdE_knownGood) write(6,'(a32,l1)') 'symmetricSolver: ', symmetricSolver endif -#endif flush(6) end subroutine CPFEM_init @@ -266,11 +247,7 @@ end subroutine CPFEM_init !-------------------------------------------------------------------------------------------------- !> @brief perform initialization at first call, update variables and call the actual material model !-------------------------------------------------------------------------------------------------- -#if defined(Marc4DAMASK) || defined(Abaqus) subroutine CPFEM_general(mode, parallelExecution, ffn, ffn1, temperature_inp, dt, elFE, ip, cauchyStress, jacobian) -#else -subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) -#endif use numerics, only: & defgradTolerance, & iJacoStiffness, & @@ -281,7 +258,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) debug_levelBasic, & debug_levelExtensive, & debug_levelSelective, & -#if defined(Marc4DAMASK) || defined(Abaqus) debug_stressMaxLocation, & debug_stressMinLocation, & debug_jacobianMaxLocation, & @@ -290,7 +266,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) debug_stressMin, & debug_jacobianMax, & debug_jacobianMin, & -#endif debug_e, & debug_i use FEsolving, only: & @@ -348,12 +323,10 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) use homogenization, only: & materialpoint_F, & materialpoint_F0, & -#if defined(Marc4DAMASK) || defined(Abaqus) materialpoint_P, & materialpoint_dPdF, & materialpoint_results, & materialpoint_sizeResults, & -#endif materialpoint_stressAndItsTangent, & materialpoint_postResults use IO, only: & @@ -368,7 +341,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) real(pReal), dimension (3,3), intent(in) :: ffn, & !< deformation gradient for t=t0 ffn1 !< deformation gradient for t=t1 integer(pInt), intent(in) :: mode !< computation mode 1: regular computation plus aging of results -#if defined(Marc4DAMASK) || defined(Abaqus) real(pReal), intent(in) :: temperature_inp !< temperature logical, intent(in) :: parallelExecution !< flag indicating parallel computation of requested IPs real(pReal), dimension(6), intent(out) :: cauchyStress !< stress vector in Mandel notation @@ -381,20 +353,13 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) real(pReal), dimension (3,3,3,3) :: H_sym, & H, & jacobian3333 ! jacobian in Matrix notation -#else - logical, parameter :: parallelExecution = .true. -#endif integer(pInt) elCP, & ! crystal plasticity element number i, j, k, l, m, n, ph, homog, mySource logical updateJaco ! flag indicating if JAcobian has to be updated character(len=1024) :: rankStr -#if defined(Marc4DAMASK) || defined(Abaqus) elCP = mesh_FEasCP('elem',elFE) -#else - elCP = elFE -#endif if (iand(debug_level(debug_CPFEM), debug_levelBasic) /= 0_pInt & .and. elCP == debug_e .and. ip == debug_i) then @@ -411,13 +376,10 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) write(6,'(a,/)') '#############################################'; flush (6) endif - -#if defined(Marc4DAMASK) || defined(Abaqus) if (iand(mode, CPFEM_BACKUPJACOBIAN) /= 0_pInt) & CPFEM_dcsde_knownGood = CPFEM_dcsde if (iand(mode, CPFEM_RESTOREJACOBIAN) /= 0_pInt) & CPFEM_dcsde = CPFEM_dcsde_knownGood -#endif !*** age results and write restart data if requested if (iand(mode, CPFEM_AGERESULTS) /= 0_pInt) then @@ -514,11 +476,9 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) enddo writeHomogInstances close (777) -#if defined(Marc4DAMASK) || defined(Abaqus) call IO_write_jobRealFile(777,'convergeddcsdE',size(CPFEM_dcsdE)) write (777,rec=1) CPFEM_dcsdE close (777) -#endif endif endif ! results aging @@ -529,22 +489,18 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) !* If no parallel execution is required, there is no need to collect FEM input if (.not. parallelExecution) then -#if defined(Marc4DAMASK) || defined(Abaqus) temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & temperature_inp -#endif materialpoint_F0(1:3,1:3,ip,elCP) = ffn materialpoint_F(1:3,1:3,ip,elCP) = ffn1 elseif (iand(mode, CPFEM_COLLECT) /= 0_pInt) then -#if defined(Marc4DAMASK) || defined(Abaqus) call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal CPFEM_cs(1:6,ip,elCP) = rnd * CPFEM_odd_stress CPFEM_dcsde(1:6,1:6,ip,elCP) = CPFEM_odd_jacobian * math_identity2nd(6) temperature(material_homog(ip,elCP))%p(thermalMapping(material_homog(ip,elCP))%p(ip,elCP)) = & temperature_inp -#endif materialpoint_F0(1:3,1:3,ip,elCP) = ffn materialpoint_F(1:3,1:3,ip,elCP) = ffn1 CPFEM_calc_done = .false. @@ -569,12 +525,10 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) endif outdatedFFN1 = .true. endif -#if defined(Marc4DAMASK) || defined(Abaqus) call random_number(rnd) if (rnd < 0.5_pReal) rnd = rnd - 1.0_pReal CPFEM_cs(1:6,ip,elCP) = rnd*CPFEM_odd_stress CPFEM_dcsde(1:6,1:6,ip,elCP) = CPFEM_odd_jacobian*math_identity2nd(6) -#endif !*** deformation gradient is not outdated @@ -607,7 +561,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) endif !* map stress and stiffness (or return odd values if terminally ill) -#if defined(Marc4DAMASK) || defined(Abaqus) terminalIllness: if ( terminallyIll ) then call random_number(rnd) @@ -648,11 +601,8 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) CPFEM_dcsde(1:6,1:6,ip,elCP) = math_Mandel3333to66(J_inverse * H_sym) endif terminalIllness -#endif - endif validCalculation -#if defined(Marc4DAMASK) || defined(Abaqus) !* report stress and stiffness if ((iand(debug_level(debug_CPFEM), debug_levelExtensive) /= 0_pInt) & .and. ((debug_e == elCP .and. debug_i == ip) & @@ -663,11 +613,9 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) '<< CPFEM >> Jacobian/GPa at elFE ip ', elFE, ip, transpose(CPFEM_dcsdE(1:6,1:6,ip,elCP))*1.0e-9_pReal flush(6) endif -#endif endif -#if defined(Marc4DAMASK) || defined(Abaqus) !*** warn if stiffness close to zero if (all(abs(CPFEM_dcsdE(1:6,1:6,ip,elCP)) < 1e-10_pReal)) call IO_warning(601,elCP,ip) @@ -696,7 +644,6 @@ subroutine CPFEM_general(mode, ffn, ffn1, dt, elFE, ip) debug_jacobianMinLocation = [elCP, ip] debug_jacobianMin = minval(jacobian3333) endif -#endif end subroutine CPFEM_general diff --git a/src/CPFEM2.f90 b/src/CPFEM2.f90 index 51a26dc55..3e926ee71 100644 --- a/src/CPFEM2.f90 +++ b/src/CPFEM2.f90 @@ -43,7 +43,7 @@ subroutine CPFEM_initAll(el,ip) crystallite_init use homogenization, only: & homogenization_init, & -materialpoint_postResults + materialpoint_postResults use IO, only: & IO_init use DAMASK_interface @@ -73,7 +73,7 @@ materialpoint_postResults call crystallite_init call homogenization_init call materialpoint_postResults - call CPFEM_init + call CPFEM_init end subroutine CPFEM_initAll @@ -251,8 +251,6 @@ subroutine CPFEM_general(age, dt) crystallite_Tstar0_v, & crystallite_Tstar_v use homogenization, only: & - materialpoint_F, & - materialpoint_F0, & materialpoint_stressAndItsTangent, & materialpoint_postResults use IO, only: & diff --git a/src/C_routines.c b/src/C_routines.c index 7be6264d7..5bc09745f 100644 --- a/src/C_routines.c +++ b/src/C_routines.c @@ -9,6 +9,14 @@ /* http://stackoverflow.com/questions/30279228/is-there-an-alternative-to-getcwd-in-fortran-2003-2008 */ +int isdirectory_c(const char *dir){ + struct stat statbuf; + if(stat(dir, &statbuf) != 0) + return 0; + return S_ISDIR(statbuf.st_mode); +} + + void getcurrentworkdir_c(char cwd[], int *stat ){ char cwd_tmp[1024]; if(getcwd(cwd_tmp, sizeof(cwd_tmp)) == cwd_tmp){ @@ -20,9 +28,14 @@ void getcurrentworkdir_c(char cwd[], int *stat ){ } } -int isdirectory_c(const char *dir){ - struct stat statbuf; - if(stat(dir, &statbuf) != 0) - return 0; - return S_ISDIR(statbuf.st_mode); + +void gethostname_c(char hostname[], int *stat ){ + char hostname_tmp[1024]; + if(gethostname(hostname_tmp, sizeof(hostname_tmp)) == 0){ + strcpy(hostname,hostname_tmp); + *stat = 0; + } + else{ + *stat = 1; + } } diff --git a/src/DAMASK_abaqus_std.f b/src/DAMASK_abaqus_std.f index cdd12dac8..d15682c58 100644 --- a/src/DAMASK_abaqus_std.f +++ b/src/DAMASK_abaqus_std.f @@ -116,7 +116,6 @@ subroutine UMAT(STRESS,STATEV,DDSDDE,SSE,SPD,SCD,& CPFEM_CALCRESULTS, & CPFEM_AGERESULTS, & CPFEM_COLLECT, & - CPFEM_RESTOREJACOBIAN, & CPFEM_BACKUPJACOBIAN, & cycleCounter, & theInc, & diff --git a/src/DAMASK_marc.f90 b/src/DAMASK_marc.f90 index a4542f96a..8425f3e1e 100644 --- a/src/DAMASK_marc.f90 +++ b/src/DAMASK_marc.f90 @@ -240,17 +240,17 @@ subroutine hypela2(d,g,e,de,s,t,dt,ngens,m,nn,kcus,matus,ndi,nshear,disp, & real(pReal), dimension(6) :: stress real(pReal), dimension(6,6) :: ddsdde integer(pInt) :: computationMode, i, cp_en, node, CPnodeID - !$ integer :: defaultNumThreadsInt !< default value set by Marc + !$ integer(4) :: defaultNumThreadsInt !< default value set by Marc if (iand(debug_level(debug_MARC),debug_LEVELBASIC) /= 0_pInt) then write(6,'(a,/,i8,i8,i2)') ' MSC.MARC information on shape of element(2), IP:', m, nn - write(6,'(a,2(1i))'), ' Jacobian: ', ngens,ngens - write(6,'(a,1i)'), ' Direct stress: ', ndi - write(6,'(a,1i)'), ' Shear stress: ', nshear - write(6,'(a,1i)'), ' DoF: ', ndeg - write(6,'(a,1i)'), ' Coordinates: ', ncrd - write(6,'(a,1i)'), ' Nodes: ', nnode - write(6,'(a,1i)'), ' Deformation gradient: ', itel + write(6,'(a,2(i1))') ' Jacobian: ', ngens,ngens + write(6,'(a,i1)') ' Direct stress: ', ndi + write(6,'(a,i1)') ' Shear stress: ', nshear + write(6,'(a,i2)') ' DoF: ', ndeg + write(6,'(a,i2)') ' Coordinates: ', ncrd + write(6,'(a,i12)') ' Nodes: ', nnode + write(6,'(a,i1)') ' Deformation gradient: ', itel write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n:', & math_transpose33(ffn) write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' Deformation gradient at t=n+1:', & @@ -421,4 +421,4 @@ subroutine plotv(v,s,sp,etot,eplas,ecreep,t,m,nn,layer,ndi,nshear,jpltcd) if (jpltcd > materialpoint_sizeResults) call IO_error(700_pInt,jpltcd) ! complain about out of bounds error v = materialpoint_results(jpltcd,nn,mesh_FEasCP('elem', m)) -end subroutine plotv \ No newline at end of file +end subroutine plotv diff --git a/src/DAMASK_spectral.f90 b/src/DAMASK_spectral.f90 index e999bf5dc..6f1794e35 100644 --- a/src/DAMASK_spectral.f90 +++ b/src/DAMASK_spectral.f90 @@ -81,7 +81,7 @@ program DAMASK_spectral use spectral_mech_Polarisation use spectral_damage use spectral_thermal - + implicit none @@ -93,9 +93,9 @@ program DAMASK_spectral logical, dimension(9) :: temp_maskVector = .false. !< temporarily from loadcase file when reading in tensors integer(pInt), parameter :: FILEUNIT = 234_pInt !< file unit, DAMASK IO does not support newunit feature integer(pInt), allocatable, dimension(:) :: chunkPos - + integer(pInt) :: & - N_t = 0_pInt, & !< # of time indicators found in load case file + N_t = 0_pInt, & !< # of time indicators found in load case file N_n = 0_pInt, & !< # of increment specifiers found in load case file N_def = 0_pInt !< # of rate of deformation specifiers found in load case file character(len=65536) :: & @@ -105,7 +105,7 @@ program DAMASK_spectral ! loop variables, convergence etc. real(pReal), dimension(3,3), parameter :: & ones = 1.0_pReal, & - zeros = 0.0_pReal + zeros = 0.0_pReal integer(pInt), parameter :: & subStepFactor = 2_pInt !< for each substep, divide the last time increment by 2.0 real(pReal) :: & @@ -139,6 +139,7 @@ program DAMASK_spectral integer(MPI_OFFSET_KIND) :: fileOffset integer(MPI_OFFSET_KIND), dimension(:), allocatable :: outputSize integer(pInt), parameter :: maxByteOut = 2147483647-4096 !< limit of one file output write https://trac.mpich.org/projects/mpich/ticket/1742 + integer(pInt), parameter :: maxRealOut = maxByteOut/pReal integer(pLongInt), dimension(2) :: outputIndex PetscErrorCode :: ierr external :: & @@ -149,18 +150,17 @@ program DAMASK_spectral MPI_file_get_position, & MPI_file_write, & MPI_abort, & + MPI_finalize, & MPI_allreduce, & PETScFinalize !-------------------------------------------------------------------------------------------------- ! init DAMASK (all modules) call CPFEM_initAll(el = 1_pInt, ip = 1_pInt) - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- DAMASK_spectral init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- DAMASK_spectral init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - + !-------------------------------------------------------------------------------------------------- ! initialize field solver information nActiveFields = 1 @@ -192,20 +192,20 @@ program DAMASK_spectral if ((N_def /= N_n) .or. (N_n /= N_t) .or. N_n < 1_pInt) & ! sanity check call IO_error(error_ID=837_pInt,ext_msg = trim(loadCaseFile)) ! error message for incomplete loadcase allocate (loadCases(N_n)) ! array of load cases - loadCases%P%myType='p' - + loadCases%stress%myType='stress' + do i = 1, size(loadCases) allocate(loadCases(i)%ID(nActiveFields)) field = 1 loadCases(i)%ID(field) = FIELD_MECH_ID ! mechanical active by default - if (any(thermal_type == THERMAL_conduction_ID)) then ! thermal field active + thermalActive: if (any(thermal_type == THERMAL_conduction_ID)) then field = field + 1 - loadCases(i)%ID(field) = FIELD_THERMAL_ID - endif - if (any(damage_type == DAMAGE_nonlocal_ID)) then ! damage field active + loadCases(i)%ID(field) = FIELD_THERMAL_ID + endif thermalActive + damageActive: if (any(damage_type == DAMAGE_nonlocal_ID)) then field = field + 1 loadCases(i)%ID(field) = FIELD_DAMAGE_ID - endif + endif damageActive enddo !-------------------------------------------------------------------------------------------------- @@ -231,12 +231,10 @@ program DAMASK_spectral endif do j = 1_pInt, 9_pInt temp_maskVector(j) = IO_stringValue(line,chunkPos,i+j) /= '*' ! true if not a * - enddo - do j = 1_pInt,9_pInt if (temp_maskVector(j)) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) ! read value where applicable enddo loadCases(currentLoadCase)%deformation%maskLogical = & ! logical mask in 3x3 notation - transpose(reshape(temp_maskVector,[ 3,3])) + transpose(reshape(temp_maskVector,[ 3,3])) loadCases(currentLoadCase)%deformation%maskFloat = & ! float (1.0/0.0) mask in 3x3 notation merge(ones,zeros,loadCases(currentLoadCase)%deformation%maskLogical) loadCases(currentLoadCase)%deformation%values = math_plain9to33(temp_valueVector) ! values in 3x3 notation @@ -244,14 +242,12 @@ program DAMASK_spectral temp_valueVector = 0.0_pReal do j = 1_pInt, 9_pInt temp_maskVector(j) = IO_stringValue(line,chunkPos,i+j) /= '*' ! true if not an asterisk - enddo - do j = 1_pInt,9_pInt if (temp_maskVector(j)) temp_valueVector(j) = IO_floatValue(line,chunkPos,i+j) ! read value where applicable enddo - loadCases(currentLoadCase)%P%maskLogical = transpose(reshape(temp_maskVector,[ 3,3])) - loadCases(currentLoadCase)%P%maskFloat = merge(ones,zeros,& - loadCases(currentLoadCase)%P%maskLogical) - loadCases(currentLoadCase)%P%values = math_plain9to33(temp_valueVector) + loadCases(currentLoadCase)%stress%maskLogical = transpose(reshape(temp_maskVector,[ 3,3])) + loadCases(currentLoadCase)%stress%maskFloat = merge(ones,zeros,& + loadCases(currentLoadCase)%stress%maskLogical) + loadCases(currentLoadCase)%stress%values = math_plain9to33(temp_valueVector) case('t','time','delta') ! increment time loadCases(currentLoadCase)%time = IO_floatValue(line,chunkPos,i+1_pInt) case('n','incs','increments','steps') ! number of increments @@ -260,10 +256,10 @@ program DAMASK_spectral loadCases(currentLoadCase)%incs = IO_intValue(line,chunkPos,i+1_pInt) loadCases(currentLoadCase)%logscale = 1_pInt case('freq','frequency','outputfreq') ! frequency of result writings - loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,chunkPos,i+1_pInt) + loadCases(currentLoadCase)%outputfrequency = IO_intValue(line,chunkPos,i+1_pInt) case('r','restart','restartwrite') ! frequency of writing restart information loadCases(currentLoadCase)%restartfrequency = & - max(0_pInt,IO_intValue(line,chunkPos,i+1_pInt)) + max(0_pInt,IO_intValue(line,chunkPos,i+1_pInt)) case('guessreset','dropguessing') loadCases(currentLoadCase)%followFormerTrajectory = .false. ! do not continue to predict deformation along former trajectory case('euler') ! rotation of currentLoadCase given in euler angles @@ -272,10 +268,10 @@ program DAMASK_spectral k = 1_pInt ! assuming keyword indicating degree/radians present select case (IO_lc(IO_stringValue(line,chunkPos,i+1_pInt))) case('deg','degree') - case('rad','radian') ! don't convert from degree to radian + case('rad','radian') ! don't convert from degree to radian l = 0_pInt - case default - k = 0_pInt + case default + k = 0_pInt end select do j = 1_pInt, 3_pInt temp_valueVector(j) = IO_floatValue(line,chunkPos,i+k+j) @@ -290,7 +286,7 @@ program DAMASK_spectral loadCases(currentLoadCase)%rotation = math_plain9to33(temp_valueVector) end select enddo; enddo - close(FILEUNIT) + close(FILEUNIT) !-------------------------------------------------------------------------------------------------- ! consistency checks and output of load case @@ -302,14 +298,14 @@ program DAMASK_spectral write(6,'(1x,a,i6)') 'load case: ', currentLoadCase if (.not. loadCases(currentLoadCase)%followFormerTrajectory) & write(6,'(2x,a)') 'drop guessing along trajectory' - if (loadCases(currentLoadCase)%deformation%myType=='l') then + if (loadCases(currentLoadCase)%deformation%myType == 'l') then do j = 1_pInt, 3_pInt if (any(loadCases(currentLoadCase)%deformation%maskLogical(j,1:3) .eqv. .true.) .and. & any(loadCases(currentLoadCase)%deformation%maskLogical(j,1:3) .eqv. .false.)) & errorID = 832_pInt ! each row should be either fully or not at all defined enddo write(6,'(2x,a)') 'velocity gradient:' - else if (loadCases(currentLoadCase)%deformation%myType=='f') then + else if (loadCases(currentLoadCase)%deformation%myType == 'f') then write(6,'(2x,a)') 'deformation gradient at end of load case:' else write(6,'(2x,a)') 'deformation gradient rate:' @@ -318,27 +314,27 @@ program DAMASK_spectral if(loadCases(currentLoadCase)%deformation%maskLogical(i,j)) then write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%deformation%values(i,j) else - write(6,'(2x,12a)',advance='no') ' * ' + write(6,'(2x,12a)',advance='no') ' * ' endif enddo; write(6,'(/)',advance='no') enddo - if (any(loadCases(currentLoadCase)%P%maskLogical .eqv. & - loadCases(currentLoadCase)%deformation%maskLogical)) errorID = 831_pInt ! exclusive or masking only - if (any(loadCases(currentLoadCase)%P%maskLogical .and. & - transpose(loadCases(currentLoadCase)%P%maskLogical) .and. & + if (any(loadCases(currentLoadCase)%stress%maskLogical .eqv. & + loadCases(currentLoadCase)%deformation%maskLogical)) errorID = 831_pInt ! exclusive or masking only + if (any(loadCases(currentLoadCase)%stress%maskLogical .and. & + transpose(loadCases(currentLoadCase)%stress%maskLogical) .and. & reshape([ .false.,.true.,.true.,.true.,.false.,.true.,.true.,.true.,.false.],[ 3,3]))) & errorID = 838_pInt ! no rotation is allowed by stress BC write(6,'(2x,a)') 'stress / GPa:' do i = 1_pInt, 3_pInt; do j = 1_pInt, 3_pInt - if(loadCases(currentLoadCase)%P%maskLogical(i,j)) then - write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%P%values(i,j)*1e-9_pReal + if(loadCases(currentLoadCase)%stress%maskLogical(i,j)) then + write(6,'(2x,f12.7)',advance='no') loadCases(currentLoadCase)%stress%values(i,j)*1e-9_pReal else - write(6,'(2x,12a)',advance='no') ' * ' + write(6,'(2x,12a)',advance='no') ' * ' endif enddo; write(6,'(/)',advance='no') enddo if (any(abs(math_mul33x33(loadCases(currentLoadCase)%rotation, & - math_transpose33(loadCases(currentLoadCase)%rotation))-math_I3) >& + math_transpose33(loadCases(currentLoadCase)%rotation))-math_I3) > & reshape(spread(tol_math_check,1,9),[ 3,3]))& .or. abs(math_det33(loadCases(currentLoadCase)%rotation)) > & 1.0_pReal + tol_math_check) errorID = 846_pInt ! given rotation matrix contains strain @@ -359,7 +355,7 @@ program DAMASK_spectral endif !-------------------------------------------------------------------------------------------------- -! doing initialization depending on selected solver +! doing initialization depending on selected solver call Utilities_init() do field = 1, nActiveFields select case (loadCases(1)%ID(field)) @@ -371,26 +367,26 @@ program DAMASK_spectral if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') call AL_init - + case (DAMASK_spectral_SolverPolarisation_label) if(iand(debug_level(debug_spectral),debug_levelBasic)/= 0 .and. worldrank == 0_pInt) & call IO_warning(42_pInt, ext_msg='debug Divergence') call Polarisation_init - + case default - call IO_error(error_ID = 891, ext_msg = trim(spectral_solver)) + call IO_error(error_ID = 891_pInt, ext_msg = trim(spectral_solver)) end select case(FIELD_THERMAL_ID) call spectral_thermal_init - + case(FIELD_DAMAGE_ID) call spectral_damage_init() end select enddo - + !-------------------------------------------------------------------------------------------------- ! write header of output file if (worldrank == 0) then @@ -409,7 +405,7 @@ program DAMASK_spectral write(resUnit) 'logscales:', loadCases%logscale write(resUnit) 'increments:', loadCases%incs ! one entry per LoadCase write(resUnit) 'startingIncrement:', restartInc - 1_pInt ! start with writing out the previous inc - write(resUnit) 'eoh' + write(resUnit) 'eoh' close(resUnit) ! end of header open(newunit=statUnit,file=trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//& '.sta',form='FORMATTED',status='REPLACE') @@ -428,29 +424,30 @@ program DAMASK_spectral allocate(outputSize(worldsize), source = 0_MPI_OFFSET_KIND) outputSize(worldrank+1) = size(materialpoint_results,kind=MPI_OFFSET_KIND)*int(pReal,MPI_OFFSET_KIND) call MPI_allreduce(MPI_IN_PLACE,outputSize,worldsize,MPI_LONG,MPI_SUM,PETSC_COMM_WORLD,ierr) ! get total output size over each process - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_allreduce') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_allreduce') call MPI_file_open(PETSC_COMM_WORLD, & trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'.spectralOut', & MPI_MODE_WRONLY + MPI_MODE_APPEND, & MPI_INFO_NULL, & resUnit, & ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_open') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_open') call MPI_file_get_position(resUnit,fileOffset,ierr) ! get offset from header - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_get_position') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_get_position') fileOffset = fileOffset + sum(outputSize(1:worldrank)) ! offset of my process in file (header + processes before me) call MPI_file_seek (resUnit,fileOffset,MPI_SEEK_SET,ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_seek') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_seek') if (.not. appendToOutFile) then ! if not restarting, write 0th increment - do i=1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output - outputIndex=int([(i-1_pInt)*((maxByteOut/pReal)/materialpoint_sizeResults)+1_pInt, & - min(i*((maxByteOut/pReal)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) - call MPI_file_write(resUnit,reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)),& - [(outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults]), & - (outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults,& + do i = 1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output + outputIndex = int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & + min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) + call MPI_file_write(resUnit, & + reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)), & + [(outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults]), & + (outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults, & MPI_DOUBLE, MPI_STATUS_IGNORE, ierr) - if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_write') + if (ierr /= 0_pInt) call IO_error(error_ID=894_pInt, ext_msg='MPI_file_write') enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position if (worldrank == 0) & @@ -459,7 +456,7 @@ program DAMASK_spectral !-------------------------------------------------------------------------------------------------- ! loopping over loadcases loadCaseLooping: do currentLoadCase = 1_pInt, size(loadCases) - time0 = time ! currentLoadCase start time + time0 = time ! currentLoadCase start time guess = loadCases(currentLoadCase)%followFormerTrajectory ! change of load case? homogeneous guess for the first inc !-------------------------------------------------------------------------------------------------- @@ -471,11 +468,11 @@ program DAMASK_spectral ! forwarding time timeIncOld = timeinc if (loadCases(currentLoadCase)%logscale == 0_pInt) then ! linear scale - timeinc = loadCases(currentLoadCase)%time/loadCases(currentLoadCase)%incs ! only valid for given linear time scale. will be overwritten later in case loglinear scale is used + timeinc = loadCases(currentLoadCase)%time/real(loadCases(currentLoadCase)%incs,pReal) ! only valid for given linear time scale. will be overwritten later in case loglinear scale is used else - if (currentLoadCase == 1_pInt) then ! 1st currentLoadCase of logarithmic scale + if (currentLoadCase == 1_pInt) then ! 1st currentLoadCase of logarithmic scale if (inc == 1_pInt) then ! 1st inc of 1st currentLoadCase of logarithmic scale - timeinc = loadCases(1)%time*(2.0_pReal**real( 1_pInt-loadCases(1)%incs ,pReal)) ! assume 1st inc is equal to 2nd + timeinc = loadCases(1)%time*(2.0_pReal**real( 1_pInt-loadCases(1)%incs ,pReal)) ! assume 1st inc is equal to 2nd else ! not-1st inc of 1st currentLoadCase of logarithmic scale timeinc = loadCases(1)%time*(2.0_pReal**real(inc-1_pInt-loadCases(1)%incs ,pReal)) endif @@ -489,16 +486,16 @@ program DAMASK_spectral endif timeinc = timeinc / 2.0_pReal**real(cutBackLevel,pReal) ! depending on cut back level, decrease time step - forwarding: if(totalIncsCounter >= restartInc) then + forwarding: if (totalIncsCounter >= restartInc) then stepFraction = 0_pInt !-------------------------------------------------------------------------------------------------- -! loop over sub incs +! loop over sub incs subIncLooping: do while (stepFraction/subStepFactor**cutBackLevel <1_pInt) time = time + timeinc ! forward time - stepFraction = stepFraction + 1_pInt + stepFraction = stepFraction + 1_pInt remainingLoadCaseTime = time0 - time + loadCases(currentLoadCase)%time + timeInc - + !-------------------------------------------------------------------------------------------------- ! report begin of new increment if (worldrank == 0) then @@ -516,7 +513,7 @@ program DAMASK_spectral ',a,'//IO_intOut(stepFraction)//',a,'//IO_intOut(subStepFactor**cutBackLevel)//')') & 'Increment ',totalIncsCounter,'/',sum(loadCases%incs),& '-',stepFraction, '/', subStepFactor**cutBackLevel - endif + endif !-------------------------------------------------------------------------------------------------- ! forward fields @@ -527,33 +524,28 @@ program DAMASK_spectral case (DAMASK_spectral_SolverBasicPETSc_label) call BasicPETSc_forward (& guess,timeinc,timeIncOld,remainingLoadCaseTime, & - F_BC = loadCases(currentLoadCase)%deformation, & - P_BC = loadCases(currentLoadCase)%P, & + deformation_BC = loadCases(currentLoadCase)%deformation, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) case (DAMASK_spectral_SolverAL_label) call AL_forward (& guess,timeinc,timeIncOld,remainingLoadCaseTime, & - F_BC = loadCases(currentLoadCase)%deformation, & - P_BC = loadCases(currentLoadCase)%P, & + deformation_BC = loadCases(currentLoadCase)%deformation, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) case (DAMASK_spectral_SolverPolarisation_label) call Polarisation_forward (& guess,timeinc,timeIncOld,remainingLoadCaseTime, & - F_BC = loadCases(currentLoadCase)%deformation, & - P_BC = loadCases(currentLoadCase)%P, & + deformation_BC = loadCases(currentLoadCase)%deformation, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) - end select - - case(FIELD_THERMAL_ID) - call spectral_thermal_forward (& - guess,timeinc,timeIncOld,remainingLoadCaseTime) - - case(FIELD_DAMAGE_ID) - call spectral_damage_forward (& - guess,timeinc,timeIncOld,remainingLoadCaseTime) + end select + + case(FIELD_THERMAL_ID); call spectral_thermal_forward() + case(FIELD_DAMAGE_ID); call spectral_damage_forward() end select - enddo - + enddo + !-------------------------------------------------------------------------------------------------- ! solve fields stagIter = 0_pInt @@ -565,47 +557,42 @@ program DAMASK_spectral select case (spectral_solver) case (DAMASK_spectral_SolverBasicPETSc_label) solres(field) = BasicPETSC_solution (& - incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & - P_BC = loadCases(currentLoadCase)%P, & - F_BC = loadCases(currentLoadCase)%deformation, & + incInfo,timeinc,timeIncOld, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) - + case (DAMASK_spectral_SolverAL_label) solres(field) = AL_solution (& - incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & - P_BC = loadCases(currentLoadCase)%P, & - F_BC = loadCases(currentLoadCase)%deformation, & + incInfo,timeinc,timeIncOld, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) - + case (DAMASK_spectral_SolverPolarisation_label) solres(field) = Polarisation_solution (& - incInfo,guess,timeinc,timeIncOld,remainingLoadCaseTime, & - P_BC = loadCases(currentLoadCase)%P, & - F_BC = loadCases(currentLoadCase)%deformation, & + incInfo,timeinc,timeIncOld, & + stress_BC = loadCases(currentLoadCase)%stress, & rotation_BC = loadCases(currentLoadCase)%rotation) - - end select - + + end select + case(FIELD_THERMAL_ID) - solres(field) = spectral_thermal_solution (& - guess,timeinc,timeIncOld,remainingLoadCaseTime) - + solres(field) = spectral_thermal_solution(timeinc,timeIncOld,remainingLoadCaseTime) + case(FIELD_DAMAGE_ID) - solres(field) = spectral_damage_solution (& - guess,timeinc,timeIncOld,remainingLoadCaseTime) + solres(field) = spectral_damage_solution(timeinc,timeIncOld,remainingLoadCaseTime) end select - if(.not. solres(field)%converged) exit ! no solution found + if (.not. solres(field)%converged) exit ! no solution found enddo stagIter = stagIter + 1_pInt stagIterate = stagIter < stagItMax .and. & all(solres(:)%converged) .and. & .not. all(solres(:)%stagConverged) - enddo + enddo !-------------------------------------------------------------------------------------------------- -! check solution - cutBack = .False. +! check solution + cutBack = .False. if(solres(1)%termIll .or. .not. all(solres(:)%converged .and. solres(:)%stagConverged)) then ! no solution found if (cutBackLevel < maxCutBack) then ! do cut back if (worldrank == 0) write(6,'(/,a)') ' cut back detected' @@ -616,12 +603,12 @@ program DAMASK_spectral timeinc = timeinc/2.0_pReal elseif (solres(1)%termIll) then ! material point model cannot find a solution, exit in any casy call IO_warning(850_pInt) - call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written (e.g. for regridding) + call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written elseif (continueCalculation == 1_pInt) then - guess = .true. ! accept non converged BVP solution - else ! default behavior, exit if spectral solver does not converge + guess = .true. ! accept non converged BVP solution + else ! default behavior, exit if spectral solver does not converge call IO_warning(850_pInt) - call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written (e.g. for regridding) + call quit(-1_pInt*(lastRestartWritten+1_pInt)) ! quit and provide information about last restart inc written endif else guess = .true. ! start guessing after first converged (sub)inc @@ -631,8 +618,8 @@ program DAMASK_spectral write(statUnit,*) totalIncsCounter, time, cutBackLevel, & solres%converged, solres%iterationsNeeded ! write statistics about accepted solution flush(statUnit) - endif - endif + endif + endif enddo subIncLooping cutBackLevel = max(0_pInt, cutBackLevel - 1_pInt) ! try half number of subincs next inc if(all(solres(:)%converged)) then ! report converged inc @@ -653,8 +640,8 @@ program DAMASK_spectral call MPI_file_seek (resUnit,fileOffset,MPI_SEEK_SET,ierr) if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_file_seek') do i=1, size(materialpoint_results,3)/(maxByteOut/(materialpoint_sizeResults*pReal))+1 ! slice the output of my process in chunks not exceeding the limit for one output - outputIndex=int([(i-1_pInt)*((maxByteOut/pReal)/materialpoint_sizeResults)+1_pInt, & - min(i*((maxByteOut/pReal)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) + outputIndex=int([(i-1_pInt)*((maxRealOut)/materialpoint_sizeResults)+1_pInt, & + min(i*((maxRealOut)/materialpoint_sizeResults),size(materialpoint_results,3))],pLongInt) call MPI_file_write(resUnit,reshape(materialpoint_results(:,:,outputIndex(1):outputIndex(2)),& [(outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults]), & (outputIndex(2)-outputIndex(1)+1)*materialpoint_sizeResults,& @@ -663,11 +650,11 @@ program DAMASK_spectral enddo fileOffset = fileOffset + sum(outputSize) ! forward to current file position endif - if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. & ! at frequency of writing restart information set restart parameter for FEsolving - mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! first call to CPFEM_general will write? + if( loadCases(currentLoadCase)%restartFrequency > 0_pInt .and. & ! at frequency of writing restart information set restart parameter for FEsolving + mod(inc,loadCases(currentLoadCase)%restartFrequency) == 0_pInt) then ! first call to CPFEM_general will write? restartWrite = .true. lastRestartWritten = inc - endif + endif else forwarding time = time + timeinc guess = .true. @@ -699,7 +686,7 @@ program DAMASK_spectral call AL_destroy() case (DAMASK_spectral_SolverPolarisation_label) call Polarisation_destroy() - end select + end select case(FIELD_THERMAL_ID) call spectral_thermal_destroy() case(FIELD_DAMAGE_ID) @@ -710,6 +697,13 @@ program DAMASK_spectral call PETScFinalize(ierr); CHKERRQ(ierr) +#ifdef _OPENMP + call MPI_finalize(i) + if (i /= 0_pInt) then + call IO_error(error_ID=894, el=i, ext_msg="Finalize()") + endif +#endif + if (notConvergedCounter > 0_pInt) call quit(3_pInt) ! error if some are not converged call quit(0_pInt) ! no complains ;) @@ -720,35 +714,30 @@ end program DAMASK_spectral !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @brief quit subroutine to mimic behavior of FEM solvers !> @details exits the Spectral solver and reports time and duration. Exit code 0 signals -!> everything went fine. Exit code 1 signals an error, message according to IO_error. Exit code -!> 2 signals request for regridding, increment of last saved restart information is written to +!> everything went fine. Exit code 1 signals an error, message according to IO_error. Exit code +!> 2 signals no converged solution and increment of last saved restart information is written to !> stderr. Exit code 3 signals no severe problems, but some increments did not converge !-------------------------------------------------------------------------------------------------- subroutine quit(stop_id) use prec, only: & pInt - use numerics, only: & - worldrank implicit none integer(pInt), intent(in) :: stop_id integer, dimension(8) :: dateAndTime ! type default integer - if (worldrank == 0_pInt) then - call date_and_time(values = dateAndTime) - write(6,'(/,a)') 'DAMASK terminated on:' - write(6,'(a,2(i2.2,a),i4.4)') 'Date: ',dateAndTime(3),'/',& - dateAndTime(2),'/',& - dateAndTime(1) - write(6,'(a,2(i2.2,a),i2.2)') 'Time: ',dateAndTime(5),':',& - dateAndTime(6),':',& - dateAndTime(7) - endif - + call date_and_time(values = dateAndTime) + write(6,'(/,a)') 'DAMASK terminated on:' + write(6,'(a,2(i2.2,a),i4.4)') 'Date: ',dateAndTime(3),'/',& + dateAndTime(2),'/',& + dateAndTime(1) + write(6,'(a,2(i2.2,a),i2.2)') 'Time: ',dateAndTime(5),':',& + dateAndTime(6),':',& + dateAndTime(7) + if (stop_id == 0_pInt) stop 0 ! normal termination - if (stop_id < 0_pInt) then ! trigger regridding - if (worldrank == 0_pInt) & - write(0,'(a,i6)') 'restart information available at ', stop_id*(-1_pInt) + if (stop_id < 0_pInt) then ! terminally ill, restart might help + write(0,'(a,i6)') 'restart information available at ', stop_id*(-1_pInt) stop 2 endif if (stop_id == 3_pInt) stop 3 ! not all incs converged diff --git a/src/FEsolving.f90 b/src/FEsolving.f90 index 3b0aeb194..8e09a1524 100644 --- a/src/FEsolving.f90 +++ b/src/FEsolving.f90 @@ -60,8 +60,6 @@ subroutine FE_init IO_warning, & IO_timeStamp use DAMASK_interface - use numerics, only: & - worldrank implicit none #if defined(Marc4DAMASK) || defined(Abaqus) @@ -72,11 +70,9 @@ subroutine FE_init integer(pInt), allocatable, dimension(:) :: chunkPos #endif - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- FEsolving init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- FEsolving init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess modelName = getSolverJobName() #ifdef Spectral @@ -153,10 +149,6 @@ subroutine FE_init 200 close(FILEUNIT) endif -!-------------------------------------------------------------------------------------------------- -! the following array are allocated by mesh.f90 and need to be deallocated in case of regridding - if (allocated(calcMode)) deallocate(calcMode) - if (allocated(FEsolving_execIP)) deallocate(FEsolving_execIP) #endif if (iand(debug_level(debug_FEsolving),debug_levelBasic) /= 0_pInt) then write(6,'(a21,l1)') ' restart writing: ', restartWrite diff --git a/src/IO.f90 b/src/IO.f90 index ff6b7b091..894e81852 100644 --- a/src/IO.f90 +++ b/src/IO.f90 @@ -80,25 +80,10 @@ subroutine IO_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) implicit none - integer(pInt) :: worldrank = 0_pInt -#ifdef PETSc -#include - PetscErrorCode :: ierr -#endif - external :: & - MPI_Comm_rank, & - MPI_Abort -#ifdef PETSc - call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr) -#endif - - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- IO init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- IO init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - end subroutine IO_init @@ -144,6 +129,7 @@ recursive function IO_read(fileUnit,reset) result(line) !-------------------------------------------------------------------------------------------------- ! normal case if (input == '') return ! regular line + !-------------------------------------------------------------------------------------------------- ! recursion case if (stack >= 10_pInt) call IO_error(104_pInt,ext_msg=input) ! recursion limit reached @@ -156,7 +142,7 @@ recursive function IO_read(fileUnit,reset) result(line) pathOn(stack) = path(1:scan(path,SEP,.true.))//input ! glue include to current file's dir endif - open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack)) ! open included file + open(newunit=unitOn(stack),iostat=myStat,file=pathOn(stack),action='read') ! open included file if (myStat /= 0_pInt) call IO_error(100_pInt,el=myStat,ext_msg=pathOn(stack)) line = IO_read(fileUnit) @@ -546,7 +532,7 @@ function IO_hybridIA(Nast,ODFfileName) !-------------------------------------------------------------------------------------------------- ! math module is not available - real(pReal), parameter :: PI = 3.14159265358979323846264338327950288419716939937510_pReal + real(pReal), parameter :: PI = 3.141592653589793_pReal real(pReal), parameter :: INRAD = PI/180.0_pReal integer(pInt) :: i,j,bin,NnonZero,Nset,Nreps,reps,phi1,Phi,phi2 @@ -666,7 +652,7 @@ function IO_hybridIA(Nast,ODFfileName) else prob = 0.0_pReal endif - dV_V(phi2,Phi,phi1) = prob*dg_0*sin((Phi-1.0_pReal+center)*deltas(2)) + dV_V(phi2,Phi,phi1) = prob*dg_0*sin((real(Phi-1_pInt,pReal)+center)*deltas(2)) enddo; enddo; enddo close(FILEUNIT) dV_V = dV_V/sum_dV_V ! normalize to 1 @@ -713,7 +699,7 @@ function IO_hybridIA(Nast,ODFfileName) do i=1_pInt,Nast if (i < Nast) then call random_number(rnd) - j = nint(rnd*(Nreps-i)+i+0.5_pReal,pInt) + j = nint(rnd*real(Nreps-i,pReal)+real(i,pReal)+0.5_pReal,pInt) else j = i endif @@ -1281,8 +1267,8 @@ integer(pInt) function IO_countContinuousIntValues(fileUnit) line = IO_read(fileUnit, .true.) ! reset IO_read exit elseif (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator - IO_countContinuousIntValues = 1_pInt + IO_intValue(line,chunkPos,3_pInt) & - - IO_intValue(line,chunkPos,1_pInt) + IO_countContinuousIntValues = 1_pInt + abs( IO_intValue(line,chunkPos,3_pInt) & + - IO_intValue(line,chunkPos,1_pInt)) line = IO_read(fileUnit, .true.) ! reset IO_read exit ! only one single range indicator allowed else if (IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'of' ) then ! found multiple entries indicator @@ -1335,9 +1321,9 @@ function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN) lookupMaxN integer(pInt), dimension(:,:), intent(in) :: lookupMap character(len=64), dimension(:), intent(in) :: lookupName - integer(pInt) :: i + integer(pInt) :: i,first,last #ifdef Abaqus - integer(pInt) :: j,l,c,first,last + integer(pInt) :: j,l,c #endif integer(pInt), allocatable, dimension(:) :: chunkPos @@ -1362,7 +1348,9 @@ function IO_continuousIntValues(fileUnit,maxN,lookupName,lookupMap,lookupMaxN) enddo exit else if (chunkPos(1) > 2_pInt .and. IO_lc(IO_stringValue(line,chunkPos,2_pInt)) == 'to' ) then ! found range indicator - do i = IO_intValue(line,chunkPos,1_pInt),IO_intValue(line,chunkPos,3_pInt) + first = IO_intValue(line,chunkPos,1_pInt) + last = IO_intValue(line,chunkPos,3_pInt) + do i = first, last, sign(1_pInt,last-first) IO_continuousIntValues(1) = IO_continuousIntValues(1) + 1_pInt IO_continuousIntValues(1+IO_continuousIntValues(1)) = i enddo @@ -1582,8 +1570,6 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) msg = 'math_check: R*v == q*v failed' case (410_pInt) msg = 'eigenvalues computation error' - case (450_pInt) - msg = 'unknown symmetry type specified' !------------------------------------------------------------------------------------------------- ! homogenization errors @@ -1640,8 +1626,6 @@ subroutine IO_error(error_ID,el,ip,g,ext_msg) msg = 'update of gamma operator not possible when pre-calculated' case (880_pInt) msg = 'mismatch of microstructure count and a*b*c in geom file' - case (890_pInt) - msg = 'invalid input for regridding' case (891_pInt) msg = 'unknown solver type selected' case (892_pInt) diff --git a/src/commercialFEM_fileList.f90 b/src/commercialFEM_fileList.f90 index 677ca049b..7b95490b0 100644 --- a/src/commercialFEM_fileList.f90 +++ b/src/commercialFEM_fileList.f90 @@ -4,7 +4,6 @@ !> @details List of files needed by MSC.Marc, Abaqus/Explicit, and Abaqus/Standard !-------------------------------------------------------------------------------------------------- #include "IO.f90" -#include "libs.f90" #include "numerics.f90" #include "debug.f90" #include "math.f90" diff --git a/src/constitutive.f90 b/src/constitutive.f90 index 3ef51aecf..35137438d 100644 --- a/src/constitutive.f90 +++ b/src/constitutive.f90 @@ -612,8 +612,6 @@ subroutine constitutive_LiAndItsTangent(Li, dLi_dTstar3333, dLi_dFi3333, Tstar_v use material, only: & phase_plasticity, & material_phase, & - material_homog, & - phaseAt, phasememberAt, & phase_kinematics, & phase_Nkinematics, & PLASTICITY_isotropic_ID, & diff --git a/src/core_quit.f90 b/src/core_quit.f90 deleted file mode 100644 index 3a730c82d..000000000 --- a/src/core_quit.f90 +++ /dev/null @@ -1,12 +0,0 @@ -!******************************************************************** -! quit subroutine to satisfy IO_error for core module -! -!******************************************************************** -subroutine quit(stop_id) - use prec, only: & - pInt - - implicit none - integer(pInt), intent(in) :: stop_id - -end subroutine diff --git a/src/crystallite.f90 b/src/crystallite.f90 index 98159d7a3..b8117e6b4 100644 --- a/src/crystallite.f90 +++ b/src/crystallite.f90 @@ -197,19 +197,15 @@ subroutine crystallite_init nMax, & !< maximum number of ip neighbors myNcomponents, & !< number of components at current IP section = 0_pInt, & - j, & - p, & mySize character(len=65536) :: & tag = '', & line= '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- crystallite init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- crystallite init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess cMax = homogenization_maxNgrains iMax = mesh_maxNips @@ -515,18 +511,16 @@ end subroutine crystallite_init !-------------------------------------------------------------------------------------------------- subroutine crystallite_stressAndItsTangent(updateJaco) use prec, only: & - tol_math_check + tol_math_check, & + dNeq0 use numerics, only: & subStepMinCryst, & subStepSizeCryst, & stepIncreaseCryst, & - pert_Fg, & - pert_method, & nCryst, & numerics_integrator, & numerics_integrationMode, & - numerics_timeSyncing, & - analyticJaco + numerics_timeSyncing use debug, only: & debug_level, & debug_crystallite, & @@ -582,43 +576,22 @@ subroutine crystallite_stressAndItsTangent(updateJaco) logical, intent(in) :: & updateJaco !< whether to update the Jacobian (stiffness) or not real(pReal) :: & - myPert, & ! perturbation with correct sign formerSubStep, & subFracIntermediate real(pReal), dimension(3,3) :: & invFp, & ! inverse of the plastic deformation gradient Fe_guess, & ! guess for elastic deformation gradient Tstar ! 2nd Piola-Kirchhoff stress tensor - real(pReal), allocatable, dimension(:,:,:,:,:,:,:) :: & - dPdF_perturbation1, & - dPdF_perturbation2 - real(pReal), allocatable, dimension(:,:,:,:,:) :: & - F_backup, & - Fp_backup, & - InvFp_backup, & - Fi_backup, & - InvFi_backup, & - Fe_backup, & - Lp_backup, & - Li_backup, & - P_backup - real(pReal), allocatable, dimension(:,:,:,:) :: & - Tstar_v_backup - logical, allocatable, dimension(:,:,:) :: & - convergenceFlag_backup integer(pInt) :: & NiterationCrystallite, & ! number of iterations in crystallite loop c, & !< counter in integration point component loop i, & !< counter in integration point loop e, & !< counter in element loop - k, & - l, & n, startIP, endIP, & neighboring_e, & neighboring_i, & o, & p, & - perturbation , & ! loop counter for forward,backward perturbation mode myNcomponents, & mySource ! local variables used for calculating analytic Jacobian @@ -807,7 +780,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco) endif else subFracIntermediate = maxval(crystallite_subFrac, mask=.not.crystallite_localPlasticity) - if (abs(subFracIntermediate) > tiny(0.0_pReal)) then + if (dNeq0(subFracIntermediate)) then crystallite_neighborEnforcedCutback = .false. ! look for ips that require a cutback because of a nonconverged neighbor !$OMP PARALLEL !$OMP DO PRIVATE(neighboring_e,neighboring_i) @@ -848,7 +821,7 @@ subroutine crystallite_stressAndItsTangent(updateJaco) !$OMP DO PRIVATE(neighboring_e,neighboring_i) do e = FEsolving_execElem(1),FEsolving_execElem(2) do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) - if (.not. crystallite_localPlasticity(1,i,e) .and. abs(crystallite_subFrac(1,i,e)) > tiny(0.0_pReal)) then + if (.not. crystallite_localPlasticity(1,i,e) .and. dNeq0(crystallite_subFrac(1,i,e))) then do n = 1_pInt,FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,e)))) neighboring_e = mesh_ipNeighborhood(1,n,i,e) neighboring_i = mesh_ipNeighborhood(2,n,i,e) @@ -1144,371 +1117,115 @@ subroutine crystallite_stressAndItsTangent(updateJaco) ! --+>> STIFFNESS CALCULATION <<+-- computeJacobian: if(updateJaco) then - jacobianMethod: if (analyticJaco) then + !$OMP PARALLEL DO PRIVATE(dSdF,dSdFe,dSdFi,dLpdS,dLpdFi,dFpinvdF,dLidS,dLidFi,dFidS,& + !$OMP rhs_3333,lhs_3333,temp_99,temp_33,temp_3333,myNcomponents,error) + elementLooping6: do e = FEsolving_execElem(1),FEsolving_execElem(2) + myNcomponents = homogenization_Ngrains(mesh_element(3,e)) + do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed + do c = 1_pInt,myNcomponents + call constitutive_TandItsTangent(temp_33,dSdFe,dSdFi,crystallite_Fe(1:3,1:3,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate elastic stress tangent - ! --- ANALYTIC JACOBIAN --- + call constitutive_LiAndItsTangent(temp_33,dLidS,dLidFi,crystallite_Tstar_v(1:6,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e), & + c,i,e) ! call constitutive law to calculate Li tangent in lattice configuration + if (sum(abs(dLidS)) < tol_math_check) then + dFidS = 0.0_pReal + else + temp_33 = math_inv33(crystallite_subFi0(1:3,1:3,c,i,e)) + lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal + do o=1_pInt,3_pInt; do p=1_pInt,3_pInt + lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) + & + crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidFi(1:3,1:3,o,p)) + lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) + & + crystallite_invFi(1:3,1:3,c,i,e)*crystallite_invFi(p,o,c,i,e) + rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) - & + crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidS(1:3,1:3,o,p)) + enddo; enddo + call math_invert(9_pInt,math_Plain3333to99(lhs_3333),temp_99,error) + if (error) then + call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & + ext_msg='inversion error in analytic tangent calculation') + dFidS = 0.0_pReal + else + dFidS = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) + endif + dLidS = math_mul3333xx3333(dLidFi,dFidS) + dLidS + endif - !$OMP PARALLEL DO PRIVATE(dSdF,dSdFe,dSdFi,dLpdS,dLpdFi,dFpinvdF,dLidS,dLidFi,dFidS,& - !$OMP rhs_3333,lhs_3333,temp_99,temp_33,temp_3333,myNcomponents,error) - elementLooping6: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) ! iterate over IPs of this element to be processed - do c = 1_pInt,myNcomponents - call constitutive_TandItsTangent(temp_33,dSdFe,dSdFi,crystallite_Fe(1:3,1:3,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate elastic stress tangent + call constitutive_LpAndItsTangent(temp_33,dLpdS,dLpdFi,crystallite_Tstar_v(1:6,c,i,e), & + crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate Lp tangent in lattice configuration + dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS - call constitutive_LiAndItsTangent(temp_33,dLidS,dLidFi,crystallite_Tstar_v(1:6,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e), & - c,i,e) ! call constitutive law to calculate Li tangent in lattice configuration - if (sum(abs(dLidS)) < tol_math_check) then - dFidS = 0.0_pReal - else - temp_33 = math_inv33(crystallite_subFi0(1:3,1:3,c,i,e)) - lhs_3333 = 0.0_pReal; rhs_3333 = 0.0_pReal - do o=1_pInt,3_pInt; do p=1_pInt,3_pInt - lhs_3333(1:3,1:3,o,p) = lhs_3333(1:3,1:3,o,p) + & - crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidFi(1:3,1:3,o,p)) - lhs_3333(1:3,o,1:3,p) = lhs_3333(1:3,o,1:3,p) + & - crystallite_invFi(1:3,1:3,c,i,e)*crystallite_invFi(p,o,c,i,e) - rhs_3333(1:3,1:3,o,p) = rhs_3333(1:3,1:3,o,p) - & - crystallite_subdt(c,i,e)*math_mul33x33(temp_33,dLidS(1:3,1:3,o,p)) - enddo; enddo - call math_invert(9_pInt,math_Plain3333to99(lhs_3333),temp_99,error) - if (error) then - call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & - ext_msg='inversion error in analytic tangent calculation') - dFidS = 0.0_pReal - else - dFidS = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) - endif - dLidS = math_mul3333xx3333(dLidFi,dFidS) + dLidS - endif + temp_33 = math_transpose33(math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & + crystallite_invFi(1:3,1:3,c,i,e))) + rhs_3333 = 0.0_pReal + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + rhs_3333(p,o,1:3,1:3) = math_mul33x33(dSdFe(p,o,1:3,1:3),temp_33) - call constitutive_LpAndItsTangent(temp_33,dLpdS,dLpdFi,crystallite_Tstar_v(1:6,c,i,e), & - crystallite_Fi(1:3,1:3,c,i,e),c,i,e) ! call constitutive law to calculate Lp tangent in lattice configuration - dLpdS = math_mul3333xx3333(dLpdFi,dFidS) + dLpdS + temp_3333 = 0.0_pReal + temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + math_inv33(crystallite_subFp0(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + temp_3333(1:3,1:3,p,o) = math_mul33x33(math_mul33x33(temp_33,dLpdS(1:3,1:3,p,o)), & + crystallite_invFi(1:3,1:3,c,i,e)) - temp_33 = math_transpose33(math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & - crystallite_invFi(1:3,1:3,c,i,e))) - rhs_3333 = 0.0_pReal - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - rhs_3333(p,o,1:3,1:3) = math_mul33x33(dSdFe(p,o,1:3,1:3),temp_33) + temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)), & + math_inv33(crystallite_subFi0(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + temp_3333(1:3,1:3,p,o) = temp_3333(1:3,1:3,p,o) + math_mul33x33(temp_33,dLidS(1:3,1:3,p,o)) - temp_3333 = 0.0_pReal - temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - math_inv33(crystallite_subFp0(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - temp_3333(1:3,1:3,p,o) = math_mul33x33(math_mul33x33(temp_33,dLpdS(1:3,1:3,p,o)), & - crystallite_invFi(1:3,1:3,c,i,e)) + lhs_3333 = crystallite_subdt(c,i,e)*math_mul3333xx3333(dSdFe,temp_3333) + & + math_mul3333xx3333(dSdFi,dFidS) - temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)), & - math_inv33(crystallite_subFi0(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - temp_3333(1:3,1:3,p,o) = temp_3333(1:3,1:3,p,o) + math_mul33x33(temp_33,dLidS(1:3,1:3,p,o)) + call math_invert(9_pInt,math_identity2nd(9_pInt)+math_Plain3333to99(lhs_3333),temp_99,error) + if (error) then + call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & + ext_msg='inversion error in analytic tangent calculation') + dSdF = rhs_3333 + else + dSdF = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) + endif - lhs_3333 = crystallite_subdt(c,i,e)*math_mul3333xx3333(dSdFe,temp_3333) + & - math_mul3333xx3333(dSdFi,dFidS) + dFpinvdF = 0.0_pReal + temp_3333 = math_mul3333xx3333(dLpdS,dSdF) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + dFpinvdF(1:3,1:3,p,o) = -crystallite_subdt(c,i,e)* & + math_mul33x33(math_inv33(crystallite_subFp0(1:3,1:3,c,i,e)), & + math_mul33x33(temp_3333(1:3,1:3,p,o), & + crystallite_invFi(1:3,1:3,c,i,e))) - call math_invert(9_pInt,math_identity2nd(9_pInt)+math_Plain3333to99(lhs_3333),temp_99,error) - if (error) then - call IO_warning(warning_ID=600_pInt,el=e,ip=i,g=c, & - ext_msg='inversion error in analytic tangent calculation') - dSdF = rhs_3333 - else - dSdF = math_mul3333xx3333(math_Plain99to3333(temp_99),rhs_3333) - endif + crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.0_pReal + temp_33 = math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & + math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e)))) + forall(p=1_pInt:3_pInt) & + crystallite_dPdF(p,1:3,p,1:3,c,i,e) = math_transpose33(temp_33) - dFpinvdF = 0.0_pReal - temp_3333 = math_mul3333xx3333(dLpdS,dSdF) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - dFpinvdF(1:3,1:3,p,o) = -crystallite_subdt(c,i,e)* & - math_mul33x33(math_inv33(crystallite_subFp0(1:3,1:3,c,i,e)), & - math_mul33x33(temp_3333(1:3,1:3,p,o), & - crystallite_invFi(1:3,1:3,c,i,e))) + temp_33 = math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e),dFpinvdF(1:3,1:3,p,o)),temp_33) - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.0_pReal - temp_33 = math_mul33x33(crystallite_invFp(1:3,1:3,c,i,e), & - math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e)))) - forall(p=1_pInt:3_pInt) & - crystallite_dPdF(p,1:3,p,1:3,c,i,e) = math_transpose33(temp_33) + temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(math_mul33x33(temp_33,dSdF(1:3,1:3,p,o)), & + math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - temp_33 = math_mul33x33(math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e),dFpinvdF(1:3,1:3,p,o)),temp_33) + temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & + crystallite_invFp(1:3,1:3,c,i,e)), & + math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e))) + forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & + crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & + math_mul33x33(temp_33,math_transpose33(dFpinvdF(1:3,1:3,p,o))) - temp_33 = math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(math_mul33x33(temp_33,dSdF(1:3,1:3,p,o)), & - math_transpose33(crystallite_invFp(1:3,1:3,c,i,e))) - - temp_33 = math_mul33x33(math_mul33x33(crystallite_subF(1:3,1:3,c,i,e), & - crystallite_invFp(1:3,1:3,c,i,e)), & - math_Mandel6to33(crystallite_Tstar_v(1:6,c,i,e))) - forall(p=1_pInt:3_pInt, o=1_pInt:3_pInt) & - crystallite_dPdF(1:3,1:3,p,o,c,i,e) = crystallite_dPdF(1:3,1:3,p,o,c,i,e) + & - math_mul33x33(temp_33,math_transpose33(dFpinvdF(1:3,1:3,p,o))) - - enddo; enddo - enddo elementLooping6 - !$OMP END PARALLEL DO - - else jacobianMethod - - ! --- STANDARD (PERTURBATION METHOD) FOR JACOBIAN --- - - numerics_integrationMode = 2_pInt - - ! --- BACKUP --- - allocate(dPdF_perturbation1(3,3,3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(dPdF_perturbation2(3,3,3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(F_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(InvFp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fi_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(InvFi_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Fe_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Lp_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Li_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(P_backup (3,3, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(Tstar_v_backup (6, homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = 0.0_pReal) - allocate(convergenceFlag_backup (homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), source = .false.) - - !$OMP PARALLEL DO PRIVATE(myNcomponents) - elementLooping7: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) - enddo - - F_backup(1:3,1:3,c,i,e) = crystallite_subF(1:3,1:3,c,i,e) ! ... and kinematics - Fp_backup(1:3,1:3,c,i,e) = crystallite_Fp(1:3,1:3,c,i,e) - InvFp_backup(1:3,1:3,c,i,e) = crystallite_invFp(1:3,1:3,c,i,e) - Fi_backup(1:3,1:3,c,i,e) = crystallite_Fi(1:3,1:3,c,i,e) - InvFi_backup(1:3,1:3,c,i,e) = crystallite_invFi(1:3,1:3,c,i,e) - Fe_backup(1:3,1:3,c,i,e) = crystallite_Fe(1:3,1:3,c,i,e) - Lp_backup(1:3,1:3,c,i,e) = crystallite_Lp(1:3,1:3,c,i,e) - Li_backup(1:3,1:3,c,i,e) = crystallite_Li(1:3,1:3,c,i,e) - Tstar_v_backup(1:6,c,i,e) = crystallite_Tstar_v(1:6,c,i,e) - P_backup(1:3,1:3,c,i,e) = crystallite_P(1:3,1:3,c,i,e) - convergenceFlag_backup(c,i,e) = crystallite_converged(c,i,e) - enddo; enddo - enddo elementLooping7 - !$END PARALLEL DO - ! --- CALCULATE STATE AND STRESS FOR PERTURBATION --- - - dPdF_perturbation1 = crystallite_dPdF0 ! initialize stiffness with known good values from last increment - dPdF_perturbation2 = crystallite_dPdF0 ! initialize stiffness with known good values from last increment - pertubationLoop: do perturbation = 1,2 ! forward and backward perturbation - if (iand(pert_method,perturbation) > 0_pInt) then ! mask for desired direction - myPert = -pert_Fg * (-1.0_pReal)**perturbation ! set perturbation step - do k = 1,3; do l = 1,3 ! ...alter individual components - if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & - .and. ((e == debug_e .and. i == debug_i .and. c == debug_g) & - .or. .not. iand(debug_level(debug_crystallite),debug_levelSelective) /= 0_pInt)) & - write(6,'(a,2(1x,i1),1x,a,/)') '<< CRYST >> [[[[[[ Stiffness perturbation',k,l,']]]]]]' - ! --- INITIALIZE UNPERTURBED STATE --- - - select case(numerics_integrator(numerics_integrationMode)) - case(1_pInt) -!why not OMP? ! Fix-point method: restore to last converged state at end of subinc, since this is probably closest to perturbed state - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_Fp(1:3,1:3,c,i,e) = Fp_backup(1:3,1:3,c,i,e) - crystallite_invFp(1:3,1:3,c,i,e) = InvFp_backup(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = Fi_backup(1:3,1:3,c,i,e) - crystallite_invFi(1:3,1:3,c,i,e) = InvFi_backup(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = Fe_backup(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = Lp_backup(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = Li_backup(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = Tstar_v_backup(1:6,c,i,e) - enddo; enddo - enddo - case(2_pInt,3_pInt) ! explicit Euler methods: nothing to restore (except for F), since we are only doing a stress integration step - case(4_pInt,5_pInt) -!why not OMP? ! explicit Runge-Kutta methods: restore to start of subinc, since we are doing a full integration of state and stress - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%subState0(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%subState0(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_Fp(1:3,1:3,c,i,e) = crystallite_subFp0(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = crystallite_subFi0(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = crystallite_subFe0(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = crystallite_subLp0(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = crystallite_subLi0(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = crystallite_subTstar0_v(1:6,c,i,e) - enddo; enddo - enddo - end select - - ! --- PERTURB EITHER FORWARD OR BACKWARD --- -!why not OMP? - do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e) - do c = 1,myNcomponents - crystallite_subF(1:3,1:3,c,i,e) = F_backup(1:3,1:3,c,i,e) - crystallite_subF(k,l,c,i,e) = crystallite_subF(k,l,c,i,e) + myPert - crystallite_todo(c,i,e) = crystallite_requested(c,i,e) & - .and. convergenceFlag_backup(c,i,e) - if (crystallite_todo(c,i,e)) crystallite_converged(c,i,e) = .false. ! start out non-converged - enddo; enddo; enddo - - - select case(numerics_integrator(numerics_integrationMode)) - case(1_pInt) - call crystallite_integrateStateFPI() - case(2_pInt) - call crystallite_integrateStateEuler() - case(3_pInt) - call crystallite_integrateStateAdaptiveEuler() - case(4_pInt) - call crystallite_integrateStateRK4() - case(5_pInt) - call crystallite_integrateStateRKCK45() - end select - !why not OMP? - elementLooping8: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - select case(perturbation) - case(1_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. crystallite_converged(c,i,e)) & ! converged state warrants stiffness update - dPdF_perturbation1(1:3,1:3,k,l,c,i,e) = & - (crystallite_P(1:3,1:3,c,i,e) - P_backup(1:3,1:3,c,i,e)) / myPert ! tangent dP_ij/dFg_kl - case(2_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. crystallite_converged(c,i,e)) & ! converged state warrants stiffness update - dPdF_perturbation2(1:3,1:3,k,l,c,i,e) = & - (crystallite_P(1:3,1:3,c,i,e) - P_backup(1:3,1:3,c,i,e)) / myPert ! tangent dP_ij/dFg_kl - end select - enddo elementLooping8 - - enddo; enddo ! k,l component perturbation loop - - endif - enddo pertubationLoop - - ! --- STIFFNESS ACCORDING TO PERTURBATION METHOD AND CONVERGENCE --- - - elementLooping9: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - select case(pert_method) - case(1_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 1: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = dPdF_perturbation1(1:3,1:3,1:3,1:3,c,i,e) - case(2_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 2: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = dPdF_perturbation2(1:3,1:3,1:3,1:3,c,i,e) - case(3_pInt) - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. convergenceFlag_backup(c,i,e)) & ! perturbation mode 3: central solution converged - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = 0.5_pReal* ( dPdF_perturbation1(1:3,1:3,1:3,1:3,c,i,e) & - + dPdF_perturbation2(1:3,1:3,1:3,1:3,c,i,e)) - end select - forall (i = FEsolving_execIP(1,e):FEsolving_execIP(2,e), c = 1:myNcomponents, & - crystallite_requested(c,i,e) .and. .not. convergenceFlag_backup(c,i,e)) & ! for any pertubation mode: if central solution did not converge... - crystallite_dPdF(1:3,1:3,1:3,1:3,c,i,e) = crystallite_fallbackdPdF(1:3,1:3,1:3,1:3,c,i,e) ! ...use (elastic) fallback - enddo elementLooping9 - - ! --- RESTORE --- -!why not OMP? - elementLooping10: do e = FEsolving_execElem(1),FEsolving_execElem(2) - myNcomponents = homogenization_Ngrains(mesh_element(3,e)) - do i = FEsolving_execIP(1,e),FEsolving_execIP(2,e); do c = 1,myNcomponents - - plasticState (phaseAt(c,i,e))%state( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%state_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%state( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%state_backup(:,phasememberAt(c,i,e)) - enddo - - plasticState (phaseAt(c,i,e))%dotState( :,phasememberAt(c,i,e)) = & - plasticState (phaseAt(c,i,e))%dotState_backup(:,phasememberAt(c,i,e)) - do mySource = 1_pInt, phase_Nsources(phaseAt(c,i,e)) - sourceState(phaseAt(c,i,e))%p(mySource)%dotState( :,phasememberAt(c,i,e)) = & - sourceState(phaseAt(c,i,e))%p(mySource)%dotState_backup(:,phasememberAt(c,i,e)) - enddo - - crystallite_subF(1:3,1:3,c,i,e) = F_backup(1:3,1:3,c,i,e) - crystallite_Fp(1:3,1:3,c,i,e) = Fp_backup(1:3,1:3,c,i,e) - crystallite_invFp(1:3,1:3,c,i,e) = InvFp_backup(1:3,1:3,c,i,e) - crystallite_Fi(1:3,1:3,c,i,e) = Fi_backup(1:3,1:3,c,i,e) - crystallite_invFi(1:3,1:3,c,i,e) = InvFi_backup(1:3,1:3,c,i,e) - crystallite_Fe(1:3,1:3,c,i,e) = Fe_backup(1:3,1:3,c,i,e) - crystallite_Lp(1:3,1:3,c,i,e) = Lp_backup(1:3,1:3,c,i,e) - crystallite_Li(1:3,1:3,c,i,e) = Li_backup(1:3,1:3,c,i,e) - crystallite_Tstar_v(1:6,c,i,e) = Tstar_v_backup(1:6,c,i,e) - crystallite_P(1:3,1:3,c,i,e) = P_backup(1:3,1:3,c,i,e) - crystallite_converged(c,i,e) = convergenceFlag_backup(c,i,e) - enddo; enddo - enddo elementLooping10 - - deallocate(dPdF_perturbation1) - deallocate(dPdF_perturbation2) - deallocate(F_backup ) - deallocate(Fp_backup ) - deallocate(InvFp_backup ) - deallocate(Fi_backup ) - deallocate(InvFi_backup ) - deallocate(Fe_backup ) - deallocate(Lp_backup ) - deallocate(Li_backup ) - deallocate(P_backup ) - deallocate(Tstar_v_backup ) - deallocate(convergenceFlag_backup) - - endif jacobianMethod + enddo; enddo + enddo elementLooping6 + !$OMP END PARALLEL DO endif computeJacobian !why not OMP? @@ -3380,7 +3097,8 @@ end subroutine crystallite_integrateStateFPI !-------------------------------------------------------------------------------------------------- logical function crystallite_stateJump(ipc,ip,el) use prec, only: & - prec_isNaN + prec_isNaN, & + dNeq0 use debug, only: & debug_level, & debug_crystallite, & @@ -3432,7 +3150,7 @@ logical function crystallite_stateJump(ipc,ip,el) enddo #ifndef _OPENMP - if (any(plasticState(p)%deltaState(1:mySizePlasticDeltaState,c) /= 0.0_pReal) & + if (any(dNeq0(plasticState(p)%deltaState(1:mySizePlasticDeltaState,c))) & .and. iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & .and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) & .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then @@ -3487,7 +3205,8 @@ logical function crystallite_integrateStress(& ) use prec, only: pLongInt, & tol_math_check, & - prec_isNaN + prec_isNaN, & + dEq0 use numerics, only: nStress, & aTol_crystalliteStress, & rTol_crystalliteStress, & @@ -3605,9 +3324,8 @@ logical function crystallite_integrateStress(& #ifndef _OPENMP if (iand(debug_level(debug_crystallite), debug_levelExtensive) /= 0_pInt & .and. ((el == debug_e .and. ip == debug_i .and. ipc == debug_g) & - .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) then + .or. .not. iand(debug_level(debug_crystallite), debug_levelSelective) /= 0_pInt)) & write(6,'(a,i8,1x,i2,1x,i3)') '<< CRYST >> integrateStress at el ip ipc ',el,ip,ipc - endif #endif @@ -3635,7 +3353,7 @@ logical function crystallite_integrateStress(& !* inversion of Fp_current... invFp_current = math_inv33(Fp_current) - if (all(abs(invFp_current) <= tiny(0.0_pReal))) then ! math_inv33 returns zero when failed, avoid floating point comparison + failedInversionFp: if (all(dEq0(invFp_current))) then #ifndef _OPENMP if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then write(6,'(a,i8,1x,a,i8,a,1x,i2,1x,i3)') '<< CRYST >> integrateStress failed on inversion of Fp_current at el (elFE) ip g ',& @@ -3645,13 +3363,13 @@ logical function crystallite_integrateStress(& endif #endif return - endif + endif failedInversionFp A = math_mul33x33(Fg_new,invFp_current) ! intermediate tensor needed later to calculate dFe_dLp !* inversion of Fi_current... invFi_current = math_inv33(Fi_current) - if (all(abs(invFi_current) <= tiny(0.0_pReal))) then ! math_inv33 returns zero when failed, avoid floating point comparison + failedInversionFi: if (all(dEq0(invFi_current))) then #ifndef _OPENMP if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then write(6,'(a,i8,1x,a,i8,a,1x,i2,1x,i3)') '<< CRYST >> integrateStress failed on inversion of Fi_current at el (elFE) ip ipc ',& @@ -3661,7 +3379,7 @@ logical function crystallite_integrateStress(& endif #endif return - endif + endif failedInversionFi !* start LpLoop with normal step length @@ -3713,9 +3431,8 @@ logical function crystallite_integrateStress(& !* calculate plastic velocity gradient and its tangent from constitutive law - if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then + if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) & call system_clock(count=tick,count_rate=tickrate,count_max=maxticks) - endif call constitutive_LpAndItsTangent(Lp_constitutive, dLp_dT3333, dLp_dFi3333, & Tstar_v, Fi_new, ipc, ip, el) @@ -3911,7 +3628,7 @@ logical function crystallite_integrateStress(& invFp_new = math_mul33x33(invFp_current,B) invFp_new = invFp_new / math_det33(invFp_new)**(1.0_pReal/3.0_pReal) ! regularize by det Fp_new = math_inv33(invFp_new) - if (all(abs(Fp_new)<= tiny(0.0_pReal))) then ! math_inv33 returns zero when failed, avoid floating point comparison + failedInversionInvFp: if (all(dEq0(Fp_new))) then #ifndef _OPENMP if (iand(debug_level(debug_crystallite), debug_levelBasic) /= 0_pInt) then write(6,'(a,i8,1x,a,i8,a,1x,i2,1x,i3,a,i3)') '<< CRYST >> integrateStress failed on invFp_new inversion at el ip ipc ',& @@ -3923,7 +3640,7 @@ logical function crystallite_integrateStress(& endif #endif return - endif + endif failedInversionInvFp Fe_new = math_mul33x33(math_mul33x33(Fg_new,invFp_new),invFi_new) ! calc resulting Fe !* calculate 1st Piola-Kirchhoff stress @@ -4144,7 +3861,7 @@ function crystallite_postResults(ipc, ip, el) mySize = 1_pInt detF = math_det33(crystallite_partionedF(1:3,1:3,ipc,ip,el)) ! V_current = det(F) * V_reference crystallite_postResults(c+1) = detF * mesh_ipVolume(ip,el) & - / homogenization_Ngrains(mesh_element(3,el)) ! grain volume (not fraction but absolute) + / real(homogenization_Ngrains(mesh_element(3,el)),pReal) ! grain volume (not fraction but absolute) case (orientation_ID) mySize = 4_pInt crystallite_postResults(c+1:c+mySize) = crystallite_orientation(1:4,ipc,ip,el) ! grain orientation as quaternion diff --git a/src/damage_local.f90 b/src/damage_local.f90 index 1437213d7..b604c2be4 100644 --- a/src/damage_local.f90 +++ b/src/damage_local.f90 @@ -223,7 +223,7 @@ subroutine damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & phase_source, & phase_Nsources, & SOURCE_damage_isoBrittle_ID, & @@ -280,8 +280,8 @@ subroutine damage_local_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, el enddo enddo - phiDot = phiDot/homogenization_Ngrains(mappingHomogenization(2,ip,el)) - dPhiDot_dPhi = dPhiDot_dPhi/homogenization_Ngrains(mappingHomogenization(2,ip,el)) + phiDot = phiDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) end subroutine damage_local_getSourceAndItsTangent diff --git a/src/damage_nonlocal.f90 b/src/damage_nonlocal.f90 index 86805c21b..65d012705 100644 --- a/src/damage_nonlocal.f90 +++ b/src/damage_nonlocal.f90 @@ -184,7 +184,7 @@ subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & phase_source, & phase_Nsources, & SOURCE_damage_isoBrittle_ID, & @@ -241,8 +241,8 @@ subroutine damage_nonlocal_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, ip, enddo enddo - phiDot = phiDot/homogenization_Ngrains(mappingHomogenization(2,ip,el)) - dPhiDot_dPhi = dPhiDot_dPhi/homogenization_Ngrains(mappingHomogenization(2,ip,el)) + phiDot = phiDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + dPhiDot_dPhi = dPhiDot_dPhi/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) end subroutine damage_nonlocal_getSourceAndItsTangent @@ -279,9 +279,7 @@ function damage_nonlocal_getDiffusion33(ip,el) enddo damage_nonlocal_getDiffusion33 = & - charLength*charLength* & - damage_nonlocal_getDiffusion33/ & - homogenization_Ngrains(homog) + charLength**2_pInt*damage_nonlocal_getDiffusion33/real(homogenization_Ngrains(homog),pReal) end function damage_nonlocal_getDiffusion33 @@ -310,7 +308,8 @@ real(pReal) function damage_nonlocal_getMobility(ip,el) damage_nonlocal_getMobility = damage_nonlocal_getMobility + lattice_DamageMobility(material_phase(ipc,ip,el)) enddo - damage_nonlocal_getMobility = damage_nonlocal_getMobility /homogenization_Ngrains(mesh_element(3,el)) + damage_nonlocal_getMobility = damage_nonlocal_getMobility/& + real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function damage_nonlocal_getMobility diff --git a/src/damask.core.pyf b/src/damask.core.pyf deleted file mode 100644 index e6396ee1d..000000000 --- a/src/damask.core.pyf +++ /dev/null @@ -1,126 +0,0 @@ -! $Id$ -! -*- f90 -*- -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! Note: the syntax of this file is case sensitive. -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! This file was auto-generated with f2py (version:2_5972). -! See http://cens.ioc.ee/projects/f2py2e/ -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -! The auto-generated file is quite heavily corrected -! For modifying, notice the following hints: -! - if the dimension of an array depend on a array that is itself an input, use the C-Syntax: (1) becomes [0] etc. -! - be sure that the precision defined is integer, real*8, and complex*16 -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -python module core ! in - interface ! in :core - - module prec - subroutine prec_init - end subroutine prec_init - end module prec - - module damask_interface ! in :damask_interface:DAMASK_spectral_interface.f90 - subroutine DAMASK_interface_init(loadcaseParameterIn,geometryParameterIn) ! in :damask_interface:DAMASK_spectral_interface.f90 - character(len=1024), intent(in) :: loadcaseParameterIn - character(len=1024), intent(in) :: geometryParameterIn - end subroutine DAMASK_interface_init - end module damask_interface - - module io - subroutine IO_init - end subroutine IO_init - end module io - - module numerics - subroutine numerics_init - end subroutine numerics_init - end module numerics - - module debug - subroutine debug_init - end subroutine debug_init - end module debug - - module math ! in :math:math.f90 - subroutine math_init - end subroutine math_init - - function math_tensorAvg(field) ! in :math:math.f90 - ! input variables - real*8 dimension(:,:,:,:,:), intent(in), :: field - ! function definition - real*8 dimension(3,3), :: math_tensorAvg - end function math_tensorAvg - - end module math - - module fesolving - subroutine FE_init - end subroutine FE_init - end module fesolving - - module mesh ! in :mesh:mesh.f90 - subroutine mesh_init(ip,element) - integer, parameter :: ip = 1 - integer, parameter :: element = 1 - end subroutine mesh_init - - function mesh_nodesAroundCentres(gDim,Favg,centres) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:), intent(in) :: centres - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(3,3), intent(in) :: Favg - real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: mesh_nodesAroundCentres - real*8, dimension(3,size(centres,2)+1,size(centres,3)+1,size(centres,4)+1), depend(centres) :: wrappedCentres - end function mesh_nodesAroundCentres - - function mesh_deformedCoordsFFT(gDim,F,FavgIn,scalingIn) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(3,3), intent(in), optional :: FavgIn = -1.0 - real*8, dimension(3), intent(in), optional :: scalingIn = -1.0 - real*8, dimension(3,size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_deformedCoordsFFT - end function mesh_deformedCoordsFFT - - function mesh_volumeMismatch(gDim,F,nodes) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(:,:,:,:), intent(in) :: nodes - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_volumeMismatch - end function mesh_volumeMismatch - - function mesh_shapeMismatch(gDim,F,nodes,centres) ! in :mesh:mesh.f90 - real*8, dimension(:,:,:,:,:), intent(in) :: F - real*8, dimension(:,:,:,:), intent(in) :: nodes - real*8, dimension(:,:,:,:), intent(in) :: centres - real*8, dimension(3), intent(in) :: gDim - real*8, dimension(size(F,3),size(F,4),size(F,5)), depend(F) :: mesh_shapeMismatch - end function mesh_shapeMismatch - - function mesh_init_postprocessing(filepath) ! in :mesh:mesh.f90 - character(len=*), intent(in) :: filepath - end function mesh_init_postprocessing - - function mesh_build_cellnodes(nodes,Ncellnodes) ! in :mesh:mesh.f90 - integer, intent(in) :: Ncellnodes - real*8, dimension(3,:), intent(in) :: nodes - real*8, dimension(3,Ncellnodes), depend(Ncellnodes) :: mesh_build_cellnodes - end function mesh_build_cellnodes - - function mesh_get_Ncellnodes() ! in :mesh:mesh.f90 - integer :: mesh_get_Ncellnodes - end function mesh_get_Ncellnodes - - function mesh_get_unitlength() ! in :mesh:mesh.f90 - real*8 :: mesh_get_unitlength - end function mesh_get_unitlength - - function mesh_get_nodeAtIP(elemtypeFE,ip) ! in :mesh:mesh.f90 - character(len=*), intent(in) :: elemtypeFE - integer, intent(in) :: ip - integer :: mesh_get_nodeAtIP - end function mesh_get_nodeAtIP - - end module mesh - end interface -end python module core - diff --git a/src/debug.f90 b/src/debug.f90 index 01020dd39..03a0d6f08 100644 --- a/src/debug.f90 +++ b/src/debug.f90 @@ -46,10 +46,10 @@ module debug integer(pInt),protected, dimension(debug_maxNtype+2_pInt), public :: & ! specific ones, and 2 for "all" and "other" debug_level = 0_pInt - integer(pInt), public :: & - debug_cumLpCalls = 0_pInt, & !< total number of calls to LpAndItsTangent - debug_cumDeltaStateCalls = 0_pInt, & !< total number of calls to deltaState - debug_cumDotStateCalls = 0_pInt !< total number of calls to dotState + integer(pLongInt), public :: & + debug_cumLpCalls = 0_pLongInt, & !< total number of calls to LpAndItsTangent + debug_cumDeltaStateCalls = 0_pLongInt, & !< total number of calls to deltaState + debug_cumDotStateCalls = 0_pLongInt !< total number of calls to dotState integer(pInt), protected, public :: & debug_e = 1_pInt, & @@ -67,6 +67,7 @@ module debug debug_jacobianMaxLocation = 0_pInt, & debug_jacobianMinLocation = 0_pInt + integer(pInt), dimension(:), allocatable, public :: & debug_CrystalliteLoopDistribution, & !< distribution of crystallite cutbacks debug_MaterialpointStateLoopDistribution, & @@ -103,7 +104,6 @@ contains subroutine debug_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use numerics, only: & - worldrank, & nStress, & nState, & nCryst, & @@ -129,47 +129,27 @@ subroutine debug_init integer(pInt), allocatable, dimension(:) :: chunkPos character(len=65536) :: tag, line - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- debug init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- debug init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - if (allocated(debug_StressLoopLpDistribution)) & - deallocate(debug_StressLoopLpDistribution) - allocate(debug_StressLoopLpDistribution(nStress+1,2)) - debug_StressLoopLpDistribution = 0_pInt - if (allocated(debug_StressLoopLiDistribution)) & - deallocate(debug_StressLoopLiDistribution) - allocate(debug_StressLoopLiDistribution(nStress+1,2)) - debug_StressLoopLiDistribution = 0_pInt - if (allocated(debug_StateLoopDistribution)) & - deallocate(debug_StateLoopDistribution) - allocate(debug_StateLoopDistribution(nState+1,2)) - debug_StateLoopDistribution = 0_pInt - if (allocated(debug_CrystalliteLoopDistribution)) & - deallocate(debug_CrystalliteLoopDistribution) - allocate(debug_CrystalliteLoopDistribution(nCryst+1)) - debug_CrystalliteLoopDistribution = 0_pInt - if (allocated(debug_MaterialpointStateLoopDistribution)) & - deallocate(debug_MaterialpointStateLoopDistribution) - allocate(debug_MaterialpointStateLoopDistribution(nMPstate)) - debug_MaterialpointStateLoopDistribution = 0_pInt - if (allocated(debug_MaterialpointLoopDistribution)) & - deallocate(debug_MaterialpointLoopDistribution) - allocate(debug_MaterialpointLoopDistribution(nHomog+1)) - debug_MaterialpointLoopDistribution = 0_pInt + allocate(debug_StressLoopLpDistribution(nStress+1,2), source=0_pInt) + allocate(debug_StressLoopLiDistribution(nStress+1,2), source=0_pInt) + allocate(debug_StateLoopDistribution(nState+1,2), source=0_pInt) + allocate(debug_CrystalliteLoopDistribution(nCryst+1), source=0_pInt) + allocate(debug_MaterialpointStateLoopDistribution(nMPstate), source=0_pInt) + allocate(debug_MaterialpointLoopDistribution(nHomog+1), source=0_pInt) !-------------------------------------------------------------------------------------------------- ! try to open the config file line = '' fileExists: if(IO_open_file_stat(FILEUNIT,debug_configFile)) then - do while (trim(line) /= IO_EOF) ! read thru sections of phase part + do while (trim(line) /= IO_EOF) ! read thru sections of phase part line = IO_read(FILEUNIT) if (IO_isBlank(line)) cycle ! skip empty lines chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key + tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key select case(tag) case ('element','e','el') debug_e = IO_intValue(line,chunkPos,2_pInt) diff --git a/src/homogenization_RGC.f90 b/src/homogenization_RGC.f90 index 0919b1e5e..ef293fc22 100644 --- a/src/homogenization_RGC.f90 +++ b/src/homogenization_RGC.f90 @@ -386,6 +386,8 @@ end subroutine homogenization_RGC_partitionDeformation ! "happy" with result !-------------------------------------------------------------------------------------------------- function homogenization_RGC_updateState(P,F,F0,avgF,dt,dPdF,ip,el) + use prec, only: & + dEq0 use debug, only: & debug_level, & debug_homogenization,& @@ -441,10 +443,10 @@ function homogenization_RGC_updateState(P,F,F0,avgF,dt,dPdF,ip,el) real(pReal), dimension(:,:), allocatable :: tract,jmatrix,jnverse,smatrix,pmatrix,rmatrix real(pReal), dimension(:), allocatable :: resid,relax,p_relax,p_resid,drelax - if(abs(dt) < tiny(0.0_pReal)) then ! zero time step - homogenization_RGC_updateState = .true. ! pretend everything is fine and return + zeroTimeStep: if(dEq0(dt)) then + homogenization_RGC_updateState = .true. ! pretend everything is fine and return return - endif + endif zeroTimeStep !-------------------------------------------------------------------------------------------------- ! get the dimension of the cluster (grains and interfaces) diff --git a/src/hydrogenflux_cahnhilliard.f90 b/src/hydrogenflux_cahnhilliard.f90 index 898e7ed8d..35168da2d 100644 --- a/src/hydrogenflux_cahnhilliard.f90 +++ b/src/hydrogenflux_cahnhilliard.f90 @@ -223,8 +223,7 @@ function hydrogenflux_cahnhilliard_getMobility33(ip,el) enddo hydrogenflux_cahnhilliard_getMobility33 = & - hydrogenflux_cahnhilliard_getMobility33/ & - homogenization_Ngrains(mesh_element(3,el)) + hydrogenflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function hydrogenflux_cahnhilliard_getMobility33 @@ -258,8 +257,7 @@ function hydrogenflux_cahnhilliard_getDiffusion33(ip,el) enddo hydrogenflux_cahnhilliard_getDiffusion33 = & - hydrogenflux_cahnhilliard_getDiffusion33/ & - homogenization_Ngrains(mesh_element(3,el)) + hydrogenflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function hydrogenflux_cahnhilliard_getDiffusion33 @@ -295,8 +293,7 @@ function hydrogenflux_cahnhilliard_getFormationEnergy(ip,el) enddo hydrogenflux_cahnhilliard_getFormationEnergy = & - hydrogenflux_cahnhilliard_getFormationEnergy/ & - homogenization_Ngrains(mesh_element(3,el)) + hydrogenflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function hydrogenflux_cahnhilliard_getFormationEnergy @@ -331,10 +328,9 @@ function hydrogenflux_cahnhilliard_getEntropicCoeff(ip,el) lattice_hydrogenSurfaceEnergy(material_phase(grain,ip,el)) enddo - hydrogenflux_cahnhilliard_getEntropicCoeff = & - hydrogenflux_cahnhilliard_getEntropicCoeff* & + hydrogenflux_cahnhilliard_getEntropicCoeff = hydrogenflux_cahnhilliard_getEntropicCoeff* & temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ & - homogenization_Ngrains(material_homog(ip,el)) + real(homogenization_Ngrains(material_homog(ip,el)),pReal) end function hydrogenflux_cahnhilliard_getEntropicCoeff @@ -393,8 +389,8 @@ subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_d enddo enddo - KPot = KPot/homogenization_Ngrains(material_homog(ip,el)) - dKPot_dCh = dKPot_dCh/homogenization_Ngrains(material_homog(ip,el)) + KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal) + dKPot_dCh = dKPot_dCh/real(homogenization_Ngrains(material_homog(ip,el)),pReal) end subroutine hydrogenflux_cahnhilliard_KinematicChemPotAndItsTangent diff --git a/src/kinematics_hydrogen_strain.f90 b/src/kinematics_hydrogen_strain.f90 index 154b97e79..7a33d1a5f 100644 --- a/src/kinematics_hydrogen_strain.f90 +++ b/src/kinematics_hydrogen_strain.f90 @@ -67,8 +67,6 @@ subroutine kinematics_hydrogen_strain_init(fileUnit) KINEMATICS_hydrogen_strain_ID, & material_Nphase, & MATERIAL_partPhase - use numerics,only: & - worldrank implicit none integer(pInt), intent(in) :: fileUnit @@ -79,11 +77,9 @@ subroutine kinematics_hydrogen_strain_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_hydrogen_strain_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- kinematics_'//KINEMATICS_hydrogen_strain_LABEL//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_kinematics == KINEMATICS_hydrogen_strain_ID),pInt) if (maxNinstance == 0_pInt) return diff --git a/src/kinematics_thermal_expansion.f90 b/src/kinematics_thermal_expansion.f90 index c5a221a7b..572fd91af 100644 --- a/src/kinematics_thermal_expansion.f90 +++ b/src/kinematics_thermal_expansion.f90 @@ -77,7 +77,6 @@ subroutine kinematics_thermal_expansion_init(fileUnit) integer(pInt) :: maxNinstance,phase,instance,kinematics character(len=65536) :: & tag = '', & - output = '', & line = '' mainProcess: if (worldrank == 0) then diff --git a/src/lattice.f90 b/src/lattice.f90 index 4ba915688..88f2ca007 100644 --- a/src/lattice.f90 +++ b/src/lattice.f90 @@ -377,7 +377,6 @@ module lattice LATTICE_bcc_Ntrans = 0_pInt, & !sum(lattice_bcc_NtransSystem), & !< total # of transformation systems for bcc LATTICE_bcc_Ncleavage = 9_pInt !sum(lattice_bcc_NcleavageSystem) !< total # of cleavage systems for bcc - real(pReal), dimension(3+3,LATTICE_bcc_Nslip), parameter, private :: & LATTICE_bcc_systemSlip = reshape(real([& ! Slip direction Plane normal diff --git a/src/libs.f90 b/src/libs.f90 deleted file mode 100644 index 71f300512..000000000 --- a/src/libs.f90 +++ /dev/null @@ -1,12 +0,0 @@ -!-------------------------------------------------------------------------------------------------- -!> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH -!> @brief dummy source for inclusion of Library files -!-------------------------------------------------------------------------------------------------- -module libs -!nothing in here -end module libs - -#include "../lib/IR_Precision.f90" -#include "../lib/Lib_Base64.f90" -#include "../lib/Lib_VTK_IO.f90" - diff --git a/src/material.f90 b/src/material.f90 index 372c9dd7e..cd1d21808 100644 --- a/src/material.f90 +++ b/src/material.f90 @@ -499,12 +499,12 @@ subroutine material_init() allocate(HomogenizationPosition(material_Nhomogenization),source=0_pInt) allocate(CrystallitePosition (material_Nphase), source=0_pInt) - ElemLoop:do e = 1_pInt,mesh_NcpElems ! loop over elements + ElemLoop:do e = 1_pInt,mesh_NcpElems myHomog = mesh_element(3,e) - IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) ! loop over IPs + IPloop:do i = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,e))) HomogenizationPosition(myHomog) = HomogenizationPosition(myHomog) + 1_pInt mappingHomogenization(1:2,i,e) = [HomogenizationPosition(myHomog),myHomog] - GrainLoop:do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) ! loop over grains + GrainLoop:do g = 1_pInt,homogenization_Ngrains(mesh_element(3,e)) phase = material_phase(g,i,e) ConstitutivePosition(phase) = ConstitutivePosition(phase)+1_pInt ! not distinguishing between instances of same phase phaseAt(g,i,e) = phase @@ -1051,6 +1051,8 @@ end subroutine material_parsePhase !> @brief parses the texture part in the material configuration file !-------------------------------------------------------------------------------------------------- subroutine material_parseTexture(fileUnit,myPart) + use prec, only: & + dNeq use IO, only: & IO_read, & IO_globalTagInPart, & @@ -1069,6 +1071,7 @@ subroutine material_parseTexture(fileUnit,myPart) inRad, & math_sampleRandomOri, & math_I3, & + math_det33, & math_inv33 implicit none @@ -1154,6 +1157,9 @@ subroutine material_parseTexture(fileUnit,myPart) end select enddo + if(dNeq(math_det33(texture_transformation(1:3,1:3,section)),1.0_pReal)) & + call IO_error(157_pInt,section) + case ('hybridia') textureType texture_ODFfile(section) = IO_stringValue(line,chunkPos,2_pInt) @@ -1232,6 +1238,8 @@ end subroutine material_parseTexture !! calculates the volume of the grains and deals with texture components and hybridIA !-------------------------------------------------------------------------------------------------- subroutine material_populateGrains + use prec, only: & + dEq use math, only: & math_RtoEuler, & math_EulerToR, & @@ -1342,10 +1350,10 @@ subroutine material_populateGrains write(6,'(a32,1x,a32,1x,a6)') 'homogenization_name','microstructure_name','grain#' !$OMP END CRITICAL (write2out) endif - do homog = 1_pInt,material_Nhomogenization ! loop over homogenizations + homogenizationLoop: do homog = 1_pInt,material_Nhomogenization dGrains = homogenization_Ngrains(homog) ! grain number per material point - do micro = 1_pInt,material_Nmicrostructure ! all pairs of homog and micro - if (Ngrains(homog,micro) > 0_pInt) then ! an active pair of homog and micro + microstructureLoop: do micro = 1_pInt,material_Nmicrostructure ! all pairs of homog and micro + activePair: if (Ngrains(homog,micro) > 0_pInt) then myNgrains = Ngrains(homog,micro) ! assign short name for total number of grains to populate myNconstituents = microstructure_Nconstituents(micro) ! assign short name for number of constituents if (iand(myDebug,debug_levelBasic) /= 0_pInt) then @@ -1371,7 +1379,7 @@ subroutine material_populateGrains else forall (i = 1_pInt:FE_Nips(t)) & ! loop over IPs volumeOfGrain(grain+(i-1)*dGrains+1_pInt:grain+i*dGrains) = & - mesh_ipVolume(i,e)/dGrains ! assign IPvolume/Ngrains@IP to all grains of IP + mesh_ipVolume(i,e)/real(dGrains,pReal) ! assign IPvolume/Ngrains@IP to all grains of IP grain = grain + FE_Nips(t) * dGrains ! wind forward by Nips*Ngrains@IP endif enddo @@ -1393,7 +1401,7 @@ subroutine material_populateGrains NgrainsOfConstituent = 0_pInt ! reset counter of grains per constituent forall (i = 1_pInt:myNconstituents) & - NgrainsOfConstituent(i) = nint(microstructure_fraction(i,micro) * myNgrains, pInt) ! do rounding integer conversion + NgrainsOfConstituent(i) = nint(microstructure_fraction(i,micro)*real(myNgrains,pReal),pInt)! do rounding integer conversion do while (sum(NgrainsOfConstituent) /= myNgrains) ! total grain count over constituents wrong? sgn = sign(1_pInt, myNgrains - sum(NgrainsOfConstituent)) ! direction of required change extreme = 0.0_pReal @@ -1434,24 +1442,24 @@ subroutine material_populateGrains ! ...has texture components if (texture_ODFfile(textureID) == '') then gauss: do t = 1_pInt,texture_Ngauss(textureID) ! loop over Gauss components - do g = 1_pInt,int(myNorientations*texture_Gauss(5,t,textureID),pInt) ! loop over required grain count + do g = 1_pInt,int(real(myNorientations,pReal)*texture_Gauss(5,t,textureID),pInt) ! loop over required grain count orientationOfGrain(:,grain+constituentGrain+g) = & math_sampleGaussOri(texture_Gauss(1:3,t,textureID),& texture_Gauss( 4,t,textureID)) enddo constituentGrain = & - constituentGrain + int(myNorientations*texture_Gauss(5,t,textureID)) ! advance counter for grains of current constituent + constituentGrain + int(real(myNorientations,pReal)*texture_Gauss(5,t,textureID)) ! advance counter for grains of current constituent enddo gauss fiber: do t = 1_pInt,texture_Nfiber(textureID) ! loop over fiber components - do g = 1_pInt,int(myNorientations*texture_Fiber(6,t,textureID),pInt) ! loop over required grain count + do g = 1_pInt,int(real(myNorientations,pReal)*texture_Fiber(6,t,textureID),pInt) ! loop over required grain count orientationOfGrain(:,grain+constituentGrain+g) = & math_sampleFiberOri(texture_Fiber(1:2,t,textureID),& texture_Fiber(3:4,t,textureID),& texture_Fiber( 5,t,textureID)) enddo constituentGrain = & - constituentGrain + int(myNorientations*texture_fiber(6,t,textureID),pInt) ! advance counter for grains of current constituent + constituentGrain + int(real(myNorientations,pReal)*texture_fiber(6,t,textureID),pInt) ! advance counter for grains of current constituent enddo fiber random: do constituentGrain = constituentGrain+1_pInt,myNorientations ! fill remainder with random @@ -1462,7 +1470,7 @@ subroutine material_populateGrains else orientationOfGrain(1:3,grain+1_pInt:grain+myNorientations) = & IO_hybridIA(myNorientations,texture_ODFfile(textureID)) - if (all(orientationOfGrain(1:3,grain+1_pInt) == -1.0_pReal)) call IO_error(156_pInt) + if (all(dEq(orientationOfGrain(1:3,grain+1_pInt),-1.0_pReal))) call IO_error(156_pInt) endif !-------------------------------------------------------------------------------------------------- @@ -1501,7 +1509,7 @@ subroutine material_populateGrains do j = 1_pInt,NgrainsOfConstituent(i)-1_pInt ! walk thru grains of current constituent call random_number(rnd) - t = nint(rnd*(NgrainsOfConstituent(i)-j)+j+0.5_pReal,pInt) ! select a grain in remaining list + t = nint(rnd*real(NgrainsOfConstituent(i)-j,pReal)+real(j,pReal)+0.5_pReal,pInt) ! select a grain in remaining list m = phaseOfGrain(grain+t) ! exchange current with random phaseOfGrain(grain+t) = phaseOfGrain(grain+j) phaseOfGrain(grain+j) = m @@ -1539,7 +1547,7 @@ subroutine material_populateGrains randomOrder = math_range(microstructure_maxNconstituents) ! start out with ordered sequence of constituents call random_number(rndArray) ! as many rnd numbers as (max) constituents do j = 1_pInt, myNconstituents - 1_pInt ! loop over constituents ... - r = nint(rndArray(j)*(myNconstituents-j)+j+0.5_pReal,pInt) ! ... select one in remaining list + r = nint(rndArray(j)*real(myNconstituents-j,pReal)+real(j,pReal)+0.5_pReal,pInt) ! ... select one in remaining list c = randomOrder(r) ! ... call it "c" randomOrder(r) = randomOrder(j) ! ... and exchange with present position in constituent list grain = sum(NgrainsOfConstituent(1:c-1_pInt)) ! figure out actual starting index in overall/consecutive grain population @@ -1576,21 +1584,16 @@ subroutine material_populateGrains enddo enddo - endif ! active homog,micro pair - enddo - enddo + endif activePair + enddo microstructureLoop + enddo homogenizationLoop deallocate(volumeOfGrain) deallocate(phaseOfGrain) deallocate(textureOfGrain) deallocate(orientationOfGrain) + deallocate(texture_transformation) deallocate(Nelems) - !> @todo - causing segmentation fault: needs looking into - !do homog = 1,material_Nhomogenization - ! do micro = 1,material_Nmicrostructure - ! if (Nelems(homog,micro) > 0_pInt) deallocate(elemsOfHomogMicro(homog,micro)%p) - ! enddo - !enddo deallocate(elemsOfHomogMicro) end subroutine material_populateGrains diff --git a/src/math.f90 b/src/math.f90 index 9ad98df9e..315da2642 100644 --- a/src/math.f90 +++ b/src/math.f90 @@ -13,10 +13,10 @@ module math implicit none private - real(pReal), parameter, public :: PI = 3.14159265358979323846264338327950288419716939937510_pReal !< ratio of a circle's circumference to its diameter + real(pReal), parameter, public :: PI = 3.141592653589793_pReal !< ratio of a circle's circumference to its diameter real(pReal), parameter, public :: INDEG = 180.0_pReal/PI !< conversion from radian into degree real(pReal), parameter, public :: INRAD = PI/180.0_pReal !< conversion from degree into radian - complex(pReal), parameter, public :: TWOPIIMG = (0.0_pReal,2.0_pReal)* PI !< Re(0.0), Im(2xPi) + complex(pReal), parameter, public :: TWOPIIMG = (0.0_pReal,2.0_pReal)*(PI,0.0_pReal) !< Re(0.0), Im(2xPi) real(pReal), dimension(3,3), parameter, public :: & MATH_I3 = reshape([& @@ -72,10 +72,6 @@ module math 3_pInt,3_pInt & ],[2,9]) !< arrangement in Plain notation -#ifdef Spectral - include 'fftw3.f03' -#endif - public :: & math_init, & math_qsort, & @@ -162,22 +158,8 @@ module math math_areaTriangle, & math_rotate_forward33, & math_rotate_backward33, & - math_rotate_forward3333 -#ifdef Spectral - public :: & - fftw_set_timelimit, & - fftw_plan_dft_3d, & - fftw_plan_many_dft_r2c, & - fftw_plan_many_dft_c2r, & - fftw_plan_with_nthreads, & - fftw_init_threads, & - fftw_alloc_complex, & - fftw_execute_dft, & - fftw_execute_dft_r2c, & - fftw_execute_dft_c2r, & - fftw_destroy_plan, & - math_tensorAvg -#endif + math_rotate_forward3333, & + math_limit private :: & math_partition, & halton, & @@ -197,7 +179,6 @@ subroutine math_init use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use prec, only: tol_math_check use numerics, only: & - worldrank, & fixedSeed use IO, only: IO_error, IO_timeStamp @@ -212,11 +193,9 @@ subroutine math_init ! comment the first random_seed call out, set randSize to 1, and use ifort character(len=64) :: error_msg - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- math init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- math init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess call random_seed(size=randSize) if (allocated(randInit)) deallocate(randInit) @@ -235,13 +214,11 @@ subroutine math_init call random_number(randTest(i)) enddo - mainProcess2: if (worldrank == 0) then - write(6,*) 'size of random seed: ', randSize - do i =1, randSize - write(6,*) 'value of random seed: ', i, randInit(i) - enddo - write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest - endif mainProcess2 + write(6,'(a,I2)') ' size of random seed: ', randSize + do i =1, randSize + write(6,'(a,I2,I14)') ' value of random seed: ', i, randInit(i) + enddo + write(6,'(a,4(/,26x,f17.14),/)') ' start of random sequence: ', randTest call random_seed(put = randInit) @@ -723,6 +700,8 @@ end function math_transpose33 ! returns all zeroes if not possible, i.e. if det close to zero !-------------------------------------------------------------------------------------------------- pure function math_inv33(A) + use prec, only: & + dNeq0 implicit none real(pReal),dimension(3,3),intent(in) :: A @@ -735,7 +714,7 @@ pure function math_inv33(A) DetA = A(1,1) * math_inv33(1,1) + A(1,2) * math_inv33(2,1) + A(1,3) * math_inv33(3,1) - if (abs(DetA) > tiny(DetA)) then ! use a real threshold here + if (dNeq0(DetA)) then math_inv33(1,2) = -A(1,2) * A(3,3) + A(1,3) * A(3,2) math_inv33(2,2) = A(1,1) * A(3,3) - A(1,3) * A(3,1) math_inv33(3,2) = -A(1,1) * A(3,2) + A(1,2) * A(3,1) @@ -759,6 +738,8 @@ end function math_inv33 ! returns error if not possible, i.e. if det close to zero !-------------------------------------------------------------------------------------------------- pure subroutine math_invert33(A, InvA, DetA, error) + use prec, only: & + dEq0 implicit none logical, intent(out) :: error @@ -772,7 +753,7 @@ pure subroutine math_invert33(A, InvA, DetA, error) DetA = A(1,1) * InvA(1,1) + A(1,2) * InvA(2,1) + A(1,3) * InvA(3,1) - if (abs(DetA) <= tiny(DetA)) then + if (dEq0(DetA)) then InvA = 0.0_pReal error = .true. else @@ -1096,7 +1077,7 @@ pure function math_Plain99to3333(m99) integer(pInt) :: i,j forall (i=1_pInt:9_pInt,j=1_pInt:9_pInt) math_Plain99to3333(mapPlain(1,i),mapPlain(2,i),& - mapPlain(1,j),mapPlain(2,j)) = m99(i,j) + mapPlain(1,j),mapPlain(2,j)) = m99(i,j) end function math_Plain99to3333 @@ -1208,10 +1189,10 @@ function math_qRand() real(pReal), dimension(3) :: rnd call halton(3_pInt,rnd) - math_qRand(1) = cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)) - math_qRand(2) = sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)) - math_qRand(3) = cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)) - math_qRand(4) = sin(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)) + math_qRand = [cos(2.0_pReal*PI*rnd(1))*sqrt(rnd(3)), & + sin(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), & + cos(2.0_pReal*PI*rnd(2))*sqrt(1.0_pReal-rnd(3)), & + sin(2.0_pReal*PI*rnd(1))*sqrt(rnd(3))] end function math_qRand @@ -1277,6 +1258,8 @@ end function math_qNorm !> @brief quaternion inversion !-------------------------------------------------------------------------------------------------- pure function math_qInv(Q) + use prec, only: & + dNeq0 implicit none real(pReal), dimension(4), intent(in) :: Q @@ -1286,8 +1269,7 @@ pure function math_qInv(Q) math_qInv = 0.0_pReal squareNorm = math_qDot(Q,Q) - if (abs(squareNorm) > tiny(squareNorm)) & - math_qInv = math_qConj(Q) / squareNorm + if (dNeq0(squareNorm)) math_qInv = math_qConj(Q) / squareNorm end function math_qInv @@ -1468,7 +1450,7 @@ pure function math_EulerToQ(eulerangles) cos(halfangles(1)-halfangles(3)) * s, & sin(halfangles(1)-halfangles(3)) * s, & sin(halfangles(1)+halfangles(3)) * c ] - math_EulerToQ = math_qConj(math_EulerToQ) ! convert to passive rotation + math_EulerToQ = math_qConj(math_EulerToQ) ! convert to passive rotation end function math_EulerToQ @@ -1488,7 +1470,7 @@ pure function math_axisAngleToR(axis,omega) real(pReal), dimension(3) :: axisNrm real(pReal) :: norm,s,c,c1 - norm = sqrt(math_mul3x3(axis,axis)) + norm = norm2(axis) if (norm > 1.0e-8_pReal) then ! non-zero rotation axisNrm = axis/norm ! normalize axis to be sure @@ -1526,7 +1508,7 @@ pure function math_EulerAxisAngleToR(axis,omega) real(pReal), dimension(3), intent(in) :: axis real(pReal), intent(in) :: omega - math_EulerAxisAngleToR = transpose(math_axisAngleToR(axis,omega)) ! convert to passive rotation + math_EulerAxisAngleToR = transpose(math_axisAngleToR(axis,omega)) ! convert to passive rotation end function math_EulerAxisAngleToR @@ -1545,7 +1527,7 @@ pure function math_EulerAxisAngleToQ(axis,omega) real(pReal), dimension(3), intent(in) :: axis real(pReal), intent(in) :: omega - math_EulerAxisAngleToQ = math_qConj(math_axisAngleToQ(axis,omega)) ! convert to passive rotation + math_EulerAxisAngleToQ = math_qConj(math_axisAngleToQ(axis,omega)) ! convert to passive rotation end function math_EulerAxisAngleToQ @@ -1568,7 +1550,7 @@ pure function math_axisAngleToQ(axis,omega) norm = sqrt(math_mul3x3(axis,axis)) rotation: if (norm > 1.0e-8_pReal) then - axisNrm = axis/norm ! normalize axis to be sure + axisNrm = axis/norm ! normalize axis to be sure math_axisAngleToQ = [cos(0.5_pReal*omega), sin(0.5_pReal*omega) * axisNrm(1:3)] else rotation math_axisAngleToQ = [1.0_pReal,0.0_pReal,0.0_pReal,0.0_pReal] @@ -1594,7 +1576,7 @@ pure function math_qToR(q) S = reshape( [0.0_pReal, -q(4), q(3), & q(4), 0.0_pReal, -q(2), & - -q(3), q(2), 0.0_pReal],[3,3]) ! notation is transposed + -q(3), q(2), 0.0_pReal],[3,3]) ! notation is transposed math_qToR = (2.0_pReal * q(1)*q(1) - 1.0_pReal) * math_I3 & + 2.0_pReal * T - 2.0_pReal * q(1) * S @@ -1618,17 +1600,17 @@ pure function math_qToEuler(qPassive) q = math_qConj(qPassive) ! convert to active rotation, since formulas are defined for active rotations - math_qToEuler(2) = acos(1.0_pReal-2.0_pReal*(q(2)*q(2)+q(3)*q(3))) + math_qToEuler(2) = acos(1.0_pReal-2.0_pReal*(q(2)**2+q(3)**2)) if (abs(math_qToEuler(2)) < 1.0e-6_pReal) then math_qToEuler(1) = sign(2.0_pReal*acos(math_limit(q(1),-1.0_pReal, 1.0_pReal)),q(4)) math_qToEuler(3) = 0.0_pReal else - math_qToEuler(1) = atan2(q(1)*q(3)+q(2)*q(4), q(1)*q(2)-q(3)*q(4)) + math_qToEuler(1) = atan2(+q(1)*q(3)+q(2)*q(4), q(1)*q(2)-q(3)*q(4)) math_qToEuler(3) = atan2(-q(1)*q(3)+q(2)*q(4), q(1)*q(2)+q(3)*q(4)) endif - math_qToEuler = merge(math_qToEuler + [2.0_pReal*PI, PI, 2.0_pReal*PI], & ! ensure correct range + math_qToEuler = merge(math_qToEuler + [2.0_pReal*PI, PI, 2.0_pReal*PI], & ! ensure correct range math_qToEuler, math_qToEuler<0.0_pReal) end function math_qToEuler @@ -1882,37 +1864,29 @@ end function math_sampleGaussVar !-------------------------------------------------------------------------------------------------- -!> @brief symmetrically equivalent Euler angles for given sample symmetry 1:triclinic, 2:monoclinic, 4:orthotropic +!> @brief symmetrically equivalent Euler angles for given sample symmetry +!> @detail 1 (equivalent to != 2 and !=4):triclinic, 2:monoclinic, 4:orthotropic !-------------------------------------------------------------------------------------------------- pure function math_symmetricEulers(sym,Euler) implicit none - integer(pInt), intent(in) :: sym + integer(pInt), intent(in) :: sym !< symmetry Class real(pReal), dimension(3), intent(in) :: Euler real(pReal), dimension(3,3) :: math_symmetricEulers - integer(pInt) :: i,j - math_symmetricEulers(1,1) = PI+Euler(1) - math_symmetricEulers(2,1) = Euler(2) - math_symmetricEulers(3,1) = Euler(3) + math_symmetricEulers = transpose(reshape([PI+Euler(1), PI-Euler(1), 2.0_pReal*PI-Euler(1), & + Euler(2), PI-Euler(2), PI -Euler(2), & + Euler(3), PI+Euler(3), PI +Euler(3)],[3,3])) ! transpose is needed to have symbolic notation instead of column-major - math_symmetricEulers(1,2) = PI-Euler(1) - math_symmetricEulers(2,2) = PI-Euler(2) - math_symmetricEulers(3,2) = PI+Euler(3) - - math_symmetricEulers(1,3) = 2.0_pReal*PI-Euler(1) - math_symmetricEulers(2,3) = PI-Euler(2) - math_symmetricEulers(3,3) = PI+Euler(3) - - forall (i=1_pInt:3_pInt,j=1_pInt:3_pInt) math_symmetricEulers(j,i) = modulo(math_symmetricEulers(j,i),2.0_pReal*pi) + math_symmetricEulers = modulo(math_symmetricEulers,2.0_pReal*pi) select case (sym) - case (4_pInt) ! all done + case (4_pInt) ! orthotropic: all done - case (2_pInt) ! return only first + case (2_pInt) ! monoclinic: return only first math_symmetricEulers(1:3,2:3) = 0.0_pReal - case default ! return blank + case default ! triclinic: return blank math_symmetricEulers = 0.0_pReal end select @@ -2091,6 +2065,8 @@ end function math_eigenvectorBasisSym33 !> @brief rotational part from polar decomposition of 33 tensor m !-------------------------------------------------------------------------------------------------- function math_rotationalPart33(m) + use prec, only: & + dEq0 use IO, only: & IO_warning @@ -2102,12 +2078,12 @@ function math_rotationalPart33(m) U = math_eigenvectorBasisSym33(math_mul33x33(transpose(m),m)) Uinv = math_inv33(U) - if (all(abs(Uinv) <= tiny(Uinv))) then ! math_inv33 returns zero when failed, avoid floating point equality comparison + inversionFailed: if (all(dEq0(Uinv))) then math_rotationalPart33 = math_I3 call IO_warning(650_pInt) - else + else inversionFailed math_rotationalPart33 = math_mul33x33(m,Uinv) - endif + endif inversionFailed end function math_rotationalPart33 diff --git a/src/mesh.f90 b/src/mesh.f90 index 22e103df0..7da3d4968 100644 --- a/src/mesh.f90 +++ b/src/mesh.f90 @@ -116,12 +116,8 @@ module mesh #endif #ifdef Spectral -#ifdef PETSc #include include 'fftw3-mpi.f03' -#else - include 'fftw3.f03' -#endif #endif ! These definitions should actually reside in the FE-solver specific part (different for MARC/ABAQUS) @@ -413,18 +409,13 @@ module mesh mesh_build_ipVolumes, & mesh_build_ipCoordinates, & mesh_cellCenterCoordinates, & - mesh_init_postprocessing, & mesh_get_Ncellnodes, & mesh_get_unitlength, & mesh_get_nodeAtIP #ifdef Spectral public :: & mesh_spectral_getGrid, & - mesh_spectral_getSize, & - mesh_nodesAroundCentres, & - mesh_deformedCoordsFFT, & - mesh_volumeMismatch, & - mesh_shapeMismatch + mesh_spectral_getSize #endif private :: & @@ -436,8 +427,7 @@ module mesh mesh_spectral_build_nodes, & mesh_spectral_build_elements, & mesh_spectral_build_ipNeighborhood, & -#endif -#ifdef Marc4DAMASK +#elif defined Marc4DAMASK mesh_marc_get_tableStyles, & mesh_marc_count_nodesAndElements, & mesh_marc_count_elementSets, & @@ -448,8 +438,7 @@ module mesh mesh_marc_build_nodes, & mesh_marc_count_cpSizes, & mesh_marc_build_elements, & -#endif -#ifdef Abaqus +#elif defined Abaqus mesh_abaqus_count_nodesAndElements, & mesh_abaqus_count_elementSets, & mesh_abaqus_count_materials, & @@ -473,11 +462,7 @@ module mesh mesh_tell_statistics, & FE_mapElemtype, & mesh_faceMatch, & - mesh_build_FEdata, & - mesh_write_cellGeom, & - mesh_write_elemGeom, & - mesh_write_meshfile, & - mesh_read_meshfile + mesh_build_FEdata contains @@ -487,9 +472,7 @@ contains !! Order and routines strongly depend on type of solver !-------------------------------------------------------------------------------------------------- subroutine mesh_init(ip,el) -#ifdef Spectral use, intrinsic :: iso_c_binding -#endif use DAMASK_interface use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) use IO, only: & @@ -498,6 +481,7 @@ subroutine mesh_init(ip,el) #endif #ifdef Spectral IO_open_file, & + IO_error, & #else IO_open_InputFile, & #endif @@ -524,18 +508,17 @@ subroutine mesh_init(ip,el) implicit none #ifdef Spectral - integer(C_INTPTR_T) :: gridMPI(3), alloc_local, local_K, local_K_offset + integer(C_INTPTR_T) :: devNull, local_K, local_K_offset + integer :: ierr, worldsize #endif integer(pInt), parameter :: FILEUNIT = 222_pInt integer(pInt), intent(in) :: el, ip integer(pInt) :: j logical :: myDebug - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- mesh init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- mesh init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess if (allocated(mesh_mapFEtoCPelem)) deallocate(mesh_mapFEtoCPelem) if (allocated(mesh_mapFEtoCPnode)) deallocate(mesh_mapFEtoCPnode) @@ -562,25 +545,21 @@ subroutine mesh_init(ip,el) myDebug = (iand(debug_level(debug_mesh),debug_levelBasic) /= 0_pInt) #ifdef Spectral -#ifdef PETSc call fftw_mpi_init() -#endif call IO_open_file(FILEUNIT,geometryFile) ! parse info from geometry file... if (myDebug) write(6,'(a)') ' Opened geometry file'; flush(6) grid = mesh_spectral_getGrid(fileUnit) - geomSize = mesh_spectral_getSize(fileUnit) + call MPI_comm_size(PETSC_COMM_WORLD, worldsize, ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_comm_size') + if(worldsize>grid(3)) call IO_error(894_pInt, ext_msg='number of processes exceeds grid(3)') -#ifdef PETSc - gridMPI = int(grid,C_INTPTR_T) - alloc_local = fftw_mpi_local_size_3d(gridMPI(3), gridMPI(2), gridMPI(1)/2 +1, & - MPI_COMM_WORLD, local_K, local_K_offset) + geomSize = mesh_spectral_getSize(fileUnit) + devNull = fftw_mpi_local_size_3d(int(grid(3),C_INTPTR_T),int(grid(2),C_INTPTR_T),& + int(grid(1),C_INTPTR_T)/2+1,PETSC_COMM_WORLD,local_K,local_K_offset) grid3 = int(local_K,pInt) grid3Offset = int(local_K_offset,pInt) - size3 = geomSize(3)*real(grid3,pReal) /real(grid(3),pReal) size3Offset = geomSize(3)*real(grid3Offset,pReal)/real(grid(3),pReal) -#endif - if (myDebug) write(6,'(a)') ' Grid partitioned'; flush(6) call mesh_spectral_count() if (myDebug) write(6,'(a)') ' Counted nodes/elements'; flush(6) @@ -592,8 +571,7 @@ subroutine mesh_init(ip,el) if (myDebug) write(6,'(a)') ' Built nodes'; flush(6) call mesh_spectral_build_elements(FILEUNIT) if (myDebug) write(6,'(a)') ' Built elements'; flush(6) -#endif -#ifdef Marc4DAMASK +#elif defined Marc4DAMASK call IO_open_inputFile(FILEUNIT,modelName) ! parse info from input file... if (myDebug) write(6,'(a)') ' Opened input file'; flush(6) call mesh_marc_get_tableStyles(FILEUNIT) @@ -616,8 +594,7 @@ subroutine mesh_init(ip,el) if (myDebug) write(6,'(a)') ' Counted CP sizes'; flush(6) call mesh_marc_build_elements(FILEUNIT) if (myDebug) write(6,'(a)') ' Built elements'; flush(6) -#endif -#ifdef Abaqus +#elif defined Abaqus call IO_open_inputFile(FILEUNIT,modelName) ! parse info from input file... if (myDebug) write(6,'(a)') ' Opened input file'; flush(6) noPart = IO_abaqus_hasNoPart(FILEUNIT) @@ -666,15 +643,12 @@ subroutine mesh_init(ip,el) if (myDebug) write(6,'(a)') ' Built shared elements'; flush(6) call mesh_build_ipNeighborhood #else - call mesh_spectral_build_ipNeighborhood(FILEUNIT) + call mesh_spectral_build_ipNeighborhood #endif if (myDebug) write(6,'(a)') ' Built IP neighborhood'; flush(6) if (worldrank == 0_pInt) then call mesh_tell_statistics - call mesh_write_meshfile - call mesh_write_cellGeom - call mesh_write_elemGeom endif if (usePingPong .and. (mesh_Nelems /= mesh_NcpElems)) & @@ -1417,11 +1391,9 @@ end subroutine mesh_spectral_build_elements !> @brief build neighborhood relations for spectral !> @details assign globals: mesh_ipNeighborhood !-------------------------------------------------------------------------------------------------- -subroutine mesh_spectral_build_ipNeighborhood(fileUnit) +subroutine mesh_spectral_build_ipNeighborhood implicit none - integer(pInt), intent(in) :: & - fileUnit integer(pInt) :: & x,y,z, & e @@ -1558,332 +1530,8 @@ function mesh_nodesAroundCentres(gDim,Favg,centres) result(nodes) nodes = nodes/8.0_pReal end function mesh_nodesAroundCentres - - -!-------------------------------------------------------------------------------------------------- -!> @brief calculate coordinates in current configuration for given defgrad -! using integration in Fourier space -!-------------------------------------------------------------------------------------------------- -function mesh_deformedCoordsFFT(gDim,F,FavgIn,scalingIn) result(coords) - use IO, only: & - IO_error - use numerics, only: & - fftw_timelimit, & - fftw_planner_flag - use debug, only: & - debug_mesh, & - debug_level, & - debug_levelBasic - use math, only: & - PI, & - math_mul33x3 - - implicit none - real(pReal), intent(in), dimension(:,:,:,:,:) :: F - real(pReal), dimension(3,size(F,3),size(F,4),size(F,5)) :: coords - real(pReal), intent(in), dimension(3) :: gDim - real(pReal), intent(in), dimension(3,3), optional :: FavgIn - real(pReal), intent(in), dimension(3), optional :: scalingIn - -! allocatable arrays for fftw c routines - type(C_PTR) :: planForth, planBack - type(C_PTR) :: coords_fftw, defgrad_fftw - real(pReal), dimension(:,:,:,:,:), pointer :: F_real - complex(pReal), dimension(:,:,:,:,:), pointer :: F_fourier - real(pReal), dimension(:,:,:,:), pointer :: coords_real - complex(pReal), dimension(:,:,:,:), pointer :: coords_fourier - ! other variables - integer(pInt) :: i, j, k, m, res1Red - integer(pInt), dimension(3) :: k_s, iRes - real(pReal), dimension(3) :: scaling, step, offset_coords, integrator - real(pReal), dimension(3,3) :: Favg - integer(pInt), dimension(2:3,2) :: Nyquist ! highest frequencies to be removed (1 if even, 2 if odd) - - if (present(scalingIn)) then - where (scalingIn < 0.0_pReal) ! invalid values. in case of f2py -1 if not present - scaling = [1.0_pReal,1.0_pReal,1.0_pReal] - elsewhere - scaling = scalingIn - end where - else - scaling = 1.0_pReal - endif - - iRes = [size(F,3),size(F,4),size(F,5)] - integrator = gDim / 2.0_pReal / PI ! see notes where it is used - res1Red = iRes(1)/2_pInt + 1_pInt ! size of complex array in first dimension (c2r, r2c) - step = gDim/real(iRes, pReal) - Nyquist(2,1:2) = [iRes(2)/2_pInt + 1_pInt, iRes(2)/2_pInt + 1_pInt + mod(iRes(2),2_pInt)] - Nyquist(3,1:2) = [iRes(3)/2_pInt + 1_pInt, iRes(3)/2_pInt + 1_pInt + mod(iRes(3),2_pInt)] - -!-------------------------------------------------------------------------------------------------- -! report - if (iand(debug_level(debug_mesh),debug_levelBasic) /= 0_pInt) then - write(6,'(a)') ' Restore geometry using FFT-based integration' - write(6,'(a,3(i12 ))') ' grid a b c: ', iRes - write(6,'(a,3(es12.5))') ' size x y z: ', gDim - endif - -!-------------------------------------------------------------------------------------------------- -! sanity check - if (pReal /= C_DOUBLE .or. pInt /= C_INT) & - call IO_error(0_pInt,ext_msg='Fortran to C in mesh_deformedCoordsFFT') - -!-------------------------------------------------------------------------------------------------- -! allocation and FFTW initialization - defgrad_fftw = fftw_alloc_complex(int(res1Red *iRes(2)*iRes(3)*9_pInt,C_SIZE_T)) ! C_SIZE_T is of type integer(8) - coords_fftw = fftw_alloc_complex(int(res1Red *iRes(2)*iRes(3)*3_pInt,C_SIZE_T)) ! C_SIZE_T is of type integer(8) - call c_f_pointer(defgrad_fftw, F_real, & - [iRes(1)+2_pInt-mod(iRes(1),2_pInt),iRes(2),iRes(3),3_pInt,3_pInt]) - call c_f_pointer(defgrad_fftw, F_fourier, & - [res1Red, iRes(2),iRes(3),3_pInt,3_pInt]) - call c_f_pointer(coords_fftw, coords_real, & - [iRes(1)+2_pInt-mod(iRes(1),2_pInt),iRes(2),iRes(3),3_pInt]) - call c_f_pointer(coords_fftw, coords_fourier, & - [res1Red, iRes(2),iRes(3),3_pInt]) - - call fftw_set_timelimit(fftw_timelimit) - planForth = fftw_plan_many_dft_r2c(3_pInt,[iRes(3),iRes(2) ,iRes(1)],9_pInt,& ! dimensions , length in each dimension in reversed order - F_real,[iRes(3),iRes(2) ,iRes(1)+2_pInt-mod(iRes(1),2_pInt)],& ! input data , physical length in each dimension in reversed order - 1_pInt, iRes(3)*iRes(2)*(iRes(1)+2_pInt-mod(iRes(1),2_pInt)),& ! striding , product of physical lenght in the 3 dimensions - F_fourier,[iRes(3),iRes(2) ,res1Red],& - 1_pInt, iRes(3)*iRes(2)* res1Red,fftw_planner_flag) - - planBack = fftw_plan_many_dft_c2r(3_pInt,[iRes(3),iRes(2) ,iRes(1)],3_pInt,& - coords_fourier,[iRes(3),iRes(2) ,res1Red],& - 1_pInt, iRes(3)*iRes(2)* res1Red,& - coords_real,[iRes(3),iRes(2) ,iRes(1)+2_pInt-mod(iRes(1),2_pInt)],& - 1_pInt, iRes(3)*iRes(2)*(iRes(1)+2_pInt-mod(iRes(1),2_pInt)),& - fftw_planner_flag) - F_real(1:iRes(1),1:iRes(2),1:iRes(3),1:3,1:3) = & - reshape(F,[iRes(1),iRes(2),iRes(3),3,3], order = [4,5,1,2,3]) ! F_real is overwritten during plan creatio, is larger (padding) and has different order - -!-------------------------------------------------------------------------------------------------- -! FFT - call fftw_execute_dft_r2c(planForth, F_real, F_fourier) - -!-------------------------------------------------------------------------------------------------- -! if no average F is given, compute it in Fourier space - if (present(FavgIn)) then - if (all(FavgIn < 0.0_pReal)) then - Favg = real(F_fourier(1,1,1,1:3,1:3),pReal)/real(product(iRes),pReal) !the f2py way to tell it is not present - else - Favg = FavgIn - endif - else - Favg = real(F_fourier(1,1,1,1:3,1:3),pReal)/real(product(iRes),pReal) - endif - -!-------------------------------------------------------------------------------------------------- -! remove highest frequency in each direction, in third direction only if not 2D - - if(iRes(1)/=1_pInt) & ! do not delete the whole slice in case of 2D calculation - F_fourier (res1Red, 1:iRes(2), 1:iRes(3), 1:3,1:3) & - = cmplx(0.0_pReal,0.0_pReal,pReal) - if(iRes(2)/=1_pInt) & ! do not delete the whole slice in case of 2D calculation - F_fourier (1:res1Red,Nyquist(2,1):Nyquist(2,2),1:iRes(3), 1:3,1:3) & - = cmplx(0.0_pReal,0.0_pReal,pReal) - if(iRes(3)/=1_pInt) & ! do not delete the whole slice in case of 2D calculation - F_fourier (1:res1Red,1:iRes(2), Nyquist(3,1):Nyquist(3,2),1:3,1:3) & - = cmplx(0.0_pReal,0.0_pReal,pReal) - -!-------------------------------------------------------------------------------------------------- -! integration in Fourier space - coords_fourier = cmplx(0.0_pReal,0.0_pReal,pReal) - do k = 1_pInt, iRes(3) - k_s(3) = k-1_pInt - if(k > iRes(3)/2_pInt+1_pInt) k_s(3) = k_s(3)-iRes(3) - do j = 1_pInt, iRes(2) - k_s(2) = j-1_pInt - if(j > iRes(2)/2_pInt+1_pInt) k_s(2) = k_s(2)-iRes(2) - do i = 1_pInt, res1Red - k_s(1) = i-1_pInt - do m = 1_pInt,3_pInt - coords_fourier(i,j,k,m) = sum(F_fourier(i,j,k,m,1:3)*& - cmplx(0.0_pReal,real(k_s,pReal)*integrator,pReal)) - enddo - if (any(k_s /= 0_pInt)) coords_fourier(i,j,k,1:3) = & - coords_fourier(i,j,k,1:3) / cmplx(-sum(k_s*k_s),0.0_pReal,pReal) - enddo; enddo; enddo - -!-------------------------------------------------------------------------------------------------- -! iFFT and freeing memory - call fftw_execute_dft_c2r(planBack,coords_fourier,coords_real) - coords = reshape(coords_real(1:iRes(1),1:iRes(2),1:iRes(3),1:3), [3,iRes(1),iRes(2),iRes(3)], & - order = [2,3,4,1])/real(product(iRes),pReal) ! weight and change order - call fftw_destroy_plan(planForth) - call fftw_destroy_plan(planBack) - call fftw_free(defgrad_fftw) - call fftw_free(coords_fftw) - -!-------------------------------------------------------------------------------------------------- -! add average to scaled fluctuation and put (0,0,0) on (0,0,0) - offset_coords = math_mul33x3(F(1:3,1:3,1,1,1),step/2.0_pReal) - scaling*coords(1:3,1,1,1) - forall(k = 1_pInt:iRes(3), j = 1_pInt:iRes(2), i = 1_pInt:iRes(1)) & - coords(1:3,i,j,k) = scaling(1:3)*coords(1:3,i,j,k) & - + offset_coords & - + math_mul33x3(Favg,step*real([i,j,k]-1_pInt,pReal)) - -end function mesh_deformedCoordsFFT - - -!-------------------------------------------------------------------------------------------------- -!> @brief calculates the mismatch between volume of reconstructed (compatible) cube and -! determinant of defgrad at the FP -!-------------------------------------------------------------------------------------------------- -function mesh_volumeMismatch(gDim,F,nodes) result(vMismatch) - use IO, only: & - IO_error - use debug, only: & - debug_mesh, & - debug_level, & - debug_levelBasic - use math, only: & - math_det33, & - math_volTetrahedron - - implicit none - real(pReal), intent(in), dimension(:,:,:,:,:) :: & - F - real(pReal), dimension(size(F,3),size(F,4),size(F,5)) :: & - vMismatch - real(pReal), intent(in), dimension(:,:,:,:) :: & - nodes - real(pReal), dimension(3) :: & - gDim - integer(pInt), dimension(3) :: & - iRes - real(pReal), dimension(3,8) :: coords - integer(pInt) :: i,j,k - real(pReal) :: volInitial - - iRes = [size(F,3),size(F,4),size(F,5)] - volInitial = product(gDim)/real(product(iRes), pReal) - -!-------------------------------------------------------------------------------------------------- -! report and check - if (iand(debug_level(debug_mesh),debug_levelBasic) /= 0_pInt) then - write(6,'(a)') ' Calculating volume mismatch' - write(6,'(a,3(i12 ))') ' grid a b c: ', iRes - write(6,'(a,3(es12.5))') ' size x y z: ', gDim - endif - - if (any([iRes/=size(nodes,2)-1_pInt,iRes/=size(nodes,3)-1_pInt,iRes/=size(nodes,4)-1_pInt]))& - call IO_error(0_pInt,ext_msg='Arrays F and nodes in mesh_volumeMismatch') - -!-------------------------------------------------------------------------------------------------- -! calculate actual volume and volume resulting from deformation gradient - do k = 1_pInt,iRes(3) - do j = 1_pInt,iRes(2) - do i = 1_pInt,iRes(1) - coords(1:3,1) = nodes(1:3,i, j, k ) - coords(1:3,2) = nodes(1:3,i+1_pInt,j, k ) - coords(1:3,3) = nodes(1:3,i+1_pInt,j+1_pInt,k ) - coords(1:3,4) = nodes(1:3,i, j+1_pInt,k ) - coords(1:3,5) = nodes(1:3,i, j, k+1_pInt) - coords(1:3,6) = nodes(1:3,i+1_pInt,j, k+1_pInt) - coords(1:3,7) = nodes(1:3,i+1_pInt,j+1_pInt,k+1_pInt) - coords(1:3,8) = nodes(1:3,i, j+1_pInt,k+1_pInt) - vMismatch(i,j,k) = & - abs(math_volTetrahedron(coords(1:3,7),coords(1:3,1),coords(1:3,8),coords(1:3,4))) & - + abs(math_volTetrahedron(coords(1:3,7),coords(1:3,1),coords(1:3,8),coords(1:3,5))) & - + abs(math_volTetrahedron(coords(1:3,7),coords(1:3,1),coords(1:3,3),coords(1:3,4))) & - + abs(math_volTetrahedron(coords(1:3,7),coords(1:3,1),coords(1:3,3),coords(1:3,2))) & - + abs(math_volTetrahedron(coords(1:3,7),coords(1:3,5),coords(1:3,2),coords(1:3,6))) & - + abs(math_volTetrahedron(coords(1:3,7),coords(1:3,5),coords(1:3,2),coords(1:3,1))) - vMismatch(i,j,k) = vMismatch(i,j,k)/math_det33(F(1:3,1:3,i,j,k)) - enddo; enddo; enddo - vMismatch = vMismatch/volInitial - -end function mesh_volumeMismatch - - -!-------------------------------------------------------------------------------------------------- -!> @brief Routine to calculate the mismatch between the vectors from the central point to -! the corners of reconstructed (combatible) volume element and the vectors calculated by deforming -! the initial volume element with the current deformation gradient -!-------------------------------------------------------------------------------------------------- -function mesh_shapeMismatch(gDim,F,nodes,centres) result(sMismatch) - use IO, only: & - IO_error - use debug, only: & - debug_mesh, & - debug_level, & - debug_levelBasic - use math, only: & - math_mul33x3 - - implicit none - real(pReal), intent(in), dimension(:,:,:,:,:) :: & - F - real(pReal), dimension(size(F,3),size(F,4),size(F,5)) :: & - sMismatch - real(pReal), intent(in), dimension(:,:,:,:) :: & - nodes, & - centres - real(pReal), dimension(3) :: & - gDim, & - fRes - integer(pInt), dimension(3) :: & - iRes - real(pReal), dimension(3,8) :: coordsInitial - integer(pInt) i,j,k - - iRes = [size(F,3),size(F,4),size(F,5)] - fRes = real(iRes,pReal) - -!-------------------------------------------------------------------------------------------------- -! report and check - if (iand(debug_level(debug_mesh),debug_levelBasic) /= 0_pInt) then - write(6,'(a)') ' Calculating shape mismatch' - write(6,'(a,3(i12 ))') ' grid a b c: ', iRes - write(6,'(a,3(es12.5))') ' size x y z: ', gDim - endif - - if(any([iRes/=size(nodes,2)-1_pInt,iRes/=size(nodes,3)-1_pInt,iRes/=size(nodes,4)-1_pInt]) .or.& - any([iRes/=size(centres,2), iRes/=size(centres,3), iRes/=size(centres,4)]))& - call IO_error(0_pInt,ext_msg='Arrays F and nodes/centres in mesh_shapeMismatch') - -!-------------------------------------------------------------------------------------------------- -! initial positions - coordsInitial(1:3,1) = [-gDim(1)/fRes(1),-gDim(2)/fRes(2),-gDim(3)/fRes(3)] - coordsInitial(1:3,2) = [+gDim(1)/fRes(1),-gDim(2)/fRes(2),-gDim(3)/fRes(3)] - coordsInitial(1:3,3) = [+gDim(1)/fRes(1),+gDim(2)/fRes(2),-gDim(3)/fRes(3)] - coordsInitial(1:3,4) = [-gDim(1)/fRes(1),+gDim(2)/fRes(2),-gDim(3)/fRes(3)] - coordsInitial(1:3,5) = [-gDim(1)/fRes(1),-gDim(2)/fRes(2),+gDim(3)/fRes(3)] - coordsInitial(1:3,6) = [+gDim(1)/fRes(1),-gDim(2)/fRes(2),+gDim(3)/fRes(3)] - coordsInitial(1:3,7) = [+gDim(1)/fRes(1),+gDim(2)/fRes(2),+gDim(3)/fRes(3)] - coordsInitial(1:3,8) = [-gDim(1)/fRes(1),+gDim(2)/fRes(2),+gDim(3)/fRes(3)] - coordsInitial = coordsInitial/2.0_pReal - -!-------------------------------------------------------------------------------------------------- -! compare deformed original and deformed positions to actual positions - do k = 1_pInt,iRes(3) - do j = 1_pInt,iRes(2) - do i = 1_pInt,iRes(1) - sMismatch(i,j,k) = & - sqrt(sum((nodes(1:3,i, j, k ) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,1)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i+1_pInt,j, k ) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,2)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i+1_pInt,j+1_pInt,k ) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,3)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i, j+1_pInt,k ) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,4)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i, j, k+1_pInt) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,5)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i+1_pInt,j, k+1_pInt) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,6)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i+1_pInt,j+1_pInt,k+1_pInt) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,7)))**2.0_pReal))& - + sqrt(sum((nodes(1:3,i, j+1_pInt,k+1_pInt) - centres(1:3,i,j,k)& - - math_mul33x3(F(1:3,1:3,i,j,k), coordsInitial(1:3,8)))**2.0_pReal)) - enddo; enddo; enddo - -end function mesh_shapeMismatch #endif - - + #ifdef Marc4DAMASK !-------------------------------------------------------------------------------------------------- !> @brief Figures out table styles (Marc only) and stores to 'initialcondTableStyle' and @@ -4511,212 +4159,6 @@ subroutine mesh_build_FEdata end subroutine mesh_build_FEdata -!-------------------------------------------------------------------------------------------------- -!> @brief writes out initial cell geometry -!-------------------------------------------------------------------------------------------------- -subroutine mesh_write_cellGeom - use DAMASK_interface, only: & - getSolverJobName, & - getSolverWorkingDirectoryName - use IR_Precision, only: & - I4P - use Lib_VTK_IO, only: & - VTK_ini, & - VTK_geo, & - VTK_con, & - VTK_end - implicit none - integer(I4P), dimension(1:mesh_Ncells) :: celltype - integer(I4P), dimension(mesh_Ncells*(1_pInt+FE_maxNcellnodesPerCell)) :: cellconnection - integer(I4P):: error - integer(I4P):: g, c, e, CellID, i, j - - cellID = 0_pInt - j = 0_pInt - do e = 1_pInt, mesh_NcpElems ! loop over cpElems - g = FE_geomtype(mesh_element(2_pInt,e)) ! get geometry type - c = FE_celltype(g) ! get cell type - do i = 1_pInt,FE_Nips(g) ! loop over ips=cells in this element - cellID = cellID + 1_pInt - celltype(cellID) = MESH_VTKCELLTYPE(c) - cellconnection(j+1_pInt:j+FE_NcellnodesPerCell(c)+1_pInt) & - = [FE_NcellnodesPerCell(c),mesh_cell(1:FE_NcellnodesPerCell(c),i,e)-1_pInt] ! number of cellnodes per cell & list of global cellnode IDs belnging to this cell (cellnode counting starts at 0) - j = j + FE_NcellnodesPerCell(c) + 1_pInt - enddo - enddo - - error=VTK_ini(output_format = 'ASCII', & - title=trim(getSolverJobName())//' cell mesh', & - filename = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'_ipbased.vtk', & - mesh_topology = 'UNSTRUCTURED_GRID') - !ToDo: check error here - error=VTK_geo(NN = int(mesh_Ncellnodes,I4P), & - X = mesh_cellnode(1,1:mesh_Ncellnodes), & - Y = mesh_cellnode(2,1:mesh_Ncellnodes), & - Z = mesh_cellnode(3,1:mesh_Ncellnodes)) - !ToDo: check error here - error=VTK_con(NC = int(mesh_Ncells,I4P), & - connect = cellconnection(1:j), & - !ToDo: check error here - cell_type = celltype) - error=VTK_end() - !ToDo: check error here - -end subroutine mesh_write_cellGeom - - -!-------------------------------------------------------------------------------------------------- -!> @brief writes out initial element geometry -!-------------------------------------------------------------------------------------------------- -subroutine mesh_write_elemGeom - use DAMASK_interface, only: & - getSolverJobName, & - getSolverWorkingDirectoryName - use IR_Precision, only: & - I4P - use Lib_VTK_IO, only: & - VTK_ini, & - VTK_geo, & - VTK_con, & - VTK_end - - implicit none - integer(I4P), dimension(1:mesh_NcpElems) :: elemtype - integer(I4P), dimension(mesh_NcpElems*(1_pInt+FE_maxNnodes)) :: elementconnection - integer(I4P):: error - integer(pInt):: e, t, n, i - - i = 0_pInt - do e = 1_pInt, mesh_NcpElems ! loop over cpElems - t = mesh_element(2,e) ! get element type - elemtype(e) = MESH_VTKELEMTYPE(t) - elementconnection(i+1_pInt) = FE_Nnodes(t) ! number of nodes per element - do n = 1_pInt,FE_Nnodes(t) - elementconnection(i+1_pInt+n) = mesh_element(4_pInt+n,e) - 1_pInt ! global node ID of node that belongs to this element (node counting starts at 0) - enddo - i = i + 1_pInt + FE_Nnodes(t) - enddo - - error=VTK_ini(output_format = 'ASCII', & - title=trim(getSolverJobName())//' element mesh', & - filename = trim(getSolverWorkingDirectoryName())//trim(getSolverJobName())//'_nodebased.vtk', & - mesh_topology = 'UNSTRUCTURED_GRID') - !ToDo: check error here - error=VTK_geo(NN = int(mesh_Nnodes,I4P), & - X = mesh_node0(1,1:mesh_Nnodes), & - Y = mesh_node0(2,1:mesh_Nnodes), & - Z = mesh_node0(3,1:mesh_Nnodes)) - !ToDo: check error here - error=VTK_con(NC = int(mesh_Nelems,I4P), & - connect = elementconnection(1:i), & - cell_type = elemtype) - !ToDo: check error here - error =VTK_end() - !ToDo: check error here - -end subroutine mesh_write_elemGeom - - -!-------------------------------------------------------------------------------------------------- -!> @brief writes description file for mesh -!-------------------------------------------------------------------------------------------------- -subroutine mesh_write_meshfile - use IO, only: & - IO_write_jobFile - - implicit none - integer(pInt), parameter :: fileUnit = 223_pInt - integer(pInt) :: e,i,t,g,c,n - - call IO_write_jobFile(fileUnit,'mesh') - write(fileUnit,'(A16,E10.3)') 'unitlength', mesh_unitlength - write(fileUnit,'(A16,I10)') 'maxNcellnodes', mesh_maxNcellnodes - write(fileUnit,'(A16,I10)') 'maxNips', mesh_maxNips - write(fileUnit,'(A16,I10)') 'maxNnodes', mesh_maxNnodes - write(fileUnit,'(A16,I10)') 'Nnodes', mesh_Nnodes - write(fileUnit,'(A16,I10)') 'NcpElems', mesh_NcpElems - do e = 1_pInt,mesh_NcpElems - t = mesh_element(2,e) - write(fileUnit,'(20(I10))') mesh_element(1_pInt:4_pInt+FE_Nnodes(t),e) - enddo - write(fileUnit,'(A16,I10)') 'Ncellnodes', mesh_Ncellnodes - do n = 1_pInt,mesh_Ncellnodes - write(fileUnit,'(2(I10))') mesh_cellnodeParent(1:2,n) - enddo - write(fileUnit,'(A16,I10)') 'Ncells', mesh_Ncells - do e = 1_pInt,mesh_NcpElems - t = mesh_element(2,e) - g = FE_geomtype(t) - c = FE_celltype(g) - do i = 1_pInt,FE_Nips(g) - write(fileUnit,'(8(I10))') & - mesh_cell(1_pInt:FE_NcellnodesPerCell(c),i,e) - enddo - enddo - close(fileUnit) - -end subroutine mesh_write_meshfile - - -!-------------------------------------------------------------------------------------------------- -!> @brief reads mesh description file -!-------------------------------------------------------------------------------------------------- -integer function mesh_read_meshfile(filepath) - - implicit none - character(len=*), intent(in) :: filepath - integer(pInt), parameter :: fileUnit = 223_pInt - integer(pInt) :: e,i,t,g,n - - open(fileUnit,status='old',err=100,iostat=mesh_read_meshfile,action='read',file=filepath) - read(fileUnit,'(TR16,E10.3)',err=100,iostat=mesh_read_meshfile) mesh_unitlength - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_maxNcellnodes - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_maxNips - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_maxNnodes - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_Nnodes - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_NcpElems - if (.not. allocated(mesh_element)) allocate(mesh_element(4_pInt+mesh_maxNnodes,mesh_NcpElems)) - mesh_element = 0_pInt - do e = 1_pInt,mesh_NcpElems - read(fileUnit,'(20(I10))',err=100,iostat=mesh_read_meshfile) & - mesh_element(:,e) - enddo - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_Ncellnodes - if (.not. allocated(mesh_cellnodeParent)) allocate(mesh_cellnodeParent(2_pInt,mesh_Ncellnodes)) - do n = 1_pInt,mesh_Ncellnodes - read(fileUnit,'(2(I10))',err=100,iostat=mesh_read_meshfile) mesh_cellnodeParent(1:2,n) - enddo - read(fileUnit,'(TR16,I10)',err=100,iostat=mesh_read_meshfile) mesh_Ncells - if (.not. allocated(mesh_cell)) allocate(mesh_cell(FE_maxNcellnodesPerCell,mesh_maxNips,mesh_NcpElems)) - do e = 1_pInt,mesh_NcpElems - t = mesh_element(2,e) - g = FE_geomtype(t) - do i = 1_pInt,FE_Nips(g) - read(fileUnit,'(8(I10))',err=100,iostat=mesh_read_meshfile) mesh_cell(:,i,e) - enddo - enddo - close(fileUnit) - - mesh_read_meshfile = 0 ! successfully read data - -100 continue -end function mesh_read_meshfile - - -!-------------------------------------------------------------------------------------------------- -!> @brief initializes mesh data for use in post processing -!-------------------------------------------------------------------------------------------------- -integer function mesh_init_postprocessing(filepath) - - implicit none - character(len=*), intent(in) :: filepath - - call mesh_build_FEdata - mesh_init_postprocessing = mesh_read_meshfile(filepath) - -end function mesh_init_postprocessing - - !-------------------------------------------------------------------------------------------------- !> @brief returns global variable mesh_Ncellnodes !-------------------------------------------------------------------------------------------------- diff --git a/src/numerics.f90 b/src/numerics.f90 index 365b078ec..6569d7cb4 100644 --- a/src/numerics.f90 +++ b/src/numerics.f90 @@ -28,7 +28,7 @@ module numerics fixedSeed = 0_pInt, & !< fixed seeding for pseudo-random number generator, Default 0: use random seed worldrank = 0_pInt, & !< MPI worldrank (/=0 for MPI simulations only) worldsize = 0_pInt !< MPI worldsize (/=0 for MPI simulations only) - integer, protected, public :: & + integer(4), protected, public :: & DAMASK_NumThreadsInt = 0 !< value stored in environment variable DAMASK_NUM_THREADS, set to zero if no OpenMP directive integer(pInt), public :: & numerics_integrationMode = 0_pInt !< integrationMode 1 = central solution; integrationMode 2 = perturbation, Default 0: undefined, is not read from file @@ -64,7 +64,6 @@ module numerics charLength = 1.0_pReal, & !< characteristic length scale for gradient problems residualStiffness = 1.0e-6_pReal !< non-zero residual damage logical, protected, public :: & - analyticJaco = .true., & !< use analytic Jacobian or perturbation, Default for Spectral solver .true.: usePingPong = .true., & numerics_timeSyncing = .false. !< flag indicating if time synchronization in crystallite is used for nonlocal plasticity @@ -111,7 +110,7 @@ module numerics fftw_plan_mode = 'FFTW_PATIENT' !< reads the planing-rigor flag, see manual on www.fftw.org, Default FFTW_PATIENT: use patient planner flag character(len=64), protected, public :: & spectral_solver = 'basicpetsc' , & !< spectral solution method - spectral_derivative = 'continuous' !< spectral filtering method + spectral_derivative = 'continuous' !< spectral spatial derivative method character(len=1024), protected, public :: & petsc_defaultOptions = '-mech_snes_type ngmres & &-damage_snes_type ngmres & @@ -211,7 +210,6 @@ subroutine numerics_init IO_warning, & IO_timeStamp, & IO_EOF - #if defined(Spectral) || defined(FEM) !$ use OMP_LIB, only: omp_set_num_threads ! Use the standard conforming module file for omp if using the spectral solver implicit none @@ -236,19 +234,17 @@ subroutine numerics_init call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr) call MPI_Comm_size(PETSC_COMM_WORLD,worldsize,ierr);CHKERRQ(ierr) #endif - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- numerics init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- numerics init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !$ call GET_ENVIRONMENT_VARIABLE(NAME='DAMASK_NUM_THREADS',VALUE=DAMASK_NumThreadsString,STATUS=gotDAMASK_NUM_THREADS) ! get environment variable DAMASK_NUM_THREADS... !$ if(gotDAMASK_NUM_THREADS /= 0) then ! could not get number of threads, set it to 1 !$ call IO_warning(35_pInt,ext_msg='BEGIN:'//DAMASK_NumThreadsString//':END') -!$ DAMASK_NumThreadsInt = 1 +!$ DAMASK_NumThreadsInt = 1_4 !$ else !$ read(DAMASK_NumThreadsString,'(i6)') DAMASK_NumThreadsInt ! read as integer -!$ if (DAMASK_NumThreadsInt < 1) DAMASK_NumThreadsInt = 1 ! in case of string conversion fails, set it to one +!$ if (DAMASK_NumThreadsInt < 1_4) DAMASK_NumThreadsInt = 1_4 ! in case of string conversion fails, set it to one !$ endif !$ call omp_set_num_threads(DAMASK_NumThreadsInt) ! set number of threads for parallel execution @@ -317,8 +313,6 @@ subroutine numerics_init numerics_integrator(1) = IO_intValue(line,chunkPos,2_pInt) case ('integratorstiffness') numerics_integrator(2) = IO_intValue(line,chunkPos,2_pInt) - case ('analyticjaco') - analyticJaco = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('usepingpong') usepingpong = IO_intValue(line,chunkPos,2_pInt) > 0_pInt case ('timesyncing') @@ -489,14 +483,8 @@ subroutine numerics_init close(FILEUNIT) else fileExists -#ifdef FEM - if (worldrank == 0) then -#endif write(6,'(a,/)') ' using standard values' flush(6) -#ifdef FEM - endif -#endif endif fileExists #ifdef Spectral @@ -519,128 +507,125 @@ subroutine numerics_init !-------------------------------------------------------------------------------------------------- ! writing parameters to output - mainProcess3: if (worldrank == 0) then - write(6,'(a24,1x,es8.1)') ' relevantStrain: ',relevantStrain - write(6,'(a24,1x,es8.1)') ' defgradTolerance: ',defgradTolerance - write(6,'(a24,1x,i8)') ' iJacoStiffness: ',iJacoStiffness - write(6,'(a24,1x,i8)') ' iJacoLpresiduum: ',iJacoLpresiduum - write(6,'(a24,1x,es8.1)') ' pert_Fg: ',pert_Fg - write(6,'(a24,1x,i8)') ' pert_method: ',pert_method - write(6,'(a24,1x,i8)') ' nCryst: ',nCryst - write(6,'(a24,1x,es8.1)') ' subStepMinCryst: ',subStepMinCryst - write(6,'(a24,1x,es8.1)') ' subStepSizeCryst: ',subStepSizeCryst - write(6,'(a24,1x,es8.1)') ' stepIncreaseCryst: ',stepIncreaseCryst - write(6,'(a24,1x,i8)') ' nState: ',nState - write(6,'(a24,1x,i8)') ' nStress: ',nStress - write(6,'(a24,1x,es8.1)') ' rTol_crystalliteState: ',rTol_crystalliteState - write(6,'(a24,1x,es8.1)') ' rTol_crystalliteStress: ',rTol_crystalliteStress - write(6,'(a24,1x,es8.1)') ' aTol_crystalliteStress: ',aTol_crystalliteStress - write(6,'(a24,2(1x,i8))') ' integrator: ',numerics_integrator - write(6,'(a24,1x,L8)') ' timeSyncing: ',numerics_timeSyncing - write(6,'(a24,1x,L8)') ' analytic Jacobian: ',analyticJaco - write(6,'(a24,1x,L8)') ' use ping pong scheme: ',usepingpong - write(6,'(a24,1x,es8.1,/)')' unitlength: ',numerics_unitlength + write(6,'(a24,1x,es8.1)') ' relevantStrain: ',relevantStrain + write(6,'(a24,1x,es8.1)') ' defgradTolerance: ',defgradTolerance + write(6,'(a24,1x,i8)') ' iJacoStiffness: ',iJacoStiffness + write(6,'(a24,1x,i8)') ' iJacoLpresiduum: ',iJacoLpresiduum + write(6,'(a24,1x,es8.1)') ' pert_Fg: ',pert_Fg + write(6,'(a24,1x,i8)') ' pert_method: ',pert_method + write(6,'(a24,1x,i8)') ' nCryst: ',nCryst + write(6,'(a24,1x,es8.1)') ' subStepMinCryst: ',subStepMinCryst + write(6,'(a24,1x,es8.1)') ' subStepSizeCryst: ',subStepSizeCryst + write(6,'(a24,1x,es8.1)') ' stepIncreaseCryst: ',stepIncreaseCryst + write(6,'(a24,1x,i8)') ' nState: ',nState + write(6,'(a24,1x,i8)') ' nStress: ',nStress + write(6,'(a24,1x,es8.1)') ' rTol_crystalliteState: ',rTol_crystalliteState + write(6,'(a24,1x,es8.1)') ' rTol_crystalliteStress: ',rTol_crystalliteStress + write(6,'(a24,1x,es8.1)') ' aTol_crystalliteStress: ',aTol_crystalliteStress + write(6,'(a24,2(1x,i8))') ' integrator: ',numerics_integrator + write(6,'(a24,1x,L8)') ' timeSyncing: ',numerics_timeSyncing + write(6,'(a24,1x,L8)') ' use ping pong scheme: ',usepingpong + write(6,'(a24,1x,es8.1,/)')' unitlength: ',numerics_unitlength - write(6,'(a24,1x,i8)') ' nHomog: ',nHomog - write(6,'(a24,1x,es8.1)') ' subStepMinHomog: ',subStepMinHomog - write(6,'(a24,1x,es8.1)') ' subStepSizeHomog: ',subStepSizeHomog - write(6,'(a24,1x,es8.1)') ' stepIncreaseHomog: ',stepIncreaseHomog - write(6,'(a24,1x,i8,/)') ' nMPstate: ',nMPstate + write(6,'(a24,1x,i8)') ' nHomog: ',nHomog + write(6,'(a24,1x,es8.1)') ' subStepMinHomog: ',subStepMinHomog + write(6,'(a24,1x,es8.1)') ' subStepSizeHomog: ',subStepSizeHomog + write(6,'(a24,1x,es8.1)') ' stepIncreaseHomog: ',stepIncreaseHomog + write(6,'(a24,1x,i8,/)') ' nMPstate: ',nMPstate !-------------------------------------------------------------------------------------------------- ! RGC parameters - write(6,'(a24,1x,es8.1)') ' aTol_RGC: ',absTol_RGC - write(6,'(a24,1x,es8.1)') ' rTol_RGC: ',relTol_RGC - write(6,'(a24,1x,es8.1)') ' aMax_RGC: ',absMax_RGC - write(6,'(a24,1x,es8.1)') ' rMax_RGC: ',relMax_RGC - write(6,'(a24,1x,es8.1)') ' perturbPenalty_RGC: ',pPert_RGC - write(6,'(a24,1x,es8.1)') ' relevantMismatch_RGC: ',xSmoo_RGC - write(6,'(a24,1x,es8.1)') ' viscosityrate_RGC: ',viscPower_RGC - write(6,'(a24,1x,es8.1)') ' viscositymodulus_RGC: ',viscModus_RGC - write(6,'(a24,1x,es8.1)') ' maxrelaxation_RGC: ',maxdRelax_RGC - write(6,'(a24,1x,es8.1)') ' maxVolDiscrepancy_RGC: ',maxVolDiscr_RGC - write(6,'(a24,1x,es8.1)') ' volDiscrepancyMod_RGC: ',volDiscrMod_RGC - write(6,'(a24,1x,es8.1,/)') ' discrepancyPower_RGC: ',volDiscrPow_RGC + write(6,'(a24,1x,es8.1)') ' aTol_RGC: ',absTol_RGC + write(6,'(a24,1x,es8.1)') ' rTol_RGC: ',relTol_RGC + write(6,'(a24,1x,es8.1)') ' aMax_RGC: ',absMax_RGC + write(6,'(a24,1x,es8.1)') ' rMax_RGC: ',relMax_RGC + write(6,'(a24,1x,es8.1)') ' perturbPenalty_RGC: ',pPert_RGC + write(6,'(a24,1x,es8.1)') ' relevantMismatch_RGC: ',xSmoo_RGC + write(6,'(a24,1x,es8.1)') ' viscosityrate_RGC: ',viscPower_RGC + write(6,'(a24,1x,es8.1)') ' viscositymodulus_RGC: ',viscModus_RGC + write(6,'(a24,1x,es8.1)') ' maxrelaxation_RGC: ',maxdRelax_RGC + write(6,'(a24,1x,es8.1)') ' maxVolDiscrepancy_RGC: ',maxVolDiscr_RGC + write(6,'(a24,1x,es8.1)') ' volDiscrepancyMod_RGC: ',volDiscrMod_RGC + write(6,'(a24,1x,es8.1,/)') ' discrepancyPower_RGC: ',volDiscrPow_RGC !-------------------------------------------------------------------------------------------------- ! Random seeding parameter - write(6,'(a24,1x,i16,/)') ' fixed_seed: ',fixedSeed - if (fixedSeed <= 0_pInt) & - write(6,'(a,/)') ' No fixed Seed: Random is random!' + write(6,'(a24,1x,i16,/)') ' fixed_seed: ',fixedSeed + if (fixedSeed <= 0_pInt) & + write(6,'(a,/)') ' No fixed Seed: Random is random!' !-------------------------------------------------------------------------------------------------- ! gradient parameter - write(6,'(a24,1x,es8.1)') ' charLength: ',charLength - write(6,'(a24,1x,es8.1)') ' residualStiffness: ',residualStiffness + write(6,'(a24,1x,es8.1)') ' charLength: ',charLength + write(6,'(a24,1x,es8.1)') ' residualStiffness: ',residualStiffness !-------------------------------------------------------------------------------------------------- ! openMP parameter - !$ write(6,'(a24,1x,i8,/)') ' number of threads: ',DAMASK_NumThreadsInt + !$ write(6,'(a24,1x,i8,/)') ' number of threads: ',DAMASK_NumThreadsInt !-------------------------------------------------------------------------------------------------- ! field parameters - write(6,'(a24,1x,i8)') ' itmax: ',itmax - write(6,'(a24,1x,i8)') ' itmin: ',itmin - write(6,'(a24,1x,i8)') ' maxCutBack: ',maxCutBack - write(6,'(a24,1x,i8)') ' maxStaggeredIter: ',stagItMax - write(6,'(a24,1x,i8)') ' vacancyPolyOrder: ',vacancyPolyOrder - write(6,'(a24,1x,i8)') ' hydrogenPolyOrder: ',hydrogenPolyOrder - write(6,'(a24,1x,es8.1)') ' err_struct_tolAbs: ',err_struct_tolAbs - write(6,'(a24,1x,es8.1)') ' err_struct_tolRel: ',err_struct_tolRel - write(6,'(a24,1x,es8.1)') ' err_thermal_tolabs: ',err_thermal_tolabs - write(6,'(a24,1x,es8.1)') ' err_thermal_tolrel: ',err_thermal_tolrel - write(6,'(a24,1x,es8.1)') ' err_damage_tolabs: ',err_damage_tolabs - write(6,'(a24,1x,es8.1)') ' err_damage_tolrel: ',err_damage_tolrel - write(6,'(a24,1x,es8.1)') ' err_vacancyflux_tolabs: ',err_vacancyflux_tolabs - write(6,'(a24,1x,es8.1)') ' err_vacancyflux_tolrel: ',err_vacancyflux_tolrel - write(6,'(a24,1x,es8.1)') ' err_porosity_tolabs: ',err_porosity_tolabs - write(6,'(a24,1x,es8.1)') ' err_porosity_tolrel: ',err_porosity_tolrel - write(6,'(a24,1x,es8.1)') ' err_hydrogenflux_tolabs:',err_hydrogenflux_tolabs - write(6,'(a24,1x,es8.1)') ' err_hydrogenflux_tolrel:',err_hydrogenflux_tolrel - write(6,'(a24,1x,es8.1)') ' vacancyBoundPenalty: ',vacancyBoundPenalty - write(6,'(a24,1x,es8.1)') ' hydrogenBoundPenalty: ',hydrogenBoundPenalty + write(6,'(a24,1x,i8)') ' itmax: ',itmax + write(6,'(a24,1x,i8)') ' itmin: ',itmin + write(6,'(a24,1x,i8)') ' maxCutBack: ',maxCutBack + write(6,'(a24,1x,i8)') ' maxStaggeredIter: ',stagItMax + write(6,'(a24,1x,i8)') ' vacancyPolyOrder: ',vacancyPolyOrder + write(6,'(a24,1x,i8)') ' hydrogenPolyOrder: ',hydrogenPolyOrder + write(6,'(a24,1x,es8.1)') ' err_struct_tolAbs: ',err_struct_tolAbs + write(6,'(a24,1x,es8.1)') ' err_struct_tolRel: ',err_struct_tolRel + write(6,'(a24,1x,es8.1)') ' err_thermal_tolabs: ',err_thermal_tolabs + write(6,'(a24,1x,es8.1)') ' err_thermal_tolrel: ',err_thermal_tolrel + write(6,'(a24,1x,es8.1)') ' err_damage_tolabs: ',err_damage_tolabs + write(6,'(a24,1x,es8.1)') ' err_damage_tolrel: ',err_damage_tolrel + write(6,'(a24,1x,es8.1)') ' err_vacancyflux_tolabs: ',err_vacancyflux_tolabs + write(6,'(a24,1x,es8.1)') ' err_vacancyflux_tolrel: ',err_vacancyflux_tolrel + write(6,'(a24,1x,es8.1)') ' err_porosity_tolabs: ',err_porosity_tolabs + write(6,'(a24,1x,es8.1)') ' err_porosity_tolrel: ',err_porosity_tolrel + write(6,'(a24,1x,es8.1)') ' err_hydrogenflux_tolabs:',err_hydrogenflux_tolabs + write(6,'(a24,1x,es8.1)') ' err_hydrogenflux_tolrel:',err_hydrogenflux_tolrel + write(6,'(a24,1x,es8.1)') ' vacancyBoundPenalty: ',vacancyBoundPenalty + write(6,'(a24,1x,es8.1)') ' hydrogenBoundPenalty: ',hydrogenBoundPenalty !-------------------------------------------------------------------------------------------------- ! spectral parameters #ifdef Spectral - write(6,'(a24,1x,i8)') ' continueCalculation: ',continueCalculation - write(6,'(a24,1x,L8)') ' memory_efficient: ',memory_efficient - write(6,'(a24,1x,i8)') ' divergence_correction: ',divergence_correction - write(6,'(a24,1x,a)') ' spectral_derivative: ',trim(spectral_derivative) - if(fftw_timelimit<0.0_pReal) then - write(6,'(a24,1x,L8)') ' fftw_timelimit: ',.false. - else - write(6,'(a24,1x,es8.1)') ' fftw_timelimit: ',fftw_timelimit - endif - write(6,'(a24,1x,a)') ' fftw_plan_mode: ',trim(fftw_plan_mode) - write(6,'(a24,1x,i8)') ' fftw_planner_flag: ',fftw_planner_flag - write(6,'(a24,1x,L8,/)') ' update_gamma: ',update_gamma - write(6,'(a24,1x,es8.1)') ' err_stress_tolAbs: ',err_stress_tolAbs - write(6,'(a24,1x,es8.1)') ' err_stress_tolRel: ',err_stress_tolRel - write(6,'(a24,1x,es8.1)') ' err_div_tolAbs: ',err_div_tolAbs - write(6,'(a24,1x,es8.1)') ' err_div_tolRel: ',err_div_tolRel - write(6,'(a24,1x,es8.1)') ' err_curl_tolAbs: ',err_curl_tolAbs - write(6,'(a24,1x,es8.1)') ' err_curl_tolRel: ',err_curl_tolRel - write(6,'(a24,1x,es8.1)') ' polarAlpha: ',polarAlpha - write(6,'(a24,1x,es8.1)') ' polarBeta: ',polarBeta - write(6,'(a24,1x,a)') ' spectral solver: ',trim(spectral_solver) - write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options) + write(6,'(a24,1x,i8)') ' continueCalculation: ',continueCalculation + write(6,'(a24,1x,L8)') ' memory_efficient: ',memory_efficient + write(6,'(a24,1x,i8)') ' divergence_correction: ',divergence_correction + write(6,'(a24,1x,a)') ' spectral_derivative: ',trim(spectral_derivative) + if(fftw_timelimit<0.0_pReal) then + write(6,'(a24,1x,L8)') ' fftw_timelimit: ',.false. + else + write(6,'(a24,1x,es8.1)') ' fftw_timelimit: ',fftw_timelimit + endif + write(6,'(a24,1x,a)') ' fftw_plan_mode: ',trim(fftw_plan_mode) + write(6,'(a24,1x,i8)') ' fftw_planner_flag: ',fftw_planner_flag + write(6,'(a24,1x,L8,/)') ' update_gamma: ',update_gamma + write(6,'(a24,1x,es8.1)') ' err_stress_tolAbs: ',err_stress_tolAbs + write(6,'(a24,1x,es8.1)') ' err_stress_tolRel: ',err_stress_tolRel + write(6,'(a24,1x,es8.1)') ' err_div_tolAbs: ',err_div_tolAbs + write(6,'(a24,1x,es8.1)') ' err_div_tolRel: ',err_div_tolRel + write(6,'(a24,1x,es8.1)') ' err_curl_tolAbs: ',err_curl_tolAbs + write(6,'(a24,1x,es8.1)') ' err_curl_tolRel: ',err_curl_tolRel + write(6,'(a24,1x,es8.1)') ' polarAlpha: ',polarAlpha + write(6,'(a24,1x,es8.1)') ' polarBeta: ',polarBeta + write(6,'(a24,1x,a)') ' spectral solver: ',trim(spectral_solver) + write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options) #endif !-------------------------------------------------------------------------------------------------- ! spectral parameters #ifdef FEM - write(6,'(a24,1x,i8)') ' integrationOrder: ',integrationOrder - write(6,'(a24,1x,i8)') ' structOrder: ',structOrder - write(6,'(a24,1x,i8)') ' thermalOrder: ',thermalOrder - write(6,'(a24,1x,i8)') ' damageOrder: ',damageOrder - write(6,'(a24,1x,i8)') ' vacancyfluxOrder: ',vacancyfluxOrder - write(6,'(a24,1x,i8)') ' porosityOrder: ',porosityOrder - write(6,'(a24,1x,i8)') ' hydrogenfluxOrder: ',hydrogenfluxOrder - write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options) - write(6,'(a24,1x,L8)') ' B-Bar stabilisation: ',BBarStabilisation + write(6,'(a24,1x,i8)') ' integrationOrder: ',integrationOrder + write(6,'(a24,1x,i8)') ' structOrder: ',structOrder + write(6,'(a24,1x,i8)') ' thermalOrder: ',thermalOrder + write(6,'(a24,1x,i8)') ' damageOrder: ',damageOrder + write(6,'(a24,1x,i8)') ' vacancyfluxOrder: ',vacancyfluxOrder + write(6,'(a24,1x,i8)') ' porosityOrder: ',porosityOrder + write(6,'(a24,1x,i8)') ' hydrogenfluxOrder: ',hydrogenfluxOrder + write(6,'(a24,1x,a)') ' PETSc_options: ',trim(petsc_defaultOptions)//' '//trim(petsc_options) + write(6,'(a24,1x,L8)') ' B-Bar stabilisation: ',BBarStabilisation #endif - endif mainProcess3 !-------------------------------------------------------------------------------------------------- diff --git a/src/plastic_disloUCLA.f90 b/src/plastic_disloUCLA.f90 index 11863c5c4..62d09186f 100644 --- a/src/plastic_disloUCLA.f90 +++ b/src/plastic_disloUCLA.f90 @@ -152,8 +152,6 @@ subroutine plastic_disloUCLA_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -173,11 +171,9 @@ subroutine plastic_disloUCLA_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOUCLA_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOUCLA_ID),pInt) if (maxNinstance == 0_pInt) return @@ -498,10 +494,6 @@ subroutine plastic_disloUCLA_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) @@ -981,7 +973,8 @@ end subroutine plastic_disloUCLA_LpAndItsTangent !-------------------------------------------------------------------------------------------------- subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) use prec, only: & - tol_math_check + tol_math_check, & + dEq0 use math, only: & pi use material, only: & @@ -1119,7 +1112,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) !* Dipole formation EdgeDipMinDistance = & plastic_disloUCLA_CEdgeDipMinDistance(instance)*plastic_disloUCLA_burgersPerSlipSystem(j,instance) - if (abs(tau_slip_pos) <= tiny(0.0_pReal)) then + if (dEq0(tau_slip_pos)) then DotRhoDipFormation = 0.0_pReal else EdgeDipDistance = & @@ -1147,7 +1140,7 @@ subroutine plastic_disloUCLA_dotState(Tstar_v,Temperature,ipc,ip,el) plastic_disloUCLA_CAtomicVolume(instance)*plastic_disloUCLA_burgersPerSlipSystem(j,instance)**(3.0_pReal) VacancyDiffusion = & plastic_disloUCLA_D0(instance)*exp(-plastic_disloUCLA_Qsd(instance)/(kB*Temperature)) - if (abs(tau_slip_pos) <= tiny(0.0_pReal)) then + if (dEq0(tau_slip_pos)) then DotRhoEdgeDipClimb = 0.0_pReal else ClimbVelocity = & @@ -1180,7 +1173,8 @@ end subroutine plastic_disloUCLA_dotState !-------------------------------------------------------------------------------------------------- function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) use prec, only: & - tol_math_check + tol_math_check, & + dEq use math, only: & pi use material, only: & @@ -1408,7 +1402,7 @@ function plastic_disloUCLA_postResults(Tstar_v,Temperature,ipc,ip,el) c = c + ns elseif(plastic_disloUCLA_outputID(o,instance) == stress_exponent_ID) then do j = 1_pInt, ns - if (abs(gdot_slip_pos(j)+gdot_slip_neg(j))<=tiny(0.0_pReal)) then + if (dEq(gdot_slip_pos(j)+gdot_slip_neg(j),0.0_pReal)) then plastic_disloUCLA_postResults(c+j) = 0.0_pReal else plastic_disloUCLA_postResults(c+j) = (tau_slip_pos(j)+tau_slip_neg(j))/& diff --git a/src/plastic_dislotwin.f90 b/src/plastic_dislotwin.f90 index b9ffde804..43fe0c6d8 100644 --- a/src/plastic_dislotwin.f90 +++ b/src/plastic_dislotwin.f90 @@ -199,6 +199,10 @@ contains !-------------------------------------------------------------------------------------------------- subroutine plastic_dislotwin_init(fileUnit) use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use prec, only: & + dEq0, & + dNeq0, & + dNeq use debug, only: & debug_level,& debug_constitutive,& @@ -235,8 +239,6 @@ subroutine plastic_dislotwin_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -258,11 +260,9 @@ subroutine plastic_dislotwin_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip, tempPerTwin, tempPerTrans - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_DISLOTWIN_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_DISLOTWIN_ID),pInt) if (maxNinstance == 0_pInt) return @@ -749,8 +749,8 @@ subroutine plastic_dislotwin_init(fileUnit) if (plastic_dislotwin_Qsd(instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='Qsd ('//PLASTICITY_DISLOTWIN_label//')') if (sum(plastic_dislotwin_Ntwin(:,instance)) > 0_pInt) then - if (abs(plastic_dislotwin_SFE_0K(instance)) <= tiny(0.0_pReal) .and. & - abs(plastic_dislotwin_dSFE_dT(instance)) <= tiny(0.0_pReal) .and. & + if (dEq0(plastic_dislotwin_SFE_0K(instance)) .and. & + dEq0(plastic_dislotwin_dSFE_dT(instance)) .and. & lattice_structure(phase) == LATTICE_fcc_ID) & call IO_error(211_pInt,el=instance,ext_msg='SFE0K ('//PLASTICITY_DISLOTWIN_label//')') if (plastic_dislotwin_aTolRho(instance) <= 0.0_pReal) & @@ -759,8 +759,8 @@ subroutine plastic_dislotwin_init(fileUnit) call IO_error(211_pInt,el=instance,ext_msg='aTolTwinFrac ('//PLASTICITY_DISLOTWIN_label//')') endif if (sum(plastic_dislotwin_Ntrans(:,instance)) > 0_pInt) then - if (abs(plastic_dislotwin_SFE_0K(instance)) <= tiny(0.0_pReal) .and. & - abs(plastic_dislotwin_dSFE_dT(instance)) <= tiny(0.0_pReal) .and. & + if (dEq0(plastic_dislotwin_SFE_0K(instance)) .and. & + dEq0(plastic_dislotwin_dSFE_dT(instance)) .and. & lattice_structure(phase) == LATTICE_fcc_ID) & call IO_error(211_pInt,el=instance,ext_msg='SFE0K ('//PLASTICITY_DISLOTWIN_label//')') if (plastic_dislotwin_aTolTransFrac(instance) <= 0.0_pReal) & @@ -773,8 +773,8 @@ subroutine plastic_dislotwin_init(fileUnit) if (plastic_dislotwin_sbVelocity(instance) > 0.0_pReal .and. & plastic_dislotwin_pShearBand(instance) <= 0.0_pReal) & call IO_error(211_pInt,el=instance,ext_msg='pShearBand ('//PLASTICITY_DISLOTWIN_label//')') - if (abs(plastic_dislotwin_dipoleFormationFactor(instance)) > tiny(0.0_pReal) .and. & - plastic_dislotwin_dipoleFormationFactor(instance) /= 1.0_pReal) & + if (dNeq0(plastic_dislotwin_dipoleFormationFactor(instance)) .and. & + dNeq(plastic_dislotwin_dipoleFormationFactor(instance), 1.0_pReal)) & call IO_error(211_pInt,el=instance,ext_msg='dipoleFormationFactor ('//PLASTICITY_DISLOTWIN_label//')') if (plastic_dislotwin_sbVelocity(instance) > 0.0_pReal .and. & plastic_dislotwin_qShearBand(instance) <= 0.0_pReal) & @@ -927,10 +927,6 @@ subroutine plastic_dislotwin_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) @@ -1628,7 +1624,8 @@ end subroutine plastic_dislotwin_microstructure !-------------------------------------------------------------------------------------------------- subroutine plastic_dislotwin_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature,ipc,ip,el) use prec, only: & - tol_math_check + tol_math_check, & + dNeq0 use math, only: & math_Plain3333to99, & math_Mandel6to33, & @@ -1775,8 +1772,7 @@ subroutine plastic_dislotwin_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,Temperature !-------------------------------------------------------------------------------------------------- ! Shear banding (shearband) part - if(abs(plastic_dislotwin_sbVelocity(instance)) > tiny(0.0_pReal) .and. & - abs(plastic_dislotwin_sbResistance(instance)) > tiny(0.0_pReal)) then + if(dNeq0(plastic_dislotwin_sbVelocity(instance)) .and. dNeq0(plastic_dislotwin_sbResistance(instance))) then gdot_sb = 0.0_pReal dgdot_dtausb = 0.0_pReal call math_eigenValuesVectorsSym(math_Mandel6to33(Tstar_v),eigValues,eigVectors,error) @@ -1942,7 +1938,8 @@ end subroutine plastic_dislotwin_LpAndItsTangent !-------------------------------------------------------------------------------------------------- subroutine plastic_dislotwin_dotState(Tstar_v,Temperature,ipc,ip,el) use prec, only: & - tol_math_check + tol_math_check, & + dEq0 use math, only: & pi use material, only: & @@ -2043,7 +2040,7 @@ subroutine plastic_dislotwin_dotState(Tstar_v,Temperature,ipc,ip,el) !* Dipole formation EdgeDipMinDistance = & plastic_dislotwin_CEdgeDipMinDistance(instance)*plastic_dislotwin_burgersPerSlipSystem(j,instance) - if (abs(tau_slip(j)) <= tiny(0.0_pReal)) then + if (dEq0(tau_slip(j))) then DotRhoDipFormation = 0.0_pReal else EdgeDipDistance = & @@ -2071,10 +2068,10 @@ subroutine plastic_dislotwin_dotState(Tstar_v,Temperature,ipc,ip,el) plastic_dislotwin_CAtomicVolume(instance)*plastic_dislotwin_burgersPerSlipSystem(j,instance)**(3.0_pReal) VacancyDiffusion = & plastic_dislotwin_D0(instance)*exp(-plastic_dislotwin_Qsd(instance)/(kB*Temperature)) - if (abs(tau_slip(j)) <= tiny(0.0_pReal)) then + if (dEq0(tau_slip(j))) then DotRhoEdgeDipClimb = 0.0_pReal else - if (EdgeDipDistance-EdgeDipMinDistance <= tiny(0.0_pReal)) then + if (dEq0(EdgeDipDistance-EdgeDipMinDistance)) then DotRhoEdgeDipClimb = 0.0_pReal else ClimbVelocity = 3.0_pReal*lattice_mu(ph)*VacancyDiffusion*AtomicVolume/ & @@ -2189,7 +2186,8 @@ end subroutine plastic_dislotwin_dotState !-------------------------------------------------------------------------------------------------- function plastic_dislotwin_postResults(Tstar_v,Temperature,ipc,ip,el) use prec, only: & - tol_math_check + tol_math_check, & + dEq0 use math, only: & pi, & math_Mandel6to33, & @@ -2504,11 +2502,8 @@ function plastic_dislotwin_postResults(Tstar_v,Temperature,ipc,ip,el) endif !* Stress exponent - if (abs(gdot_slip(j))<=tiny(0.0_pReal)) then - plastic_dislotwin_postResults(c+j) = 0.0_pReal - else - plastic_dislotwin_postResults(c+j) = (tau/gdot_slip(j))*dgdot_dtauslip - endif + plastic_dislotwin_postResults(c+j) = & + merge(0.0_pReal,(tau/gdot_slip(j))*dgdot_dtauslip,dEq0(gdot_slip(j))) enddo ; enddo c = c + ns case (sb_eigenvalues_ID) diff --git a/src/plastic_isotropic.f90 b/src/plastic_isotropic.f90 index a074c3862..c26b63cfe 100644 --- a/src/plastic_isotropic.f90 +++ b/src/plastic_isotropic.f90 @@ -94,8 +94,6 @@ subroutine plastic_isotropic_init(fileUnit) debug_constitutive, & debug_levelBasic use numerics, only: & - analyticJaco, & - worldrank, & numerics_integrator use math, only: & math_Mandel3333to66, & @@ -145,11 +143,9 @@ subroutine plastic_isotropic_init(fileUnit) outputtag = '' integer(pInt) :: NipcMyPhase - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_ISOTROPIC_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_ISOTROPIC_ID),pInt) if (maxNinstance == 0_pInt) return @@ -316,10 +312,6 @@ subroutine plastic_isotropic_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase),source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) @@ -524,6 +516,8 @@ end subroutine plastic_isotropic_LiAndItsTangent !> @brief calculates the rate of change of microstructure !-------------------------------------------------------------------------------------------------- subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) + use prec, only: & + dEq0 use math, only: & math_mul6x6 use material, only: & @@ -570,7 +564,7 @@ subroutine plastic_isotropic_dotState(Tstar_v,ipc,ip,el) !-------------------------------------------------------------------------------------------------- ! hardening coefficient if (abs(gamma_dot) > 1e-12_pReal) then - if (abs(param(instance)%tausat_SinhFitA) <= tiny(0.0_pReal)) then + if (dEq0(param(instance)%tausat_SinhFitA)) then saturation = param(instance)%tausat else saturation = ( param(instance)%tausat & diff --git a/src/plastic_none.f90 b/src/plastic_none.f90 index a9007667f..7a7589774 100644 --- a/src/plastic_none.f90 +++ b/src/plastic_none.f90 @@ -34,7 +34,6 @@ subroutine plastic_none_init use IO, only: & IO_timeStamp use numerics, only: & - worldrank, & numerics_integrator use material, only: & phase_plasticity, & @@ -53,11 +52,9 @@ subroutine plastic_none_init sizeDotState, & sizeDeltaState - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONE_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_none_ID),pInt) if (maxNinstance == 0_pInt) return @@ -84,11 +81,9 @@ subroutine plastic_none_init allocate(plasticState(phase)%partionedState0 (sizeState,NofMyPhase)) allocate(plasticState(phase)%subState0 (sizeState,NofMyPhase)) allocate(plasticState(phase)%state (sizeState,NofMyPhase)) - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase)) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase)) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase)) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase)) if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase)) allocate(plasticState(phase)%previousDotState2(sizeDotState,NofMyPhase)) diff --git a/src/plastic_nonlocal.f90 b/src/plastic_nonlocal.f90 index 98e6af226..0c0a48523 100644 --- a/src/plastic_nonlocal.f90 +++ b/src/plastic_nonlocal.f90 @@ -8,7 +8,7 @@ module plastic_nonlocal use prec, only: & pReal, & pInt - + implicit none private character(len=22), dimension(11), parameter, private :: & @@ -23,20 +23,20 @@ module plastic_nonlocal 'rhoDipEdge ', & 'rhoDipScrew ', & 'accumulatedshear ' ] !< list of "basic" microstructural state variables that are independent from other state variables - + character(len=16), dimension(3), parameter, private :: & - DEPENDENTSTATES = ['rhoForest ', & - 'tauThreshold ', & + DEPENDENTSTATES = ['rhoForest ', & + 'tauThreshold ', & 'tauBack ' ] !< list of microstructural state variables that depend on other state variables - + character(len=20), dimension(6), parameter, private :: & - OTHERSTATES = ['velocityEdgePos ', & - 'velocityEdgeNeg ', & + OTHERSTATES = ['velocityEdgePos ', & + 'velocityEdgeNeg ', & 'velocityScrewPos ', & 'velocityScrewNeg ', & 'maxDipoleHeightEdge ', & 'maxDipoleHeightScrew' ] !< list of other dependent state variables that are not updated by microstructure - + real(pReal), parameter, private :: & KB = 1.38e-23_pReal !< Physical parameter, Boltzmann constant in J/Kelvin @@ -48,13 +48,13 @@ module plastic_nonlocal integer(pInt), dimension(:,:), allocatable, target, public :: & plastic_nonlocal_sizePostResult !< size of each post result output - + character(len=64), dimension(:,:), allocatable, target, public :: & plastic_nonlocal_output !< name of each post result output - + integer(pInt), dimension(:), allocatable, target, public :: & - plastic_nonlocal_Noutput !< number of outputs per instance of this plasticity - + plastic_nonlocal_Noutput !< number of outputs per instance of this plasticity + integer(pInt), dimension(:,:), allocatable, private :: & iGamma, & !< state indices for accumulated shear iRhoF, & !< state indices for forest density @@ -66,16 +66,16 @@ module plastic_nonlocal iRhoD, & !< state indices for dipole density iV, & !< state indices for dislcation velocities iD !< state indices for stable dipole height - + integer(pInt), dimension(:), allocatable, public, protected :: & totalNslip !< total number of active slip systems for each instance - + integer(pInt), dimension(:,:), allocatable, private :: & Nslip, & !< number of active slip systems for each family and instance slipFamily, & !< lookup table relating active slip system to slip family for each instance slipSystemLattice, & !< lookup table relating active slip system index to lattice slip system index for each instance colinearSystem !< colinear system to the active slip system (only valid for fcc!) - + real(pReal), dimension(:), allocatable, private :: & atomicVolume, & !< atomic volume Dsd0, & !< prefactor for self-diffusion coefficient @@ -102,7 +102,7 @@ module plastic_nonlocal rhoSglRandomBinning, & linetensionEffect, & edgeJogFactor - + real(pReal), dimension(:,:), allocatable, private :: & rhoSglEdgePos0, & !< initial edge_pos dislocation density per slip system for each family and instance rhoSglEdgeNeg0, & !< initial edge_neg dislocation density per slip system for each family and instance @@ -115,40 +115,40 @@ module plastic_nonlocal burgersPerSlipFamily, & !< absolute length of burgers vector [m] for each family and instance burgers, & !< absolute length of burgers vector [m] for each slip system and instance interactionSlipSlip !< coefficients for slip-slip interaction for each interaction type and instance - + real(pReal), dimension(:,:,:), allocatable, private :: & minDipoleHeightPerSlipFamily, & !< minimum stable edge/screw dipole height for each family and instance minDipoleHeight, & !< minimum stable edge/screw dipole height for each slip system and instance - peierlsStressPerSlipFamily, & !< Peierls stress (edge and screw) - peierlsStress, & !< Peierls stress (edge and screw) + peierlsStressPerSlipFamily, & !< Peierls stress (edge and screw) + peierlsStress, & !< Peierls stress (edge and screw) forestProjectionEdge, & !< matrix of forest projections of edge dislocations for each instance forestProjectionScrew, & !< matrix of forest projections of screw dislocations for each instance interactionMatrixSlipSlip !< interaction matrix of the different slip systems for each instance - + real(pReal), dimension(:,:,:,:), allocatable, private :: & lattice2slip, & !< orthogonal transformation matrix from lattice coordinate system to slip coordinate system (passive rotation !!!) rhoDotEdgeJogsOutput, & sourceProbability - + real(pReal), dimension(:,:,:,:,:), allocatable, private :: & - rhoDotFluxOutput, & + rhoDotFluxOutput, & rhoDotMultiplicationOutput, & rhoDotSingle2DipoleGlideOutput, & rhoDotAthermalAnnihilationOutput, & rhoDotThermalAnnihilationOutput, & nonSchmidProjection !< combined projection of Schmid and non-Schmid contributions to the resolved shear stress (only for screws) - + real(pReal), dimension(:,:,:,:,:,:), allocatable, private :: & compatibility !< slip system compatibility between me and my neighbors - + real(pReal), dimension(:,:), allocatable, private :: & nonSchmidCoeff - + logical, dimension(:), allocatable, private :: & shortRangeStressCorrection, & !< flag indicating the use of the short range stress correction by a excess density gradient term probabilisticMultiplication - - enum, bind(c) + + enum, bind(c) enumerator :: undefined_ID, & rho_ID, & delta_ID, & @@ -235,9 +235,9 @@ module plastic_nonlocal accumulatedshear_ID, & dislocationstress_ID end enum - integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & + integer(kind(undefined_ID)), dimension(:,:), allocatable, private :: & plastic_nonlocal_outputID !< ID of each post result output - + public :: & plastic_nonlocal_init, & plastic_nonlocal_stateInit, & @@ -248,11 +248,11 @@ module plastic_nonlocal plastic_nonlocal_deltaState, & plastic_nonlocal_updateCompatibility, & plastic_nonlocal_postResults - + private :: & plastic_nonlocal_kinetics, & plastic_nonlocal_dislocationstress - + contains @@ -262,8 +262,8 @@ contains !-------------------------------------------------------------------------------------------------- subroutine plastic_nonlocal_init(fileUnit) use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) -use math, only: math_Mandel3333to66, & - math_Voigt66to3333, & +use math, only: math_Mandel3333to66, & + math_Voigt66to3333, & math_mul3x3, & math_transpose33 use IO, only: IO_read, & @@ -295,8 +295,6 @@ use material, only: phase_plasticity, & material_phase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator @@ -330,13 +328,11 @@ integer(pInt) :: phase, & integer(pInt) :: sizeState, sizeDotState,sizeDependentState, sizeDeltaState - integer(pInt) :: NofMyPhase - - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + integer(pInt) :: NofMyPhase + + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_NONLOCAL_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstances = int(count(phase_plasticity == PLASTICITY_NONLOCAL_ID),pInt) if (maxNinstances == 0) return ! we don't have to do anything if there's no instance for this constitutive law @@ -406,11 +402,11 @@ allocate(nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstances), s do while (trim(line) /= IO_EOF .and. IO_lc(IO_getTag(line,'<','>')) /= MATERIAL_partPhase) ! wind forward to line = IO_read(fileUnit) enddo - + parsingFile: do while (trim(line) /= IO_EOF) ! read through phases of phase part line = IO_read(fileUnit) if (IO_isBlank(line)) cycle ! skip empty lines - if (IO_getTag(line,'<','>') /= '') then ! stop at next part + if (IO_getTag(line,'<','>') /= '') then ! stop at next part line = IO_read(fileUnit, .true.) ! reset IO_read exit endif @@ -978,7 +974,7 @@ allocate(nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstances), s sanityChecks: do phase = 1_pInt, size(phase_plasticity) myPhase: if (phase_plasticity(phase) == PLASTICITY_NONLOCAL_ID) then - instance = phase_plasticityInstance(phase) + instance = phase_plasticityInstance(phase) if (sum(Nslip(:,instance)) <= 0_pInt) & call IO_error(211_pInt,ext_msg='Nslip ('//PLASTICITY_NONLOCAL_label//')') do o = 1_pInt,maxval(phase_Noutput) @@ -1065,13 +1061,13 @@ allocate(nonSchmidCoeff(lattice_maxNnonSchmid,maxNinstances), s call IO_error(211_pInt,ext_msg='CFLfactor ('//PLASTICITY_NONLOCAL_label//')') if (fEdgeMultiplication(instance) < 0.0_pReal .or. fEdgeMultiplication(instance) > 1.0_pReal) & call IO_error(211_pInt,ext_msg='edgemultiplicationfactor ('//PLASTICITY_NONLOCAL_label//')') - - + + !*** determine total number of active slip systems Nslip(1:lattice_maxNslipFamily,instance) = min(lattice_NslipSystem(1:lattice_maxNslipFamily,phase), & Nslip(1:lattice_maxNslipFamily,instance) ) ! we can't use more slip systems per family than specified in lattice totalNslip(instance) = sum(Nslip(1:lattice_maxNslipFamily,instance)) - endif myPhase + endif myPhase enddo sanityChecks @@ -1116,13 +1112,13 @@ allocate(compatibility(2,maxTotalNslip,maxTotalNslip,mesh_maxNipNeighbors,mesh_m allocate(peierlsStress(maxTotalNslip,2,maxNinstances), source=0.0_pReal) allocate(colinearSystem(maxTotalNslip,maxNinstances), source=0_pInt) allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), source=0.0_pReal) - + initializeInstances: do phase = 1_pInt, size(phase_plasticity) NofMyPhase=count(material_phase==phase) - myPhase2: if (phase_plasticity(phase) == PLASTICITY_NONLOCAL_ID .and. NofMyPhase/=0) then + myPhase2: if (phase_plasticity(phase) == PLASTICITY_NONLOCAL_ID) then instance = phase_plasticityInstance(phase) !*** Inverse lookup of my slip system family and the slip system in lattice - + l = 0_pInt do f = 1_pInt,lattice_maxNslipFamily do s = 1_pInt,Nslip(f,instance) @@ -1130,10 +1126,10 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), slipFamily(l,instance) = f slipSystemLattice(l,instance) = sum(lattice_NslipSystem(1:f-1_pInt, phase)) + s enddo; enddo - - + + !*** determine size of state array - + ns = totalNslip(instance) sizeDotState = int(size(BASICSTATES),pInt) * ns @@ -1193,10 +1189,10 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), enddo if (iD(ns,2,instance) /= sizeState) & ! check if last index is equal to size of state call IO_error(0_pInt, ext_msg = 'state indices not properly set ('//PLASTICITY_NONLOCAL_label//')') - - + + !*** determine size of postResults array - + outputsLoop: do o = 1_pInt,plastic_nonlocal_Noutput(instance) select case(plastic_nonlocal_outputID(o,instance)) case( rho_ID, & @@ -1287,13 +1283,13 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), mySize = 6_pInt case default end select - - if (mySize > 0_pInt) then ! any meaningful output found + + if (mySize > 0_pInt) then ! any meaningful output found plastic_nonlocal_sizePostResult(o,instance) = mySize plastic_nonlocal_sizePostResults(instance) = plastic_nonlocal_sizePostResults(instance) + mySize endif enddo outputsLoop - + plasticState(phase)%sizeState = sizeState plasticState(phase)%sizeDotState = sizeDotState plasticState(phase)%sizeDeltaState = sizeDeltaState @@ -1310,10 +1306,6 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) @@ -1326,63 +1318,63 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), plasticState(phase)%dotState(iGamma(1,instance):iGamma(ns,instance),1:NofMyPhase) plasticState(phase)%accumulatedSlip => & plasticState(phase)%state (iGamma(1,instance):iGamma(ns,instance),1:NofMyPhase) - - do s1 = 1_pInt,ns + + do s1 = 1_pInt,ns f = slipFamily(s1,instance) - + !*** burgers vector, mean free path prefactor and minimum dipole distance for each slip system - + burgers(s1,instance) = burgersPerSlipFamily(f,instance) lambda0(s1,instance) = lambda0PerSlipFamily(f,instance) minDipoleHeight(s1,1:2,instance) = minDipoleHeightPerSlipFamily(f,1:2,instance) peierlsStress(s1,1:2,instance) = peierlsStressPerSlipFamily(f,1:2,instance) - + do s2 = 1_pInt,ns - + !*** calculation of forest projections for edge and screw dislocations. s2 acts as forest for s1 - + forestProjectionEdge(s1,s2,instance) & = abs(math_mul3x3(lattice_sn(1:3,slipSystemLattice(s1,instance),phase), & lattice_st(1:3,slipSystemLattice(s2,instance),phase))) ! forest projection of edge dislocations is the projection of (t = b x n) onto the slip normal of the respective slip plane - + forestProjectionScrew(s1,s2,instance) & = abs(math_mul3x3(lattice_sn(1:3,slipSystemLattice(s1,instance),phase), & lattice_sd(1:3,slipSystemLattice(s2,instance),phase))) ! forest projection of screw dislocations is the projection of b onto the slip normal of the respective splip plane - + !*** calculation of interaction matrices - + interactionMatrixSlipSlip(s1,s2,instance) & = interactionSlipSlip(lattice_interactionSlipSlip(slipSystemLattice(s1,instance), & slipSystemLattice(s2,instance), & phase), instance) - + !*** colinear slip system (only makes sense for fcc like it is defined here) - + if (lattice_interactionSlipSlip(slipSystemLattice(s1,instance), & slipSystemLattice(s2,instance), & phase) == 3_pInt) then colinearSystem(s1,instance) = s2 endif - + enddo - + !*** rotation matrix from lattice configuration to slip system - + lattice2slip(1:3,1:3,s1,instance) & = math_transpose33( reshape([ lattice_sd(1:3, slipSystemLattice(s1,instance), phase), & -lattice_st(1:3, slipSystemLattice(s1,instance), phase), & lattice_sn(1:3, slipSystemLattice(s1,instance), phase)], [3,3])) enddo - - + + !*** combined projection of Schmid and non-Schmid contributions to the resolved shear stress (only for screws) - !* four types t: + !* four types t: !* 1) positive screw at positive resolved stress !* 2) positive screw at negative resolved stress !* 3) negative screw at positive resolved stress !* 4) negative screw at negative resolved stress - - do s = 1_pInt,ns + + do s = 1_pInt,ns do l = 1_pInt,lattice_NnonSchmid(phase) nonSchmidProjection(1:3,1:3,1,s,instance) = nonSchmidProjection(1:3,1:3,1,s,instance) & + nonSchmidCoeff(l,instance) * lattice_Sslip(1:3,1:3,2*l,slipSystemLattice(s,instance),phase) @@ -1398,7 +1390,7 @@ allocate(nonSchmidProjection(3,3,4,maxTotalNslip,maxNinstances), call plastic_nonlocal_aTolState(phase,instance) endif myPhase2 - + enddo initializeInstances end subroutine plastic_nonlocal_init @@ -1426,7 +1418,7 @@ implicit none integer(pInt) :: e, & i, & - ns, & ! short notation for total number of active slip systems + ns, & ! short notation for total number of active slip systems f, & ! index of lattice family from, & upto, & @@ -1436,7 +1428,7 @@ integer(pInt) :: e, & instance, & maxNinstances real(pReal), dimension(2) :: noise -real(pReal), dimension(4) :: rnd +real(pReal), dimension(4) :: rnd real(pReal) meanDensity, & totalVolume, & densityBinning, & @@ -1447,7 +1439,7 @@ maxNinstances = int(count(phase_plasticity == PLASTICITY_NONLOCAL_ID),pInt) do instance = 1_pInt,maxNinstances ns = totalNslip(instance) - ! randomly distribute dislocation segments on random slip system and of random type in the volume + ! randomly distribute dislocation segments on random slip system and of random type in the volume if (rhoSglRandom(instance) > 0.0_pReal) then ! get the total volume of the instance @@ -1526,7 +1518,7 @@ subroutine plastic_nonlocal_aTolState(ph,instance) plasticState implicit none - integer(pInt), intent(in) :: & + integer(pInt), intent(in) :: & instance, & !< number specifying the instance of the plasticity ph integer(pInt) :: & @@ -1540,7 +1532,7 @@ subroutine plastic_nonlocal_aTolState(ph,instance) end forall forall (c = 1_pInt:2_pInt) & plasticState(ph)%aTolState(iRhoD(1:ns,c,instance)) = aTolRho(instance) - + plasticState(ph)%aTolState(iGamma(1:ns,instance)) = aTolShear(instance) end subroutine plastic_nonlocal_aTolState @@ -1549,6 +1541,8 @@ end subroutine plastic_nonlocal_aTolState !> @brief calculates quantities characterizing the microstructure !-------------------------------------------------------------------------------------------------- subroutine plastic_nonlocal_microstructure(Fe, Fp, ip, el) +use prec, only: & + dEq0 use IO, only: & IO_error use math, only: & @@ -1606,8 +1600,8 @@ real(pReal), dimension(3,3), intent(in) :: & integer(pInt) neighbor_el, & ! element number of neighboring material point neighbor_ip, & ! integration point of neighboring material point - instance, & ! my instance of this plasticity - neighbor_instance, & ! instance of this plasticity of neighboring material point + instance, & ! my instance of this plasticity + neighbor_instance, & ! instance of this plasticity of neighboring material point neighbor_phase, & ns, & ! total number of active slip systems at my material point neighbor_ns, & ! total number of active slip systems at neighboring material point @@ -1678,25 +1672,25 @@ where (abs(rhoDip) * mesh_ipVolume(ip,el) ** 0.667_pReal < significantN(instance forall (s = 1_pInt:ns) & rhoForest(s) = dot_product((sum(abs(rhoSgl(1:ns,[1,2,5,6])),2) + rhoDip(1:ns,1)), & - forestProjectionEdge(s,1:ns,instance)) & + forestProjectionEdge(s,1:ns,instance)) & + dot_product((sum(abs(rhoSgl(1:ns,[3,4,7,8])),2) + rhoDip(1:ns,2)), & forestProjectionScrew(s,1:ns,instance)) -!*** calculate the threshold shear stress for dislocation slip -!*** coefficients are corrected for the line tension effect +!*** calculate the threshold shear stress for dislocation slip +!*** coefficients are corrected for the line tension effect !*** (see Kubin,Devincre,Hoc; 2008; Modeling dislocation storage rates and mean free paths in face-centered cubic crystals) myInteractionMatrix = 0.0_pReal myInteractionMatrix(1:ns,1:ns) = interactionMatrixSlipSlip(1:ns,1:ns,instance) if (lattice_structure(ph) == LATTICE_bcc_ID .or. lattice_structure(ph) == LATTICE_fcc_ID) then ! only fcc and bcc - do s = 1_pInt,ns + do s = 1_pInt,ns myRhoForest = max(rhoForest(s),significantRho(instance)) correction = ( 1.0_pReal - linetensionEffect(instance) & + linetensionEffect(instance) & * log(0.35_pReal * burgers(s,instance) * sqrt(myRhoForest)) & / log(0.35_pReal * burgers(s,instance) * 1e6_pReal)) ** 2.0_pReal - myInteractionMatrix(s,1:ns) = correction * myInteractionMatrix(s,1:ns) + myInteractionMatrix(s,1:ns) = correction * myInteractionMatrix(s,1:ns) enddo endif forall (s = 1_pInt:ns) & @@ -1715,9 +1709,9 @@ if (.not. phase_localPlasticity(ph) .and. shortRangeStressCorrection(instance)) rhoExcess(1,1:ns) = rhoSgl(1:ns,1) - rhoSgl(1:ns,2) rhoExcess(2,1:ns) = rhoSgl(1:ns,3) - rhoSgl(1:ns,4) FVsize = mesh_ipVolume(ip,el) ** (1.0_pReal/3.0_pReal) - + !* loop through my neighborhood and get the connection vectors (in lattice frame) and the excess densities - + nRealNeighbors = 0_pInt neighbor_rhoTotal = 0.0_pReal do n = 1_pInt,FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el)))) @@ -1769,17 +1763,17 @@ if (.not. phase_localPlasticity(ph) .and. shortRangeStressCorrection(instance)) neighbor_rhoExcess(1:2,1:ns,n) = rhoExcess endif enddo - + !* loop through the slip systems and calculate the dislocation gradient by !* 1. interpolation of the excess density in the neighorhood !* 2. interpolation of the dead dislocation density in the central volume - + m(1:3,1:ns,1) = lattice_sd(1:3,slipSystemLattice(1:ns,instance),ph) m(1:3,1:ns,2) = -lattice_st(1:3,slipSystemLattice(1:ns,instance),ph) do s = 1_pInt,ns - + !* gradient from interpolation of neighboring excess density do c = 1_pInt,2_pInt @@ -1792,28 +1786,28 @@ if (.not. phase_localPlasticity(ph) .and. shortRangeStressCorrection(instance)) - neighbor_rhoExcess(c,s,neighbors(2)) enddo invConnections = math_inv33(connections) - if (all(abs(invConnections) <= tiny(0.0_pReal))) & ! check for failed in version (math_inv33 returns 0) and avoid floating point equality comparison + if (all(dEq0(invConnections))) & call IO_error(-1_pInt,ext_msg='back stress calculation: inversion error') rhoExcessGradient(c) = math_mul3x3(m(1:3,s,c), & math_mul33x3(invConnections,rhoExcessDifferences)) enddo - + !* plus gradient from deads - + do t = 1_pInt,4_pInt c = (t - 1_pInt) / 2_pInt + 1_pInt rhoExcessGradient(c) = rhoExcessGradient(c) + rhoSgl(s,t+4_pInt) / FVsize enddo !* normalized with the total density - + rhoExcessGradient_over_rho = 0.0_pReal forall (c = 1_pInt:2_pInt) & rhoTotal(c) = (sum(abs(rhoSgl(s,[2*c-1,2*c,2*c+3,2*c+4]))) + rhoDip(s,c) & + sum(neighbor_rhoTotal(c,s,:))) / real(1_pInt + nRealNeighbors,pReal) forall (c = 1_pInt:2_pInt, rhoTotal(c) > 0.0_pReal) & rhoExcessGradient_over_rho(c) = rhoExcessGradient(c) / rhoTotal(c) - + !* gives the local stress correction when multiplied with a factor tauBack(s) = - lattice_mu(ph) * burgers(s,instance) / (2.0_pReal * pi) & @@ -1844,7 +1838,7 @@ end subroutine plastic_nonlocal_microstructure !-------------------------------------------------------------------------------------------------- -!> @brief calculates kinetics +!> @brief calculates kinetics !-------------------------------------------------------------------------------------------------- subroutine plastic_nonlocal_kinetics(v, dv_dtau, dv_dtauNS, tau, tauNS, & tauThreshold, c, Temperature, ip, el) @@ -1880,7 +1874,7 @@ real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1_pInt integer(pInt) :: instance, & !< current instance of this plasticity ns, & !< short notation for the total number of active slip systems s !< index of my current slip system -real(pReal) tauRel_P, & +real(pReal) tauRel_P, & tauRel_S, & tauEff, & !< effective shear stress tPeierls, & !< waiting time in front of a peierls barriers @@ -1918,7 +1912,7 @@ if (Temperature > 0.0_pReal) then !* Peierls contribution !* Effective stress includes non Schmid constributions !* The derivative only gives absolute values; the correct sign is taken care of in the formula for the derivative of the velocity - + tauEff = max(0.0_pReal, abs(tauNS(s)) - tauThreshold(s)) ! ensure that the effective stress is positive meanfreepath_P = burgers(s,instance) jumpWidth_P = burgers(s,instance) @@ -1933,7 +1927,7 @@ if (Temperature > 0.0_pReal) then if (tauEff < criticalStress_P) then dtPeierls_dtau = tPeierls * pParam(instance) * qParam(instance) * activationVolume_P / (KB * Temperature) & * (1.0_pReal - tauRel_P**pParam(instance))**(qParam(instance)-1.0_pReal) & - * tauRel_P**(pParam(instance)-1.0_pReal) + * tauRel_P**(pParam(instance)-1.0_pReal) else dtPeierls_dtau = 0.0_pReal endif @@ -1957,32 +1951,32 @@ if (Temperature > 0.0_pReal) then dtSolidSolution_dtau = tSolidSolution * pParam(instance) * qParam(instance) & * activationVolume_S / (KB * Temperature) & * (1.0_pReal - tauRel_S**pParam(instance))**(qParam(instance)-1.0_pReal) & - * tauRel_S**(pParam(instance)-1.0_pReal) + * tauRel_S**(pParam(instance)-1.0_pReal) else dtSolidSolution_dtau = 0.0_pReal endif !* viscous glide velocity - + tauEff = abs(tau(s)) - tauThreshold(s) mobility = burgers(s,instance) / viscosity(instance) vViscous = mobility * tauEff - !* Mean velocity results from waiting time at peierls barriers and solid solution obstacles with respective meanfreepath of - !* free flight at glide velocity in between. + !* Mean velocity results from waiting time at peierls barriers and solid solution obstacles with respective meanfreepath of + !* free flight at glide velocity in between. !* adopt sign from resolved stress v(s) = sign(1.0_pReal,tau(s)) & / (tPeierls / meanfreepath_P + tSolidSolution / meanfreepath_S + 1.0_pReal / vViscous) dv_dtau(s) = v(s) * v(s) * (dtSolidSolution_dtau / meanfreepath_S & + mobility / (vViscous * vViscous)) - dv_dtauNS(s) = v(s) * v(s) * dtPeierls_dtau / meanfreepath_P + dv_dtauNS(s) = v(s) * v(s) * dtPeierls_dtau / meanfreepath_P endif enddo endif - + #ifndef _OPENMP if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt & @@ -2051,7 +2045,7 @@ integer(pInt) instance, & sLattice !< index of my current slip system according to lattice order real(pReal), dimension(3,3,3,3) :: dLp_dTstar3333 !< derivative of Lp with respect to Tstar (3x3x3x3 matrix) real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1_pInt,ip,el))),8) :: & - rhoSgl !< single dislocation densities (including blocked) + rhoSgl !< single dislocation densities (including blocked) real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1_pInt,ip,el))),4) :: & v, & !< velocity tauNS, & !< resolved shear stress including non Schmid and backstress terms @@ -2075,7 +2069,7 @@ instance = phase_plasticityInstance(ph) ns = totalNslip(instance) -!*** shortcut to state variables +!*** shortcut to state variables forall (s = 1_pInt:ns, t = 1_pInt:4_pInt) @@ -2114,7 +2108,7 @@ tau = tau + tauBack !*** get dislocation velocity and its tangent and store the velocity in the state array -! edges +! edges call plastic_nonlocal_kinetics(v(1:ns,1), dv_dtau(1:ns,1), dv_dtauNS(1:ns,1), & tau(1:ns), tauNS(1:ns,1), tauThreshold(1:ns), & 1_pInt, Temperature, ip, el) @@ -2153,7 +2147,7 @@ forall (s = 1_pInt:ns, t = 5_pInt:8_pInt, rhoSgl(s,t) * v(s,t-4_pInt) < 0.0_pRea gdotTotal = sum(rhoSgl(1:ns,1:4) * v, 2) * burgers(1:ns,instance) do s = 1_pInt,ns - sLattice = slipSystemLattice(s,instance) + sLattice = slipSystemLattice(s,instance) Lp = Lp + gdotTotal(s) * lattice_Sslip(1:3,1:3,1,sLattice,ph) ! Schmid contributions to tangent @@ -2167,14 +2161,14 @@ do s = 1_pInt,ns forall (i=1_pInt:3_pInt,j=1_pInt:3_pInt,k=1_pInt:3_pInt,l=1_pInt:3_pInt) & dLp_dTstar3333(i,j,k,l) = dLp_dTstar3333(i,j,k,l) & + lattice_Sslip(i,j,1,sLattice,ph) & - * ( nonSchmidProjection(k,l,1,s,instance) * rhoSgl(s,3) * dv_dtauNS(s,3) & + * ( nonSchmidProjection(k,l,1,s,instance) * rhoSgl(s,3) * dv_dtauNS(s,3) & + nonSchmidProjection(k,l,3,s,instance) * rhoSgl(s,4) * dv_dtauNS(s,4) ) & * burgers(s,instance) else forall (i=1_pInt:3_pInt,j=1_pInt:3_pInt,k=1_pInt:3_pInt,l=1_pInt:3_pInt) & dLp_dTstar3333(i,j,k,l) = dLp_dTstar3333(i,j,k,l) & + lattice_Sslip(i,j,1,sLattice,ph) & - * ( nonSchmidProjection(k,l,2,s,instance) * rhoSgl(s,3) * dv_dtauNS(s,3) & + * ( nonSchmidProjection(k,l,2,s,instance) * rhoSgl(s,3) * dv_dtauNS(s,3) & + nonSchmidProjection(k,l,4,s,instance) * rhoSgl(s,4) * dv_dtauNS(s,4) ) & * burgers(s,instance) endif @@ -2200,6 +2194,8 @@ end subroutine plastic_nonlocal_LpAndItsTangent !> @brief (instantaneous) incremental change of microstructure !-------------------------------------------------------------------------------------------------- subroutine plastic_nonlocal_deltaState(Tstar_v,ip,el) +use prec, only: & + dNeq0 use debug, only: debug_level, & debug_constitutive, & debug_levelBasic, & @@ -2265,7 +2261,7 @@ real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1,ip,e ns = totalNslip(instance) -!*** shortcut to state variables +!*** shortcut to state variables forall (s = 1_pInt:ns, t = 1_pInt:4_pInt) rhoSgl(s,t) = max(plasticState(ph)%state(iRhoU(s,t,instance),of), 0.0_pReal) ! ensure positive single mobile densities @@ -2311,7 +2307,7 @@ enddo !*** calculate limits for stable dipole height do s = 1_pInt,ns - sLattice = slipSystemLattice(s,instance) + sLattice = slipSystemLattice(s,instance) tau(s) = math_mul6x6(Tstar_v, lattice_Sslip_v(1:6,1,sLattice,ph)) + tauBack(s) if (abs(tau(s)) < 1.0e-15_pReal) tau(s) = 1.0e-15_pReal enddo @@ -2322,9 +2318,9 @@ dUpper(1:ns,2) = lattice_mu(ph) * burgers(1:ns,instance) / (4.0_pReal * pi * abs forall (c = 1_pInt:2_pInt) - where(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+& - abs(rhoSgl(1:ns,2*c+3))+abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)) >= tiny(0.0_pReal)) & - dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + where(dNeq0(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+abs(rhoSgl(1:ns,2*c+3))& + +abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)))) & + dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + abs(rhoSgl(1:ns,2*c+3)) + abs(rhoSgl(1:ns,2*c+4)) + rhoDip(1:ns,c)), & dUpper(1:ns,c)) end forall @@ -2335,7 +2331,7 @@ deltaDUpper = dUpper - dUpperOld !*** dissociation by stress increase deltaRhoDipole2SingleStress = 0.0_pReal forall (c=1_pInt:2_pInt, s=1_pInt:ns, deltaDUpper(s,c) < 0.0_pReal .and. & - abs(dUpperOld(s,c) - dLower(s,c)) > tiny(0.0_pReal)) & + dNeq0(dUpperOld(s,c) - dLower(s,c))) & deltaRhoDipole2SingleStress(s,8_pInt+c) = rhoDip(s,c) * deltaDUpper(s,c) & / (dUpperOld(s,c) - dLower(s,c)) @@ -2347,7 +2343,7 @@ forall (t=1_pInt:4_pInt) & !*** store new maximum dipole height in state forall (s = 1_pInt:ns, c = 1_pInt:2_pInt) & - plasticState(ph)%state(iD(s,c,instance),of) = dUpper(s,c) + plasticState(ph)%state(iD(s,c,instance),of) = dUpper(s,c) @@ -2382,7 +2378,10 @@ end subroutine plastic_nonlocal_deltaState subroutine plastic_nonlocal_dotState(Tstar_v, Fe, Fp, Temperature, & timestep,subfrac, ip,el) -use prec, only: DAMASK_NaN +use prec, only: DAMASK_NaN, & + dNeq0, & + dNeq, & + dEq0 use numerics, only: numerics_integrationMode, & numerics_timeSyncing use IO, only: IO_error @@ -2400,7 +2399,7 @@ use math, only: math_mul6x6, & math_mul33x33, & math_inv33, & math_det33, & - math_transpose33, & + math_transpose33, & pi use mesh, only: mesh_NcpElems, & mesh_maxNips, & @@ -2426,7 +2425,7 @@ use lattice, only: lattice_Sslip_v, & lattice_mu, & lattice_nu, & lattice_structure, & - LATTICE_bcc_ID, & + LATTICE_bcc_ID, & LATTICE_fcc_ID implicit none @@ -2438,14 +2437,14 @@ real(pReal), intent(in) :: Temperature, & timestep !< substepped crystallite time increment real(pReal), dimension(6), intent(in) :: Tstar_v !< current 2nd Piola-Kirchhoff stress in Mandel notation real(pReal), dimension(homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - subfrac !< fraction of timestep at the beginning of the substepped crystallite time increment + subfrac !< fraction of timestep at the beginning of the substepped crystallite time increment real(pReal), dimension(3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & Fe, & !< elastic deformation gradient Fp !< plastic deformation gradient - + !*** local variables -integer(pInt) :: ph, & +integer(pInt) :: ph, & instance, & !< current instance of this plasticity neighbor_instance, & !< instance of my neighbor's plasticity ns, & !< short notation for the total number of active slip systems @@ -2494,7 +2493,7 @@ real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1_pInt nSources real(pReal), dimension(totalNslip(phase_plasticityInstance(material_phase(1_pInt,ip,el))),2) :: & rhoDip, & !< current dipole dislocation densities (screw and edge dipoles) - rhoDipOriginal, & + rhoDipOriginal, & dLower, & !< minimum stable dipole distance for edges and screws dUpper !< current maximum stable dipole distance for edges and screws real(pReal), dimension(3,totalNslip(phase_plasticityInstance(material_phase(1_pInt,ip,el))),4) :: & @@ -2512,11 +2511,11 @@ real(pReal) area, & transmissivity, & !< overall transmissivity of dislocation flux to neighboring material point lineLength, & !< dislocation line length leaving the current interface selfDiffusion, & !< self diffusion - rnd, & + rnd, & meshlength logical considerEnteringFlux, & considerLeavingFlux - + p = phaseAt(1,ip,el) o = phasememberAt(1,ip,el) @@ -2538,7 +2537,7 @@ tau = 0.0_pReal gdot = 0.0_pReal -!*** shortcut to state variables +!*** shortcut to state variables forall (s = 1_pInt:ns, t = 1_pInt:4_pInt) @@ -2572,7 +2571,7 @@ if (numerics_timeSyncing) then .or. abs(rhoSgl0) < significantRho(instance)) & rhoSgl0 = 0.0_pReal endif - + !*** sanity check for timestep @@ -2605,7 +2604,7 @@ forall (t = 1_pInt:4_pInt) & !*** calculate limits for stable dipole height do s = 1_pInt,ns ! loop over slip systems - sLattice = slipSystemLattice(s,instance) + sLattice = slipSystemLattice(s,instance) tau(s) = math_mul6x6(Tstar_v, lattice_Sslip_v(1:6,1,sLattice,ph)) + tauBack(s) if (abs(tau(s)) < 1.0e-15_pReal) tau(s) = 1.0e-15_pReal enddo @@ -2616,9 +2615,9 @@ dUpper(1:ns,1) = lattice_mu(ph) * burgers(1:ns,instance) & dUpper(1:ns,2) = lattice_mu(ph) * burgers(1:ns,instance) & / (4.0_pReal * pi * abs(tau)) forall (c = 1_pInt:2_pInt) - where(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+& - abs(rhoSgl(1:ns,2*c+3))+abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)) >= tiny(0.0_pReal)) & - dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + where(dNeq0(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+abs(rhoSgl(1:ns,2*c+3))& + +abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)))) & + dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + abs(rhoSgl(1:ns,2*c+3)) + abs(rhoSgl(1:ns,2*c+4)) + rhoDip(1:ns,c)), & dUpper(1:ns,c)) end forall @@ -2692,7 +2691,7 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then .and. CFLfactor(instance) * abs(v) * timestep & > mesh_ipVolume(ip,el) / maxval(mesh_ipArea(:,ip,el)))) then ! ...with velocity above critical value (we use the reference volume and area for simplicity here) #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt) then + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt) then write(6,'(a,i5,a,i2)') '<< CONST >> CFL condition not fullfilled at el ',el,' ip ',ip write(6,'(a,e10.3,a,e10.3)') '<< CONST >> velocity is at ', & maxval(abs(v), abs(gdot) > 0.0_pReal & @@ -2709,15 +2708,15 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then !*** be aware of the definition of lattice_st = lattice_sd x lattice_sn !!! !*** opposite sign to our p vector in the (s,p,n) triplet !!! - + m(1:3,1:ns,1) = lattice_sd(1:3, slipSystemLattice(1:ns,instance), ph) m(1:3,1:ns,2) = -lattice_sd(1:3, slipSystemLattice(1:ns,instance), ph) m(1:3,1:ns,3) = -lattice_st(1:3, slipSystemLattice(1:ns,instance), ph) m(1:3,1:ns,4) = lattice_st(1:3, slipSystemLattice(1:ns,instance), ph) - + my_Fe = Fe(1:3,1:3,1_pInt,ip,el) my_F = math_mul33x33(my_Fe, Fp(1:3,1:3,1_pInt,ip,el)) - + do n = 1_pInt,FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el)))) ! loop through my neighbors ! write(6,*) 'c' neighbor_el = mesh_ipNeighborhood(1,n,ip,el) @@ -2730,7 +2729,7 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then opposite_el = mesh_ipNeighborhood(1,opposite_neighbor,ip,el) opposite_ip = mesh_ipNeighborhood(2,opposite_neighbor,ip,el) opposite_n = mesh_ipNeighborhood(3,opposite_neighbor,ip,el) - + if (neighbor_n > 0_pInt) then ! if neighbor exists, average deformation gradient neighbor_instance = phase_plasticityInstance(material_phase(1_pInt,neighbor_ip,neighbor_el)) neighbor_Fe = Fe(1:3,1:3,1_pInt,neighbor_ip,neighbor_el) @@ -2739,29 +2738,28 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then else ! if no neighbor, take my value as average Favg = my_F endif - + !* FLUX FROM MY NEIGHBOR TO ME - !* This is only considered, if I have a neighbor of nonlocal plasticity - !* (also nonlocal constitutive law with local properties) that is at least a little bit + !* This is only considered, if I have a neighbor of nonlocal plasticity + !* (also nonlocal constitutive law with local properties) that is at least a little bit !* compatible. !* If it's not at all compatible, no flux is arriving, because everything is dammed in front of !* my neighbor's interface. - !* The entering flux from my neighbor will be distributed on my slip systems according to the + !* The entering flux from my neighbor will be distributed on my slip systems according to the !*compatibility - + considerEnteringFlux = .false. - neighbor_v = 0.0_pReal ! needed for check of sign change in flux density below + neighbor_v = 0.0_pReal ! needed for check of sign change in flux density below neighbor_rhoSgl = 0.0_pReal if (neighbor_n > 0_pInt) then if (phase_plasticity(material_phase(1,neighbor_ip,neighbor_el)) == PLASTICITY_NONLOCAL_ID & .and. any(compatibility(:,:,:,n,ip,el) > 0.0_pReal)) & considerEnteringFlux = .true. endif - + if (considerEnteringFlux) then - if(numerics_timeSyncing .and. (subfrac(1_pInt,neighbor_ip,neighbor_el) /= subfrac(1_pInt,ip,el))) & - then ! for timesyncing: in case of a timestep at the interface we have to use "state0" to make sure that fluxes n both sides are equal + if(numerics_timeSyncing .and. (dNeq(subfrac(1,neighbor_ip,neighbor_el),subfrac(1,ip,el)))) then ! for timesyncing: in case of a timestep at the interface we have to use "state0" to make sure that fluxes n both sides are equal forall (s = 1:ns, t = 1_pInt:4_pInt) neighbor_v(s,t) = plasticState(np)%state0(iV (s,t,neighbor_instance),no) @@ -2790,7 +2788,7 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then c = (t + 1_pInt) / 2 topp = t + mod(t,2_pInt) - mod(t+1_pInt,2_pInt) if (neighbor_v(s,t) * math_mul3x3(m(1:3,s,t), normal_neighbor2me) > 0.0_pReal & ! flux from my neighbor to me == entering flux for me - .and. v(s,t) * neighbor_v(s,t) >= 0.0_pReal ) then ! ... only if no sign change in flux density + .and. v(s,t) * neighbor_v(s,t) >= 0.0_pReal ) then ! ... only if no sign change in flux density lineLength = neighbor_rhoSgl(s,t) * neighbor_v(s,t) & * math_mul3x3(m(1:3,s,t), normal_neighbor2me) * area ! positive line length that wants to enter through this interface where (compatibility(c,1_pInt:ns,s,n,ip,el) > 0.0_pReal) & ! positive compatibility... @@ -2805,16 +2803,16 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then enddo enddo endif - - + + !* FLUX FROM ME TO MY NEIGHBOR - !* This is not considered, if my opposite neighbor has a different constitutive law than nonlocal (still considered for nonlocal law with lcal properties). + !* This is not considered, if my opposite neighbor has a different constitutive law than nonlocal (still considered for nonlocal law with lcal properties). !* Then, we assume, that the opposite(!) neighbor sends an equal amount of dislocations to me. !* So the net flux in the direction of my neighbor is equal to zero: !* leaving flux to neighbor == entering flux from opposite neighbor !* In case of reduced transmissivity, part of the leaving flux is stored as dead dislocation density. !* That means for an interface of zero transmissivity the leaving flux is fully converted to dead dislocations. - + considerLeavingFlux = .true. if (opposite_n > 0_pInt) then if (phase_plasticity(material_phase(1,opposite_ip,opposite_el)) /= PLASTICITY_NONLOCAL_ID) & @@ -2822,32 +2820,32 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then endif if (considerLeavingFlux) then - - !* timeSyncing mode: If the central ip has zero subfraction, always use "state0". This is needed in case of + + !* timeSyncing mode: If the central ip has zero subfraction, always use "state0". This is needed in case of !* a synchronization step for the central ip, because then "state" contains the values at the end of the - !* previously converged full time step. Also, if either me or my neighbor has zero subfraction, we have to + !* previously converged full time step. Also, if either me or my neighbor has zero subfraction, we have to !* use "state0" to make sure that fluxes on both sides of the (potential) timestep are equal. my_rhoSgl = rhoSgl my_v = v if(numerics_timeSyncing) then - if (abs(subfrac(1_pInt,ip,el))<= tiny(0.0_pReal)) then + if (dEq0(subfrac(1_pInt,ip,el))) then my_rhoSgl = rhoSgl0 my_v = v0 elseif (neighbor_n > 0_pInt) then - if (abs(subfrac(1_pInt,neighbor_ip,neighbor_el))<= tiny(0.0_pReal)) then + if (dEq0(subfrac(1_pInt,neighbor_ip,neighbor_el))) then my_rhoSgl = rhoSgl0 my_v = v0 endif endif endif - + normal_me2neighbor_defConf = math_det33(Favg) & - * math_mul33x3(math_inv33(math_transpose33(Favg)), & + * math_mul33x3(math_inv33(math_transpose33(Favg)), & mesh_ipAreaNormal(1:3,n,ip,el)) ! calculate the normal of the interface in (average) deformed configuration (pointing from me to my neighbor!!!) normal_me2neighbor = math_mul33x3(math_transpose33(my_Fe), normal_me2neighbor_defConf) & / math_det33(my_Fe) ! interface normal in my lattice configuration area = mesh_ipArea(n,ip,el) * norm2(normal_me2neighbor) - normal_me2neighbor = normal_me2neighbor / norm2(normal_me2neighbor) ! normalize the surface normal to unit length + normal_me2neighbor = normal_me2neighbor / norm2(normal_me2neighbor) ! normalize the surface normal to unit length do s = 1_pInt,ns do t = 1_pInt,4_pInt c = (t + 1_pInt) / 2_pInt @@ -2866,9 +2864,9 @@ if (.not. phase_localPlasticity(material_phase(1_pInt,ip,el))) then endif enddo enddo - endif - - enddo ! neighbor loop + endif + + enddo ! neighbor loop endif @@ -2906,7 +2904,7 @@ enddo rhoDotAthermalAnnihilation = 0.0_pReal -forall (c=1_pInt:2_pInt) & +forall (c=1_pInt:2_pInt) & rhoDotAthermalAnnihilation(1:ns,c+8_pInt) = -2.0_pReal * dLower(1:ns,c) / burgers(1:ns,instance) & * ( 2.0_pReal * (rhoSgl(1:ns,2*c-1) * abs(gdot(1:ns,2*c)) + rhoSgl(1:ns,2*c) * abs(gdot(1:ns,2*c-1))) & ! was single hitting single + 2.0_pReal * (abs(rhoSgl(1:ns,2*c+3)) * abs(gdot(1:ns,2*c)) + abs(rhoSgl(1:ns,2*c+4)) * abs(gdot(1:ns,2*c-1))) & ! was single hitting immobile single or was immobile single hit by single @@ -2917,8 +2915,8 @@ if (lattice_structure(ph) == LATTICE_fcc_ID) & ! only fcc rhoDotAthermalAnnihilation(colinearSystem(s,instance),1:2) = - rhoDotAthermalAnnihilation(s,10) & * 0.25_pReal * sqrt(rhoForest(s)) * (dUpper(s,2) + dLower(s,2)) * edgeJogFactor(instance) - - + + !*** thermally activated annihilation of edge dipoles by climb rhoDotThermalAnnihilation = 0.0_pReal @@ -2942,7 +2940,7 @@ rhoDot = rhoDotFlux & + rhoDotMultiplication & + rhoDotSingle2DipoleGlide & + rhoDotAthermalAnnihilation & - + rhoDotThermalAnnihilation + + rhoDotThermalAnnihilation if (numerics_integrationMode == 1_pInt) then ! save rates for output if in central integration mode rhoDotFluxOutput(1:ns,1:8,1_pInt,ip,el) = rhoDotFlux(1:ns,1:8) @@ -2981,7 +2979,7 @@ endif if ( any(rhoSglOriginal(1:ns,1:4) + rhoDot(1:ns,1:4) * timestep < -aTolRho(instance)) & .or. any(rhoDipOriginal(1:ns,1:2) + rhoDot(1:ns,9:10) * timestep < -aTolRho(instance))) then #ifndef _OPENMP - if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt) then + if (iand(debug_level(debug_constitutive),debug_levelExtensive) /= 0_pInt) then write(6,'(a,i5,a,i2)') '<< CONST >> evolution rate leads to negative density at el ',el,' ip ',ip write(6,'(a)') '<< CONST >> enforcing cutback !!!' endif @@ -2989,7 +2987,7 @@ if ( any(rhoSglOriginal(1:ns,1:4) + rhoDot(1:ns,1:4) * timestep < -aTolRho(in plasticState(p)%dotState = DAMASK_NaN return else - forall (s = 1:ns, t = 1_pInt:4_pInt) + forall (s = 1:ns, t = 1_pInt:4_pInt) plasticState(p)%dotState(iRhoU(s,t,instance),o) = rhoDot(s,t) plasticState(p)%dotState(iRhoB(s,t,instance),o) = rhoDot(s,t+4_pInt) endforall @@ -3037,10 +3035,10 @@ integer(pInt), intent(in) :: i, & e ! element index real(pReal), dimension(4,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & orientation ! crystal orientation in quaternions - + !* local variables integer(pInt) Nneighbors, & ! number of neighbors - n, & ! neighbor index + n, & ! neighbor index neighbor_e, & ! element index of my neighbor neighbor_i, & ! integration point index of my neighbor ph, & @@ -3054,15 +3052,15 @@ integer(pInt) Nneighbors, & real(pReal), dimension(4) :: absoluteMisorientation ! absolute misorientation (without symmetry) between me and my neighbor real(pReal), dimension(2,totalNslip(phase_plasticityInstance(material_phase(1,i,e))),& totalNslip(phase_plasticityInstance(material_phase(1,i,e))),& - FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,e))))) :: & + FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,e))))) :: & my_compatibility ! my_compatibility for current element and ip -real(pReal), dimension(3,totalNslip(phase_plasticityInstance(material_phase(1,i,e)))) :: & +real(pReal), dimension(3,totalNslip(phase_plasticityInstance(material_phase(1,i,e)))) :: & slipNormal, & slipDirection real(pReal) my_compatibilitySum, & thresholdValue, & nThresholdValues -logical, dimension(totalNslip(phase_plasticityInstance(material_phase(1,i,e)))) :: & +logical, dimension(totalNslip(phase_plasticityInstance(material_phase(1,i,e)))) :: & belowThreshold @@ -3078,43 +3076,38 @@ slipDirection(1:3,1:ns) = lattice_sd(1:3, slipSystemLattice(1:ns,instance), ph) !*** start out fully compatible my_compatibility = 0.0_pReal -forall(s1 = 1_pInt:ns) & - my_compatibility(1:2,s1,s1,1:Nneighbors) = 1.0_pReal - +forall(s1 = 1_pInt:ns) my_compatibility(1:2,s1,s1,1:Nneighbors) = 1.0_pReal !*** Loop thrugh neighbors and check whether there is any my_compatibility. -do n = 1_pInt,Nneighbors +neighbors: do n = 1_pInt,Nneighbors neighbor_e = mesh_ipNeighborhood(1,n,i,e) neighbor_i = mesh_ipNeighborhood(2,n,i,e) - - + + !* FREE SURFACE !* Set surface transmissivity to the value specified in the material.config - + if (neighbor_e <= 0_pInt .or. neighbor_i <= 0_pInt) then - forall(s1 = 1_pInt:ns) & - my_compatibility(1:2,s1,s1,n) = sqrt(surfaceTransmissivity(instance)) + forall(s1 = 1_pInt:ns) my_compatibility(1:2,s1,s1,n) = sqrt(surfaceTransmissivity(instance)) cycle endif - - + + !* PHASE BOUNDARY - !* If we encounter a different nonlocal "cpfem" phase at the neighbor, + !* If we encounter a different nonlocal "cpfem" phase at the neighbor, !* we consider this to be a real "physical" phase boundary, so completely incompatible. - !* If one of the two "CPFEM" phases has a local plasticity law, + !* If one of the two "CPFEM" phases has a local plasticity law, !* we do not consider this to be a phase boundary, so completely compatible. - + neighbor_phase = material_phase(1,neighbor_i,neighbor_e) if (neighbor_phase /= ph) then - if (.not. phase_localPlasticity(neighbor_phase) .and. .not. phase_localPlasticity(ph)) then - forall(s1 = 1_pInt:ns) & - my_compatibility(1:2,s1,s1,n) = 0.0_pReal ! = sqrt(0.0) - endif + if (.not. phase_localPlasticity(neighbor_phase) .and. .not. phase_localPlasticity(ph))& + forall(s1 = 1_pInt:ns) my_compatibility(1:2,s1,s1,n) = 0.0_pReal cycle endif - + !* GRAIN BOUNDARY ! !* fixed transmissivity for adjacent ips with different texture (only if explicitly given in material.config) @@ -3127,47 +3120,47 @@ do n = 1_pInt,Nneighbors endif cycle endif - + !* GRAIN BOUNDARY ? !* Compatibility defined by relative orientation of slip systems: !* The my_compatibility value is defined as the product of the slip normal projection and the slip direction projection. - !* Its sign is always positive for screws, for edges it has the same sign as the slip normal projection. - !* Since the sum for each slip system can easily exceed one (which would result in a transmissivity larger than one), + !* Its sign is always positive for screws, for edges it has the same sign as the slip normal projection. + !* Since the sum for each slip system can easily exceed one (which would result in a transmissivity larger than one), !* only values above or equal to a certain threshold value are considered. This threshold value is chosen, such that - !* the number of compatible slip systems is minimized with the sum of the original my_compatibility values exceeding one. - !* Finally the smallest my_compatibility value is decreased until the sum is exactly equal to one. + !* the number of compatible slip systems is minimized with the sum of the original my_compatibility values exceeding one. + !* Finally the smallest my_compatibility value is decreased until the sum is exactly equal to one. !* All values below the threshold are set to zero. else absoluteMisorientation = lattice_qDisorientation(orientation(1:4,1,i,e), & orientation(1:4,1,neighbor_i,neighbor_e)) ! no symmetry - do s1 = 1_pInt,ns ! my slip systems - do s2 = 1_pInt,ns ! my neighbor's slip systems + mySlipSystems: do s1 = 1_pInt,ns + neighborSlipSystems: do s2 = 1_pInt,ns my_compatibility(1,s2,s1,n) = math_mul3x3(slipNormal(1:3,s1), math_qRot(absoluteMisorientation, slipNormal(1:3,s2))) & * abs(math_mul3x3(slipDirection(1:3,s1), math_qRot(absoluteMisorientation, slipDirection(1:3,s2)))) my_compatibility(2,s2,s1,n) = abs(math_mul3x3(slipNormal(1:3,s1), math_qRot(absoluteMisorientation, slipNormal(1:3,s2)))) & * abs(math_mul3x3(slipDirection(1:3,s1), math_qRot(absoluteMisorientation, slipDirection(1:3,s2)))) - enddo - + enddo neighborSlipSystems + my_compatibilitySum = 0.0_pReal belowThreshold = .true. do while (my_compatibilitySum < 1.0_pReal .and. any(belowThreshold(1:ns))) thresholdValue = maxval(my_compatibility(2,1:ns,s1,n), belowThreshold(1:ns)) ! screws always positive - nThresholdValues = real(count(my_compatibility(2,1:ns,s1,n) == thresholdValue),pReal) + nThresholdValues = real(count(my_compatibility(2,1:ns,s1,n) >= thresholdValue),pReal) where (my_compatibility(2,1:ns,s1,n) >= thresholdValue) & belowThreshold(1:ns) = .false. if (my_compatibilitySum + thresholdValue * nThresholdValues > 1.0_pReal) & - where (abs(my_compatibility(1:2,1:ns,s1,n)) == thresholdValue) & ! MD: rather check below threshold? + where (abs(my_compatibility(1:2,1:ns,s1,n)) >= thresholdValue) & ! MD: rather check below threshold? my_compatibility(1:2,1:ns,s1,n) = sign((1.0_pReal - my_compatibilitySum) & / nThresholdValues, my_compatibility(1:2,1:ns,s1,n)) my_compatibilitySum = my_compatibilitySum + nThresholdValues * thresholdValue enddo where (belowThreshold(1:ns)) my_compatibility(1,1:ns,s1,n) = 0.0_pReal where (belowThreshold(1:ns)) my_compatibility(2,1:ns,s1,n) = 0.0_pReal - enddo ! my slip systems cycle + enddo mySlipSystems endif -enddo ! neighbor cycle +enddo neighbors compatibility(1:2,1:ns,1:ns,1:Nneighbors,i,e) = my_compatibility @@ -3177,6 +3170,8 @@ end subroutine plastic_nonlocal_updateCompatibility !* calculates quantities characterizing the microstructure * !********************************************************************* function plastic_nonlocal_dislocationstress(Fe, ip, el) +use prec, only: & + dEq0 use math, only: math_mul33x33, & math_mul33x3, & math_inv33, & @@ -3284,7 +3279,7 @@ if (.not. phase_localPlasticity(ph)) then invFe = math_inv33(Fe(1:3,1:3,1_pInt,ip,el)) !* in case of periodic surfaces we have to find out how many periodic images in each direction we need - + do dir = 1_pInt,3_pInt maxCoord(dir) = maxval(mesh_node0(dir,:)) minCoord(dir) = minval(mesh_node0(dir,:)) @@ -3299,10 +3294,10 @@ if (.not. phase_localPlasticity(ph)) then endif enddo - - !* loop through all material points (also through their periodic images if present), + + !* loop through all material points (also through their periodic images if present), !* but only consider nonlocal neighbors within a certain cutoff radius R - + do neighbor_el = 1_pInt,mesh_NcpElems ipLoop: do neighbor_ip = 1_pInt,FE_Nips(FE_geomtype(mesh_element(2,neighbor_el))) neighbor_phase = material_phase(1_pInt,neighbor_ip,neighbor_el) @@ -3314,7 +3309,7 @@ if (.not. phase_localPlasticity(ph)) then neighbor_ns = totalNslip(neighbor_instance) neighbor_invFe = math_inv33(Fe(1:3,1:3,1,neighbor_ip,neighbor_el)) neighbor_ipVolumeSideLength = mesh_ipVolume(neighbor_ip,neighbor_el) ** (1.0_pReal/3.0_pReal) ! reference volume used here - + forall (s = 1_pInt:neighbor_ns, c = 1_pInt:2_pInt) neighbor_rhoExcess(c,1,s) = plasticState(np)%state(iRhoU(s,2*c-1,neighbor_instance),no) & ! positive mobiles - plasticState(np)%state(iRhoU(s,2*c,neighbor_instance),no) ! negative mobiles @@ -3326,43 +3321,43 @@ if (.not. phase_localPlasticity(ph)) then do deltaX = periodicImages(1,1),periodicImages(2,1) do deltaY = periodicImages(1,2),periodicImages(2,2) do deltaZ = periodicImages(1,3),periodicImages(2,3) - - + + !* regular case - + if (neighbor_el /= el .or. neighbor_ip /= ip & .or. deltaX /= 0_pInt .or. deltaY /= 0_pInt .or. deltaZ /= 0_pInt) then - + neighbor_coords = mesh_cellCenterCoordinates(neighbor_ip,neighbor_el) & + [real(deltaX,pReal), real(deltaY,pReal), real(deltaZ,pReal)] * meshSize connection = neighbor_coords - coords distance = sqrt(sum(connection * connection)) if (distance > cutoffRadius(instance)) cycle - + !* the segment length is the minimum of the third root of the control volume and the ip distance !* this ensures, that the central MP never sits on a neighbor dislocation segment - + connection_neighborLattice = math_mul33x3(neighbor_invFe, connection) segmentLength = min(neighbor_ipVolumeSideLength, distance) - + !* loop through all slip systems of the neighbor material point !* and add up the stress contributions from egde and screw excess on these slip systems (if significant) - + do s = 1_pInt,neighbor_ns if (all(abs(neighbor_rhoExcess(:,:,s)) < significantRho(instance))) cycle ! not significant - - + + !* map the connection vector from the lattice into the slip system frame - + connection_neighborSlip = math_mul33x3(lattice2slip(1:3,1:3,s,neighbor_instance), & connection_neighborLattice) - - + + !* edge contribution to stress sigma = 0.0_pReal - + x = connection_neighborSlip(1) y = connection_neighborSlip(2) z = connection_neighborSlip(3) @@ -3372,7 +3367,7 @@ if (.not. phase_localPlasticity(ph)) then do j = 1_pInt,2_pInt if (abs(neighbor_rhoExcess(1,j,s)) < significantRho(instance)) then - cycle + cycle elseif (j > 1_pInt) then x = connection_neighborSlip(1) & + sign(0.5_pReal * segmentLength, & @@ -3381,16 +3376,16 @@ if (.not. phase_localPlasticity(ph)) then xsquare = x * x endif - + flipSign = sign(1.0_pReal, -y) do side = 1_pInt,-1_pInt,-2_pInt lambda = real(side,pReal) * 0.5_pReal * segmentLength - y R = sqrt(xsquare + zsquare + lambda * lambda) Rsquare = R * R - Rcube = Rsquare * R + Rcube = Rsquare * R denominator = R * (R + flipSign * lambda) - if (abs(denominator)<= tiny(0.0_pReal)) exit ipLoop - + if (dEq0(denominator)) exit ipLoop + sigma(1,1) = sigma(1,1) - real(side,pReal) & * flipSign * z / denominator & * (1.0_pReal + xsquare / Rsquare + xsquare / denominator) & @@ -3411,14 +3406,14 @@ if (.not. phase_localPlasticity(ph)) then sigma(2,3) = sigma(2,3) - real(side,pReal) & * (lattice_nu(ph) / R - zsquare / Rcube) * neighbor_rhoExcess(1,j,s) enddo - enddo - + enddo + !* screw contribution to stress - + x = connection_neighborSlip(1) ! have to restore this value, because position might have been adapted for edge deads before do j = 1_pInt,2_pInt if (abs(neighbor_rhoExcess(2,j,s)) < significantRho(instance)) then - cycle + cycle elseif (j > 1_pInt) then y = connection_neighborSlip(2) & + sign(0.5_pReal * segmentLength, & @@ -3432,10 +3427,10 @@ if (.not. phase_localPlasticity(ph)) then lambda = x + real(side,pReal) * 0.5_pReal * segmentLength R = sqrt(ysquare + zsquare + lambda * lambda) Rsquare = R * R - Rcube = Rsquare * R + Rcube = Rsquare * R denominator = R * (R + flipSign * lambda) - if (abs(denominator)<= tiny(0.0_pReal)) exit ipLoop - + if (dEq0(denominator)) exit ipLoop + sigma(1,2) = sigma(1,2) - real(side,pReal) * flipSign * z & * (1.0_pReal - lattice_nu(ph)) / denominator & * neighbor_rhoExcess(2,j,s) @@ -3444,25 +3439,25 @@ if (.not. phase_localPlasticity(ph)) then * neighbor_rhoExcess(2,j,s) enddo enddo - + if (all(abs(sigma) < 1.0e-10_pReal)) cycle ! SIGMA IS NOT A REAL STRESS, THATS WHY WE NEED A REALLY SMALL VALUE HERE !* copy symmetric parts - + sigma(2,1) = sigma(1,2) sigma(3,1) = sigma(1,3) sigma(3,2) = sigma(2,3) - + !* scale stresses and map them into the neighbor material point's lattice configuration - + sigma = sigma * lattice_mu(neighbor_phase) * burgers(s,neighbor_instance) & / (4.0_pReal * pi * (1.0_pReal - lattice_nu(neighbor_phase))) & * mesh_ipVolume(neighbor_ip,neighbor_el) / segmentLength ! reference volume is used here (according to the segment length calculation) Tdislo_neighborLattice = Tdislo_neighborLattice & + math_mul33x33(math_transpose33(lattice2slip(1:3,1:3,s,neighbor_instance)), & math_mul33x33(sigma, lattice2slip(1:3,1:3,s,neighbor_instance))) - + enddo ! slip system loop @@ -3470,16 +3465,16 @@ if (.not. phase_localPlasticity(ph)) then !* only consider dead dislocations !* we assume that they all sit at a distance equal to half the third root of V !* in direction of the according slip direction - + else - + forall (s = 1_pInt:ns, c = 1_pInt:2_pInt) & - rhoExcessDead(c,s) = plasticState(p)%state(iRhoB(s,2*c-1,instance),o) & ! positive deads (here we use symmetry: if this has negative sign it is - !treated as negative density at positive position instead of positive + rhoExcessDead(c,s) = plasticState(p)%state(iRhoB(s,2*c-1,instance),o) & ! positive deads (here we use symmetry: if this has negative sign it is + !treated as negative density at positive position instead of positive !density at negative position) - + plasticState(p)%state(iRhoB(s,2*c,instance),o) ! negative deads (here we use symmetry: if this has negative sign it is - !treated as positive density at positive position instead of negative + + plasticState(p)%state(iRhoB(s,2*c,instance),o) ! negative deads (here we use symmetry: if this has negative sign it is + !treated as positive density at positive position instead of negative !density at negative position) do s = 1_pInt,ns if (all(abs(rhoExcessDead(:,s)) < significantRho(instance))) cycle ! not significant @@ -3488,11 +3483,11 @@ if (.not. phase_localPlasticity(ph)) then * neighbor_ipVolumeSideLength * lattice_mu(ph) * burgers(s,instance) & / (sqrt(2.0_pReal) * pi * (1.0_pReal - lattice_nu(ph))) sigma(3,1) = sigma(1,3) - + Tdislo_neighborLattice = Tdislo_neighborLattice & + math_mul33x33(math_transpose33(lattice2slip(1:3,1:3,s,instance)), & math_mul33x33(sigma, lattice2slip(1:3,1:3,s,instance))) - + enddo ! slip system loop endif @@ -3502,7 +3497,7 @@ if (.not. phase_localPlasticity(ph)) then enddo ! deltaX loop - !* map the stress from the neighbor MP's lattice configuration into the deformed configuration + !* map the stress from the neighbor MP's lattice configuration into the deformed configuration !* and back into my lattice configuration neighborLattice2myLattice = math_mul33x33(invFe, Fe(1:3,1:3,1,neighbor_ip,neighbor_el)) @@ -3510,19 +3505,21 @@ if (.not. phase_localPlasticity(ph)) then + math_mul33x33(neighborLattice2myLattice, & math_mul33x33(Tdislo_neighborLattice, & math_transpose33(neighborLattice2myLattice))) - + enddo ipLoop enddo ! element loop - + endif end function plastic_nonlocal_dislocationstress - + !-------------------------------------------------------------------------------------------------- !> @brief return array of constitutive results !-------------------------------------------------------------------------------------------------- function plastic_nonlocal_postResults(Tstar_v,Fe,ip,el) + use prec, only: & + dNeq0 use math, only: & math_mul6x6, & math_mul33x3, & @@ -3553,11 +3550,11 @@ function plastic_nonlocal_postResults(Tstar_v,Fe,ip,el) integer(pInt), intent(in) :: & ip, & !< integration point el !< element - + real(pReal), dimension(plastic_nonlocal_sizePostResults(& phase_plasticityInstance(material_phase(1_pInt,ip,el)))) :: & plastic_nonlocal_postResults - + integer(pInt) :: & ph, & instance, & !< current instance of this plasticity @@ -3623,7 +3620,7 @@ tauBack = plasticState(ph)%State(iTauB(1:ns,instance),of) forall (t = 1_pInt:4_pInt) & gdot(1:ns,t) = rhoSgl(1:ns,t) * burgers(1:ns,instance) * v(1:ns,t) - + !* calculate limits for stable dipole height @@ -3639,9 +3636,9 @@ dUpper(1:ns,1) = lattice_mu(ph) * burgers(1:ns,instance) & dUpper(1:ns,2) = lattice_mu(ph) * burgers(1:ns,instance) & / (4.0_pReal * pi * abs(tau)) forall (c = 1_pInt:2_pInt) - where(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+& - abs(rhoSgl(1:ns,2*c+3))+abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)) >= tiny(0.0_pReal)) & - dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + where(dNeq0(sqrt(rhoSgl(1:ns,2*c-1)+rhoSgl(1:ns,2*c)+abs(rhoSgl(1:ns,2*c+3))& + +abs(rhoSgl(1:ns,2*c+4))+rhoDip(1:ns,c)))) & + dUpper(1:ns,c) = min(1.0_pReal / sqrt(rhoSgl(1:ns,2*c-1) + rhoSgl(1:ns,2*c) & + abs(rhoSgl(1:ns,2*c+3)) + abs(rhoSgl(1:ns,2*c+4)) + rhoDip(1:ns,c)), & dUpper(1:ns,c)) end forall @@ -3664,95 +3661,95 @@ outputsLoop: do o = 1_pInt,plastic_nonlocal_Noutput(instance) case (rho_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl),2) + sum(rhoDip,2) cs = cs + ns - + case (rho_sgl_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl),2) cs = cs + ns - + case (rho_sgl_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl(1:ns,1:4)),2) cs = cs + ns - + case (rho_sgl_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoSgl(1:ns,5:8),2) cs = cs + ns - + case (rho_dip_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDip,2) cs = cs + ns - + case (rho_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl(1:ns,[1,2,5,6])),2) + rhoDip(1:ns,1) cs = cs + ns - + case (rho_sgl_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl(1:ns,[1,2,5,6])),2) cs = cs + ns - + case (rho_sgl_edge_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoSgl(1:ns,1:2),2) cs = cs + ns - + case (rho_sgl_edge_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoSgl(1:ns,5:6),2) cs = cs + ns - + case (rho_sgl_edge_pos_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,1) + abs(rhoSgl(1:ns,5)) cs = cs + ns - + case (rho_sgl_edge_pos_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,1) cs = cs + ns - + case (rho_sgl_edge_pos_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,5) cs = cs + ns - + case (rho_sgl_edge_neg_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,2) + abs(rhoSgl(1:ns,6)) cs = cs + ns - + case (rho_sgl_edge_neg_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,2) cs = cs + ns - + case (rho_sgl_edge_neg_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,6) cs = cs + ns - + case (rho_dip_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDip(1:ns,1) cs = cs + ns - + case (rho_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl(1:ns,[3,4,7,8])),2) + rhoDip(1:ns,2) cs = cs + ns - + case (rho_sgl_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(abs(rhoSgl(1:ns,[3,4,7,8])),2) cs = cs + ns - + case (rho_sgl_screw_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoSgl(1:ns,3:4),2) cs = cs + ns - + case (rho_sgl_screw_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoSgl(1:ns,7:8),2) cs = cs + ns - + case (rho_sgl_screw_pos_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,3) + abs(rhoSgl(1:ns,7)) cs = cs + ns - + case (rho_sgl_screw_pos_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,3) cs = cs + ns - + case (rho_sgl_screw_pos_immobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,7) cs = cs + ns - + case (rho_sgl_screw_neg_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,4) + abs(rhoSgl(1:ns,8)) cs = cs + ns @@ -3768,82 +3765,82 @@ outputsLoop: do o = 1_pInt,plastic_nonlocal_Noutput(instance) case (rho_dip_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDip(1:ns,2) cs = cs + ns - + case (excess_rho_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = (rhoSgl(1:ns,1) + abs(rhoSgl(1:ns,5))) & - (rhoSgl(1:ns,2) + abs(rhoSgl(1:ns,6))) & + (rhoSgl(1:ns,3) + abs(rhoSgl(1:ns,7))) & - (rhoSgl(1:ns,4) + abs(rhoSgl(1:ns,8))) cs = cs + ns - + case (excess_rho_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = (rhoSgl(1:ns,1) + abs(rhoSgl(1:ns,5))) & - (rhoSgl(1:ns,2) + abs(rhoSgl(1:ns,6))) cs = cs + ns - + case (excess_rho_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = (rhoSgl(1:ns,3) + abs(rhoSgl(1:ns,7))) & - (rhoSgl(1:ns,4) + abs(rhoSgl(1:ns,8))) cs = cs + ns - + case (rho_forest_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoForest cs = cs + ns - + case (delta_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = 1.0_pReal / sqrt(sum(abs(rhoSgl),2) + sum(rhoDip,2)) cs = cs + ns - + case (delta_sgl_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = 1.0_pReal / sqrt(sum(abs(rhoSgl),2)) cs = cs + ns - + case (delta_dip_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = 1.0_pReal / sqrt(sum(rhoDip,2)) cs = cs + ns - + case (shearrate_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(gdot,2) cs = cs + ns - + case (resolvedstress_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = tau cs = cs + ns - + case (resolvedstress_back_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = tauBack cs = cs + ns - + case (resolvedstress_external_ID) - do s = 1_pInt,ns + do s = 1_pInt,ns sLattice = slipSystemLattice(s,instance) plastic_nonlocal_postResults(cs+s) = math_mul6x6(Tstar_v, lattice_Sslip_v(1:6,1,sLattice,ph)) enddo cs = cs + ns - + case (resistance_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = tauThreshold cs = cs + ns - + case (rho_dot_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotSgl(1:ns,1:4),2) & + sum(rhoDotSgl(1:ns,5:8)*sign(1.0_pReal,rhoSgl(1:ns,5:8)),2) & + sum(rhoDotDip,2) cs = cs + ns - + case (rho_dot_sgl_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotSgl(1:ns,1:4),2) & + sum(rhoDotSgl(1:ns,5:8)*sign(1.0_pReal,rhoSgl(1:ns,5:8)),2) cs = cs + ns - + case (rho_dot_sgl_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotSgl(1:ns,1:4),2) cs = cs + ns - + case (rho_dot_dip_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotDip,2) cs = cs + ns - + case (rho_dot_gen_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotMultiplicationOutput(1:ns,1,1_pInt,ip,el) & + rhoDotMultiplicationOutput(1:ns,2,1_pInt,ip,el) @@ -3856,157 +3853,157 @@ outputsLoop: do o = 1_pInt,plastic_nonlocal_Noutput(instance) case (rho_dot_gen_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotMultiplicationOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - + case (rho_dot_sgl2dip_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotSingle2DipoleGlideOutput(1:ns,1,1_pInt,ip,el) & + rhoDotSingle2DipoleGlideOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - + case (rho_dot_sgl2dip_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotSingle2DipoleGlideOutput(1:ns,1,1_pInt,ip,el) cs = cs + ns - + case (rho_dot_sgl2dip_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotSingle2DipoleGlideOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - + case (rho_dot_ann_ath_ID) - plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotAthermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) & + plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotAthermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) & + rhoDotAthermalAnnihilationOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - - case (rho_dot_ann_the_ID) - plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotThermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) & + + case (rho_dot_ann_the_ID) + plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotThermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) & + rhoDotThermalAnnihilationOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - case (rho_dot_ann_the_edge_ID) - plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotThermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) + case (rho_dot_ann_the_edge_ID) + plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotThermalAnnihilationOutput(1:ns,1,1_pInt,ip,el) cs = cs + ns - case (rho_dot_ann_the_screw_ID) + case (rho_dot_ann_the_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotThermalAnnihilationOutput(1:ns,2,1_pInt,ip,el) cs = cs + ns - case (rho_dot_edgejogs_ID) + case (rho_dot_edgejogs_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoDotEdgeJogsOutput(1:ns,1_pInt,ip,el) cs = cs + ns case (rho_dot_flux_mobile_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotFluxOutput(1:ns,1:4,1_pInt,ip,el),2) cs = cs + ns - + case (rho_dot_flux_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotFluxOutput(1:ns,1:4,1_pInt,ip,el),2) & + sum(rhoDotFluxOutput(1:ns,5:8,1_pInt,ip,el)*sign(1.0_pReal,rhoSgl(1:ns,5:8)),2) cs = cs + ns - + case (rho_dot_flux_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotFluxOutput(1:ns,1:2,1_pInt,ip,el),2) & + sum(rhoDotFluxOutput(1:ns,5:6,1_pInt,ip,el)*sign(1.0_pReal,rhoSgl(1:ns,5:6)),2) cs = cs + ns - + case (rho_dot_flux_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = sum(rhoDotFluxOutput(1:ns,3:4,1_pInt,ip,el),2) & + sum(rhoDotFluxOutput(1:ns,7:8,1_pInt,ip,el)*sign(1.0_pReal,rhoSgl(1:ns,7:8)),2) cs = cs + ns - + case (velocity_edge_pos_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = v(1:ns,1) cs = cs + ns - + case (velocity_edge_neg_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = v(1:ns,2) cs = cs + ns - + case (velocity_screw_pos_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = v(1:ns,3) cs = cs + ns - + case (velocity_screw_neg_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = v(1:ns,4) cs = cs + ns - + case (slipdirectionx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = m_currentconf(1,1:ns,1) cs = cs + ns - + case (slipdirectiony_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = m_currentconf(2,1:ns,1) cs = cs + ns - + case (slipdirectionz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = m_currentconf(3,1:ns,1) cs = cs + ns - + case (slipnormalx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = n_currentconf(1,1:ns) cs = cs + ns - + case (slipnormaly_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = n_currentconf(2,1:ns) cs = cs + ns - + case (slipnormalz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = n_currentconf(3,1:ns) cs = cs + ns - + case (fluxdensity_edge_posx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,1) * v(1:ns,1) * m_currentconf(1,1:ns,1) cs = cs + ns - + case (fluxdensity_edge_posy_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,1) * v(1:ns,1) * m_currentconf(2,1:ns,1) cs = cs + ns - + case (fluxdensity_edge_posz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,1) * v(1:ns,1) * m_currentconf(3,1:ns,1) cs = cs + ns - + case (fluxdensity_edge_negx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,2) * v(1:ns,2) * m_currentconf(1,1:ns,1) cs = cs + ns - + case (fluxdensity_edge_negy_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,2) * v(1:ns,2) * m_currentconf(2,1:ns,1) cs = cs + ns - + case (fluxdensity_edge_negz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,2) * v(1:ns,2) * m_currentconf(3,1:ns,1) cs = cs + ns - + case (fluxdensity_screw_posx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,3) * v(1:ns,3) * m_currentconf(1,1:ns,2) cs = cs + ns - + case (fluxdensity_screw_posy_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,3) * v(1:ns,3) * m_currentconf(2,1:ns,2) cs = cs + ns - + case (fluxdensity_screw_posz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = rhoSgl(1:ns,3) * v(1:ns,3) * m_currentconf(3,1:ns,2) cs = cs + ns - + case (fluxdensity_screw_negx_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,4) * v(1:ns,4) * m_currentconf(1,1:ns,2) cs = cs + ns - + case (fluxdensity_screw_negy_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,4) * v(1:ns,4) * m_currentconf(2,1:ns,2) cs = cs + ns - + case (fluxdensity_screw_negz_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = - rhoSgl(1:ns,4) * v(1:ns,4) * m_currentconf(3,1:ns,2) cs = cs + ns - + case (maximumdipoleheight_edge_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = dUpper(1:ns,1) cs = cs + ns - + case (maximumdipoleheight_screw_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = dUpper(1:ns,2) cs = cs + ns - + case(dislocationstress_ID) sigma = plastic_nonlocal_dislocationstress(Fe, ip, el) plastic_nonlocal_postResults(cs+1_pInt) = sigma(1,1) @@ -4016,11 +4013,11 @@ outputsLoop: do o = 1_pInt,plastic_nonlocal_Noutput(instance) plastic_nonlocal_postResults(cs+5_pInt) = sigma(2,3) plastic_nonlocal_postResults(cs+6_pInt) = sigma(3,1) cs = cs + 6_pInt - + case(accumulatedshear_ID) plastic_nonlocal_postResults(cs+1_pInt:cs+ns) = plasticState(ph)%state(iGamma(1:ns,instance),of) cs = cs + ns - + end select enddo outputsLoop diff --git a/src/plastic_phenoplus.f90 b/src/plastic_phenoplus.f90 index 38561af60..c9b5eead9 100644 --- a/src/plastic_phenoplus.f90 +++ b/src/plastic_phenoplus.f90 @@ -112,6 +112,8 @@ contains !-------------------------------------------------------------------------------------------------- subroutine plastic_phenoplus_init(fileUnit) use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use prec, only: & + dEq0 use debug, only: & debug_level, & debug_constitutive,& @@ -143,8 +145,6 @@ subroutine plastic_phenoplus_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -166,11 +166,10 @@ subroutine plastic_phenoplus_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPLUS_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPLUS_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_PHENOPLUS_ID),pInt) if (maxNinstance == 0_pInt) return @@ -481,8 +480,7 @@ subroutine plastic_phenoplus_init(fileUnit) if (any(plastic_phenoplus_tausat_slip(:,instance) <= 0.0_pReal .and. & plastic_phenoplus_Nslip(:,instance) > 0)) & call IO_error(211_pInt,el=instance,ext_msg='tausat_slip ('//PLASTICITY_PHENOPLUS_label//')') - if (any(abs(plastic_phenoplus_a_slip(instance)) <= tiny(0.0_pReal) .and. & - plastic_phenoplus_Nslip(:,instance) > 0)) & + if (any(dEq0(plastic_phenoplus_a_slip(instance)) .and. plastic_phenoplus_Nslip(:,instance) > 0)) & call IO_error(211_pInt,el=instance,ext_msg='a_slip ('//PLASTICITY_PHENOPLUS_label//')') if (any(plastic_phenoplus_tau0_twin(:,instance) < 0.0_pReal .and. & plastic_phenoplus_Ntwin(:,instance) > 0)) & @@ -557,7 +555,7 @@ subroutine plastic_phenoplus_init(fileUnit) ! allocate state arrays sizeState = plastic_phenoplus_totalNslip(instance) & ! s_slip + plastic_phenoplus_totalNtwin(instance) & ! s_twin - + 2_pInt & ! sum(gamma) + sum(twinVolFrac) + + 2_pInt & ! sum(gamma) + sum(f) + plastic_phenoplus_totalNslip(instance) & ! accshear_slip + plastic_phenoplus_totalNtwin(instance) & ! accshear_twin + plastic_phenoplus_totalNslip(instance) ! kappa @@ -568,7 +566,7 @@ subroutine plastic_phenoplus_init(fileUnit) ! memory leak issue. sizeDotState = plastic_phenoplus_totalNslip(instance) & ! s_slip + plastic_phenoplus_totalNtwin(instance) & ! s_twin - + 2_pInt & ! sum(gamma) + sum(twinVolFrac) + + 2_pInt & ! sum(gamma) + sum(f) + plastic_phenoplus_totalNslip(instance) & ! accshear_slip + plastic_phenoplus_totalNtwin(instance) ! accshear_twin @@ -587,10 +585,6 @@ subroutine plastic_phenoplus_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) @@ -739,256 +733,183 @@ end subroutine plastic_phenoplus_aTolState !-------------------------------------------------------------------------------------------------- !> @brief calculate push-up factors (kappa) for each voxel based on its neighbors !-------------------------------------------------------------------------------------------------- -subroutine plastic_phenoplus_microstructure(orientation,ipc,ip,el,F0,Fe,Fp,Tstar_v) - use math, only: pi, & - math_identity2nd, & - math_mul33x33, & - math_mul33xx33, & - math_mul3x3, & - math_transpose33, & - math_qDot, & - math_qRot, & - indeg +subroutine plastic_phenoplus_microstructure(orientation,ipc,ip,el) + use math, only: pi, & + math_mul33x33, & + math_mul3x3, & + math_transpose33, & + math_qDot, & + math_qRot, & + indeg - use mesh, only: mesh_element, & - FE_NipNeighbors, & - FE_geomtype, & - FE_celltype, & - mesh_maxNips, & - mesh_NcpElems, & - mesh_ipNeighborhood + use mesh, only: mesh_element, & + FE_NipNeighbors, & + FE_geomtype, & + FE_celltype, & + mesh_maxNips, & + mesh_NcpElems, & + mesh_ipNeighborhood - use material, only: material_phase, & - material_texture, & - phase_plasticityInstance, & - phaseAt, phasememberAt, & - homogenization_maxNgrains, & - plasticState + use material, only: material_phase, & + material_texture, & + phase_plasticityInstance, & + phaseAt, phasememberAt, & + homogenization_maxNgrains, & + plasticState - use lattice, only: lattice_Sslip_v, & - lattice_maxNslipFamily, & - lattice_NslipSystem, & - lattice_NslipSystem, & - lattice_sn, & - lattice_sd, & - lattice_qDisorientation + use lattice, only: lattice_sn, & + lattice_sd, & + lattice_qDisorientation - !***input variables - implicit none - integer(pInt), intent(in) :: & - ipc, & !< component-ID of integration point - ip, & !< integration point - el - real(pReal), dimension(3,3,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - F0, & !< deformation gradient from last increment - Fe, & !< elastic deformation gradient - Fp !< elastic deformation gradient !< element - real(pReal), dimension(4,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - orientation !< crystal orientation in quaternions - real(pReal), dimension(6,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & - Tstar_v !< for calculation of gdot + !***input variables + implicit none + integer(pInt), intent(in) :: & + ipc, & !< component-ID of integration point + ip, & !< integration point + el !< element + real(pReal), dimension(4,homogenization_maxNgrains,mesh_maxNips,mesh_NcpElems), intent(in) :: & + orientation ! crystal orientation in quaternions - !***local variables - integer(pInt) instance, & !my instance of this plasticity - ph, & !my phase - of, & !my spatial position in memory (offset) - textureID, & !my texture - index_myFamily, & - Nneighbors, & !number of neighbors (<= 6) - vld_Nneighbors, & !number of my valid neighbors - n, & !neighbor index (for iterating through all neighbors) - n_calcTaylor, & ! - n_phasecheck, & ! - ns, & !number of slip system - nt, & !number of twin system - me_slip, & !my slip system index - neighbor_el, & !element number of neighboring material point - neighbor_ip, & !integration point of neighboring material point - neighbor_ipc, & !I have no idea what is this - neighbor_of, & !spatial position in memory for this neighbor (offset) - neighbor_ph, & !neighbor's phase - neighbor_instance, & !neighbor's instance of this plasticity - neighbor_tex, & !neighbor's texture ID - ne_slip, & !slip system index for neighbor - index_kappa, & !index of pushup factors in plasticState - j, & !quickly loop through slip families - f,i,& !loop counter for me - f_ne, i_ne !loop counter for neighbor + !***local variables + integer(pInt) instance, & !my instance of this plasticity + ph, & !my phase + of, & !my spatial position in memory (offset) + textureID, & !my texture + Nneighbors, & !number of neighbors (<= 6) + vld_Nneighbors, & !number of my valid neighbors + n, & !neighbor index (for iterating through all neighbors) + ns, & !number of slip system + nt, & !number of twin system + me_slip, & !my slip system index + neighbor_el, & !element number of neighboring material point + neighbor_ip, & !integration point of neighboring material point + neighbor_n, & !I have no idea what is this + neighbor_of, & !spatial position in memory for this neighbor (offset) + neighbor_ph, & !neighbor's phase + neighbor_tex, & !neighbor's texture ID + ne_slip_ac, & !loop to find neighbor shear + ne_slip, & !slip system index for neighbor + index_kappa, & !index of pushup factors in plasticState + offset_acshear_slip, & !offset in PlasticState for the accumulative shear + j !quickly loop through slip families - real(pReal) mprime_cut, & !m' cutoff to consider neighboring effect - dtaylor_cut, & !threshold for determine high contrast interface using Taylor factor - tau_slip, & !the average accumulative shear from my neighbor - taylor_me, & !Taylor factor for me - taylor_ne, & !Taylor factor for my current neighbor - d_vonstrain, & !von Mises delta strain (temp container) - sum_gdot !total shear rate for given material point + real(pReal) kappa_max, & ! + tmp_myshear_slip, & !temp storage for accumulative shear for me + mprime_cut, & !m' cutoff to consider neighboring effect + avg_acshear_ne, & !the average accumulative shear from my neighbor + tmp_mprime, & !temp holder for m' value + tmp_acshear !temp holder for accumulative shear for m' - real(pReal), dimension(3,3) :: & - F0_me, & !my deformation gradient from last converged increment - Fe_me, & !my elastic deformation gradient - Fp_me, & !my plastic deformation gradient - dF_me, & !my deformation gradient change (delta) - dE_me, & !my Green Lagrangian strain tensor (delta) - F0_ne, & ! - Fe_ne, & !elastic deformation gradient of my current neighbor - Fp_ne, & !plastic deformation gradient of my current neighbor - dF_ne, & !deformation gradient of my current neighbor - dE_ne !delta Green Lagrangian strain tensor - real(pReal), dimension(plastic_phenoplus_totalNslip(phase_plasticityInstance(material_phase(1,ip,el)))) :: & - m_primes !m' between me_alpha(one) and neighbor beta(all) + real(pReal), dimension(plastic_phenoplus_totalNslip(phase_plasticityInstance(material_phase(1,ip,el)))) :: & + m_primes, & !m' between me_alpha(one) and neighbor beta(all) + me_acshear, & !temp storage for ac_shear of one particular system for me + ne_acshear !temp storage for ac_shear of one particular system for one of my neighbor - real(pReal), dimension(3,plastic_phenoplus_totalNslip(phase_plasticityInstance(material_phase(1,ip,el)))) :: & - slipNormal, & - slipDirect + real(pReal), dimension(3,plastic_phenoplus_totalNslip(phase_plasticityInstance(material_phase(1,ip,el)))) :: & + slipNormal, & + slipDirect - real(pReal), dimension(4) :: & - my_orientation, & !store my orientation - neighbor_orientation, & !store my neighbor orientation - absMisorientation + real(pReal), dimension(4) :: my_orientation, & !store my orientation + neighbor_orientation, & !store my neighbor orientation + absMisorientation - real(pReal), dimension(FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el))))) :: & - ne_mprimes, & !m' between each neighbor - d_taylors !store (taylor_ne-taylor_me) for each neighbor + real(pReal), dimension(FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el))))) :: & + ne_mprimes !m' between each neighbor - !***Get my properties - Nneighbors = FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el)))) - ph = phaseAt(ipc,ip,el) !get my phase - of = phasememberAt(ipc,ip,el) !get my spatial location offset in memory - textureID = material_texture(1,ip,el) !get my texture ID - instance = phase_plasticityInstance(ph) !get my instance based on phase ID - ns = plastic_phenoplus_totalNslip(instance) - nt = plastic_phenoplus_totalNtwin(instance) - index_kappa = ns + nt + 2_pInt + ns + nt !location of kappa in plasticState + !***Get my properties + Nneighbors = FE_NipNeighbors(FE_celltype(FE_geomtype(mesh_element(2,el)))) + ph = phaseAt(ipc,ip,el) !get my phase + of = phasememberAt(ipc,ip,el) !get my spatial location offset in memory + textureID = material_texture(1,ip,el) !get my texture ID + instance = phase_plasticityInstance(ph) !get my instance based on phase ID + ns = plastic_phenoplus_totalNslip(instance) + nt = plastic_phenoplus_totalNtwin(instance) + offset_acshear_slip = ns + nt + 2_pInt + index_kappa = ns + nt + 2_pInt + ns + nt !location of kappa in plasticState + mprime_cut = 0.7_pReal !set by Dr.Bieler - !***init calculation for given voxel - mprime_cut = 0.7_pReal !set by Dr.Bieler - dtaylor_cut = 1.0_pReal !set by Chen, quick test only + !***gather my accumulative shear from palsticState + FINDMYSHEAR: do j = 1_pInt,ns + me_acshear(j) = plasticState(ph)%state(offset_acshear_slip+j, of) + enddo FINDMYSHEAR - !***gather my orientation, F and slip systems - my_orientation = orientation(1:4, ipc, ip, el) - F0_me = F0(1:3, 1:3, ipc, ip, el) - Fe_me = Fe(1:3, 1:3, ipc, ip, el) - Fp_me = Fp(1:3, 1:3, ipc, ip, el) - slipNormal(1:3, 1:ns) = lattice_sn(1:3, 1:ns, ph) - slipDirect(1:3, 1:ns) = lattice_sd(1:3, 1:ns, ph) + !***gather my orientation and slip systems + my_orientation = orientation(1:4, ipc, ip, el) + slipNormal(1:3, 1:ns) = lattice_sn(1:3, 1:ns, ph) + slipDirect(1:3, 1:ns) = lattice_sd(1:3, 1:ns, ph) + kappa_max = plastic_phenoplus_kappa_max(instance) !maximum pushups allowed (READIN) - !***check if all my neighbors have the same phase as me - vld_Nneighbors = 0 - PHASECHECK: DO n_phasecheck = 1_pInt, Nneighbors - !******for each of my neighbor - neighbor_el = mesh_ipNeighborhood( 1, n_phasecheck, ip, el ) - neighbor_ip = mesh_ipNeighborhood( 2, n_phasecheck, ip, el ) - neighbor_ipc = 1 - neighbor_of = phasememberAt( neighbor_ipc, neighbor_ip, neighbor_el ) - neighbor_ph = phaseAt( neighbor_ipc, neighbor_ip, neighbor_el ) - IF (neighbor_ph == ph) THEN - vld_Nneighbors = vld_Nneighbors + 1_pInt - ENDIF - ENDDO PHASECHECK + !***calculate kappa between me and all my neighbors + LOOPMYSLIP: DO me_slip=1_pInt,ns + vld_Nneighbors = Nneighbors + tmp_myshear_slip = me_acshear(me_slip) + tmp_mprime = 0.0_pReal !highest m' from all neighbors + tmp_acshear = 0.0_pReal !accumulative shear from highest m' - !***initialize kappa with 1.0 (assume no push-up) - plasticState(ph)%state(index_kappa+1_pInt:index_kappa+ns, of) = 1.0_pReal + !***go through my neighbors to find highest m' + LOOPNEIGHBORS: DO n=1_pInt,Nneighbors + neighbor_el = mesh_ipNeighborhood(1,n,ip,el) + neighbor_ip = mesh_ipNeighborhood(2,n,ip,el) + neighbor_n = 1 !It is ipc + neighbor_of = phasememberAt( neighbor_n, neighbor_ip, neighbor_el) + neighbor_ph = phaseAt( neighbor_n, neighbor_ip, neighbor_el) + neighbor_tex = material_texture(1,neighbor_ip,neighbor_el) + neighbor_orientation = orientation(1:4, neighbor_n, neighbor_ip, neighbor_el) !ipc is always 1. + absMisorientation = lattice_qDisorientation(my_orientation, & + neighbor_orientation, & + 0_pInt) !no need for explicit calculation of symmetry - !***only calculate kappa for those inside the main phase - IF (vld_Nneighbors == Nneighbors) THEN - !******calculate Taylor factor for me - dF_me = math_mul33x33(Fe_me,Fp_me) - F0_me - dE_me = 0.5*(math_mul33x33(math_transpose33(dF_me), dF_me) - math_identity2nd(3)) !dE = 0.5(dF^tdF-I) - d_vonstrain = SQRT(2.0_pReal/3.0_pReal * math_mul33xx33(dE_me, dE_me)) - sum_gdot = 0.0_pReal - !go through my slip system to find the sum of gamma_dot - j = 0_pInt - slipFamilies: DO f = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f-1_pInt,ph)) !at which index starts my family - slipSystems: DO i = 1_pInt,plastic_phenoplus_Nslip(f,instance) - j = j+1_pInt - tau_slip = dot_product(Tstar_v(1:6, ipc, ip, el),lattice_Sslip_v(1:6,1,index_myFamily+i,ph)) - sum_gdot = sum_gdot + & - plastic_phenoplus_gdot0_slip(instance)* & - ((abs(tau_slip)/(plasticState(ph)%state(j,of))) & - **plastic_phenoplus_n_slip(instance))*sign(1.0_pReal,tau_slip) - ENDDO slipSystems - ENDDO slipFamilies - taylor_me = d_vonstrain/sum_gdot + !***find the accumulative shear for this neighbor + LOOPFINDNEISHEAR: DO ne_slip_ac=1_pInt, ns + ne_acshear(ne_slip_ac) = plasticState(ph)%state(offset_acshear_slip+ne_slip_ac, & + neighbor_of) + ENDDO LOOPFINDNEISHEAR - !***calculate delta_M (Taylor factor) between each neighbor and me - LOOPCALCTAYLOR: DO n_calcTaylor=1_pInt, Nneighbors - !******for each of my neighbor - neighbor_el = mesh_ipNeighborhood( 1, n_calcTaylor, ip, el ) - neighbor_ip = mesh_ipNeighborhood( 2, n_calcTaylor, ip, el ) - neighbor_ipc = 1 !It is ipc - neighbor_of = phasememberAt( neighbor_ipc, neighbor_ip, neighbor_el ) - neighbor_ph = phaseAt( neighbor_ipc, neighbor_ip, neighbor_el ) - neighbor_instance = phase_plasticityInstance( neighbor_ph ) - neighbor_tex = material_texture( 1,neighbor_ip, neighbor_el ) - neighbor_orientation = orientation( 1:4, neighbor_ipc, neighbor_ip, neighbor_el ) !ipc is always 1. - Fe_ne = Fe( 1:3, 1:3, neighbor_ipc, neighbor_ip, neighbor_el ) - Fp_ne = Fp( 1:3, 1:3, neighbor_ipc, neighbor_ip, neighbor_el ) - F0_ne = F0( 1:3, 1:3, neighbor_ipc, neighbor_ip, neighbor_el ) - !******calculate the Taylor factor - dF_ne = math_mul33x33(Fe_ne, Fp_ne) - F0_ne - dE_ne = 0.5*(math_mul33x33(math_transpose33(dF_ne), dF_ne) - math_identity2nd(3)) !dE = 0.5(dF^tdF-I) - d_vonstrain = SQRT(2.0_pReal/3.0_pReal * math_mul33xx33(dE_ne, dE_ne)) - sum_gdot = 0.0_pReal - !go through my neighbor slip system to calculate sum_gdot - j = 0_pInt - slipFamiliesNeighbor: DO f_ne = 1_pInt,lattice_maxNslipFamily - index_myFamily = sum(lattice_NslipSystem(1:f_ne-1_pInt,neighbor_ph)) ! at which index starts my family - slipSystemsNeighbor: DO i_ne = 1_pInt,plastic_phenoplus_Nslip(f_ne,neighbor_instance) - j = j+1_pInt - tau_slip = dot_product(Tstar_v(1:6, neighbor_ipc, neighbor_ip, neighbor_el), & - lattice_Sslip_v(1:6,1,index_myFamily+i_ne,neighbor_ph)) - sum_gdot = sum_gdot & - +plastic_phenoplus_gdot0_slip(neighbor_instance) & - *((abs(tau_slip)/(plasticState(neighbor_ph)%state(j,neighbor_of))) & - **plastic_phenoplus_n_slip(neighbor_instance))*sign(1.0_pReal,tau_slip) - ENDDO slipSystemsNeighbor - ENDDO slipFamiliesNeighbor - taylor_ne = d_vonstrain / sum_gdot - !******calculate Taylor difference - d_taylors(n_calcTaylor) = taylor_ne - taylor_me - ENDDO LOOPCALCTAYLOR + !***calculate the average accumulative shear and use it as cutoff + avg_acshear_ne = sum(ne_acshear)/real(ns,pReal) - !***Only perform necessary calculation if high contrast interface is detected - IF (maxval(d_taylors) > dtaylor_cut) THEN - !*****calculate kappa per slip system base - LOOPMYSLIP: DO me_slip = 1_pInt, ns - ne_mprimes = 0.0_pReal !initialize max m' to 0 for all neighbors - LOOPMYNEIGHBORS: DO n=1_pInt, Nneighbors - !*******only consider neighbor at the high contrast interface - IF (d_taylors(n) > dtaylor_cut) THEN - neighbor_el = mesh_ipNeighborhood( 1, n_calcTaylor, ip, el ) - neighbor_ip = mesh_ipNeighborhood( 2, n_calcTaylor, ip, el ) - neighbor_ipc = 1 !It is ipc - neighbor_of = phasememberAt( neighbor_ipc, neighbor_ip, neighbor_el ) - neighbor_ph = phaseAt( neighbor_ipc, neighbor_ip, neighbor_el ) - neighbor_instance = phase_plasticityInstance( neighbor_ph ) - neighbor_tex = material_texture( 1,neighbor_ip, neighbor_el ) - neighbor_orientation = orientation( 1:4, neighbor_ipc, neighbor_ip, neighbor_el ) !ipc is always 1. - absMisorientation = lattice_qDisorientation( my_orientation, & - neighbor_orientation, & - 0_pInt ) !no need for explicit calculation of symmetry - !*********go through neighbor slip system to calculate m' - LOOPNEIGHBORSLIP: DO ne_slip=1_pInt,ns - m_primes(ne_slip) = abs(math_mul3x3(slipNormal(1:3,me_slip), & - math_qRot(absMisorientation, slipNormal(1:3,ne_slip)))) & - *abs(math_mul3x3(slipDirect(1:3,me_slip), & - math_qRot(absMisorientation, slipDirect(1:3,ne_slip)))) - ENDDO LOOPNEIGHBORSLIP - ne_mprimes(n) = maxval(m_primes) - ENDIF - ENDDO LOOPMYNEIGHBORS + !*** + IF (ph==neighbor_ph) THEN + !***walk through all the + LOOPNEIGHBORSLIP: DO ne_slip=1_pInt,ns + !***only consider slip system that is active (above average accumulative shear) + IF (ne_acshear(ne_slip) > avg_acshear_ne) THEN + m_primes(ne_slip) = abs(math_mul3x3(slipNormal(1:3,me_slip), & + math_qRot(absMisorientation, slipNormal(1:3,ne_slip)))) & + *abs(math_mul3x3(slipDirect(1:3,me_slip), & + math_qRot(absMisorientation, slipDirect(1:3,ne_slip)))) + !***find the highest m' and corresponding accumulative shear + IF (m_primes(ne_slip) > tmp_mprime) THEN + tmp_mprime = m_primes(ne_slip) + tmp_acshear = ne_acshear(ne_slip) + ENDIF + ENDIF + ENDDO LOOPNEIGHBORSLIP - plasticState(ph)%state(index_kappa+me_slip, of) = & - 1.03_pReal + 0.03_pReal*ERF(4.0_pReal * maxval(ne_mprimes) - 4.0_pReal) + ELSE + ne_mprimes(n) = 0.0_pReal + vld_Nneighbors = vld_Nneighbors - 1_pInt + ENDIF - ENDDO LOOPMYSLIP - - ENDIF + ENDDO LOOPNEIGHBORS + !***check if this element close to rim + IF (vld_Nneighbors < Nneighbors) THEN + !***rim voxel, no modification allowed + plasticState(ph)%state(index_kappa+me_slip, of) = 1.0_pReal + ELSE + !***patch voxel, started to calculate push up factor for gamma_dot + IF ((tmp_mprime > mprime_cut) .AND. (tmp_acshear > tmp_myshear_slip)) THEN + plasticState(ph)%state(index_kappa+me_slip, of) = 1.0_pReal / tmp_mprime + ELSE + !***minimum damping factor is 0.5 + plasticState(ph)%state(index_kappa+me_slip, of) = 0.5_pReal + tmp_mprime * 0.5_pReal + ENDIF ENDIF + ENDDO LOOPMYSLIP + end subroutine plastic_phenoplus_microstructure @@ -996,6 +917,8 @@ end subroutine plastic_phenoplus_microstructure !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- subroutine plastic_phenoplus_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) + use prec, only: & + dNeq0 use math, only: & math_Plain3333to99, & math_Mandel6to33 @@ -1111,7 +1034,7 @@ subroutine plastic_phenoplus_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) (gdot_slip_pos+gdot_slip_neg)*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) ! Calculation of the tangent of Lp - if (abs(gdot_slip_pos) > tiny(0.0_pReal)) then + if (dNeq0(gdot_slip_pos)) then dgdot_dtauslip_pos = gdot_slip_pos*plastic_phenoplus_n_slip(instance)/tau_slip_pos forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & @@ -1119,7 +1042,7 @@ subroutine plastic_phenoplus_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) nonSchmid_tensor(m,n,1) endif - if (abs(gdot_slip_neg) > tiny(0.0_pReal)) then + if (dNeq0(gdot_slip_neg)) then dgdot_dtauslip_neg = gdot_slip_neg*plastic_phenoplus_n_slip(instance)/tau_slip_neg forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & @@ -1146,7 +1069,7 @@ subroutine plastic_phenoplus_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) Lp = Lp + gdot_twin*lattice_Stwin(1:3,1:3,index_myFamily+i,ph) ! Calculation of the tangent of Lp - if (abs(gdot_twin) > tiny(0.0_pReal)) then + if (dNeq0(gdot_twin)) then dgdot_dtautwin = gdot_twin*plastic_phenoplus_n_twin(instance)/tau_twin forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & diff --git a/src/plastic_phenopowerlaw.f90 b/src/plastic_phenopowerlaw.f90 index 8bc86c97d..a7c7b10e6 100644 --- a/src/plastic_phenopowerlaw.f90 +++ b/src/plastic_phenopowerlaw.f90 @@ -124,6 +124,8 @@ contains !-------------------------------------------------------------------------------------------------- subroutine plastic_phenopowerlaw_init(fileUnit) use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use prec, only: & + dEq0 use debug, only: & debug_level, & debug_constitutive,& @@ -155,8 +157,6 @@ subroutine plastic_phenopowerlaw_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -179,11 +179,9 @@ subroutine plastic_phenopowerlaw_init(fileUnit) line = '' real(pReal), dimension(:), allocatable :: tempPerSlip - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_PHENOPOWERLAW_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_PHENOPOWERLAW_ID),pInt) if (maxNinstance == 0_pInt) return @@ -487,8 +485,7 @@ subroutine plastic_phenopowerlaw_init(fileUnit) if (any(plastic_phenopowerlaw_tausat_slip(:,instance) <= 0.0_pReal .and. & plastic_phenopowerlaw_Nslip(:,instance) > 0)) & call IO_error(211_pInt,el=instance,ext_msg='tausat_slip ('//PLASTICITY_PHENOPOWERLAW_label//')') - if (any(abs(plastic_phenopowerlaw_a_slip(instance)) <= tiny(0.0_pReal) .and. & - plastic_phenopowerlaw_Nslip(:,instance) > 0)) & + if (any(dEq0(plastic_phenopowerlaw_a_slip(instance)) .and. plastic_phenopowerlaw_Nslip(:,instance) > 0)) & call IO_error(211_pInt,el=instance,ext_msg='a_slip ('//PLASTICITY_PHENOPOWERLAW_label//')') if (any(plastic_phenopowerlaw_tau0_twin(:,instance) < 0.0_pReal .and. & plastic_phenopowerlaw_Ntwin(:,instance) > 0)) & @@ -585,10 +582,6 @@ subroutine plastic_phenopowerlaw_init(fileUnit) allocate(plasticState(phase)%state ( sizeState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%dotState (sizeDotState,NipcMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NipcMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup ( sizeState,NipcMyPhase),source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NipcMyPhase),source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NipcMyPhase),source=0.0_pReal) allocate(plasticState(phase)%previousDotState2(sizeDotState,NipcMyPhase),source=0.0_pReal) @@ -774,6 +767,8 @@ end subroutine plastic_phenopowerlaw_aTolState !> @brief calculates plastic velocity gradient and its tangent !-------------------------------------------------------------------------------------------------- subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip,el) + use prec, only: & + dNeq0 use math, only: & math_Plain3333to99, & math_Mandel6to33 @@ -863,7 +858,7 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip, (gdot_slip_pos+gdot_slip_neg)*lattice_Sslip(1:3,1:3,1,index_myFamily+i,ph) ! Calculation of the tangent of Lp - if (abs(gdot_slip_pos) > tiny(0.0_pReal)) then + if (dNeq0(gdot_slip_pos)) then dgdot_dtauslip_pos = gdot_slip_pos*plastic_phenopowerlaw_n_slip(instance)/tau_slip_pos forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & @@ -871,7 +866,7 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip, nonSchmid_tensor(m,n,1) endif - if (abs(gdot_slip_neg) > tiny(0.0_pReal)) then + if (dNeq0(gdot_slip_neg)) then dgdot_dtauslip_neg = gdot_slip_neg*plastic_phenopowerlaw_n_slip(instance)/tau_slip_neg forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & @@ -898,7 +893,7 @@ subroutine plastic_phenopowerlaw_LpAndItsTangent(Lp,dLp_dTstar99,Tstar_v,ipc,ip, Lp = Lp + gdot_twin*lattice_Stwin(1:3,1:3,index_myFamily+i,ph) ! Calculation of the tangent of Lp - if (abs(gdot_twin) > tiny(0.0_pReal)) then + if (dNeq0(gdot_twin)) then dgdot_dtautwin = gdot_twin*plastic_phenopowerlaw_n_twin(instance)/tau_twin forall (k=1_pInt:3_pInt,l=1_pInt:3_pInt,m=1_pInt:3_pInt,n=1_pInt:3_pInt) & dLp_dTstar3333(k,l,m,n) = dLp_dTstar3333(k,l,m,n) + & @@ -1009,8 +1004,9 @@ subroutine plastic_phenopowerlaw_dotState(Tstar_v,ipc,ip,el) enddo nonSchmidSystems gdot_slip(j) = plastic_phenopowerlaw_gdot0_slip(instance)*0.5_pReal* & ((abs(tau_slip_pos)/(plasticState(ph)%state(j,of)))**plastic_phenopowerlaw_n_slip(instance) & - +(abs(tau_slip_neg)/(plasticState(ph)%state(j,of)))**plastic_phenopowerlaw_n_slip(instance))& - *sign(1.0_pReal,tau_slip_pos) + *sign(1.0_pReal,tau_slip_pos) & + +(abs(tau_slip_neg)/(plasticState(ph)%state(j,of)))**plastic_phenopowerlaw_n_slip(instance) & + *sign(1.0_pReal,tau_slip_neg)) enddo slipSystems1 enddo slipFamilies1 @@ -1155,9 +1151,9 @@ function plastic_phenopowerlaw_postResults(Tstar_v,ipc,ip,el) enddo plastic_phenopowerlaw_postResults(c+j) = plastic_phenopowerlaw_gdot0_slip(instance)*0.5_pReal* & ((abs(tau_slip_pos)/plasticState(ph)%state(j,of))**plastic_phenopowerlaw_n_slip(instance) & - +(abs(tau_slip_neg)/plasticState(ph)%state(j,of))**plastic_phenopowerlaw_n_slip(instance))& - *sign(1.0_pReal,tau_slip_pos) - + *sign(1.0_pReal,tau_slip_pos) & + +(abs(tau_slip_neg)/(plasticState(ph)%state(j,of)))**plastic_phenopowerlaw_n_slip(instance) & + *sign(1.0_pReal,tau_slip_neg)) enddo slipSystems1 enddo slipFamilies1 c = c + nSlip diff --git a/src/plastic_titanmod.f90 b/src/plastic_titanmod.f90 index 24bf543b7..ac80af82b 100644 --- a/src/plastic_titanmod.f90 +++ b/src/plastic_titanmod.f90 @@ -216,8 +216,6 @@ subroutine plastic_titanmod_init(fileUnit) MATERIAL_partPhase use lattice use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -241,11 +239,9 @@ subroutine plastic_titanmod_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_TITANMOD_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- constitutive_'//PLASTICITY_TITANMOD_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_plasticity == PLASTICITY_TITANMOD_ID),pInt) if (maxNinstance == 0_pInt) return @@ -859,10 +855,6 @@ subroutine plastic_titanmod_init(fileUnit) allocate(plasticState(phase)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(plasticState(phase)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(plasticState(phase)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(plasticState(phase)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(plasticState(phase)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/porosity_none.f90 b/src/porosity_none.f90 index 92d4d9fe5..1e6ea9dc9 100644 --- a/src/porosity_none.f90 +++ b/src/porosity_none.f90 @@ -23,21 +23,17 @@ subroutine porosity_none_init() use IO, only: & IO_timeStamp use material - use numerics, only: & - worldrank implicit none integer(pInt) :: & homog, & NofMyHomog - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_none_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- porosity_'//POROSITY_none_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - initializeInstances: do homog = 1_pInt, material_Nhomogenization + initializeInstances: do homog = 1_pInt, material_Nhomogenization myhomog: if (porosity_type(homog) == POROSITY_none_ID) then NofMyHomog = count(material_homog == homog) diff --git a/src/porosity_phasefield.f90 b/src/porosity_phasefield.f90 index ec7e4c341..b41ae2756 100644 --- a/src/porosity_phasefield.f90 +++ b/src/porosity_phasefield.f90 @@ -210,8 +210,7 @@ function porosity_phasefield_getFormationEnergy(ip,el) enddo porosity_phasefield_getFormationEnergy = & - porosity_phasefield_getFormationEnergy/ & - homogenization_Ngrains(mesh_element(3,el)) + porosity_phasefield_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function porosity_phasefield_getFormationEnergy @@ -243,8 +242,7 @@ function porosity_phasefield_getSurfaceEnergy(ip,el) enddo porosity_phasefield_getSurfaceEnergy = & - porosity_phasefield_getSurfaceEnergy/ & - homogenization_Ngrains(mesh_element(3,el)) + porosity_phasefield_getSurfaceEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function porosity_phasefield_getSurfaceEnergy @@ -308,7 +306,7 @@ subroutine porosity_phasefield_getSourceAndItsTangent(phiDot, dPhiDot_dPhi, phi, enddo W_e = W_e + sum(abs(strain*math_mul66x6(C,strain))) enddo - W_e = W_e/homogenization_Ngrains(homog) + W_e = W_e/real(homogenization_Ngrains(homog),pReal) phiDot = 2.0_pReal*(1.0_pReal - phi)*(1.0_pReal - Cv)*(1.0_pReal - Cv) - & 2.0_pReal*phi*(W_e + Cv*porosity_phasefield_getFormationEnergy(ip,el))/ & @@ -350,8 +348,7 @@ function porosity_phasefield_getDiffusion33(ip,el) enddo porosity_phasefield_getDiffusion33 = & - porosity_phasefield_getDiffusion33/ & - homogenization_Ngrains(homog) + porosity_phasefield_getDiffusion33/real(homogenization_Ngrains(homog),pReal) end function porosity_phasefield_getDiffusion33 @@ -377,10 +374,12 @@ real(pReal) function porosity_phasefield_getMobility(ip,el) porosity_phasefield_getMobility = 0.0_pReal do ipc = 1, homogenization_Ngrains(mesh_element(3,el)) - porosity_phasefield_getMobility = porosity_phasefield_getMobility + lattice_PorosityMobility(material_phase(ipc,ip,el)) + porosity_phasefield_getMobility = porosity_phasefield_getMobility & + + lattice_PorosityMobility(material_phase(ipc,ip,el)) enddo - porosity_phasefield_getMobility = porosity_phasefield_getMobility/homogenization_Ngrains(mesh_element(3,el)) + porosity_phasefield_getMobility = & + porosity_phasefield_getMobility/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function porosity_phasefield_getMobility diff --git a/src/prec.f90 b/src/prec.f90 index e099c8964..c6ae656b8 100644 --- a/src/prec.f90 +++ b/src/prec.f90 @@ -20,12 +20,7 @@ module prec private #if (FLOAT==8) integer, parameter, public :: pReal = 8 !< floating point double precision (was selected_real_kind(15,300), number with 15 significant digits, up to 1e+-300) -#ifdef __INTEL_COMPILER - real(pReal), parameter, public :: DAMASK_NaN = Z'7FF8000000000000' !< quiet NaN for double precision (from http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_035.html, copy can be found in documentation/Code/Fortran) -#endif -#ifdef __GFORTRAN__ - real(pReal), parameter, public :: DAMASK_NaN = real(Z'7FF8000000000000',pReal) !< quiet NaN for double precision (from http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_035.html, copy can be found in documentation/Code/Fortran) -#endif + real(pReal), parameter, public :: DAMASK_NaN = real(Z'7FF8000000000000',pReal) !< quiet NaN for double precision (from http://www.hpc.unimelb.edu.au/doc/f90lrm/dfum_035.html) #else NO SUITABLE PRECISION FOR REAL SELECTED, STOPPING COMPILATION #endif @@ -67,11 +62,9 @@ module prec real(pReal), allocatable, dimension(:,:) :: & partionedState0, & subState0, & - state_backup, & deltaState, & previousDotState, & !< state rate of previous xxxx previousDotState2, & !< state rate two xxxx ago - dotState_backup, & !< backup of state rate RK4dotState real(pReal), allocatable, dimension(:,:,:) :: & RKCK45dotState @@ -83,7 +76,7 @@ module prec nTwin = 0_pInt, & nTrans = 0_pInt logical :: & - nonlocal = .false. !< absolute tolerance for state integration + nonlocal = .false. real(pReal), pointer, dimension(:,:), contiguous :: & slipRate, & !< slip rate accumulatedSlip !< accumulated plastic slip @@ -115,7 +108,11 @@ module prec prec_init, & prec_isNaN, & dEq, & - dNeq + dEq0, & + cEq, & + dNeq, & + dNeq0, & + cNeq contains @@ -128,30 +125,17 @@ subroutine prec_init iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) implicit none - integer(pInt) :: worldrank = 0_pInt -#ifdef PETSc -#include - PetscErrorCode :: ierr -#endif external :: & - quit, & - MPI_Comm_rank, & - MPI_Abort - -#ifdef PETSc - call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr) -#endif + quit - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- prec init -+>>>' + write(6,'(/,a)') ' <<<+- prec init -+>>>' #include "compilation_info.f90" - write(6,'(a,i3)') ' Bytes for pReal: ',pReal - write(6,'(a,i3)') ' Bytes for pInt: ',pInt - write(6,'(a,i3)') ' Bytes for pLongInt: ',pLongInt - write(6,'(a,e10.3)') ' NaN: ', DAMASK_NaN - write(6,'(a,l3)') ' NaN != NaN: ',DAMASK_NaN /= DAMASK_NaN - write(6,'(a,l3,/)') ' NaN check passed ',prec_isNAN(DAMASK_NaN) - endif mainProcess + write(6,'(a,i3)') ' Bytes for pReal: ',pReal + write(6,'(a,i3)') ' Bytes for pInt: ',pInt + write(6,'(a,i3)') ' Bytes for pLongInt: ',pLongInt + write(6,'(a,e10.3)') ' NaN: ', DAMASK_NaN + write(6,'(a,l3)') ' NaN != NaN: ',DAMASK_NaN /= DAMASK_NaN + write(6,'(a,l3,/)') ' NaN check passed ',prec_isNAN(DAMASK_NaN) if ((.not. prec_isNaN(DAMASK_NaN)) .or. (DAMASK_NaN == DAMASK_NaN)) call quit(9000) realloc_lhs_test = [1_pInt,2_pInt] @@ -180,28 +164,102 @@ end function prec_isNaN !-------------------------------------------------------------------------------------------------- -!> @brief equality comparison for double precision +!> @brief equality comparison for float with double precision ! replaces "==" but for certain (relative) tolerance. Counterpart to dNeq -! http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ !-------------------------------------------------------------------------------------------------- logical elemental pure function dEq(a,b,tol) - real(pReal), intent(in) :: a,b - real(pReal), intent(in), optional :: tol - real(pReal), parameter :: eps = 2.2204460492503131E-16 ! DBL_EPSILON in C - dEq = merge(.True., .False.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) + + implicit none + real(pReal), intent(in) :: a,b + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dEq = merge(.True., .False.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) end function dEq !-------------------------------------------------------------------------------------------------- -!> @brief inequality comparison for double precision +!> @brief inequality comparison for float with double precision ! replaces "!=" but for certain (relative) tolerance. Counterpart to dEq -! http://www.cygnus-software.com/papers/comparingfloats/comparingfloats.htm +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ !-------------------------------------------------------------------------------------------------- logical elemental pure function dNeq(a,b,tol) - real(pReal), intent(in) :: a,b - real(pReal), intent(in), optional :: tol - real(pReal), parameter :: eps = 2.2204460492503131E-16 ! DBL_EPSILON in C - dNeq = merge(.False., .True.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) + + implicit none + real(pReal), intent(in) :: a,b + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dNeq = merge(.False., .True.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) end function dNeq + +!-------------------------------------------------------------------------------------------------- +!> @brief equality to 0 comparison for float with double precision +! replaces "==0" but for certain (absolute) tolerance. Counterpart to dNeq0 +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ +!-------------------------------------------------------------------------------------------------- +logical elemental pure function dEq0(a,tol) + + implicit none + real(pReal), intent(in) :: a + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dEq0 = merge(.True., .False.,abs(a) <= merge(tol,eps,present(tol))*10.0_pReal) +end function dEq0 + + +!-------------------------------------------------------------------------------------------------- +!> @brief inequality to 0 comparison for float with double precision +! replaces "!=0" but for certain (absolute) tolerance. Counterpart to dEq0 +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ +!-------------------------------------------------------------------------------------------------- +logical elemental pure function dNeq0(a,tol) + + implicit none + real(pReal), intent(in) :: a + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + dNeq0 = merge(.False., .True.,abs(a) <= merge(tol,eps,present(tol))*10.0_pReal) +end function dNeq0 + + +!-------------------------------------------------------------------------------------------------- +!> @brief equality comparison for complex with double precision +! replaces "==" but for certain (relative) tolerance. Counterpart to cNeq +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ +! probably a component wise comparison would be more accurate than the comparsion of the absolute +! value +!-------------------------------------------------------------------------------------------------- +logical elemental pure function cEq(a,b,tol) + + implicit none + complex(pReal), intent(in) :: a,b + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + cEq = merge(.True., .False.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) +end function cEq + + +!-------------------------------------------------------------------------------------------------- +!> @brief inequality comparison for complex with double precision +! replaces "!=" but for certain (relative) tolerance. Counterpart to cEq +! https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/ +! probably a component wise comparison would be more accurate than the comparsion of the absolute +! value +!-------------------------------------------------------------------------------------------------- +logical elemental pure function cNeq(a,b,tol) + + implicit none + complex(pReal), intent(in) :: a,b + real(pReal), intent(in), optional :: tol + real(pReal), parameter :: eps = 2.220446049250313E-16 ! DBL_EPSILON in C + + cNeq = merge(.False., .True.,abs(a-b) <= merge(tol,eps,present(tol))*maxval(abs([a,b]))) +end function cNeq + end module prec diff --git a/src/source_damage_anisoBrittle.f90 b/src/source_damage_anisoBrittle.f90 index efd76091e..53cc411af 100644 --- a/src/source_damage_anisoBrittle.f90 +++ b/src/source_damage_anisoBrittle.f90 @@ -92,8 +92,6 @@ subroutine source_damage_anisoBrittle_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator use lattice, only: & lattice_maxNcleavageFamily, & @@ -111,11 +109,9 @@ subroutine source_damage_anisoBrittle_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoBrittle_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoBrittle_LABEL//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_anisoBrittle_ID),pInt) if (maxNinstance == 0_pInt) return @@ -268,10 +264,6 @@ subroutine source_damage_anisoBrittle_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_damage_anisoDuctile.f90 b/src/source_damage_anisoDuctile.f90 index 72480382a..1a79e3b34 100644 --- a/src/source_damage_anisoDuctile.f90 +++ b/src/source_damage_anisoDuctile.f90 @@ -96,8 +96,6 @@ subroutine source_damage_anisoDuctile_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator use lattice, only: & lattice_maxNslipFamily, & @@ -115,11 +113,9 @@ subroutine source_damage_anisoDuctile_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoDuctile_LABEL//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_anisoDuctile_LABEL//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_anisoDuctile_ID),pInt) if (maxNinstance == 0_pInt) return @@ -270,10 +266,6 @@ subroutine source_damage_anisoDuctile_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_damage_isoBrittle.f90 b/src/source_damage_isoBrittle.f90 index 1603ecf48..18194618e 100644 --- a/src/source_damage_isoBrittle.f90 +++ b/src/source_damage_isoBrittle.f90 @@ -82,8 +82,6 @@ subroutine source_damage_isoBrittle_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -97,11 +95,9 @@ subroutine source_damage_isoBrittle_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoBrittle_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoBrittle_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_isoBrittle_ID),pInt) if (maxNinstance == 0_pInt) return @@ -222,10 +218,6 @@ subroutine source_damage_isoBrittle_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_damage_isoDuctile.f90 b/src/source_damage_isoDuctile.f90 index 3a85bab24..f30f9a72e 100644 --- a/src/source_damage_isoDuctile.f90 +++ b/src/source_damage_isoDuctile.f90 @@ -82,8 +82,6 @@ subroutine source_damage_isoDuctile_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -97,11 +95,9 @@ subroutine source_damage_isoDuctile_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoDuctile_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_damage_isoDuctile_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_damage_isoDuctile_ID),pInt) if (maxNinstance == 0_pInt) return @@ -222,10 +218,6 @@ subroutine source_damage_isoDuctile_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_thermal_dissipation.f90 b/src/source_thermal_dissipation.f90 index dd6453db0..d649549ad 100644 --- a/src/source_thermal_dissipation.f90 +++ b/src/source_thermal_dissipation.f90 @@ -68,8 +68,6 @@ subroutine source_thermal_dissipation_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -83,11 +81,9 @@ subroutine source_thermal_dissipation_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_dissipation_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_dissipation_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_thermal_dissipation_ID),pInt) if (maxNinstance == 0_pInt) return @@ -163,10 +159,6 @@ subroutine source_thermal_dissipation_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_thermal_externalheat.f90 b/src/source_thermal_externalheat.f90 index 203826205..60aaebe42 100644 --- a/src/source_thermal_externalheat.f90 +++ b/src/source_thermal_externalheat.f90 @@ -1,6 +1,7 @@ !-------------------------------------------------------------------------------------------------- !> @author Pratheek Shanthraj, Max-Planck-Institut für Eisenforschung GmbH -!> @brief material subroutine for thermal source due to plastic dissipation +!> @author Philip Eisenlohr, Michigan State University +!> @brief material subroutine for variable heat source !> @details to be done !-------------------------------------------------------------------------------------------------- module source_thermal_externalheat @@ -10,24 +11,24 @@ module source_thermal_externalheat implicit none private - integer(pInt), dimension(:), allocatable, public, protected :: & + integer(pInt), dimension(:), allocatable, public, protected :: & source_thermal_externalheat_sizePostResults, & !< cumulative size of post results source_thermal_externalheat_offset, & !< which source is my current thermal dissipation mechanism? source_thermal_externalheat_instance !< instance of thermal dissipation source mechanism - integer(pInt), dimension(:,:), allocatable, target, public :: & + integer(pInt), dimension(:,:), allocatable, target, public :: & source_thermal_externalheat_sizePostResult !< size of each post result output - character(len=64), dimension(:,:), allocatable, target, public :: & + character(len=64), dimension(:,:), allocatable, target, public :: & source_thermal_externalheat_output !< name of each post result output - integer(pInt), dimension(:), allocatable, target, public :: & + integer(pInt), dimension(:), allocatable, target, public :: & source_thermal_externalheat_Noutput !< number of outputs per instance of this source - integer(pInt), dimension(:), allocatable, private :: & + integer(pInt), dimension(:), allocatable, private :: & source_thermal_externalheat_nIntervals - real(pReal), dimension(:,:), allocatable, private :: & + real(pReal), dimension(:,:), allocatable, private :: & source_thermal_externalheat_time, & source_thermal_externalheat_rate @@ -73,8 +74,6 @@ subroutine source_thermal_externalheat_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -89,11 +88,9 @@ subroutine source_thermal_externalheat_init(fileUnit) line = '' real(pReal), allocatable, dimension(:,:) :: temp_time, temp_rate - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_thermal_externalheat_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_thermal_externalheat_ID),pInt) if (maxNinstance == 0_pInt) return @@ -140,23 +137,26 @@ subroutine source_thermal_externalheat_init(fileUnit) if (phase > 0_pInt ) then; if (any(phase_source(:,phase) == SOURCE_thermal_externalheat_ID)) then ! do not short-circuit here (.and. with next if statemen). It's not safe in Fortran - instance = source_thermal_externalheat_instance(phase) ! which instance of my source is present phase + instance = source_thermal_externalheat_instance(phase) ! which instance of my source is present phase chunkPos = IO_stringPos(line) - tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key + tag = IO_lc(IO_stringValue(line,chunkPos,1_pInt)) ! extract key select case(tag) - case ('externalheat_time') + case ('externalheat_time','externalheat_rate') if (chunkPos(1) <= 2_pInt) & call IO_error(150_pInt,ext_msg=trim(tag)//' ('//SOURCE_thermal_externalheat_label//')') + if ( source_thermal_externalheat_nIntervals(instance) > 0_pInt & + .and. source_thermal_externalheat_nIntervals(instance) /= chunkPos(1) - 2_pInt) & + call IO_error(150_pInt,ext_msg=trim(tag)//' ('//SOURCE_thermal_externalheat_label//')') + source_thermal_externalheat_nIntervals(instance) = chunkPos(1) - 2_pInt do interval = 1, source_thermal_externalheat_nIntervals(instance) + 1_pInt - temp_time(instance, interval) = IO_floatValue(line,chunkPos,1_pInt + interval) + select case(tag) + case ('externalheat_time') + temp_time(instance, interval) = IO_floatValue(line,chunkPos,1_pInt + interval) + case ('externalheat_rate') + temp_rate(instance, interval) = IO_floatValue(line,chunkPos,1_pInt + interval) + end select enddo - - case ('externalheat_rate') - do interval = 1, source_thermal_externalheat_nIntervals(instance) + 1_pInt - temp_rate(instance, interval) = IO_floatValue(line,chunkPos,1_pInt + interval) - enddo - end select endif; endif enddo parsingFile @@ -166,13 +166,13 @@ subroutine source_thermal_externalheat_init(fileUnit) initializeInstances: do phase = 1_pInt, material_Nphase if (any(phase_source(:,phase) == SOURCE_thermal_externalheat_ID)) then - NofMyPhase=count(material_phase==phase) + NofMyPhase = count(material_phase==phase) instance = source_thermal_externalheat_instance(phase) sourceOffset = source_thermal_externalheat_offset(phase) source_thermal_externalheat_time(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) = & - temp_time(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) + temp_time(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) source_thermal_externalheat_rate(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) = & - temp_rate(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) + temp_rate(instance,1:source_thermal_externalheat_nIntervals(instance)+1_pInt) sizeDotState = 1_pInt sizeDeltaState = 0_pInt @@ -189,10 +189,6 @@ subroutine source_thermal_externalheat_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) @@ -208,7 +204,8 @@ subroutine source_thermal_externalheat_init(fileUnit) end subroutine source_thermal_externalheat_init !-------------------------------------------------------------------------------------------------- -!> @brief calculates derived quantities from state +!> @brief rate of change of state +!> @details state only contains current time to linearly interpolate given heat powers !-------------------------------------------------------------------------------------------------- subroutine source_thermal_externalheat_dotState(ipc, ip, el) use material, only: & @@ -229,12 +226,12 @@ subroutine source_thermal_externalheat_dotState(ipc, ip, el) constituent = phasememberAt(ipc,ip,el) sourceOffset = source_thermal_externalheat_offset(phase) - sourceState(phase)%p(sourceOffset)%dotState(1,constituent) = 1.0_pReal + sourceState(phase)%p(sourceOffset)%dotState(1,constituent) = 1.0_pReal ! state is current time end subroutine source_thermal_externalheat_dotState !-------------------------------------------------------------------------------------------------- -!> @brief returns local vacancy generation rate +!> @brief returns local heat generation rate !-------------------------------------------------------------------------------------------------- subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, ipc, ip, el) use material, only: & @@ -252,21 +249,24 @@ subroutine source_thermal_externalheat_getRateAndItsTangent(TDot, dTDot_dT, ipc, integer(pInt) :: & instance, phase, constituent, sourceOffset, interval real(pReal) :: & - norm_time + frac_time phase = phaseAt(ipc,ip,el) constituent = phasememberAt(ipc,ip,el) instance = source_thermal_externalheat_instance(phase) sourceOffset = source_thermal_externalheat_offset(phase) - do interval = 1, source_thermal_externalheat_nIntervals(instance) - norm_time = (sourceState(phase)%p(sourceOffset)%state(1,constituent) - & + do interval = 1, source_thermal_externalheat_nIntervals(instance) ! scan through all rate segments + frac_time = (sourceState(phase)%p(sourceOffset)%state(1,constituent) - & source_thermal_externalheat_time(instance,interval)) / & (source_thermal_externalheat_time(instance,interval+1) - & - source_thermal_externalheat_time(instance,interval)) - if (norm_time >= 0.0_pReal .and. norm_time < 1.0_pReal) & - TDot = source_thermal_externalheat_rate(instance,interval ) * (1.0_pReal - norm_time) + & - source_thermal_externalheat_rate(instance,interval+1) * norm_time + source_thermal_externalheat_time(instance,interval)) ! fractional time within segment + if ( (frac_time < 0.0_pReal .and. interval == 1) & + .or. (frac_time >= 1.0_pReal .and. interval == source_thermal_externalheat_nIntervals(instance)) & + .or. (frac_time >= 0.0_pReal .and. frac_time < 1.0_pReal) ) & + TDot = source_thermal_externalheat_rate(instance,interval ) * (1.0_pReal - frac_time) + & + source_thermal_externalheat_rate(instance,interval+1) * frac_time ! interpolate heat rate between segment boundaries... + ! ...or extrapolate if outside of bounds enddo dTDot_dT = 0.0 diff --git a/src/source_vacancy_irradiation.f90 b/src/source_vacancy_irradiation.f90 index fd7220020..986c229ff 100644 --- a/src/source_vacancy_irradiation.f90 +++ b/src/source_vacancy_irradiation.f90 @@ -70,8 +70,6 @@ subroutine source_vacancy_irradiation_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -85,11 +83,9 @@ subroutine source_vacancy_irradiation_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_irradiation_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_irradiation_ID),pInt) if (maxNinstance == 0_pInt) return @@ -169,10 +165,6 @@ subroutine source_vacancy_irradiation_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_vacancy_phenoplasticity.f90 b/src/source_vacancy_phenoplasticity.f90 index 2690cf691..924490637 100644 --- a/src/source_vacancy_phenoplasticity.f90 +++ b/src/source_vacancy_phenoplasticity.f90 @@ -68,8 +68,6 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -83,11 +81,9 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_phenoplasticity_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_phenoplasticity_ID),pInt) if (maxNinstance == 0_pInt) return @@ -163,10 +159,6 @@ subroutine source_vacancy_phenoplasticity_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/source_vacancy_thermalfluc.f90 b/src/source_vacancy_thermalfluc.f90 index 5891ff764..b835e8bce 100644 --- a/src/source_vacancy_thermalfluc.f90 +++ b/src/source_vacancy_thermalfluc.f90 @@ -72,8 +72,6 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) sourceState, & MATERIAL_partPhase use numerics,only: & - analyticJaco, & - worldrank, & numerics_integrator implicit none @@ -87,11 +85,9 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- source_'//SOURCE_vacancy_thermalfluc_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(phase_source == SOURCE_vacancy_thermalfluc_ID),pInt) if (maxNinstance == 0_pInt) return @@ -170,10 +166,6 @@ subroutine source_vacancy_thermalfluc_init(fileUnit) allocate(sourceState(phase)%p(sourceOffset)%dotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%deltaState (sizeDeltaState,NofMyPhase), source=0.0_pReal) - if (.not. analyticJaco) then - allocate(sourceState(phase)%p(sourceOffset)%state_backup (sizeState,NofMyPhase), source=0.0_pReal) - allocate(sourceState(phase)%p(sourceOffset)%dotState_backup (sizeDotState,NofMyPhase), source=0.0_pReal) - endif if (any(numerics_integrator == 1_pInt)) then allocate(sourceState(phase)%p(sourceOffset)%previousDotState (sizeDotState,NofMyPhase), source=0.0_pReal) allocate(sourceState(phase)%p(sourceOffset)%previousDotState2 (sizeDotState,NofMyPhase), source=0.0_pReal) diff --git a/src/spectral_damage.f90 b/src/spectral_damage.f90 index e2bb80b31..9c259a2fb 100644 --- a/src/spectral_damage.f90 +++ b/src/spectral_damage.f90 @@ -42,7 +42,6 @@ module spectral_damage integer(pInt), private :: totalIter = 0_pInt !< total iteration in current increment real(pReal), dimension(3,3), private :: D_ref real(pReal), private :: mobility_ref - character(len=1024), private :: incInfo public :: & spectral_damage_init, & @@ -50,21 +49,7 @@ module spectral_damage spectral_damage_forward, & spectral_damage_destroy external :: & - VecDestroy, & - DMDestroy, & - DMDACreate3D, & - DMCreateGlobalVector, & - DMDASNESSetFunctionLocal, & PETScFinalize, & - SNESDestroy, & - SNESGetNumberFunctionEvals, & - SNESGetIterationNumber, & - SNESSolve, & - SNESSetDM, & - SNESGetConvergedReason, & - SNESSetConvergenceTest, & - SNESSetFromOptions, & - SNESCreate, & MPI_Abort, & MPI_Bcast, & MPI_Allreduce @@ -90,20 +75,32 @@ subroutine spectral_damage_init() damage_nonlocal_getMobility implicit none - DM :: damage_grid - Vec :: uBound, lBound - PetscErrorCode :: ierr - PetscObject :: dummy integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc integer(pInt) :: i, j, k, cell + DM :: damage_grid + Vec :: uBound, lBound + PetscErrorCode :: ierr character(len=100) :: snes_type - mainProcess: if (worldrank == 0_pInt) then - write(6,'(/,a)') ' <<<+- spectral_damage init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + external :: & + SNESCreate, & + SNESSetOptionsPrefix, & + DMDACreate3D, & + SNESSetDM, & + DMDAGetCorners, & + DMCreateGlobalVector, & + DMDASNESSetFunctionLocal, & + SNESSetFromOptions, & + SNESGetType, & + VecSet, & + DMGetGlobalVector, & + DMRestoreGlobalVector, & + SNESVISetVariableBounds + + write(6,'(/,a)') ' <<<+- spectral_damage init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! initialize solver specific parts of PETSc @@ -124,7 +121,8 @@ subroutine spectral_damage_init() CHKERRQ(ierr) call SNESSetDM(damage_snes,damage_grid,ierr); CHKERRQ(ierr) !< connect snes to da call DMCreateGlobalVector(damage_grid,solution,ierr); CHKERRQ(ierr) !< global solution vector (grid x 1, i.e. every def grad tensor) - call DMDASNESSetFunctionLocal(damage_grid,INSERT_VALUES,spectral_damage_formResidual,dummy,ierr) !< residual vector of same shape as solution vector + call DMDASNESSetFunctionLocal(damage_grid,INSERT_VALUES,spectral_damage_formResidual,& + PETSC_NULL_OBJECT,ierr) !< residual vector of same shape as solution vector CHKERRQ(ierr) call SNESSetFromOptions(damage_snes,ierr); CHKERRQ(ierr) !< pull it all together with additional cli arguments call SNESGetType(damage_snes,snes_type,ierr); CHKERRQ(ierr) @@ -171,15 +169,11 @@ end subroutine spectral_damage_init !-------------------------------------------------------------------------------------------------- !> @brief solution for the spectral damage scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function spectral_damage_solution(guess,timeinc,timeinc_old,loadCaseTime) +type(tSolutionState) function spectral_damage_solution(timeinc,timeinc_old,loadCaseTime) use numerics, only: & itmax, & err_damage_tolAbs, & err_damage_tolRel - use spectral_utilities, only: & - tBoundaryCondition, & - Utilities_maskedCompliance, & - Utilities_updateGamma use mesh, only: & grid, & grid3 @@ -194,16 +188,21 @@ type(tSolutionState) function spectral_damage_solution(guess,timeinc,timeinc_old timeinc, & !< increment in time for current solution timeinc_old, & !< increment in time of last increment loadCaseTime !< remaining time of current load case - logical, intent(in) :: guess integer(pInt) :: i, j, k, cell PetscInt ::position PetscReal :: minDamage, maxDamage, stagNorm, solnNorm - + !-------------------------------------------------------------------------------------------------- ! PETSc Data PetscErrorCode :: ierr SNESConvergedReason :: reason - + + external :: & + VecMin, & + VecMax, & + SNESSolve, & + SNESGetConvergedReason + spectral_damage_solution%converged =.false. !-------------------------------------------------------------------------------------------------- @@ -281,10 +280,10 @@ subroutine spectral_damage_formResidual(in,x_scal,f_scal,dummy,ierr) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & in PetscScalar, dimension( & - XG_RANGE,YG_RANGE,ZG_RANGE) :: & + XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & x_scal PetscScalar, dimension( & - X_RANGE,Y_RANGE,Z_RANGE) :: & + X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & f_scal PetscObject :: dummy PetscErrorCode :: ierr @@ -339,7 +338,7 @@ end subroutine spectral_damage_formResidual !-------------------------------------------------------------------------------------------------- !> @brief spectral damage forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine spectral_damage_forward(guess,timeinc,timeinc_old,loadCaseTime) +subroutine spectral_damage_forward() use mesh, only: & grid, & grid3 @@ -352,15 +351,13 @@ subroutine spectral_damage_forward(guess,timeinc,timeinc_old,loadCaseTime) damage_nonlocal_getMobility implicit none - real(pReal), intent(in) :: & - timeinc_old, & - timeinc, & - loadCaseTime !< remaining time of current load case - logical, intent(in) :: guess - PetscErrorCode :: ierr integer(pInt) :: i, j, k, cell DM :: dm_local PetscScalar, dimension(:,:,:), pointer :: x_scal + PetscErrorCode :: ierr + + external :: & + SNESGetDM if (cutBack) then damage_current = damage_lastInc @@ -404,6 +401,10 @@ subroutine spectral_damage_destroy() implicit none PetscErrorCode :: ierr + external :: & + VecDestroy, & + SNESDestroy + call VecDestroy(solution,ierr); CHKERRQ(ierr) call SNESDestroy(damage_snes,ierr); CHKERRQ(ierr) diff --git a/src/spectral_interface.f90 b/src/spectral_interface.f90 index 911e6c72e..8d9a41619 100644 --- a/src/spectral_interface.f90 +++ b/src/spectral_interface.f90 @@ -13,15 +13,14 @@ module DAMASK_interface pInt implicit none private -#ifdef PETSc #include -#endif logical, public, protected :: appendToOutFile = .false. !< Append to existing spectralOut file (in case of restart, not in case of regridding) integer(pInt), public, protected :: spectralRestartInc = 1_pInt !< Increment at which calculation starts character(len=1024), public, protected :: & geometryFile = '', & !< parameter given for geometry file loadCaseFile = '' !< parameter given for load case file character(len=1024), private :: workingDirectory !< accessed by getSolverWorkingDirectoryName for compatibility reasons + character, private,parameter :: pathSep = '/' public :: & getSolverWorkingDirectoryName, & @@ -33,7 +32,6 @@ module DAMASK_interface getLoadCaseFile, & rectifyPath, & makeRelativePath, & - getPathSep, & IIO_stringValue, & IIO_intValue, & IIO_lc, & @@ -44,13 +42,12 @@ contains !> @brief initializes the solver by interpreting the command line arguments. Also writes !! information on computation to screen !-------------------------------------------------------------------------------------------------- -subroutine DAMASK_interface_init(loadCaseParameterIn,geometryParameterIn) +subroutine DAMASK_interface_init() use, intrinsic :: iso_fortran_env ! to get compiler_version and compiler_options (at least for gfortran 4.6 at the moment) + use system_routines, only: & + getHostName implicit none - character(len=1024), optional, intent(in) :: & - loadCaseParameterIn, & !< if using the f2py variant, the -l argument of DAMASK_spectral.exe - geometryParameterIn !< if using the f2py variant, the -g argument of DAMASK_spectral.exe character(len=1024) :: & commandLine, & !< command line call as string loadCaseArg ='', & !< -l argument given to DAMASK_spectral.exe @@ -61,124 +58,124 @@ subroutine DAMASK_interface_init(loadCaseParameterIn,geometryParameterIn) tag integer :: & i, & - worldrank = 0 + threadLevel, & + worldrank = 0, & + worldsize = 0 integer, allocatable, dimension(:) :: & chunkPos integer, dimension(8) :: & dateAndTime ! type default integer -#ifdef PETSc PetscErrorCode :: ierr -#endif + logical :: error external :: & quit,& MPI_Comm_rank,& + MPI_Comm_size,& PETScInitialize, & + MPI_Init_Thread, & MPI_abort + open(6, encoding='UTF-8') ! for special characters in output + !-------------------------------------------------------------------------------------------------- ! PETSc Init -#ifdef PETSc - call PetscInitialize(PETSC_NULL_CHARACTER,ierr) ! according to PETSc manual, that should be the first line in the code - CHKERRQ(ierr) ! this is a macro definition, it is case sensitive - - open(6, encoding='UTF-8') ! modern fortran compilers (gfortran >4.4, ifort >11 support it) - call MPI_Comm_rank(PETSC_COMM_WORLD,worldrank,ierr);CHKERRQ(ierr) -#endif - mainProcess: if (worldrank == 0) then - call date_and_time(values = dateAndTime) - write(6,'(/,a)') ' <<<+- DAMASK_spectral -+>>>' - write(6,'(/,a)') ' Version: '//DAMASKVERSION - write(6,'(a,2(i2.2,a),i4.4)') ' Date: ',dateAndTime(3),'/',& - dateAndTime(2),'/',& - dateAndTime(1) - write(6,'(a,2(i2.2,a),i2.2)') ' Time: ',dateAndTime(5),':',& - dateAndTime(6),':',& - dateAndTime(7) - write(6,'(/,a)') ' <<<+- DAMASK_interface init -+>>>' -#include "compilation_info.f90" - endif mainProcess - if ( present(loadcaseParameterIn) .and. present(geometryParameterIn)) then ! both mandatory parameters given in function call - geometryArg = geometryParameterIn - loadcaseArg = loadcaseParameterIn - commandLine = 'n/a' - else if ( .not.( present(loadcaseParameterIn) .and. present(geometryParameterIn))) then ! none parameters given in function call, trying to get them from command line - call get_command(commandLine) - chunkPos = IIO_stringPos(commandLine) - do i = 1, chunkPos(1) - tag = IIO_lc(IIO_stringValue(commandLine,chunkPos,i)) ! extract key - select case(tag) - case ('-h','--help') - mainProcess2: if (worldrank == 0) then - write(6,'(a)') ' #######################################################################' - write(6,'(a)') ' DAMASK_spectral:' - write(6,'(a)') ' The spectral method boundary value problem solver for' - write(6,'(a)') ' the Düsseldorf Advanced Material Simulation Kit' - write(6,'(a,/)')' #######################################################################' - write(6,'(a,/)')' Valid command line switches:' - write(6,'(a)') ' --geom (-g, --geometry)' - write(6,'(a)') ' --load (-l, --loadcase)' - write(6,'(a)') ' --workingdir (-w, --wd, --workingdirectory, -d, --directory)' - write(6,'(a)') ' --restart (-r, --rs)' - write(6,'(a)') ' --regrid (--rg)' - write(6,'(a)') ' --help (-h)' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Mandatory arguments:' - write(6,'(/,a)')' --geom PathToGeomFile/NameOfGeom.geom' - write(6,'(a)') ' Specifies the location of the geometry definition file,' - write(6,'(a)') ' if no extension is given, .geom will be appended.' - write(6,'(a)') ' "PathToGeomFile" will be the working directory if not specified' - write(6,'(a)') ' via --workingdir.' - write(6,'(a)') ' Make sure the file "material.config" exists in the working' - write(6,'(a)') ' directory.' - write(6,'(a)') ' For further configuration place "numerics.config"' - write(6,'(a)')' and "numerics.config" in that directory.' - write(6,'(/,a)')' --load PathToLoadFile/NameOfLoadFile.load' - write(6,'(a)') ' Specifies the location of the load case definition file,' - write(6,'(a)') ' if no extension is given, .load will be appended.' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Optional arguments:' - write(6,'(/,a)')' --workingdirectory PathToWorkingDirectory' - write(6,'(a)') ' Specifies the working directory and overwrites the default' - write(6,'(a)') ' "PathToGeomFile".' - write(6,'(a)') ' Make sure the file "material.config" exists in the working' - write(6,'(a)') ' directory.' - write(6,'(a)') ' For further configuration place "numerics.config"' - write(6,'(a)')' and "numerics.config" in that directory.' - write(6,'(/,a)')' --restart XX' - write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' - write(6,'(a)') ' calculate total increment No. XX.' - write(6,'(a)') ' Appends to existing results file ' - write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' - write(6,'(a)') ' Works only if the restart information for total increment' - write(6,'(a)') ' No. XX-1 is available in the working directory.' - write(6,'(/,a)')' --regrid XX' - write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' - write(6,'(a)') ' calculate total increment No. XX.' - write(6,'(a)') ' Attention: Overwrites existing results file ' - write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' - write(6,'(a)') ' Works only if the restart information for total increment' - write(6,'(a)') ' No. XX-1 is available in the working directory.' - write(6,'(/,a)')' -----------------------------------------------------------------------' - write(6,'(a)') ' Help:' - write(6,'(/,a)')' --help' - write(6,'(a,/)')' Prints this message and exits' - call quit(0_pInt) ! normal Termination - endif mainProcess2 - case ('-l', '--load', '--loadcase') - loadcaseArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) - case ('-g', '--geom', '--geometry') - geometryArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) - case ('-w', '-d', '--wd', '--directory', '--workingdir', '--workingdirectory') - workingDirArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) - case ('-r', '--rs', '--restart') - spectralRestartInc = IIO_IntValue(commandLine,chunkPos,i+1_pInt) - appendToOutFile = .true. - case ('--rg', '--regrid') - spectralRestartInc = IIO_IntValue(commandLine,chunkPos,i+1_pInt) - appendToOutFile = .false. - end select - enddo +#ifdef _OPENMP + call MPI_Init_Thread(MPI_THREAD_FUNNELED,threadLevel,ierr);CHKERRQ(ierr) ! in case of OpenMP, don't rely on PETScInitialize doing MPI init + if (threadLevel>>' + write(6,'(/,a)') ' Version: '//DAMASKVERSION + write(6,'(a,2(i2.2,a),i4.4)') ' Date: ',dateAndTime(3),'/',& + dateAndTime(2),'/',& + dateAndTime(1) + write(6,'(a,2(i2.2,a),i2.2)') ' Time: ',dateAndTime(5),':',& + dateAndTime(6),':',& + dateAndTime(7) + write(6,'(/,a,i4.1)') ' MPI processes: ',worldsize + write(6,'(/,a)') ' <<<+- DAMASK_interface init -+>>>' +#include "compilation_info.f90" + + call get_command(commandLine) + chunkPos = IIO_stringPos(commandLine) + do i = 1, chunkPos(1) + tag = IIO_lc(IIO_stringValue(commandLine,chunkPos,i)) ! extract key + select case(tag) + case ('-h','--help') + write(6,'(a)') ' #######################################################################' + write(6,'(a)') ' DAMASK_spectral:' + write(6,'(a)') ' The spectral method boundary value problem solver for' + write(6,'(a)') ' the Düsseldorf Advanced Material Simulation Kit' + write(6,'(a,/)')' #######################################################################' + write(6,'(a,/)')' Valid command line switches:' + write(6,'(a)') ' --geom (-g, --geometry)' + write(6,'(a)') ' --load (-l, --loadcase)' + write(6,'(a)') ' --workingdir (-w, --wd, --workingdirectory, -d, --directory)' + write(6,'(a)') ' --restart (-r, --rs)' + write(6,'(a)') ' --help (-h)' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Mandatory arguments:' + write(6,'(/,a)')' --geom PathToGeomFile/NameOfGeom.geom' + write(6,'(a)') ' Specifies the location of the geometry definition file,' + write(6,'(a)') ' if no extension is given, .geom will be appended.' + write(6,'(a)') ' "PathToGeomFile" will be the working directory if not specified' + write(6,'(a)') ' via --workingdir.' + write(6,'(a)') ' Make sure the file "material.config" exists in the working' + write(6,'(a)') ' directory.' + write(6,'(a)') ' For further configuration place "numerics.config"' + write(6,'(a)')' and "numerics.config" in that directory.' + write(6,'(/,a)')' --load PathToLoadFile/NameOfLoadFile.load' + write(6,'(a)') ' Specifies the location of the load case definition file,' + write(6,'(a)') ' if no extension is given, .load will be appended.' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Optional arguments:' + write(6,'(/,a)')' --workingdirectory PathToWorkingDirectory' + write(6,'(a)') ' Specifies the working directory and overwrites the default' + write(6,'(a)') ' "PathToGeomFile".' + write(6,'(a)') ' Make sure the file "material.config" exists in the working' + write(6,'(a)') ' directory.' + write(6,'(a)') ' For further configuration place "numerics.config"' + write(6,'(a)')' and "debug.config" in that directory.' + write(6,'(/,a)')' --restart XX' + write(6,'(a)') ' Reads in total increment No. XX-1 and continues to' + write(6,'(a)') ' calculate total increment No. XX.' + write(6,'(a)') ' Appends to existing results file ' + write(6,'(a)') ' "NameOfGeom_NameOfLoadFile.spectralOut".' + write(6,'(a)') ' Works only if the restart information for total increment' + write(6,'(a)') ' No. XX-1 is available in the working directory.' + write(6,'(/,a)')' -----------------------------------------------------------------------' + write(6,'(a)') ' Help:' + write(6,'(/,a)')' --help' + write(6,'(a,/)')' Prints this message and exits' + call quit(0_pInt) ! normal Termination + case ('-l', '--load', '--loadcase') + loadcaseArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) + case ('-g', '--geom', '--geometry') + geometryArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) + case ('-w', '-d', '--wd', '--directory', '--workingdir', '--workingdirectory') + workingDirArg = IIO_stringValue(commandLine,chunkPos,i+1_pInt) + case ('-r', '--rs', '--restart') + spectralRestartInc = IIO_IntValue(commandLine,chunkPos,i+1_pInt) + appendToOutFile = .true. + end select + enddo if (len(trim(loadcaseArg)) == 0 .or. len(trim(geometryArg)) == 0) then write(6,'(a)') ' Please specify geometry AND load case (-h for help)' @@ -189,25 +186,23 @@ subroutine DAMASK_interface_init(loadCaseParameterIn,geometryParameterIn) geometryFile = getGeometryFile(geometryArg) loadCaseFile = getLoadCaseFile(loadCaseArg) - call get_environment_variable('HOSTNAME',hostName) call get_environment_variable('USER',userName) - mainProcess3: if (worldrank == 0) then - write(6,'(a,a)') ' Host name: ', trim(hostName) - write(6,'(a,a)') ' User name: ', trim(userName) - write(6,'(a,a)') ' Path separator: ', getPathSep() - write(6,'(a,a)') ' Command line call: ', trim(commandLine) - if (len(trim(workingDirArg))>0) & - write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) - write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) - write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) - write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) - write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) - write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) - write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) - if (SpectralRestartInc > 1_pInt) & - write(6,'(a,i6.6)') ' Restart at increment: ', spectralRestartInc - write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile - endif mainProcess3 + error = getHostName(hostName) + write(6,'(a,a)') ' Host name: ', trim(hostName) + write(6,'(a,a)') ' User name: ', trim(userName) + write(6,'(a,a)') ' Path separator: ', pathSep + write(6,'(a,a)') ' Command line call: ', trim(commandLine) + if (len(trim(workingDirArg))>0) & + write(6,'(a,a)') ' Working dir argument: ', trim(workingDirArg) + write(6,'(a,a)') ' Geometry argument: ', trim(geometryArg) + write(6,'(a,a)') ' Loadcase argument: ', trim(loadcaseArg) + write(6,'(a,a)') ' Working directory: ', trim(getSolverWorkingDirectoryName()) + write(6,'(a,a)') ' Geometry file: ', trim(geometryFile) + write(6,'(a,a)') ' Loadcase file: ', trim(loadCaseFile) + write(6,'(a,a)') ' Solver job name: ', trim(getSolverJobName()) + if (SpectralRestartInc > 1_pInt) & + write(6,'(a,i6.6)') ' Restart at increment: ', spectralRestartInc + write(6,'(a,l1,/)') ' Append to result file: ', appendToOutFile end subroutine DAMASK_interface_init @@ -226,11 +221,9 @@ character(len=1024) function storeWorkingDirectory(workingDirectoryArg,geometryA character(len=*), intent(in) :: workingDirectoryArg !< working directory argument character(len=*), intent(in) :: geometryArg !< geometry argument character(len=1024) :: cwd - character :: pathSep logical :: error external :: quit - pathSep = getPathSep() wdGiven: if (len(workingDirectoryArg)>0) then absolutePath: if (workingDirectoryArg(1:1) == pathSep) then storeWorkingDirectory = workingDirectoryArg @@ -266,6 +259,7 @@ end function storeWorkingDirectory character(len=1024) function getSolverWorkingDirectoryName() implicit none + getSolverWorkingDirectoryName = workingDirectory end function getSolverWorkingDirectoryName @@ -278,10 +272,8 @@ character(len=1024) function getSolverJobName() implicit none integer :: posExt,posSep - character :: pathSep character(len=1024) :: tempString - pathSep = getPathSep() tempString = geometryFile posExt = scan(tempString,'.',back=.true.) @@ -312,16 +304,16 @@ character(len=1024) function getGeometryFile(geometryParameter) cwd integer :: posExt, posSep logical :: error - character :: pathSep + external :: quit getGeometryFile = geometryParameter - pathSep = getPathSep() posExt = scan(getGeometryFile,'.',back=.true.) posSep = scan(getGeometryFile,pathSep,back=.true.) if (posExt <= posSep) getGeometryFile = trim(getGeometryFile)//('.geom') ! no extension present if (scan(getGeometryFile,pathSep) /= 1) then ! relative path given as command line argument error = getcwd(cwd) + if (error) call quit(1_pInt) getGeometryFile = rectifyPath(trim(cwd)//pathSep//getGeometryFile) else getGeometryFile = rectifyPath(getGeometryFile) @@ -346,16 +338,16 @@ character(len=1024) function getLoadCaseFile(loadCaseParameter) cwd integer :: posExt, posSep logical :: error - character :: pathSep + external :: quit getLoadCaseFile = loadcaseParameter - pathSep = getPathSep() posExt = scan(getLoadCaseFile,'.',back=.true.) posSep = scan(getLoadCaseFile,pathSep,back=.true.) if (posExt <= posSep) getLoadCaseFile = trim(getLoadCaseFile)//('.load') ! no extension present if (scan(getLoadCaseFile,pathSep) /= 1) then ! relative path given as command line argument error = getcwd(cwd) + if (error) call quit(1_pInt) getLoadCaseFile = rectifyPath(trim(cwd)//pathSep//getLoadCaseFile) else getLoadCaseFile = rectifyPath(getLoadCaseFile) @@ -374,11 +366,8 @@ function rectifyPath(path) implicit none character(len=*) :: path character(len=len_trim(path)) :: rectifyPath - character :: pathSep integer :: i,j,k,l ! no pInt - pathSep = getPathSep() - !-------------------------------------------------------------------------------------------------- ! remove /./ from path l = len_trim(path) @@ -415,10 +404,8 @@ character(len=1024) function makeRelativePath(a,b) implicit none character (len=*) :: a,b - character :: pathSep integer :: i,posLastCommonSlash,remainingSlashes !no pInt - pathSep = getPathSep() posLastCommonSlash = 0 remainingSlashes = 0 @@ -434,35 +421,6 @@ character(len=1024) function makeRelativePath(a,b) end function makeRelativePath -!-------------------------------------------------------------------------------------------------- -!> @brief counting / and \ in $PATH System variable the character occuring more often is assumed -! to be the path separator -!-------------------------------------------------------------------------------------------------- -character function getPathSep() - - implicit none - character(len=2048) :: & - path - integer(pInt) :: & - backslash = 0_pInt, & - slash = 0_pInt - integer :: i - - call get_environment_variable('PATH',path) - do i=1, len(trim(path)) - if (path(i:i)=='/') slash = slash + 1_pInt - if (path(i:i)=='\') backslash = backslash + 1_pInt - enddo - - if (backslash>slash) then - getPathSep = '\' - else - getPathSep = '/' - endif - -end function getPathSep - - !-------------------------------------------------------------------------------------------------- !> @brief taken from IO, check IO_stringValue for documentation !-------------------------------------------------------------------------------------------------- diff --git a/src/spectral_mech_AL.f90 b/src/spectral_mech_AL.f90 index b6a8c9353..951ab2521 100644 --- a/src/spectral_mech_AL.f90 +++ b/src/spectral_mech_AL.f90 @@ -22,7 +22,7 @@ module spectral_mech_AL DAMASK_spectral_solverAL_label = 'al' !-------------------------------------------------------------------------------------------------- -! derived types +! derived types type(tSolutionParams), private :: params real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal @@ -31,7 +31,7 @@ module spectral_mech_AL DM, private :: da SNES, private :: snes Vec, private :: solution_vec - + !-------------------------------------------------------------------------------------------------- ! common pointwise data real(pReal), private, dimension(:,:,:,:,:), allocatable :: & @@ -49,7 +49,7 @@ module spectral_mech_AL F_av = 0.0_pReal, & !< average incompatible def grad field P_av = 0.0_pReal, & !< average 1st Piola--Kirchhoff stress P_avLastEval = 0.0_pReal !< average 1st Piola--Kirchhoff stress last call of CPFEM_general - character(len=1024), private :: incInfo !< time and increment information + character(len=1024), private :: incInfo !< time and increment information real(pReal), private, dimension(3,3,3,3) :: & C_volAvg = 0.0_pReal, & !< current volume average stiffness C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness @@ -57,7 +57,7 @@ module spectral_mech_AL S = 0.0_pReal, & !< current compliance (filled up with zeros) C_scale = 0.0_pReal, & S_scale = 0.0_pReal - + real(pReal), private :: & err_BC, & !< deviation from stress BC err_curl, & !< RMS of curl of F @@ -72,21 +72,7 @@ module spectral_mech_AL AL_forward, & AL_destroy external :: & - VecDestroy, & - DMDestroy, & - DMDACreate3D, & - DMCreateGlobalVector, & - DMDASNESSetFunctionLocal, & PETScFinalize, & - SNESDestroy, & - SNESGetNumberFunctionEvals, & - SNESGetIterationNumber, & - SNESSolve, & - SNESSetDM, & - SNESGetConvergedReason, & - SNESSetConvergenceTest, & - SNESSetFromOptions, & - SNESCreate, & MPI_Abort, & MPI_Bcast, & MPI_Allreduce @@ -130,17 +116,25 @@ subroutine AL_init temp33_Real = 0.0_pReal PetscErrorCode :: ierr - PetscObject :: dummy PetscScalar, pointer, dimension(:,:,:,:) :: xx_psc, F, F_lambda integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc character(len=1024) :: rankStr - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverAL init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + external :: & + SNESCreate, & + SNESSetOptionsPrefix, & + DMDACreate3D, & + SNESSetDM, & + DMCreateGlobalVector, & + DMDASNESSetFunctionLocal, & + SNESGetConvergedReason, & + SNESSetConvergenceTest, & + SNESSetFromOptions + + write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverAL init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif !-------------------------------------------------------------------------------------------------- ! allocate global fields @@ -150,7 +144,7 @@ subroutine AL_init allocate (F_lambdaDot (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) !-------------------------------------------------------------------------------------------------- -! PETSc Init +! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,snes,ierr); CHKERRQ(ierr) call SNESSetOptionsPrefix(snes,'mech_',ierr);CHKERRQ(ierr) allocate(localK(worldsize), source = 0); localK(worldrank+1) = grid3 @@ -168,9 +162,9 @@ subroutine AL_init CHKERRQ(ierr) call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) - call DMDASNESSetFunctionLocal(da,INSERT_VALUES,AL_formResidual,dummy,ierr) + call DMDASNESSetFunctionLocal(da,INSERT_VALUES,AL_formResidual,PETSC_NULL_OBJECT,ierr) CHKERRQ(ierr) - call SNESSetConvergenceTest(snes,AL_converged,dummy,PETSC_NULL_FUNCTION,ierr) + call SNESSetConvergenceTest(snes,AL_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) CHKERRQ(ierr) call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) @@ -185,10 +179,10 @@ subroutine AL_init 'reading values of increment ', restartInc - 1_pInt, ' from file' flush(6) write(rankStr,'(a1,i0)')'_',worldrank - call IO_read_realFile(777,'F'//trim(rankStr), trim(getSolverJobName()),size(F)) + call IO_read_realFile(777,'F'//trim(rankStr),trim(getSolverJobName()),size(F)) read (777,rec=1) F close (777) - call IO_read_realFile(777,'F_lastInc'//trim(rankStr), trim(getSolverJobName()),size(F_lastInc)) + call IO_read_realFile(777,'F_lastInc'//trim(rankStr),trim(getSolverJobName()),size(F_lastInc)) read (777,rec=1) F_lastInc close (777) call IO_read_realFile(777,'F_lambda'//trim(rankStr),trim(getSolverJobName()),size(F_lambda)) @@ -214,15 +208,14 @@ subroutine AL_init F_lambda_lastInc = F_lastInc endif restart - call Utilities_updateIPcoords(reshape(F,shape(F_lastInc))) call Utilities_constitutiveResponse(F_lastInc, reshape(F,shape(F_lastInc)), & 0.0_pReal,P,C_volAvg,C_minMaxAvg,temp33_Real,.false.,math_I3) nullify(F) nullify(F_lambda) call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc - - readRestart: if (restartInc > 1_pInt) then + + restartRead: if (restartInc > 1_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & 'reading more values of increment', restartInc - 1_pInt, 'from file' @@ -236,7 +229,7 @@ subroutine AL_init call IO_read_realFile(777,'C_ref',trim(getSolverJobName()),size(C_minMaxAvg)) read (777,rec=1) C_minMaxAvg close (777) - endif readRestart + endif restartRead call Utilities_updateGamma(C_minMaxAvg,.True.) C_scale = C_minMaxAvg @@ -249,7 +242,7 @@ end subroutine AL_init !> @brief solution for the AL scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & - AL_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + AL_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -263,20 +256,16 @@ type(tSolutionState) function & use FEsolving, only: & restartWrite, & terminallyIll - + implicit none !-------------------------------------------------------------------------------------------------- ! input data for solution real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution - timeinc_old, & !< increment in time of last increment - loadCaseTime !< remaining time of current load case - logical, intent(in) :: & - guess + timeinc_old !< increment in time of last increment type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC character(len=*), intent(in) :: & incInfoIn real(pReal), dimension(3,3), intent(in) :: rotation_BC @@ -286,11 +275,15 @@ type(tSolutionState) function & PetscErrorCode :: ierr SNESConvergedReason :: reason + external :: & + SNESSolve, & + SNESGetConvergedReason + incInfo = incInfoIn !-------------------------------------------------------------------------------------------------- ! update stiffness (and gamma operator) - S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C_volAvg) + S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg) if (update_gamma) then call Utilities_updateGamma(C_minMaxAvg,restartWrite) C_scale = C_minMaxAvg @@ -298,12 +291,12 @@ type(tSolutionState) function & endif !-------------------------------------------------------------------------------------------------- -! set module wide availabe data - mask_stress = P_BC%maskFloat - params%P_BC = P_BC%values +! set module wide availabe data + mask_stress = stress_BC%maskFloat + params%stress_BC = stress_BC%values params%rotation_BC = rotation_BC - params%timeinc = timeinc - params%timeincOld = timeinc_old + params%timeinc = timeinc + params%timeincOld = timeinc_old !-------------------------------------------------------------------------------------------------- ! solve BVP @@ -331,8 +324,7 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) itmax, & itmin, & polarAlpha, & - polarBeta, & - worldrank + polarBeta use mesh, only: & grid3, & grid @@ -369,10 +361,10 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) DMDA_LOCAL_INFO_SIZE) :: & in PetscScalar, target, dimension(3,3,2, & - XG_RANGE,YG_RANGE,ZG_RANGE) :: & + XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & x_scal PetscScalar, target, dimension(3,3,2, & - X_RANGE,Y_RANGE,Z_RANGE) :: & + X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & f_scal PetscScalar, pointer, dimension(:,:,:,:,:) :: & F, & @@ -387,6 +379,10 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) integer(pInt) :: & i, j, k, e + external :: & + SNESGetNumberFunctionEvals, & + SNESGetIterationNumber + F => x_scal(1:3,1:3,1,& XG_RANGE,YG_RANGE,ZG_RANGE) F_lambda => x_scal(1:3,1:3,2,& @@ -407,16 +403,14 @@ subroutine AL_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! report begin of new iteration totalIter = totalIter + 1_pInt - if (worldrank == 0_pInt) then - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax - if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) - flush(6) - endif + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & + ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & + math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & + math_transpose33(F_aim) + flush(6) endif newIteration !-------------------------------------------------------------------------------------------------- @@ -491,8 +485,7 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr err_curl_tolRel, & err_curl_tolAbs, & err_stress_tolAbs, & - err_stress_tolRel, & - worldrank + err_stress_tolRel use math, only: & math_mul3333xx33 use FEsolving, only: & @@ -507,7 +500,7 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr fnorm SNESConvergedReason :: reason PetscObject :: dummy - PetscErrorCode ::ierr + PetscErrorCode :: ierr real(pReal) :: & curlTol, & divTol, & @@ -515,9 +508,9 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr !-------------------------------------------------------------------------------------------------- ! stress BC handling - F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc + F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc err_BC = maxval(abs((-mask_stress+1.0_pReal)*math_mul3333xx33(C_scale,F_aim-F_av) + & - mask_stress *(P_av - params%P_BC))) ! mask = 0.0 for no bc + mask_stress *(P_av - params%stress_BC))) ! mask = 0.0 for no bc !-------------------------------------------------------------------------------------------------- ! error calculation @@ -539,24 +532,22 @@ subroutine AL_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,dummy,ierr !-------------------------------------------------------------------------------------------------- ! report - if (worldrank == 0_pInt) then - write(6,'(1/,a)') ' ... reporting .............................................................' - write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & - err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & - err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' - write(6,'(/,a)') ' ===========================================================================' - flush(6) - endif + write(6,'(1/,a)') ' ... reporting .............................................................' + write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & + err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' + write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & + err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' + write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & + err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' + write(6,'(/,a)') ' ===========================================================================' + flush(6) end subroutine AL_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_BC) +subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) use math, only: & math_mul33x33, & math_mul3333xx33, & @@ -584,8 +575,8 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_ timeinc, & loadCaseTime !< remaining time of current load case type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC, & + deformation_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC logical, intent(in) :: & guess @@ -601,21 +592,19 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_ F => xx_psc(0:8,:,:,:) F_lambda => xx_psc(9:17,:,:,:) if (restartWrite) then - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' writing converged results for restart' - flush(6) - endif + write(6,'(/,a)') ' writing converged results for restart' + flush(6) write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file + call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file write (777,rec=1) F close (777) - call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file + call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file write (777,rec=1) F_lastInc close (777) - call IO_write_jobRealFile(777,'F_lambda'//trim(rankStr),size(F_lambda)) ! writing deformation gradient field to file + call IO_write_jobRealFile(777,'F_lambda'//trim(rankStr),size(F_lambda)) ! writing deformation gradient field to file write (777,rec=1) F_lambda close (777) - call IO_write_jobRealFile(777,'F_lambda_lastInc'//trim(rankStr),size(F_lambda_lastInc)) ! writing F_lastInc field to file + call IO_write_jobRealFile(777,'F_lambda_lastInc'//trim(rankStr),size(F_lambda_lastInc)) ! writing F_lastInc field to file write (777,rec=1) F_lambda_lastInc close (777) if (worldrank == 0_pInt) then @@ -649,14 +638,14 @@ subroutine AL_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_ C_volAvgLastInc = C_volAvg !-------------------------------------------------------------------------------------------------- ! calculate rate for aim - if (F_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = F_BC%maskFloat * math_mul33x33(F_BC%values, F_aim) - elseif(F_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = F_BC%maskFloat * F_BC%values - elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime + if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F + f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) + elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed + f_aimDot = deformation_BC%maskFloat * deformation_BC%values + elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed + f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime endif - if (guess) f_aimDot = f_aimDot + P_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old + if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old F_aim_lastInc = F_aim !-------------------------------------------------------------------------------------------------- @@ -704,6 +693,11 @@ subroutine AL_destroy() implicit none PetscErrorCode :: ierr + external :: & + VecDestroy, & + SNESDestroy, & + DMDestroy + call VecDestroy(solution_vec,ierr); CHKERRQ(ierr) call SNESDestroy(snes,ierr); CHKERRQ(ierr) call DMDestroy(da,ierr); CHKERRQ(ierr) diff --git a/src/spectral_mech_Basic.f90 b/src/spectral_mech_Basic.f90 index 358a095d1..e20ed6761 100644 --- a/src/spectral_mech_Basic.f90 +++ b/src/spectral_mech_Basic.f90 @@ -48,7 +48,7 @@ module spectral_mech_basic C_volAvg = 0.0_pReal, & !< current volume average stiffness C_volAvgLastInc = 0.0_pReal, & !< previous volume average stiffness C_minMaxAvg = 0.0_pReal, & !< current (min+max)/2 stiffness - S = 0.0_pReal !< current compliance (filled up with zeros) + S = 0.0_pReal !< current compliance (filled up with zeros) real(pReal), private :: err_stress, err_div logical, private :: ForwardData integer(pInt), private :: & @@ -61,21 +61,7 @@ module spectral_mech_basic BasicPETSc_forward, & basicPETSc_destroy external :: & - VecDestroy, & - DMDestroy, & - DMDACreate3D, & - DMCreateGlobalVector, & - DMDASNESSetFunctionLocal, & PETScFinalize, & - SNESDestroy, & - SNESGetNumberFunctionEvals, & - SNESGetIterationNumber, & - SNESSolve, & - SNESSetDM, & - SNESGetConvergedReason, & - SNESSetConvergenceTest, & - SNESSetFromOptions, & - SNESCreate, & MPI_Abort, & MPI_Bcast, & MPI_Allreduce @@ -105,7 +91,7 @@ subroutine basicPETSc_init use spectral_utilities, only: & Utilities_constitutiveResponse, & Utilities_updateGamma, & - utilities_updateIPcoords, & + Utilities_updateIPcoords, & wgt use mesh, only: & grid, & @@ -115,20 +101,30 @@ subroutine basicPETSc_init implicit none real(pReal), dimension(3,3,grid(1),grid(2),grid3) :: P - PetscScalar, dimension(:,:,:,:), pointer :: F - PetscErrorCode :: ierr - PetscObject :: dummy real(pReal), dimension(3,3) :: & temp33_Real = 0.0_pReal + + PetscErrorCode :: ierr + PetscScalar, pointer, dimension(:,:,:,:) :: F + integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc character(len=1024) :: rankStr - - mainProcess: if (worldrank == 0_pInt) then - write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverBasicPETSc init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + + external :: & + SNESCreate, & + SNESSetOptionsPrefix, & + DMDACreate3D, & + SNESSetDM, & + DMCreateGlobalVector, & + DMDASNESSetFunctionLocal, & + SNESGetConvergedReason, & + SNESSetConvergenceTest, & + SNESSetFromOptions + + write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverBasicPETSc init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! allocate global fields @@ -147,17 +143,17 @@ subroutine basicPETSc_init DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, DM_BOUNDARY_NONE, & ! cut off stencil at boundary DMDA_STENCIL_BOX, & ! Moore (26) neighborhood around central point grid(1),grid(2),grid(3), & ! global grid - 1, 1, worldsize, & + 1 , 1, worldsize, & 9, 0, & ! #dof (F tensor), ghost boundary width (domain overlap) - grid (1),grid (2),localK, & ! local grid + grid(1),grid(2),localK, & ! local grid da,ierr) ! handle, error CHKERRQ(ierr) call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) ! global solution vector (grid x 9, i.e. every def grad tensor) - call DMDASNESSetFunctionLocal(da,INSERT_VALUES,BasicPETSC_formResidual,dummy,ierr) ! residual vector of same shape as solution vector + call DMDASNESSetFunctionLocal(da,INSERT_VALUES,BasicPETSC_formResidual,PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector CHKERRQ(ierr) call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) ! connect snes to da - call SNESSetConvergenceTest(snes,BasicPETSC_converged,dummy,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" + call SNESSetConvergenceTest(snes,BasicPETSC_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) ! specify custom convergence check function "_converged" CHKERRQ(ierr) call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments @@ -166,7 +162,7 @@ subroutine basicPETSc_init call DMDAVecGetArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! get the data out of PETSc to work with restart: if (restartInc > 1_pInt) then - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & + if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & 'reading values of increment ', restartInc - 1_pInt, ' from file' flush(6) @@ -195,10 +191,9 @@ subroutine basicPETSc_init temp33_Real, & .false., & math_I3) - call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) ! write data back to PETSc - restartRead: if (restartInc > 1_pInt) then + restartRead: if (restartInc > 1_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & 'reading more values of increment', restartInc - 1_pInt, 'from file' @@ -222,7 +217,7 @@ end subroutine basicPETSc_init !> @brief solution for the Basic PETSC scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & - basicPETSc_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + basicPETSc_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -241,36 +236,37 @@ type(tSolutionState) function & ! input data for solution real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution - timeinc_old, & !< increment in time of last increment - loadCaseTime !< remaining time of current load case + timeinc_old !< increment in time of last increment type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC character(len=*), intent(in) :: & incInfoIn real(pReal), dimension(3,3), intent(in) :: rotation_BC - logical, intent(in) :: & - guess !-------------------------------------------------------------------------------------------------- ! PETSc Data PetscErrorCode :: ierr SNESConvergedReason :: reason + + external :: & + SNESSolve, & + SNESGetConvergedReason + incInfo = incInfoIn !-------------------------------------------------------------------------------------------------- ! update stiffness (and gamma operator) - S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C_volAvg) + S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg) if (update_gamma) call Utilities_updateGamma(C_minmaxAvg,restartWrite) - + !-------------------------------------------------------------------------------------------------- -! set module wide availabe data - mask_stress = P_BC%maskFloat - params%P_BC = P_BC%values +! set module wide availabe data + mask_stress = stress_BC%maskFloat + params%stress_BC = stress_BC%values params%rotation_BC = rotation_BC - params%timeinc = timeinc - params%timeincOld = timeinc_old + params%timeinc = timeinc + params%timeincOld = timeinc_old !-------------------------------------------------------------------------------------------------- ! solve BVP @@ -292,14 +288,12 @@ end function BasicPETSc_solution !-------------------------------------------------------------------------------------------------- -!> @brief forms the AL residual vector +!> @brief forms the basic residual vector !-------------------------------------------------------------------------------------------------- subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) use numerics, only: & itmax, & itmin - use numerics, only: & - worldrank use mesh, only: & grid, & grid3 @@ -312,10 +306,11 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) debug_spectral, & debug_spectralRotation use spectral_utilities, only: & + wgt, & tensorField_real, & utilities_FFTtensorForward, & - utilities_FFTtensorBackward, & utilities_fourierGammaConvolution, & + utilities_FFTtensorBackward, & Utilities_constitutiveResponse, & Utilities_divergenceRMS use IO, only: & @@ -327,10 +322,10 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & in PetscScalar, dimension(3,3, & - XG_RANGE,YG_RANGE,ZG_RANGE) :: & + XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & x_scal PetscScalar, dimension(3,3, & - X_RANGE,Y_RANGE,Z_RANGE) :: & + X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & f_scal PetscInt :: & PETScIter, & @@ -338,24 +333,26 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) PetscObject :: dummy PetscErrorCode :: ierr + external :: & + SNESGetNumberFunctionEvals, & + SNESGetIterationNumber + call SNESGetNumberFunctionEvals(snes,nfuncs,ierr); CHKERRQ(ierr) call SNESGetIterationNumber(snes,PETScIter,ierr); CHKERRQ(ierr) if(nfuncs== 0 .and. PETScIter == 0) totalIter = -1_pInt ! new increment - newIteration: if (totalIter <= PETScIter) then + newIteration: if(totalIter <= PETScIter) then !-------------------------------------------------------------------------------------------------- ! report begin of new iteration totalIter = totalIter + 1_pInt - if (worldrank == 0_pInt) then - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax - if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) - flush(6) - endif + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & + ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & + math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & + math_transpose33(F_aim) + flush(6) endif newIteration !-------------------------------------------------------------------------------------------------- @@ -368,8 +365,8 @@ subroutine BasicPETSC_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! stress BC handling F_aim_lastIter = F_aim - F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc - err_stress = maxval(abs(mask_stress * (P_av - params%P_BC))) ! mask = 0.0 for no bc + F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc + err_stress = maxval(abs(mask_stress * (P_av - params%stress_BC))) ! mask = 0.0 for no bc !-------------------------------------------------------------------------------------------------- ! updated deformation gradient using fix point algorithm of basic scheme @@ -397,11 +394,10 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du err_div_tolRel, & err_div_tolAbs, & err_stress_tolRel, & - err_stress_tolAbs, & - worldrank + err_stress_tolAbs use FEsolving, only: & terminallyIll - + implicit none SNES :: snes_local PetscInt :: PETScIter @@ -415,10 +411,10 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du real(pReal) :: & divTol, & stressTol - + divTol = max(maxval(abs(P_av))*err_div_tolRel,err_div_tolAbs) stressTol = max(maxval(abs(P_av))*err_stress_tolrel,err_stress_tolabs) - + converged: if ((totalIter >= itmin .and. & all([ err_div/divTol, & err_stress/stressTol ] < 1.0_pReal)) & @@ -432,40 +428,38 @@ subroutine BasicPETSc_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason,du !-------------------------------------------------------------------------------------------------- ! report - if (worldrank == 0_pInt) then - write(6,'(1/,a)') ' ... reporting .............................................................' - write(6,'(1/,a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div,' / m, tol =',divTol,')' - write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error stress BC = ', & - err_stress/stressTol, ' (',err_stress, ' Pa, tol =',stressTol,')' - write(6,'(/,a)') ' ===========================================================================' - flush(6) - endif + write(6,'(1/,a)') ' ... reporting .............................................................' + write(6,'(1/,a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & + err_div/divTol, ' (',err_div,' / m, tol =',divTol,')' + write(6,'(a,f12.2,a,es8.2,a,es9.2,a)') ' error stress BC = ', & + err_stress/stressTol, ' (',err_stress, ' Pa, tol =',stressTol,')' + write(6,'(/,a)') ' ===========================================================================' +flush(6) end subroutine BasicPETSc_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_BC) +subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) use math, only: & math_mul33x33 ,& math_rotate_backward33 + use numerics, only: & + worldrank use mesh, only: & grid, & grid3 use spectral_utilities, only: & Utilities_calculateRate, & Utilities_forwardField, & - utilities_updateIPcoords, & + Utilities_updateIPcoords, & tBoundaryCondition, & cutBack use IO, only: & IO_write_JobRealFile use FEsolving, only: & restartWrite - use numerics, only: & - worldrank implicit none real(pReal), intent(in) :: & @@ -473,23 +467,22 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r timeinc, & loadCaseTime !< remaining time of current load case type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC, & + deformation_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC logical, intent(in) :: & guess + PetscErrorCode :: ierr PetscScalar, pointer :: F(:,:,:,:) - PetscErrorCode :: ierr + character(len=1024) :: rankStr call DMDAVecGetArrayF90(da,solution_vec,F,ierr) !-------------------------------------------------------------------------------------------------- ! restart information for spectral solver if (restartWrite) then - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' writing converged results for restart' - flush(6) - endif + write(6,'(/,a)') ' writing converged results for restart' + flush(6) write(rankStr,'(a1,i0)')'_',worldrank call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file write (777,rec=1) F @@ -508,7 +501,7 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r write (777,rec=1) C_volAvgLastInc close(777) endif - endif + endif call utilities_updateIPcoords(F) @@ -521,14 +514,14 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r C_volAvgLastInc = C_volAvg !-------------------------------------------------------------------------------------------------- ! calculate rate for aim - if (F_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = F_BC%maskFloat * math_mul33x33(F_BC%values, F_aim) - elseif(F_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = F_BC%maskFloat * F_BC%values - elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime + if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F + f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) + elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed + f_aimDot = deformation_BC%maskFloat * deformation_BC%values + elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed + f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime endif - if (guess) f_aimDot = f_aimDot + P_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old + if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old F_aim_lastInc = F_aim !-------------------------------------------------------------------------------------------------- @@ -538,12 +531,13 @@ subroutine BasicPETSc_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,r timeinc_old,guess,F_lastInc,reshape(F,[3,3,grid(1),grid(2),grid3])) F_lastInc = reshape(F, [3,3,grid(1),grid(2),grid3]) endif + F_aim = F_aim + f_aimDot * timeinc !-------------------------------------------------------------------------------------------------- ! update local deformation gradient - F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim - math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3]) + F = reshape(Utilities_forwardField(timeinc,F_lastInc,Fdot, & ! ensure that it matches rotated F_aim + math_rotate_backward33(F_aim,rotation_BC)),[9,grid(1),grid(2),grid3]) call DMDAVecRestoreArrayF90(da,solution_vec,F,ierr); CHKERRQ(ierr) end subroutine BasicPETSc_forward @@ -558,6 +552,11 @@ subroutine BasicPETSc_destroy() implicit none PetscErrorCode :: ierr + external :: & + VecDestroy, & + SNESDestroy, & + DMDestroy + call VecDestroy(solution_vec,ierr); CHKERRQ(ierr) call SNESDestroy(snes,ierr); CHKERRQ(ierr) call DMDestroy(da,ierr); CHKERRQ(ierr) diff --git a/src/spectral_mech_Polarisation.f90 b/src/spectral_mech_Polarisation.f90 index d7f1599e5..ed44793bb 100644 --- a/src/spectral_mech_Polarisation.f90 +++ b/src/spectral_mech_Polarisation.f90 @@ -22,7 +22,7 @@ module spectral_mech_Polarisation DAMASK_spectral_solverPolarisation_label = 'polarisation' !-------------------------------------------------------------------------------------------------- -! derived types +! derived types type(tSolutionParams), private :: params real(pReal), private, dimension(3,3) :: mask_stress = 0.0_pReal @@ -31,7 +31,7 @@ module spectral_mech_Polarisation DM, private :: da SNES, private :: snes Vec, private :: solution_vec - + !-------------------------------------------------------------------------------------------------- ! common pointwise data real(pReal), private, dimension(:,:,:,:,:), allocatable :: & @@ -57,7 +57,7 @@ module spectral_mech_Polarisation S = 0.0_pReal, & !< current compliance (filled up with zeros) C_scale = 0.0_pReal, & S_scale = 0.0_pReal - + real(pReal), private :: & err_BC, & !< deviation from stress BC err_curl, & !< RMS of curl of F @@ -72,21 +72,7 @@ module spectral_mech_Polarisation Polarisation_forward, & Polarisation_destroy external :: & - VecDestroy, & - DMDestroy, & - DMDACreate3D, & - DMCreateGlobalVector, & - DMDASNESSetFunctionLocal, & PETScFinalize, & - SNESDestroy, & - SNESGetNumberFunctionEvals, & - SNESGetIterationNumber, & - SNESSolve, & - SNESSetDM, & - SNESGetConvergedReason, & - SNESSetConvergenceTest, & - SNESSetFromOptions, & - SNESCreate, & MPI_Abort, & MPI_Bcast, & MPI_Allreduce @@ -130,17 +116,25 @@ subroutine Polarisation_init temp33_Real = 0.0_pReal PetscErrorCode :: ierr - PetscObject :: dummy PetscScalar, pointer, dimension(:,:,:,:) :: xx_psc, F, F_tau integer(pInt), dimension(:), allocatable :: localK integer(pInt) :: proc character(len=1024) :: rankStr - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverPolarisation init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + external :: & + SNESCreate, & + SNESSetOptionsPrefix, & + DMDACreate3D, & + SNESSetDM, & + DMCreateGlobalVector, & + DMDASNESSetFunctionLocal, & + SNESGetConvergedReason, & + SNESSetConvergenceTest, & + SNESSetFromOptions + + write(6,'(/,a)') ' <<<+- DAMASK_spectral_solverPolarisation init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif !-------------------------------------------------------------------------------------------------- ! allocate global fields @@ -150,7 +144,7 @@ subroutine Polarisation_init allocate (F_tauDot (3,3,grid(1),grid(2),grid3),source = 0.0_pReal) !-------------------------------------------------------------------------------------------------- -! PETSc Init +! initialize solver specific parts of PETSc call SNESCreate(PETSC_COMM_WORLD,snes,ierr); CHKERRQ(ierr) call SNESSetOptionsPrefix(snes,'mech_',ierr);CHKERRQ(ierr) allocate(localK(worldsize), source = 0); localK(worldrank+1) = grid3 @@ -163,14 +157,14 @@ subroutine Polarisation_init grid(1),grid(2),grid(3), & ! global grid 1 , 1, worldsize, & 18, 0, & ! #dof (F tensor), ghost boundary width (domain overlap) - grid (1),grid (2),localK, & ! local grid + grid(1),grid(2),localK, & ! local grid da,ierr) ! handle, error CHKERRQ(ierr) call SNESSetDM(snes,da,ierr); CHKERRQ(ierr) call DMCreateGlobalVector(da,solution_vec,ierr); CHKERRQ(ierr) - call DMDASNESSetFunctionLocal(da,INSERT_VALUES,Polarisation_formResidual,dummy,ierr) + call DMDASNESSetFunctionLocal(da,INSERT_VALUES,Polarisation_formResidual,PETSC_NULL_OBJECT,ierr) CHKERRQ(ierr) - call SNESSetConvergenceTest(snes,Polarisation_converged,dummy,PETSC_NULL_FUNCTION,ierr) + call SNESSetConvergenceTest(snes,Polarisation_converged,PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr) CHKERRQ(ierr) call SNESSetFromOptions(snes,ierr); CHKERRQ(ierr) @@ -180,9 +174,9 @@ subroutine Polarisation_init F => xx_psc(0:8,:,:,:) F_tau => xx_psc(9:17,:,:,:) restart: if (restartInc > 1_pInt) then - if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & + if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & - 'reading values of increment', restartInc - 1_pInt, 'from file' + 'reading values of increment ', restartInc - 1_pInt, ' from file' flush(6) write(rankStr,'(a1,i0)')'_',worldrank call IO_read_realFile(777,'F'//trim(rankStr),trim(getSolverJobName()),size(F)) @@ -221,7 +215,7 @@ subroutine Polarisation_init nullify(F_tau) call DMDAVecRestoreArrayF90(da,solution_vec,xx_psc,ierr); CHKERRQ(ierr) ! write data back to PETSc - readRestart: if (restartInc > 1_pInt) then + restartRead: if (restartInc > 1_pInt) then if (iand(debug_level(debug_spectral),debug_spectralRestart)/= 0 .and. worldrank == 0_pInt) & write(6,'(/,a,'//IO_intOut(restartInc-1_pInt)//',a)') & 'reading more values of increment', restartInc - 1_pInt, 'from file' @@ -235,7 +229,7 @@ subroutine Polarisation_init call IO_read_realFile(777,'C_ref',trim(getSolverJobName()),size(C_minMaxAvg)) read (777,rec=1) C_minMaxAvg close (777) - endif readRestart + endif restartRead call Utilities_updateGamma(C_minMaxAvg,.True.) C_scale = C_minMaxAvg @@ -248,7 +242,7 @@ end subroutine Polarisation_init !> @brief solution for the Polarisation scheme with internal iterations !-------------------------------------------------------------------------------------------------- type(tSolutionState) function & - Polarisation_solution(incInfoIn,guess,timeinc,timeinc_old,loadCaseTime,P_BC,F_BC,rotation_BC) + Polarisation_solution(incInfoIn,timeinc,timeinc_old,stress_BC,rotation_BC) use IO, only: & IO_error use numerics, only: & @@ -262,20 +256,16 @@ type(tSolutionState) function & use FEsolving, only: & restartWrite, & terminallyIll - + implicit none !-------------------------------------------------------------------------------------------------- ! input data for solution real(pReal), intent(in) :: & timeinc, & !< increment in time for current solution - timeinc_old, & !< increment in time of last increment - loadCaseTime !< remaining time of current load case - logical, intent(in) :: & - guess + timeinc_old !< increment in time of last increment type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC character(len=*), intent(in) :: & incInfoIn real(pReal), dimension(3,3), intent(in) :: rotation_BC @@ -285,11 +275,15 @@ type(tSolutionState) function & PetscErrorCode :: ierr SNESConvergedReason :: reason + external :: & + SNESSolve, & + SNESGetConvergedReason + incInfo = incInfoIn !-------------------------------------------------------------------------------------------------- ! update stiffness (and gamma operator) - S = Utilities_maskedCompliance(rotation_BC,P_BC%maskLogical,C_volAvg) + S = Utilities_maskedCompliance(rotation_BC,stress_BC%maskLogical,C_volAvg) if (update_gamma) then call Utilities_updateGamma(C_minMaxAvg,restartWrite) C_scale = C_minMaxAvg @@ -298,11 +292,11 @@ type(tSolutionState) function & !-------------------------------------------------------------------------------------------------- ! set module wide availabe data - mask_stress = P_BC%maskFloat - params%P_BC = P_BC%values + mask_stress = stress_BC%maskFloat + params%stress_BC = stress_BC%values params%rotation_BC = rotation_BC - params%timeinc = timeinc - params%timeincOld = timeinc_old + params%timeinc = timeinc + params%timeincOld = timeinc_old !-------------------------------------------------------------------------------------------------- ! solve BVP @@ -330,8 +324,7 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) itmax, & itmin, & polarAlpha, & - polarBeta, & - worldrank + polarBeta use mesh, only: & grid3, & grid @@ -368,10 +361,10 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) DMDA_LOCAL_INFO_SIZE) :: & in PetscScalar, target, dimension(3,3,2, & - XG_RANGE,YG_RANGE,ZG_RANGE) :: & + XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & x_scal PetscScalar, target, dimension(3,3,2, & - X_RANGE,Y_RANGE,Z_RANGE) :: & + X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & f_scal PetscScalar, pointer, dimension(:,:,:,:,:) :: & F, & @@ -385,7 +378,11 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) PetscErrorCode :: ierr integer(pInt) :: & i, j, k, e - + + external :: & + SNESGetNumberFunctionEvals, & + SNESGetIterationNumber + F => x_scal(1:3,1:3,1,& XG_RANGE,YG_RANGE,ZG_RANGE) F_tau => x_scal(1:3,1:3,2,& @@ -406,16 +403,14 @@ subroutine Polarisation_formResidual(in,x_scal,f_scal,dummy,ierr) !-------------------------------------------------------------------------------------------------- ! report begin of new iteration totalIter = totalIter + 1_pInt - if (worldrank == 0_pInt) then - write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & - ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax - if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & - math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) - write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & - math_transpose33(F_aim) - flush(6) - endif + write(6,'(1x,a,3(a,'//IO_intOut(itmax)//'))') trim(incInfo), & + ' @ Iteration ', itmin, '≤',totalIter, '≤', itmax + if (iand(debug_level(debug_spectral),debug_spectralRotation) /= 0) & + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim (lab) =', & + math_transpose33(math_rotate_backward33(F_aim,params%rotation_BC)) + write(6,'(/,a,/,3(3(f12.7,1x)/))',advance='no') ' deformation gradient aim =', & + math_transpose33(F_aim) + flush(6) endif newIteration !-------------------------------------------------------------------------------------------------- @@ -489,8 +484,7 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, err_curl_tolRel, & err_curl_tolAbs, & err_stress_tolAbs, & - err_stress_tolRel, & - worldrank + err_stress_tolRel use math, only: & math_mul3333xx33 use FEsolving, only: & @@ -505,7 +499,7 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, fnorm SNESConvergedReason :: reason PetscObject :: dummy - PetscErrorCode ::ierr + PetscErrorCode :: ierr real(pReal) :: & curlTol, & divTol, & @@ -513,9 +507,9 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, !-------------------------------------------------------------------------------------------------- ! stress BC handling - F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%P_BC))) ! S = 0.0 for no bc + F_aim = F_aim - math_mul3333xx33(S, ((P_av - params%stress_BC))) ! S = 0.0 for no bc err_BC = maxval(abs((-mask_stress+1.0_pReal)*math_mul3333xx33(C_scale,F_aim-F_av) + & - mask_stress *(P_av - params%P_BC))) ! mask = 0.0 for no bc + mask_stress *(P_av - params%stress_BC))) ! mask = 0.0 for no bc !-------------------------------------------------------------------------------------------------- ! error calculation @@ -537,31 +531,29 @@ subroutine Polarisation_converged(snes_local,PETScIter,xnorm,snorm,fnorm,reason, !-------------------------------------------------------------------------------------------------- ! report -if (worldrank == 0_pInt) then - write(6,'(1/,a)') ' ... reporting .............................................................' - write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & - err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & - err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' - write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & - err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' - write(6,'(/,a)') ' ===========================================================================' - flush(6) -endif + write(6,'(1/,a)') ' ... reporting .............................................................' + write(6,'(/,a,f12.2,a,es8.2,a,es9.2,a)') ' error curl = ', & + err_curl/curlTol,' (',err_curl,' -, tol =',curlTol,')' + write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error divergence = ', & + err_div/divTol, ' (',err_div, ' / m, tol =',divTol,')' + write(6,' (a,f12.2,a,es8.2,a,es9.2,a)') ' error BC = ', & + err_BC/BC_tol, ' (',err_BC, ' Pa, tol =',BC_tol,')' + write(6,'(/,a)') ' ===========================================================================' + flush(6) end subroutine Polarisation_converged !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC,rotation_BC) +subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,deformation_BC,stress_BC,rotation_BC) use math, only: & math_mul33x33, & math_mul3333xx33, & math_transpose33, & math_rotate_backward33 use numerics, only: & - worldrank + worldrank use mesh, only: & grid3, & grid @@ -582,8 +574,8 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC timeinc, & loadCaseTime !< remaining time of current load case type(tBoundaryCondition), intent(in) :: & - P_BC, & - F_BC + stress_BC, & + deformation_BC real(pReal), dimension(3,3), intent(in) :: rotation_BC logical, intent(in) :: & guess @@ -599,19 +591,19 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC F => xx_psc(0:8,:,:,:) F_tau => xx_psc(9:17,:,:,:) if (restartWrite) then - if (worldrank == 0_pInt) write(6,'(/,a)') ' writing converged results for restart' + write(6,'(/,a)') ' writing converged results for restart' flush(6) write(rankStr,'(a1,i0)')'_',worldrank - call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file + call IO_write_jobRealFile(777,'F'//trim(rankStr),size(F)) ! writing deformation gradient field to file write (777,rec=1) F close (777) - call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file + call IO_write_jobRealFile(777,'F_lastInc'//trim(rankStr),size(F_lastInc)) ! writing F_lastInc field to file write (777,rec=1) F_lastInc close (777) - call IO_write_jobRealFile(777,'F_tau'//trim(rankStr),size(F_tau)) ! writing deformation gradient field to file + call IO_write_jobRealFile(777,'F_tau'//trim(rankStr),size(F_tau)) ! writing deformation gradient field to file write (777,rec=1) F_tau close (777) - call IO_write_jobRealFile(777,'F_tau_lastInc'//trim(rankStr),size(F_tau_lastInc)) ! writing F_lastInc field to file + call IO_write_jobRealFile(777,'F_tau_lastInc'//trim(rankStr),size(F_tau_lastInc)) ! writing F_lastInc field to file write (777,rec=1) F_tau_lastInc close (777) if (worldrank == 0_pInt) then @@ -631,7 +623,8 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC write (777,rec=1) C_volAvgLastInc close(777) endif - endif + endif + call utilities_updateIPcoords(F) if (cutBack) then @@ -644,14 +637,14 @@ subroutine Polarisation_forward(guess,timeinc,timeinc_old,loadCaseTime,F_BC,P_BC C_volAvgLastInc = C_volAvg !-------------------------------------------------------------------------------------------------- ! calculate rate for aim - if (F_BC%myType=='l') then ! calculate f_aimDot from given L and current F - f_aimDot = F_BC%maskFloat * math_mul33x33(F_BC%values, F_aim) - elseif(F_BC%myType=='fdot') then ! f_aimDot is prescribed - f_aimDot = F_BC%maskFloat * F_BC%values - elseif(F_BC%myType=='f') then ! aim at end of load case is prescribed - f_aimDot = F_BC%maskFloat * (F_BC%values -F_aim)/loadCaseTime + if (deformation_BC%myType=='l') then ! calculate f_aimDot from given L and current F + f_aimDot = deformation_BC%maskFloat * math_mul33x33(deformation_BC%values, F_aim) + elseif(deformation_BC%myType=='fdot') then ! f_aimDot is prescribed + f_aimDot = deformation_BC%maskFloat * deformation_BC%values + elseif(deformation_BC%myType=='f') then ! aim at end of load case is prescribed + f_aimDot = deformation_BC%maskFloat * (deformation_BC%values -F_aim)/loadCaseTime endif - if (guess) f_aimDot = f_aimDot + P_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old + if (guess) f_aimDot = f_aimDot + stress_BC%maskFloat * (F_aim - F_aim_lastInc)/timeinc_old F_aim_lastInc = F_aim !-------------------------------------------------------------------------------------------------- @@ -701,6 +694,11 @@ subroutine Polarisation_destroy() implicit none PetscErrorCode :: ierr + external :: & + VecDestroy, & + SNESDestroy, & + DMDestroy + call VecDestroy(solution_vec,ierr); CHKERRQ(ierr) call SNESDestroy(snes,ierr); CHKERRQ(ierr) call DMDestroy(da,ierr); CHKERRQ(ierr) diff --git a/src/spectral_thermal.f90 b/src/spectral_thermal.f90 index 83e290a4c..490325ab7 100644 --- a/src/spectral_thermal.f90 +++ b/src/spectral_thermal.f90 @@ -42,7 +42,6 @@ module spectral_thermal integer(pInt), private :: totalIter = 0_pInt !< total iteration in current increment real(pReal), dimension(3,3), private :: D_ref real(pReal), private :: mobility_ref - character(len=1024), private :: incInfo public :: & spectral_thermal_init, & @@ -50,21 +49,7 @@ module spectral_thermal spectral_thermal_forward, & spectral_thermal_destroy external :: & - VecDestroy, & - DMDestroy, & - DMDACreate3D, & - DMCreateGlobalVector, & - DMDASNESSetFunctionLocal, & PETScFinalize, & - SNESDestroy, & - SNESGetNumberFunctionEvals, & - SNESGetIterationNumber, & - SNESSolve, & - SNESSetDM, & - SNESGetConvergedReason, & - SNESSetConvergenceTest, & - SNESSetFromOptions, & - SNESCreate, & MPI_Abort, & MPI_Bcast, & MPI_Allreduce @@ -99,10 +84,19 @@ subroutine spectral_thermal_init integer(pInt) :: proc integer(pInt) :: i, j, k, cell DM :: thermal_grid - PetscScalar, pointer :: x_scal(:,:,:) + PetscScalar, dimension(:,:,:), pointer :: x_scal PetscErrorCode :: ierr - PetscObject :: dummy + external :: & + SNESCreate, & + SNESSetOptionsPrefix, & + DMDACreate3D, & + SNESSetDM, & + DMDAGetCorners, & + DMCreateGlobalVector, & + DMDASNESSetFunctionLocal, & + SNESSetFromOptions + mainProcess: if (worldrank == 0_pInt) then write(6,'(/,a)') ' <<<+- spectral_thermal init -+>>>' write(6,'(a15,a)') ' Current time: ',IO_timeStamp() @@ -128,7 +122,8 @@ subroutine spectral_thermal_init CHKERRQ(ierr) call SNESSetDM(thermal_snes,thermal_grid,ierr); CHKERRQ(ierr) ! connect snes to da call DMCreateGlobalVector(thermal_grid,solution ,ierr); CHKERRQ(ierr) ! global solution vector (grid x 1, i.e. every def grad tensor) - call DMDASNESSetFunctionLocal(thermal_grid,INSERT_VALUES,spectral_thermal_formResidual,dummy,ierr) ! residual vector of same shape as solution vector + call DMDASNESSetFunctionLocal(thermal_grid,INSERT_VALUES,spectral_thermal_formResidual,& + PETSC_NULL_OBJECT,ierr) ! residual vector of same shape as solution vector CHKERRQ(ierr) call SNESSetFromOptions(thermal_snes,ierr); CHKERRQ(ierr) ! pull it all together with additional cli arguments @@ -154,6 +149,8 @@ subroutine spectral_thermal_init x_scal(xstart:xend,ystart:yend,zstart:zend) = temperature_current call DMDAVecRestoreArrayF90(thermal_grid,solution,x_scal,ierr); CHKERRQ(ierr) +!-------------------------------------------------------------------------------------------------- +! thermal reference diffusion update cell = 0_pInt D_ref = 0.0_pReal mobility_ref = 0.0_pReal @@ -171,17 +168,13 @@ subroutine spectral_thermal_init end subroutine spectral_thermal_init !-------------------------------------------------------------------------------------------------- -!> @brief solution for the Basic PETSC scheme with internal iterations +!> @brief solution for the spectral thermal scheme with internal iterations !-------------------------------------------------------------------------------------------------- -type(tSolutionState) function spectral_thermal_solution(guess,timeinc,timeinc_old,loadCaseTime) +type(tSolutionState) function spectral_thermal_solution(timeinc,timeinc_old,loadCaseTime) use numerics, only: & itmax, & err_thermal_tolAbs, & err_thermal_tolRel - use spectral_utilities, only: & - tBoundaryCondition, & - Utilities_maskedCompliance, & - Utilities_updateGamma use mesh, only: & grid, & grid3 @@ -196,16 +189,21 @@ type(tSolutionState) function spectral_thermal_solution(guess,timeinc,timeinc_ol timeinc, & !< increment in time for current solution timeinc_old, & !< increment in time of last increment loadCaseTime !< remaining time of current load case - logical, intent(in) :: guess integer(pInt) :: i, j, k, cell PetscInt :: position PetscReal :: minTemperature, maxTemperature, stagNorm, solnNorm - + !-------------------------------------------------------------------------------------------------- ! PETSc Data PetscErrorCode :: ierr SNESConvergedReason :: reason - + + external :: & + VecMin, & + VecMax, & + SNESSolve, & + SNESGetConvergedReason + spectral_thermal_solution%converged =.false. !-------------------------------------------------------------------------------------------------- @@ -246,7 +244,7 @@ type(tSolutionState) function spectral_thermal_solution(guess,timeinc,timeinc_ol if (worldrank == 0) then if (spectral_thermal_solution%converged) & write(6,'(/,a)') ' ... thermal conduction converged ..................................' - write(6,'(/,a,f8.4,2x,f8.4,2x,f8.4,/)',advance='no') ' Minimum|Maximum|Delta Temperature = ',& + write(6,'(/,a,f8.4,2x,f8.4,2x,f8.4,/)',advance='no') ' Minimum|Maximum|Delta Temperature / K = ',& minTemperature, maxTemperature, stagNorm write(6,'(/,a)') ' ===========================================================================' flush(6) @@ -284,10 +282,10 @@ subroutine spectral_thermal_formResidual(in,x_scal,f_scal,dummy,ierr) DMDALocalInfo, dimension(DMDA_LOCAL_INFO_SIZE) :: & in PetscScalar, dimension( & - XG_RANGE,YG_RANGE,ZG_RANGE) :: & + XG_RANGE,YG_RANGE,ZG_RANGE), intent(in) :: & x_scal PetscScalar, dimension( & - X_RANGE,Y_RANGE,Z_RANGE) :: & + X_RANGE,Y_RANGE,Z_RANGE), intent(out) :: & f_scal PetscObject :: dummy PetscErrorCode :: ierr @@ -338,7 +336,7 @@ end subroutine spectral_thermal_formResidual !-------------------------------------------------------------------------------------------------- !> @brief forwarding routine !-------------------------------------------------------------------------------------------------- -subroutine spectral_thermal_forward(guess,timeinc,timeinc_old,loadCaseTime) +subroutine spectral_thermal_forward() use mesh, only: & grid, & grid3 @@ -352,15 +350,13 @@ subroutine spectral_thermal_forward(guess,timeinc,timeinc_old,loadCaseTime) thermal_conduction_getSpecificHeat implicit none - real(pReal), intent(in) :: & - timeinc_old, & - timeinc, & - loadCaseTime !< remaining time of current load case - logical, intent(in) :: guess integer(pInt) :: i, j, k, cell DM :: dm_local - PetscScalar, pointer :: x_scal(:,:,:) + PetscScalar, dimension(:,:,:), pointer :: x_scal PetscErrorCode :: ierr + + external :: & + SNESGetDM if (cutBack) then temperature_current = temperature_lastInc @@ -409,6 +405,10 @@ subroutine spectral_thermal_destroy() implicit none PetscErrorCode :: ierr + external :: & + VecDestroy, & + SNESDestroy + call VecDestroy(solution,ierr); CHKERRQ(ierr) call SNESDestroy(thermal_snes,ierr); CHKERRQ(ierr) diff --git a/src/spectral_utilities.f90 b/src/spectral_utilities.f90 index 8344ff7ce..34eb0eab0 100644 --- a/src/spectral_utilities.f90 +++ b/src/spectral_utilities.f90 @@ -1,3 +1,4 @@ +!-------------------------------------------------------------------------------------------------- !> @author Martin Diehl, Max-Planck-Institut für Eisenforschung GmbH !> @author Philip Eisenlohr, Max-Planck-Institut für Eisenforschung GmbH !> @brief Utilities used by the different spectral solver variants @@ -84,7 +85,7 @@ module spectral_utilities type, public :: tLoadCase real(pReal), dimension (3,3) :: rotation = math_I3 !< rotation of BC - type(tBoundaryCondition) :: P, & !< stress BC + type(tBoundaryCondition) :: stress, & !< stress BC deformation !< deformation BC (Fdot or L) real(pReal) :: time = 0.0_pReal !< length of increment integer(pInt) :: incs = 0_pInt, & !< number of increments @@ -96,14 +97,12 @@ module spectral_utilities end type tLoadCase type, public :: tSolutionParams !< @todo use here the type definition for a full loadcase including mask - real(pReal), dimension(3,3) :: P_BC, rotation_BC + real(pReal), dimension(3,3) :: stress_BC, rotation_BC real(pReal) :: timeinc real(pReal) :: timeincOld real(pReal) :: density end type tSolutionParams - type(tSolutionParams), private :: params - type, public :: phaseFieldDataBin !< set of parameters defining a phase field real(pReal) :: diffusion = 0.0_pReal, & !< thermal conductivity mobility = 0.0_pReal, & !< thermal mobility @@ -174,8 +173,7 @@ subroutine utilities_init() memory_efficient, & petsc_defaultOptions, & petsc_options, & - divergence_correction, & - worldrank + divergence_correction use debug, only: & debug_level, & debug_SPECTRAL, & @@ -214,11 +212,9 @@ subroutine utilities_init() vecSize = 3_C_INTPTR_T, & tensorSize = 9_C_INTPTR_T - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- spectral_utilities init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- spectral_utilities init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess !-------------------------------------------------------------------------------------------------- ! set debugging parameters @@ -226,30 +222,31 @@ subroutine utilities_init() debugRotation = iand(debug_level(debug_SPECTRAL),debug_SPECTRALROTATION) /= 0 debugPETSc = iand(debug_level(debug_SPECTRAL),debug_SPECTRALPETSC) /= 0 - if(debugPETSc .and. worldrank == 0_pInt) write(6,'(3(/,a),/)') & + if(debugPETSc) write(6,'(3(/,a),/)') & ' Initializing PETSc with debug options: ', & trim(PETScDebug), & - ' add more using the PETSc_Options keyword in numerics.config ' - flush(6) + ' add more using the PETSc_Options keyword in numerics.config '; flush(6) + call PetscOptionsClear(ierr); CHKERRQ(ierr) - if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr); CHKERRQ(ierr) - call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr); CHKERRQ(ierr) - call PetscOptionsInsertString(trim(petsc_options),ierr); CHKERRQ(ierr) + if(debugPETSc) call PetscOptionsInsertString(trim(PETSCDEBUG),ierr) + CHKERRQ(ierr) + call PetscOptionsInsertString(trim(petsc_defaultOptions),ierr) + CHKERRQ(ierr) + call PetscOptionsInsertString(trim(petsc_options),ierr) + CHKERRQ(ierr) grid1Red = grid(1)/2_pInt + 1_pInt wgt = 1.0/real(product(grid),pReal) - if (worldrank == 0) then - write(6,'(a,3(i12 ))') ' grid a b c: ', grid - write(6,'(a,3(es12.5))') ' size x y z: ', geomSize - endif + write(6,'(a,3(i12 ))') ' grid a b c: ', grid + write(6,'(a,3(es12.5))') ' size x y z: ', geomSize select case (spectral_derivative) - case ('continuous') ! default, no weighting + case ('continuous') spectral_derivative_ID = DERIVATIVE_CONTINUOUS_ID - case ('central_difference') ! cosine curve with 1 for avg and zero for highest freq + case ('central_difference') spectral_derivative_ID = DERIVATIVE_CENTRAL_DIFF_ID - case ('fwbw_difference') ! gradient, might need grid scaling as for cosine filter + case ('fwbw_difference') spectral_derivative_ID = DERIVATIVE_FWBW_DIFF_ID case default call IO_error(892_pInt,ext_msg=trim(spectral_derivative)) @@ -265,8 +262,9 @@ subroutine utilities_init() enddo elseif (divergence_correction == 2_pInt) then do j = 1_pInt, 3_pInt - if (j /= minloc(geomSize/grid,1) .and. j /= maxloc(geomSize/grid,1)) & - scaledGeomSize = geomSize/geomSize(j)*grid(j) + if ( j /= int(minloc(geomSize/real(grid,pReal),1),pInt) & + .and. j /= int(maxloc(geomSize/real(grid,pReal),1),pInt)) & + scaledGeomSize = geomSize/geomSize(j)*real(grid(j),pReal) enddo else scaledGeomSize = geomSize @@ -277,9 +275,9 @@ subroutine utilities_init() ! MPI allocation gridFFTW = int(grid,C_INTPTR_T) alloc_local = fftw_mpi_local_size_3d(gridFFTW(3), gridFFTW(2), gridFFTW(1)/2 +1, & - MPI_COMM_WORLD, local_K, local_K_offset) - allocate (xi1st (3,grid1Red,grid(2),grid3),source = cmplx(0.0_pReal,0.0_pReal,pReal)) ! frequencies, only half the size for first dimension - allocate (xi2nd (3,grid1Red,grid(2),grid3),source = cmplx(0.0_pReal,0.0_pReal,pReal)) ! frequencies, only half the size for first dimension + PETSC_COMM_WORLD, local_K, local_K_offset) + allocate (xi1st (3,grid1Red,grid(2),grid3),source = cmplx(0.0_pReal,0.0_pReal,pReal)) ! frequencies for first derivatives, only half the size for first dimension + allocate (xi2nd (3,grid1Red,grid(2),grid3),source = cmplx(0.0_pReal,0.0_pReal,pReal)) ! frequencies for second derivatives, only half the size for first dimension tensorField = fftw_alloc_complex(tensorSize*alloc_local) call c_f_pointer(tensorField, tensorField_real, [3_C_INTPTR_T,3_C_INTPTR_T, & @@ -304,12 +302,12 @@ subroutine utilities_init() planTensorForth = fftw_mpi_plan_many_dft_r2c(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order tensorSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, &! no. of transforms, default iblock and oblock tensorField_real, tensorField_fourier, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision + PETSC_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision if (.not. C_ASSOCIATED(planTensorForth)) call IO_error(810, ext_msg='planTensorForth') planTensorBack = fftw_mpi_plan_many_dft_c2r(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order tensorSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, &! no. of transforms, default iblock and oblock tensorField_fourier,tensorField_real, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! all processors, planer precision + PETSC_COMM_WORLD, fftw_planner_flag) ! all processors, planer precision if (.not. C_ASSOCIATED(planTensorBack)) call IO_error(810, ext_msg='planTensorBack') !-------------------------------------------------------------------------------------------------- @@ -317,12 +315,12 @@ subroutine utilities_init() planVectorForth = fftw_mpi_plan_many_dft_r2c(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order vecSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, &! no. of transforms, default iblock and oblock vectorField_real, vectorField_fourier, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision + PETSC_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision if (.not. C_ASSOCIATED(planVectorForth)) call IO_error(810, ext_msg='planVectorForth') planVectorBack = fftw_mpi_plan_many_dft_c2r(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order vecSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, & ! no. of transforms, default iblock and oblock vectorField_fourier,vectorField_real, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! all processors, planer precision + PETSC_COMM_WORLD, fftw_planner_flag) ! all processors, planer precision if (.not. C_ASSOCIATED(planVectorBack)) call IO_error(810, ext_msg='planVectorBack') !-------------------------------------------------------------------------------------------------- @@ -330,12 +328,12 @@ subroutine utilities_init() planScalarForth = fftw_mpi_plan_many_dft_r2c(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order scalarSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, & ! no. of transforms, default iblock and oblock scalarField_real, scalarField_fourier, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision + PETSC_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision if (.not. C_ASSOCIATED(planScalarForth)) call IO_error(810, ext_msg='planScalarForth') - planScalarBack = fftw_mpi_plan_many_dft_c2r(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order, no. of transforms + planScalarBack = fftw_mpi_plan_many_dft_c2r(3, [gridFFTW(3),gridFFTW(2),gridFFTW(1)], & ! dimension, logical length in each dimension in reversed order, no. of transforms scalarSize, FFTW_MPI_DEFAULT_BLOCK, FFTW_MPI_DEFAULT_BLOCK, & ! no. of transforms, default iblock and oblock - scalarField_fourier,scalarField_real, & ! input data, output data - MPI_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision + scalarField_fourier,scalarField_real, & ! input data, output data + PETSC_COMM_WORLD, fftw_planner_flag) ! use all processors, planer precision if (.not. C_ASSOCIATED(planScalarBack)) call IO_error(810, ext_msg='planScalarBack') !-------------------------------------------------------------------------------------------------- @@ -343,8 +341,7 @@ subroutine utilities_init() if (pReal /= C_DOUBLE .or. pInt /= C_INT) call IO_error(0_pInt,ext_msg='Fortran to C') ! check for correct precision in C call fftw_set_timelimit(fftw_timelimit) ! set timelimit for plan creation - if (debugGeneral .and. worldrank == 0_pInt) write(6,'(/,a)') ' FFTW initialized' - flush(6) + if (debugGeneral) write(6,'(/,a)') ' FFTW initialized'; flush(6) !-------------------------------------------------------------------------------------------------- ! calculation of discrete angular frequencies, ordered as in FFTW (wrap around) @@ -403,7 +400,7 @@ subroutine utilities_updateGamma(C,saveReference) integer(pInt) :: & i, j, k, & l, m, n, o - logical :: ierr + logical :: err C_ref = C if (saveReference) then @@ -423,11 +420,11 @@ subroutine utilities_updateGamma(C,saveReference) forall(l = 1_pInt:3_pInt, m = 1_pInt:3_pInt) & xiDyad_cmplx(l,m) = conjg(-xi1st(l,i,j,k-grid3Offset))*xi1st(m,i,j,k-grid3Offset) forall(l = 1_pInt:3_pInt, m = 1_pInt:3_pInt) & - temp33_complex(l,m) = sum(C_ref(l,1:3,m,1:3)*xiDyad_cmplx) + temp33_complex(l,m) = sum(cmplx(C_ref(l,1:3,m,1:3),0.0_pReal)*xiDyad_cmplx) matA(1:3,1:3) = real(temp33_complex); matA(4:6,4:6) = real(temp33_complex) matA(1:3,4:6) = aimag(temp33_complex); matA(4:6,1:3) = -aimag(temp33_complex) if (abs(math_det33(matA(1:3,1:3))) > 1e-16) then - call math_invert(6_pInt, matA, matInvA, ierr) + call math_invert(6_pInt, matA, matInvA, err) temp33_complex = cmplx(matInvA(1:3,1:3),matInvA(1:3,4:6),pReal) forall(l=1_pInt:3_pInt, m=1_pInt:3_pInt, n=1_pInt:3_pInt, o=1_pInt:3_pInt) & gamma_hat(l,m,n,o,i,j,k-grid3Offset) = temp33_complex(l,n)* & @@ -528,8 +525,6 @@ subroutine utilities_fourierGammaConvolution(fieldAim) use math, only: & math_det33, & math_invert - use numerics, only: & - worldrank use mesh, only: & grid3, & grid, & @@ -543,13 +538,11 @@ subroutine utilities_fourierGammaConvolution(fieldAim) integer(pInt) :: & i, j, k, & l, m, n, o - logical :: ierr + logical :: err - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... doing gamma convolution ...............................................' - flush(6) - endif + write(6,'(/,a)') ' ... doing gamma convolution ...............................................' + flush(6) !-------------------------------------------------------------------------------------------------- ! do the actual spectral method calculation (mechanical equilibrium) @@ -559,11 +552,11 @@ subroutine utilities_fourierGammaConvolution(fieldAim) forall(l = 1_pInt:3_pInt, m = 1_pInt:3_pInt) & xiDyad_cmplx(l,m) = conjg(-xi1st(l,i,j,k))*xi1st(m,i,j,k) forall(l = 1_pInt:3_pInt, m = 1_pInt:3_pInt) & - temp33_complex(l,m) = sum(C_ref(l,1:3,m,1:3)*xiDyad_cmplx) + temp33_complex(l,m) = sum(cmplx(C_ref(l,1:3,m,1:3),0.0_pReal)*xiDyad_cmplx) matA(1:3,1:3) = real(temp33_complex); matA(4:6,4:6) = real(temp33_complex) matA(1:3,4:6) = aimag(temp33_complex); matA(4:6,1:3) = -aimag(temp33_complex) if (abs(math_det33(matA(1:3,1:3))) > 1e-16) then - call math_invert(6_pInt, matA, matInvA, ierr) + call math_invert(6_pInt, matA, matInvA, err) temp33_complex = cmplx(matInvA(1:3,1:3),matInvA(1:3,4:6),pReal) forall(l=1_pInt:3_pInt, m=1_pInt:3_pInt, n=1_pInt:3_pInt, o=1_pInt:3_pInt) & gamma_hat(l,m,n,o,1,1,1) = temp33_complex(l,n)*conjg(-xi1st(o,i,j,k))*xi1st(m,i,j,k) @@ -611,8 +604,8 @@ subroutine utilities_fourierGreenConvolution(D_ref, mobility_ref, deltaT) ! do the actual spectral method calculation do k = 1_pInt, grid3; do j = 1_pInt, grid(2) ;do i = 1_pInt, grid1Red GreenOp_hat = cmplx(1.0_pReal,0.0_pReal,pReal)/ & - (cmplx(mobility_ref,0.0_pReal,pReal) + & - deltaT*sum(conjg(xi1st(1:3,i,j,k))*matmul(D_ref,xi1st(1:3,i,j,k)))) ! why not use dot_product + (cmplx(mobility_ref,0.0_pReal,pReal) + cmplx(deltaT,0.0_pReal)*& + sum(conjg(xi1st(1:3,i,j,k))* matmul(cmplx(D_ref,0.0_pReal),xi1st(1:3,i,j,k)))) ! why not use dot_product scalarField_fourier(i,j,k) = scalarField_fourier(i,j,k)*GreenOp_hat enddo; enddo; enddo @@ -623,24 +616,24 @@ end subroutine utilities_fourierGreenConvolution !> @brief calculate root mean square of divergence of field_fourier !-------------------------------------------------------------------------------------------------- real(pReal) function utilities_divergenceRMS() - use numerics, only: & - worldrank + use IO, only: & + IO_error use mesh, only: & geomSize, & grid, & grid3 implicit none - integer(pInt) :: i, j, k - PetscErrorCode :: ierr + integer(pInt) :: i, j, k, ierr + complex(pReal), dimension(3) :: rescaledGeom external :: & MPI_Allreduce - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... calculating divergence ................................................' - flush(6) - endif + write(6,'(/,a)') ' ... calculating divergence ................................................' + flush(6) + + rescaledGeom = cmplx(geomSize/scaledGeomSize,0.0_pReal) !-------------------------------------------------------------------------------------------------- ! calculating RMS divergence criterion in Fourier space @@ -648,23 +641,24 @@ real(pReal) function utilities_divergenceRMS() do k = 1_pInt, grid3; do j = 1_pInt, grid(2) do i = 2_pInt, grid1Red -1_pInt ! Has somewhere a conj. complex counterpart. Therefore count it twice. utilities_divergenceRMS = utilities_divergenceRMS & - + 2.0_pReal*(sum (real(matmul(tensorField_fourier(1:3,1:3,i,j,k),& ! (sqrt(real(a)**2 + aimag(a)**2))**2 = real(a)**2 + aimag(a)**2. do not take square root and square again - conjg(-xi1st(1:3,i,j,k))*geomSize/scaledGeomSize))**2.0_pReal)& ! --> sum squared L_2 norm of vector + + 2.0_pReal*(sum (real(matmul(tensorField_fourier(1:3,1:3,i,j,k),& ! (sqrt(real(a)**2 + aimag(a)**2))**2 = real(a)**2 + aimag(a)**2. do not take square root and square again + conjg(-xi1st(1:3,i,j,k))*rescaledGeom))**2.0_pReal)& ! --> sum squared L_2 norm of vector +sum(aimag(matmul(tensorField_fourier(1:3,1:3,i,j,k),& - conjg(-xi1st(1:3,i,j,k))*geomSize/scaledGeomSize))**2.0_pReal)) + conjg(-xi1st(1:3,i,j,k))*rescaledGeom))**2.0_pReal)) enddo utilities_divergenceRMS = utilities_divergenceRMS & ! these two layers (DC and Nyquist) do not have a conjugate complex counterpart (if grid(1) /= 1) + sum( real(matmul(tensorField_fourier(1:3,1:3,1 ,j,k), & - conjg(-xi1st(1:3,1,j,k))*geomSize/scaledGeomSize))**2.0_pReal) & + conjg(-xi1st(1:3,1,j,k))*rescaledGeom))**2.0_pReal) & + sum(aimag(matmul(tensorField_fourier(1:3,1:3,1 ,j,k), & - conjg(-xi1st(1:3,1,j,k))*geomSize/scaledGeomSize))**2.0_pReal) & + conjg(-xi1st(1:3,1,j,k))*rescaledGeom))**2.0_pReal) & + sum( real(matmul(tensorField_fourier(1:3,1:3,grid1Red,j,k), & - conjg(-xi1st(1:3,grid1Red,j,k))*geomSize/scaledGeomSize))**2.0_pReal) & + conjg(-xi1st(1:3,grid1Red,j,k))*rescaledGeom))**2.0_pReal) & + sum(aimag(matmul(tensorField_fourier(1:3,1:3,grid1Red,j,k), & - conjg(-xi1st(1:3,grid1Red,j,k))*geomSize/scaledGeomSize))**2.0_pReal) + conjg(-xi1st(1:3,grid1Red,j,k))*rescaledGeom))**2.0_pReal) enddo; enddo if(grid(1) == 1_pInt) utilities_divergenceRMS = utilities_divergenceRMS * 0.5_pReal ! counted twice in case of grid(1) == 1 call MPI_Allreduce(MPI_IN_PLACE,utilities_divergenceRMS,1,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='utilities_divergenceRMS') utilities_divergenceRMS = sqrt(utilities_divergenceRMS) * wgt ! RMS in real space calculated with Parsevals theorem from Fourier space @@ -675,69 +669,69 @@ end function utilities_divergenceRMS !> @brief calculate max of curl of field_fourier !-------------------------------------------------------------------------------------------------- real(pReal) function utilities_curlRMS() - use numerics, only: & - worldrank + use IO, only: & + IO_error use mesh, only: & geomSize, & grid, & grid3 implicit none - integer(pInt) :: i, j, k, l - complex(pReal), dimension(3,3) :: curl_fourier - PetscErrorCode :: ierr + integer(pInt) :: i, j, k, l, ierr + complex(pReal), dimension(3,3) :: curl_fourier + complex(pReal), dimension(3) :: rescaledGeom external :: & - MPI_Reduce, & MPI_Allreduce - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... calculating curl ......................................................' - flush(6) - endif + write(6,'(/,a)') ' ... calculating curl ......................................................' + flush(6) - !-------------------------------------------------------------------------------------------------- + rescaledGeom = cmplx(geomSize/scaledGeomSize,0.0_pReal) + +!-------------------------------------------------------------------------------------------------- ! calculating max curl criterion in Fourier space utilities_curlRMS = 0.0_pReal do k = 1_pInt, grid3; do j = 1_pInt, grid(2); do i = 2_pInt, grid1Red - 1_pInt do l = 1_pInt, 3_pInt - curl_fourier(l,1) = (+tensorField_fourier(l,3,i,j,k)*xi1st(2,i,j,k)*geomSize(2)/scaledGeomSize(2) & - -tensorField_fourier(l,2,i,j,k)*xi1st(3,i,j,k)*geomSize(3)/scaledGeomSize(3)) - curl_fourier(l,2) = (+tensorField_fourier(l,1,i,j,k)*xi1st(3,i,j,k)*geomSize(3)/scaledGeomSize(3) & - -tensorField_fourier(l,3,i,j,k)*xi1st(1,i,j,k)*geomSize(1)/scaledGeomSize(1)) - curl_fourier(l,3) = (+tensorField_fourier(l,2,i,j,k)*xi1st(1,i,j,k)*geomSize(1)/scaledGeomSize(1) & - -tensorField_fourier(l,1,i,j,k)*xi1st(2,i,j,k)*geomSize(2)/scaledGeomSize(2)) + curl_fourier(l,1) = (+tensorField_fourier(l,3,i,j,k)*xi1st(2,i,j,k)*rescaledGeom(2) & + -tensorField_fourier(l,2,i,j,k)*xi1st(3,i,j,k)*rescaledGeom(3)) + curl_fourier(l,2) = (+tensorField_fourier(l,1,i,j,k)*xi1st(3,i,j,k)*rescaledGeom(3) & + -tensorField_fourier(l,3,i,j,k)*xi1st(1,i,j,k)*rescaledGeom(1)) + curl_fourier(l,3) = (+tensorField_fourier(l,2,i,j,k)*xi1st(1,i,j,k)*rescaledGeom(1) & + -tensorField_fourier(l,1,i,j,k)*xi1st(2,i,j,k)*rescaledGeom(2)) enddo - utilities_curlRMS = utilities_curlRMS + & - 2.0_pReal*sum(real(curl_fourier)**2.0_pReal + aimag(curl_fourier)**2.0_pReal)! Has somewhere a conj. complex counterpart. Therefore count it twice. + utilities_curlRMS = utilities_curlRMS & + +2.0_pReal*sum(real(curl_fourier)**2.0_pReal+aimag(curl_fourier)**2.0_pReal) ! Has somewhere a conj. complex counterpart. Therefore count it twice. enddo do l = 1_pInt, 3_pInt - curl_fourier = (+tensorField_fourier(l,3,1,j,k)*xi1st(2,1,j,k)*geomSize(2)/scaledGeomSize(2) & - -tensorField_fourier(l,2,1,j,k)*xi1st(3,1,j,k)*geomSize(3)/scaledGeomSize(3)) - curl_fourier = (+tensorField_fourier(l,1,1,j,k)*xi1st(3,1,j,k)*geomSize(3)/scaledGeomSize(3) & - -tensorField_fourier(l,3,1,j,k)*xi1st(1,1,j,k)*geomSize(1)/scaledGeomSize(1)) - curl_fourier = (+tensorField_fourier(l,2,1,j,k)*xi1st(1,1,j,k)*geomSize(1)/scaledGeomSize(1) & - -tensorField_fourier(l,1,1,j,k)*xi1st(2,1,j,k)*geomSize(2)/scaledGeomSize(2)) + curl_fourier = (+tensorField_fourier(l,3,1,j,k)*xi1st(2,1,j,k)*rescaledGeom(2) & + -tensorField_fourier(l,2,1,j,k)*xi1st(3,1,j,k)*rescaledGeom(3)) + curl_fourier = (+tensorField_fourier(l,1,1,j,k)*xi1st(3,1,j,k)*rescaledGeom(3) & + -tensorField_fourier(l,3,1,j,k)*xi1st(1,1,j,k)*rescaledGeom(1)) + curl_fourier = (+tensorField_fourier(l,2,1,j,k)*xi1st(1,1,j,k)*rescaledGeom(1) & + -tensorField_fourier(l,1,1,j,k)*xi1st(2,1,j,k)*rescaledGeom(2)) enddo - utilities_curlRMS = utilities_curlRMS + & - sum(real(curl_fourier)**2.0_pReal + aimag(curl_fourier)**2.0_pReal)! this layer (DC) does not have a conjugate complex counterpart (if grid(1) /= 1) + utilities_curlRMS = utilities_curlRMS & + + sum(real(curl_fourier)**2.0_pReal + aimag(curl_fourier)**2.0_pReal) ! this layer (DC) does not have a conjugate complex counterpart (if grid(1) /= 1) do l = 1_pInt, 3_pInt - curl_fourier = (+tensorField_fourier(l,3,grid1Red,j,k)*xi1st(2,grid1Red,j,k)*geomSize(2)/scaledGeomSize(2) & - -tensorField_fourier(l,2,grid1Red,j,k)*xi1st(3,grid1Red,j,k)*geomSize(3)/scaledGeomSize(3)) - curl_fourier = (+tensorField_fourier(l,1,grid1Red,j,k)*xi1st(3,grid1Red,j,k)*geomSize(3)/scaledGeomSize(3) & - -tensorField_fourier(l,3,grid1Red,j,k)*xi1st(1,grid1Red,j,k)*geomSize(1)/scaledGeomSize(1)) - curl_fourier = (+tensorField_fourier(l,2,grid1Red,j,k)*xi1st(1,grid1Red,j,k)*geomSize(1)/scaledGeomSize(1) & - -tensorField_fourier(l,1,grid1Red,j,k)*xi1st(2,grid1Red,j,k)*geomSize(2)/scaledGeomSize(2)) + curl_fourier = (+tensorField_fourier(l,3,grid1Red,j,k)*xi1st(2,grid1Red,j,k)*rescaledGeom(2) & + -tensorField_fourier(l,2,grid1Red,j,k)*xi1st(3,grid1Red,j,k)*rescaledGeom(3)) + curl_fourier = (+tensorField_fourier(l,1,grid1Red,j,k)*xi1st(3,grid1Red,j,k)*rescaledGeom(3) & + -tensorField_fourier(l,3,grid1Red,j,k)*xi1st(1,grid1Red,j,k)*rescaledGeom(1)) + curl_fourier = (+tensorField_fourier(l,2,grid1Red,j,k)*xi1st(1,grid1Red,j,k)*rescaledGeom(1) & + -tensorField_fourier(l,1,grid1Red,j,k)*xi1st(2,grid1Red,j,k)*rescaledGeom(2)) enddo - utilities_curlRMS = utilities_curlRMS + & - sum(real(curl_fourier)**2.0_pReal + aimag(curl_fourier)**2.0_pReal)! this layer (Nyquist) does not have a conjugate complex counterpart (if grid(1) /= 1) + utilities_curlRMS = utilities_curlRMS & + + sum(real(curl_fourier)**2.0_pReal + aimag(curl_fourier)**2.0_pReal) ! this layer (Nyquist) does not have a conjugate complex counterpart (if grid(1) /= 1) enddo; enddo call MPI_Allreduce(MPI_IN_PLACE,utilities_curlRMS,1,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='utilities_curlRMS') utilities_curlRMS = sqrt(utilities_curlRMS) * wgt - if(grid(1) == 1_pInt) utilities_curlRMS = utilities_curlRMS * 0.5_pReal ! counted twice in case of grid(1) == 1 + if(grid(1) == 1_pInt) utilities_curlRMS = utilities_curlRMS * 0.5_pReal ! counted twice in case of grid(1) == 1 end function utilities_curlRMS @@ -750,8 +744,6 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) prec_isNaN use IO, only: & IO_error - use numerics, only: & - worldrank use math, only: & math_Plain3333to99, & math_plain99to3333, & @@ -783,7 +775,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) allocate (sTimesC(size_reduced,size_reduced), source =0.0_pReal) temp99_Real = math_Plain3333to99(math_rotate_forward3333(C,rot_BC)) - if(debugGeneral .and. worldrank == 0_pInt) then + if(debugGeneral) then write(6,'(/,a)') ' ... updating masked compliance ............................................' write(6,'(/,a,/,9(9(2x,f12.7,1x)/))',advance='no') ' Stiffness C (load) / GPa =',& transpose(temp99_Real)/1.e9_pReal @@ -824,7 +816,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) if(m/=n .and. abs(sTimesC(m,n)) > (0.0_pReal + 10.0e-12_pReal)) errmatinv = .true. ! off diagonal elements of S*C should be 0 enddo enddo - if((debugGeneral .or. errmatinv) .and. (worldrank == 0_pInt)) then ! report + if(debugGeneral .or. errmatinv) then write(formatString, '(I16.16)') size_reduced formatString = '(/,a,/,'//trim(formatString)//'('//trim(formatString)//'(2x,es9.2,1x)/))' write(6,trim(formatString),advance='no') ' C * S (load) ', & @@ -838,7 +830,7 @@ function utilities_maskedCompliance(rot_BC,mask_stress,C) else temp99_real = 0.0_pReal endif - if(debugGeneral .and. worldrank == 0_pInt) & ! report + if(debugGeneral) & write(6,'(/,a,/,9(9(2x,f12.7,1x)/),/)',advance='no') ' Masked Compliance (load) * GPa =', & transpose(temp99_Real*1.e9_pReal) flush(6) @@ -931,11 +923,11 @@ end subroutine utilities_fourierTensorDivergence !-------------------------------------------------------------------------------------------------- subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & P,C_volAvg,C_minmaxAvg,P_av,forwardData,rotation_BC) + use IO, only: & + IO_error use debug, only: & debug_reset, & debug_info - use numerics, only: & - worldrank use math, only: & math_transpose33, & math_rotate_forward33, & @@ -963,37 +955,28 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & real(pReal),intent(out), dimension(3,3,3,3) :: C_volAvg, C_minmaxAvg !< average stiffness real(pReal),intent(out), dimension(3,3) :: P_av !< average PK stress - real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress + real(pReal),intent(out), dimension(3,3,grid(1),grid(2),grid3) :: P !< PK stress logical :: & age integer(pInt) :: & - j,k + j,k,ierr real(pReal), dimension(3,3,3,3) :: max_dPdF, min_dPdF real(pReal) :: max_dPdF_norm, min_dPdF_norm, defgradDetMin, defgradDetMax, defgradDet - PetscErrorCode :: ierr - external :: & - MPI_Reduce, & - MPI_Allreduce - - if (worldrank == 0_pInt) then - write(6,'(/,a)') ' ... evaluating constitutive response ......................................' - flush(6) - endif + write(6,'(/,a)') ' ... evaluating constitutive response ......................................' + flush(6) age = .False. if (forwardData) then ! aging results age = .True. materialpoint_F0 = reshape(F_lastInc, [3,3,1,product(grid(1:2))*grid3]) endif - if (cutBack) then ! restore saved variables - age = .False. - endif + if (cutBack) age = .False. ! restore saved variables materialpoint_F = reshape(F,[3,3,1,product(grid(1:2))*grid3]) - call debug_reset() + call debug_reset() ! this has no effect on rank >0 !-------------------------------------------------------------------------------------------------- ! calculate bounds of det(F) and report @@ -1005,13 +988,10 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & defgradDetMax = max(defgradDetMax,defgradDet) defgradDetMin = min(defgradDetMin,defgradDet) end do - call MPI_reduce(MPI_IN_PLACE,defgradDetMax,1,MPI_DOUBLE,MPI_MAX,0,PETSC_COMM_WORLD,ierr) - call MPI_reduce(MPI_IN_PLACE,defgradDetMin,1,MPI_DOUBLE,MPI_MIN,0,PETSC_COMM_WORLD,ierr) - if (worldrank == 0_pInt) then - write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax - write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin - flush(6) - endif + + write(6,'(a,1x,es11.4)') ' max determinant of deformation =', defgradDetMax + write(6,'(a,1x,es11.4)') ' min determinant of deformation =', defgradDetMin + flush(6) endif call CPFEM_general(age,timeinc) @@ -1032,14 +1012,16 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & end do call MPI_Allreduce(MPI_IN_PLACE,max_dPdF,81,MPI_DOUBLE,MPI_MAX,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce max') call MPI_Allreduce(MPI_IN_PLACE,min_dPdF,81,MPI_DOUBLE,MPI_MIN,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='MPI_Allreduce min') C_minmaxAvg = 0.5_pReal*(max_dPdF + min_dPdF) C_volAvg = sum(sum(materialpoint_dPdF,dim=6),dim=5) * wgt call MPI_Allreduce(MPI_IN_PLACE,C_volAvg,81,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - call debug_info() + call debug_info() ! this has no effect on rank >0 restartWrite = .false. ! reset restartWrite status cutBack = .false. ! reset cutBack status @@ -1047,15 +1029,13 @@ subroutine utilities_constitutiveResponse(F_lastInc,F,timeinc, & P = reshape(materialpoint_P, [3,3,grid(1),grid(2),grid3]) P_av = sum(sum(sum(P,dim=5),dim=4),dim=3) * wgt ! average of P call MPI_Allreduce(MPI_IN_PLACE,P_av,9,MPI_DOUBLE,MPI_SUM,PETSC_COMM_WORLD,ierr) - if (debugRotation .and. worldrank == 0_pInt) & + if (debugRotation) & write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress (lab) / MPa =',& math_transpose33(P_av)*1.e-6_pReal P_av = math_rotate_forward33(P_av,rotation_BC) - if (worldrank == 0_pInt) then - write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& + write(6,'(/,a,/,3(3(2x,f12.4,1x)/))',advance='no') ' Piola--Kirchhoff stress / MPa =',& math_transpose33(P_av)*1.e-6_pReal - flush(6) - endif + flush(6) end subroutine utilities_constitutiveResponse @@ -1187,6 +1167,10 @@ end function utilities_getFreqDerivative ! convolution !-------------------------------------------------------------------------------------------------- subroutine utilities_updateIPcoords(F) + use prec, only: & + cNeq + use IO, only: & + IO_error use math, only: & math_mul33x3 use mesh, only: & @@ -1198,10 +1182,9 @@ subroutine utilities_updateIPcoords(F) implicit none real(pReal), dimension(3,3,grid(1),grid(2),grid3), intent(in) :: F - integer(pInt) :: i, j, k, m + integer(pInt) :: i, j, k, m, ierr real(pReal), dimension(3) :: step, offset_coords real(pReal), dimension(3,3) :: Favg - PetscErrorCode :: ierr external & MPI_Bcast @@ -1212,8 +1195,8 @@ subroutine utilities_updateIPcoords(F) call utilities_FFTtensorForward() call utilities_fourierTensorDivergence() - do k = 1_pInt, grid3; do j = 1_pInt, grid(2) ;do i = 1_pInt, grid1Red - if (any(abs(xi1st(1:3,i,j,k)) > tiny(0.0_pReal))) & + do k = 1_pInt, grid3; do j = 1_pInt, grid(2); do i = 1_pInt, grid1Red + if (any(cNeq(xi1st(1:3,i,j,k),cmplx(0.0_pReal,0.0_pReal)))) & vectorField_fourier(1:3,i,j,k) = vectorField_fourier(1:3,i,j,k)/ & sum(conjg(-xi1st(1:3,i,j,k))*xi1st(1:3,i,j,k)) enddo; enddo; enddo @@ -1223,12 +1206,14 @@ subroutine utilities_updateIPcoords(F) ! average F if (grid3Offset == 0_pInt) Favg = real(tensorField_fourier(1:3,1:3,1,1,1),pReal)*wgt call MPI_Bcast(Favg,9,MPI_DOUBLE,0,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='update_IPcoords') !-------------------------------------------------------------------------------------------------- ! add average to fluctuation and put (0,0,0) on (0,0,0) step = geomSize/real(grid, pReal) if (grid3Offset == 0_pInt) offset_coords = vectorField_real(1:3,1,1,1) call MPI_Bcast(offset_coords,3,MPI_DOUBLE,0,PETSC_COMM_WORLD,ierr) + if(ierr /=0_pInt) call IO_error(894_pInt, ext_msg='update_IPcoords') offset_coords = math_mul33x3(Favg,step/2.0_pReal) - offset_coords m = 1_pInt do k = 1_pInt,grid3; do j = 1_pInt,grid(2); do i = 1_pInt,grid(1) diff --git a/src/system_routines.f90 b/src/system_routines.f90 index ab1aae03f..07e12a20b 100644 --- a/src/system_routines.f90 +++ b/src/system_routines.f90 @@ -9,7 +9,8 @@ module system_routines public :: & isDirectory, & - getCWD + getCWD, & + getHostName interface @@ -29,6 +30,14 @@ interface integer(C_INT),intent(out) :: stat end subroutine getCurrentWorkDir_C + subroutine getHostName_C(str, stat) bind(C) + use, intrinsic :: ISO_C_Binding, only: & + C_INT, & + C_CHAR + character(kind=C_CHAR), dimension(1024), intent(out) :: str ! C string is an array + integer(C_INT),intent(out) :: stat + end subroutine getHostName_C + end interface @@ -85,5 +94,34 @@ logical function getCWD(str) end function getCWD + +!-------------------------------------------------------------------------------------------------- +!> @brief gets the current host name +!-------------------------------------------------------------------------------------------------- +logical function getHostName(str) + use, intrinsic :: ISO_C_Binding, only: & + C_INT, & + C_CHAR, & + C_NULL_CHAR + + implicit none + character(len=*), intent(out) :: str + character(kind=C_CHAR), dimension(1024) :: strFixedLength ! C string is an array + integer(C_INT) :: stat + integer :: i + + str = repeat('',len(str)) + call getHostName_C(strFixedLength,stat) + do i=1,1024 ! copy array components until Null string is found + if (strFixedLength(i) /= C_NULL_CHAR) then + str(i:i)=strFixedLength(i) + else + exit + endif + enddo + getHostName=merge(.True.,.False.,stat /= 0_C_INT) + +end function getHostName + end module system_routines diff --git a/src/thermal_adiabatic.f90 b/src/thermal_adiabatic.f90 index e2d26fbb1..a0626af62 100644 --- a/src/thermal_adiabatic.f90 +++ b/src/thermal_adiabatic.f90 @@ -74,8 +74,6 @@ subroutine thermal_adiabatic_init(fileUnit) temperature, & temperatureRate, & material_partHomogenization - use numerics,only: & - worldrank implicit none integer(pInt), intent(in) :: fileUnit @@ -88,11 +86,9 @@ subroutine thermal_adiabatic_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_ADIABATIC_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_ADIABATIC_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(thermal_type == THERMAL_adiabatic_ID),pInt) if (maxNinstance == 0_pInt) return @@ -236,7 +232,7 @@ subroutine thermal_adiabatic_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & thermal_typeInstance, & phase_Nsources, & phase_source, & @@ -297,8 +293,8 @@ subroutine thermal_adiabatic_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) enddo enddo - Tdot = Tdot/homogenization_Ngrains(homog) - dTdot_dT = dTdot_dT/homogenization_Ngrains(homog) + Tdot = Tdot/real(homogenization_Ngrains(homog),pReal) + dTdot_dT = dTdot_dT/real(homogenization_Ngrains(homog),pReal) end subroutine thermal_adiabatic_getSourceAndItsTangent @@ -336,8 +332,7 @@ function thermal_adiabatic_getSpecificHeat(ip,el) enddo thermal_adiabatic_getSpecificHeat = & - thermal_adiabatic_getSpecificHeat/ & - homogenization_Ngrains(mesh_element(3,el)) + thermal_adiabatic_getSpecificHeat/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function thermal_adiabatic_getSpecificHeat @@ -375,8 +370,7 @@ function thermal_adiabatic_getMassDensity(ip,el) enddo thermal_adiabatic_getMassDensity = & - thermal_adiabatic_getMassDensity/ & - homogenization_Ngrains(mesh_element(3,el)) + thermal_adiabatic_getMassDensity/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function thermal_adiabatic_getMassDensity diff --git a/src/thermal_conduction.f90 b/src/thermal_conduction.f90 index c85923050..973ae2d03 100644 --- a/src/thermal_conduction.f90 +++ b/src/thermal_conduction.f90 @@ -75,8 +75,6 @@ subroutine thermal_conduction_init(fileUnit) temperature, & temperatureRate, & material_partHomogenization - use numerics,only: & - worldrank implicit none integer(pInt), intent(in) :: fileUnit @@ -89,11 +87,9 @@ subroutine thermal_conduction_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_CONDUCTION_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_CONDUCTION_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(thermal_type == THERMAL_conduction_ID),pInt) if (maxNinstance == 0_pInt) return @@ -190,7 +186,7 @@ subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & thermal_typeInstance, & phase_Nsources, & phase_source, & @@ -252,8 +248,8 @@ subroutine thermal_conduction_getSourceAndItsTangent(Tdot, dTdot_dT, T, ip, el) enddo enddo - Tdot = Tdot/homogenization_Ngrains(homog) - dTdot_dT = dTdot_dT/homogenization_Ngrains(homog) + Tdot = Tdot/real(homogenization_Ngrains(homog),pReal) + dTdot_dT = dTdot_dT/real(homogenization_Ngrains(homog),pReal) end subroutine thermal_conduction_getSourceAndItsTangent @@ -291,8 +287,7 @@ function thermal_conduction_getConductivity33(ip,el) enddo thermal_conduction_getConductivity33 = & - thermal_conduction_getConductivity33/ & - homogenization_Ngrains(mesh_element(3,el)) + thermal_conduction_getConductivity33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function thermal_conduction_getConductivity33 @@ -330,8 +325,7 @@ function thermal_conduction_getSpecificHeat(ip,el) enddo thermal_conduction_getSpecificHeat = & - thermal_conduction_getSpecificHeat/ & - homogenization_Ngrains(mesh_element(3,el)) + thermal_conduction_getSpecificHeat/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function thermal_conduction_getSpecificHeat @@ -369,8 +363,7 @@ function thermal_conduction_getMassDensity(ip,el) enddo thermal_conduction_getMassDensity = & - thermal_conduction_getMassDensity/ & - homogenization_Ngrains(mesh_element(3,el)) + thermal_conduction_getMassDensity/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function thermal_conduction_getMassDensity diff --git a/src/thermal_isothermal.f90 b/src/thermal_isothermal.f90 index a3ac8f685..30ca7562a 100644 --- a/src/thermal_isothermal.f90 +++ b/src/thermal_isothermal.f90 @@ -23,8 +23,6 @@ subroutine thermal_isothermal_init() use IO, only: & IO_timeStamp use material - use numerics, only: & - worldrank implicit none integer(pInt) :: & @@ -32,13 +30,11 @@ subroutine thermal_isothermal_init() NofMyHomog, & sizeState - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_isothermal_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- thermal_'//THERMAL_isothermal_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - initializeInstances: do homog = 1_pInt, material_Nhomogenization + initializeInstances: do homog = 1_pInt, material_Nhomogenization myhomog: if (thermal_type(homog) == THERMAL_isothermal_ID) then NofMyHomog = count(material_homog == homog) diff --git a/src/vacancyflux_cahnhilliard.f90 b/src/vacancyflux_cahnhilliard.f90 index be68e24a0..f73f66631 100644 --- a/src/vacancyflux_cahnhilliard.f90 +++ b/src/vacancyflux_cahnhilliard.f90 @@ -90,8 +90,6 @@ subroutine vacancyflux_cahnhilliard_init(fileUnit) vacancyflux_initialCv, & material_partHomogenization, & material_partPhase - use numerics,only: & - worldrank implicit none integer(pInt), intent(in) :: fileUnit @@ -104,11 +102,9 @@ subroutine vacancyflux_cahnhilliard_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_cahnhilliard_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_cahnhilliard_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_cahnhilliard_ID),pInt) if (maxNinstance == 0_pInt) return @@ -219,7 +215,7 @@ subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & phase_source, & phase_Nsources, & SOURCE_vacancy_phenoplasticity_ID, & @@ -266,8 +262,8 @@ subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv enddo enddo - CvDot = CvDot/homogenization_Ngrains(mappingHomogenization(2,ip,el)) - dCvDot_dCv = dCvDot_dCv/homogenization_Ngrains(mappingHomogenization(2,ip,el)) + CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) end subroutine vacancyflux_cahnhilliard_getSourceAndItsTangent @@ -301,8 +297,7 @@ function vacancyflux_cahnhilliard_getMobility33(ip,el) enddo vacancyflux_cahnhilliard_getMobility33 = & - vacancyflux_cahnhilliard_getMobility33/ & - homogenization_Ngrains(mesh_element(3,el)) + vacancyflux_cahnhilliard_getMobility33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function vacancyflux_cahnhilliard_getMobility33 @@ -336,8 +331,7 @@ function vacancyflux_cahnhilliard_getDiffusion33(ip,el) enddo vacancyflux_cahnhilliard_getDiffusion33 = & - vacancyflux_cahnhilliard_getDiffusion33/ & - homogenization_Ngrains(mesh_element(3,el)) + vacancyflux_cahnhilliard_getDiffusion33/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function vacancyflux_cahnhilliard_getDiffusion33 @@ -371,8 +365,7 @@ real(pReal) function vacancyflux_cahnhilliard_getFormationEnergy(ip,el) enddo vacancyflux_cahnhilliard_getFormationEnergy = & - vacancyflux_cahnhilliard_getFormationEnergy/ & - homogenization_Ngrains(mesh_element(3,el)) + vacancyflux_cahnhilliard_getFormationEnergy/real(homogenization_Ngrains(mesh_element(3,el)),pReal) end function vacancyflux_cahnhilliard_getFormationEnergy @@ -408,7 +401,7 @@ real(pReal) function vacancyflux_cahnhilliard_getEntropicCoeff(ip,el) vacancyflux_cahnhilliard_getEntropicCoeff = & vacancyflux_cahnhilliard_getEntropicCoeff* & temperature(material_homog(ip,el))%p(thermalMapping(material_homog(ip,el))%p(ip,el))/ & - homogenization_Ngrains(material_homog(ip,el)) + real(homogenization_Ngrains(material_homog(ip,el)),pReal) end function vacancyflux_cahnhilliard_getEntropicCoeff @@ -467,8 +460,8 @@ subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent(KPot, dKPot_dC enddo enddo - KPot = KPot/homogenization_Ngrains(material_homog(ip,el)) - dKPot_dCv = dKPot_dCv/homogenization_Ngrains(material_homog(ip,el)) + KPot = KPot/real(homogenization_Ngrains(material_homog(ip,el)),pReal) + dKPot_dCv = dKPot_dCv/real(homogenization_Ngrains(material_homog(ip,el)),pReal) end subroutine vacancyflux_cahnhilliard_KinematicChemPotAndItsTangent diff --git a/src/vacancyflux_isochempot.f90 b/src/vacancyflux_isochempot.f90 index 286eb37b7..642d5a2e0 100644 --- a/src/vacancyflux_isochempot.f90 +++ b/src/vacancyflux_isochempot.f90 @@ -72,8 +72,6 @@ subroutine vacancyflux_isochempot_init(fileUnit) vacancyConcRate, & vacancyflux_initialCv, & material_partHomogenization - use numerics,only: & - worldrank implicit none integer(pInt), intent(in) :: fileUnit @@ -86,11 +84,9 @@ subroutine vacancyflux_isochempot_init(fileUnit) tag = '', & line = '' - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isochempot_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isochempot_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess maxNinstance = int(count(vacancyflux_type == VACANCYFLUX_isochempot_ID),pInt) if (maxNinstance == 0_pInt) return @@ -235,7 +231,7 @@ subroutine vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, use material, only: & homogenization_Ngrains, & mappingHomogenization, & - phaseAt, phasememberAt, & + phaseAt, & phase_source, & phase_Nsources, & SOURCE_vacancy_phenoplasticity_ID, & @@ -282,8 +278,8 @@ subroutine vacancyflux_isochempot_getSourceAndItsTangent(CvDot, dCvDot_dCv, Cv, enddo enddo - CvDot = CvDot/homogenization_Ngrains(mappingHomogenization(2,ip,el)) - dCvDot_dCv = dCvDot_dCv/homogenization_Ngrains(mappingHomogenization(2,ip,el)) + CvDot = CvDot/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) + dCvDot_dCv = dCvDot_dCv/real(homogenization_Ngrains(mappingHomogenization(2,ip,el)),pReal) end subroutine vacancyflux_isochempot_getSourceAndItsTangent diff --git a/src/vacancyflux_isoconc.f90 b/src/vacancyflux_isoconc.f90 index c32cb648d..e4c20b246 100644 --- a/src/vacancyflux_isoconc.f90 +++ b/src/vacancyflux_isoconc.f90 @@ -23,21 +23,17 @@ subroutine vacancyflux_isoconc_init() use IO, only: & IO_timeStamp use material - use numerics, only: & - worldrank implicit none integer(pInt) :: & homog, & NofMyHomog - mainProcess: if (worldrank == 0) then - write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isoconc_label//' init -+>>>' - write(6,'(a15,a)') ' Current time: ',IO_timeStamp() + write(6,'(/,a)') ' <<<+- vacancyflux_'//VACANCYFLUX_isoconc_label//' init -+>>>' + write(6,'(a15,a)') ' Current time: ',IO_timeStamp() #include "compilation_info.f90" - endif mainProcess - initializeInstances: do homog = 1_pInt, material_Nhomogenization + initializeInstances: do homog = 1_pInt, material_Nhomogenization myhomog: if (vacancyflux_type(homog) == VACANCYFLUX_isoconc_ID) then NofMyHomog = count(material_homog == homog)