diff --git a/Cassiopee/Converter/Converter/kpython b/Cassiopee/Converter/Converter/kpython index 891b855be..b8d6185f7 100755 --- a/Cassiopee/Converter/Converter/kpython +++ b/Cassiopee/Converter/Converter/kpython @@ -28,12 +28,12 @@ if [ -n "$OMP_NUM_THREADS" ] then ncpu=$OMP_NUM_THREADS # suppose que l'OMP_NUM_THREADS de env correspond a tous les coeurs disponibles else - ncpu=$(grep processor /proc/cpuinfo |tail -1 |cut -f2 -d: ) + ncpu=$(grep processor /proc/cpuinfo | tail -1 | cut -f2 -d: ) if [ -z "$ncpu" ] then ncpu=1 else - ncpu=$((ncpu + 1 )) + ncpu=$((ncpu + 1)) fi fi @@ -144,80 +144,81 @@ then else export MPIRUN=1 export OMP_NUM_THREADS=$NTHREADS - if [ "$ELSAPROD" = 'x86_r8' ] # eos - then - # intelMpi - mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'ld' ] || [ "$ELSAPROD" = 'ld_i8' ] || [ "$ELSAPROD" = 'ld_DBG' ] || [ "$ELSAPROD" = 'ld_i8_DBG' ] # ld - then - # openMpi - if [ $SANITIZE = '1' ] - then - mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -x LD_PRELOAD=$ASAN_LIB -np $NPROCS $PYTHONEXE $SCRIPT - else - mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT - fi - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'visung_r8' ] || [ "$ELSAPROD" = 'visung_r8_i8' ] # visung - then - # openMpi - mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'aus_r8' ] # austri - then - # intelMpi - mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'sat_r8' ] # sator - then - # intelMpi - mpirun $ARGS -n $NPROCS -l -ordered-output $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'sat_cas_r8' ] || [ "$ELSAPROD" = 'sat_cas_r8_i8' ] # sator-new - then - # intelMpi - mpirun $ARGS -n $NPROCS -l -ordered-output $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'spiro_el8' ] || [ "$ELSAPROD" = 'spiro_el8_i8' ] || [ "$ELSAPROD" = 'spiro_amdrm_r8' ] || [ "$ELSAPROD" = 'spiro_amdnp_r8' ] || [ "$ELSAPROD" = 'spiro_sky_r8' ] || [ "$ELSAPROD" = 'spiro_cas_r8' ] # spiro - then - # intelMpi - mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l -ordered-output $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'juno' ] || [ "$ELSAPROD" = 'juno_i8' ] || [ "$ELSAPROD" = 'juno_DBG' ] || [ "$ELSAPROD" = 'juno_i8_DBG' ] # juno - then - # intelMpi - mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l -ordered-output $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'juno_gcc' ] || [ "$ELSAPROD" = 'juno_gcc_i8' ] || [ "$ELSAPROD" = 'juno_gcc_DBG' ] || [ "$ELSAPROD" = 'juno_gcc_i8_DBG' ] # juno gcc - then - # openMpi - if [ $SANITIZE = '1' ] - then - mpirun $ARGS -x LD_PRELOAD=$ASAN_LIB -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT - else + case "$ELSAPROD" in + 'x86_r8' ) # eos + # intelMpi + mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'ld' | 'ld_*' ) # localhost + # openMpi + if [ $SANITIZE = '1' ] + then + mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -x LD_PRELOAD=$ASAN_LIB -np $NPROCS $PYTHONEXE $SCRIPT + else + mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT + fi + [ $? != 0 ] && exit 1; + ;; + 'visung_r8' | 'visung_r8_*' ) # visung + # openMpi mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT - fi - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'cob_r8' ] # cobalt - then - export OMP_NUM_THREADS=$NTHREADS - ccc_mprun -n $NPROCS $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'msys64' ] # MSYS 2 With Win64 production - then - # MSMPI - mpiexec $ARGS -np $NPROCS $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - elif [ "$ELSAPROD" = 'win64' ] # MSYS 2 With Win64 production - then - # MSMPI - mpiexec $ARGS -np $NPROCS $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - else # default - mpirun $ARGS -np $NPROCS $PYTHONEXE $SCRIPT - [ $? != 0 ] && exit 1; - fi + [ $? != 0 ] && exit 1; + ;; + 'aus_r8' ) # austri + # intelMpi + mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'sat_r8' ) # sator + # intelMpi + mpirun $ARGS -n $NPROCS -l -ordered-output $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'sat_cas_r8' | 'sat_cas_r8_*' ) # sator-new + # intelMpi + mpirun $ARGS -n $NPROCS -l -ordered-output $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'spiro_el8' | 'spiro_el8_*' | 'spiro_amdrm_r8' | 'spiro_amdnp_r8' | 'spiro_sky_r8' | 'spiro_cas_r8' ) # spiro + # intelMpi + mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l -ordered-output $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'juno_gcc' | 'juno_gcc_*' ) # juno gcc, to list before juno + # openMpi + if [ $SANITIZE = '1' ] + then + mpirun $ARGS -x LD_PRELOAD=$ASAN_LIB -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT + else + mpirun $ARGS -x OMP_NUM_THREADS=$NTHREADS -np $NPROCS $PYTHONEXE $SCRIPT + fi + [ $? != 0 ] && exit 1; + ;; + 'juno' | 'juno_*' ) # juno + # intelMpi + mpirun $ARGS -n $NPROCS -genv OMP_NUM_THREADS=$NTHREADS -l -ordered-output $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'cob_r8' ) # cobalt + export OMP_NUM_THREADS=$NTHREADS + ccc_mprun -n $NPROCS $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'msys64' ) # MSYS 2 With Win64 production + # MSMPI + mpiexec $ARGS -np $NPROCS $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + 'win64' ) # MSYS 2 With Win64 production + # MSMPI + mpiexec $ARGS -np $NPROCS $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + ;; + *) # default + mpirun $ARGS -np $NPROCS $PYTHONEXE $SCRIPT + [ $? != 0 ] && exit 1; + esac unset MPIRUN export OMP_NUM_THREADS=$OMPNUMTHREADSINIT fi diff --git a/Cassiopee/Envs/env_Cassiopee_local b/Cassiopee/Envs/env_Cassiopee_local index 66c2daa7e..b94bdf9e7 100644 --- a/Cassiopee/Envs/env_Cassiopee_local +++ b/Cassiopee/Envs/env_Cassiopee_local @@ -2,6 +2,7 @@ # *Cassiopee* machine specific (local) variables # Preliminary checks +unset ELSAPROD if ($?CASSIOPEE == 0) then echo "You must specify a CASSIOPEE variable in your environment." echo "This variable specifies the installation path of *Cassiopee*." @@ -38,37 +39,41 @@ set MAC0=`echo $KC | grep 'node6.cluster'`; if ($%MAC0 != 0) set MAC="macosx" set MAC0=`echo $KC | grep 'topaze'`; if ($%MAC0 != 0) set MAC="topaze" # Detect MAC environment from MACHINE -set INTTYPE="" -set DBGMODE="" -if ($?MACHINE == 0) then - if ($?MAC == 0) then - echo 'Your machine is not known by uname. Try to set MACHINE.' - endif -else - if ("$MACHINE" == "i8") then - set INTTYPE="_i8" - else if ("$MACHINE" == "DBG") then +set EXT="" +if ("$MACHINE" != "") then + set INTTYPE="" + set DBGMODE="" + set BRANCHNAME="" + set MACHINETMP="$MACHINE" + + if ("$MACHINETMP" =~ *_DBG*) then + set MACHINETMP=`echo "$MACHINETMP" | sed 's/_DBG//g'` set DBGMODE="_DBG" - else if ("$MACHINE" == "i8_DBG") then + endif + + if ("$MACHINETMP" =~ *_i8*) then + set MACHINETMP=`echo "$MACHINETMP" | sed 's/_i8//g'` set INTTYPE="_i8" - set DBGMODE="_DBG" - else if ("$MACHINE" =~ "*_DBG") then - set MAC=`echo $MACHINE | rev | cut -c 5- | rev` - set DBGMODE="_DBG" - if ("$MAC" =~ "*_i8") then - set MAC=`echo $MACHINE | rev | cut -c 4- | rev` - set INTTYPE="_i8" - endif - else - if ("$MACHINE" =~ "*_i8") then - set MAC=`echo $MACHINE | rev | cut -c 4- | rev` - set INTTYPE="_i8" - else - set MAC=$MACHINE - endif endif + + if ("$MACHINETMP" =~ *_b-*) then + set BRANCHNAME=`echo "$MACHINETMP" | sed -n 's/.*_b-\(.*\)/\1/p'` + set BRANCHNAME=`echo "$BRANCHNAME" | sed 's/_.*//g'` + set MACHINETMP=`echo "$MACHINETMP" | sed "s/_b-$BRANCHNAME//"` + set MACHINETMP=`echo "$MACHINETMP" | sed 's/_$//'` + set BRANCHNAME="_$BRANCHNAME" + endif + + setenv MAC "$MACHINETMP" + set EXT="$BRANCHNAME$INTTYPE$DBGMODE" + unset MACHINETMP BRANCHNAME INTTYPE DBGMODE +endif + +# Check if MAC is empty +if ("$MAC" == "") then + echo 'Your machine is not known by uname. Try to set MACHINE.' + return 1 endif -set EXT=$INTTYPE$DBGMODE # ----------------------------- Prods ------------------------------------------ diff --git a/Cassiopee/Envs/sh_Cassiopee_local b/Cassiopee/Envs/sh_Cassiopee_local index ef4550a78..5937b0df6 100644 --- a/Cassiopee/Envs/sh_Cassiopee_local +++ b/Cassiopee/Envs/sh_Cassiopee_local @@ -2,6 +2,7 @@ # *Cassiopee* machine specific (local) variables # Preliminary checks +unset ELSAPROD if [ "$CASSIOPEE" = "" ]; then echo "You must specify a CASSIOPEE variable in your environment." echo "This variable specifies the installation path of *Cassiopee*." @@ -43,39 +44,40 @@ if echo "$KC" | grep -q 'Aryen'; then export MAC="aryen"; fi if echo "$KC" | grep -q 'WDAAA161Z'; then export MAC="WDAAA161Z"; fi # Detect MAC environement from MACHINE -INTTYPE="" -DBGMODE="" -case $MACHINE in - *_DBG) - MACHINETMP=${MACHINE%"_DBG"} +EXT="" +if [ -n "$MACHINE" ]; then + INTTYPE="" + DBGMODE="" + BRANCHNAME="" + MACHINETMP=$MACHINE + if [ "${MACHINETMP#*_DBG*}" != "$MACHINETMP" ]; then + MACHINETMP="${MACHINETMP//_DBG/}" DBGMODE="_DBG" - ;; - DBG) - DBGMODE="_DBG" - ;; - *) - MACHINETMP=$MACHINE - ;; -esac -case $MACHINETMP in - *_i8*) - export MAC=${MACHINETMP%"_i8"} - INTTYPE="_i8" - ;; - i8*) + fi + + if [ "${MACHINETMP#*_i8*}" != "$MACHINETMP" ]; then + MACHINETMP="${MACHINETMP//_i8/}" INTTYPE="_i8" - ;; - "") - if [ -z "$MAC" ]; then - echo 'Your machine is not known by uname. Try to set MACHINE.' - fi - ;; - *) - export MAC=$MACHINETMP - ;; -esac -unset MACHINETMP -EXT=$INTTYPE$DBGMODE + fi + + if [ "${MACHINETMP#*_b-*}" != "$MACHINETMP" ]; then + BRANCHNAME=${MACHINETMP#*_b-$BRANCHNAME} + BRANCHNAME=${BRANCHNAME%_*} + MACHINETMP="${MACHINETMP//_b-$BRANCHNAME/}" + MACHINETMP=${MACHINETMP%_} + BRANCHNAME="_$BRANCHNAME" + fi + + export MAC=$MACHINETMP + EXT=$BRANCHNAME$INTTYPE$DBGMODE + unset MACHINETMP BRANCHNAME INTTYPE DBGMODE +fi + +if [ -z "$MAC" ]; then + echo 'Your machine is not known by uname. Try to set MACHINE.' + return 1 +fi + # ----------------------------- Prods ------------------------------------------ if [ "$MAC" = "ld_eos8" ]; then diff --git a/Cassiopee/KCore/Dist.py b/Cassiopee/KCore/Dist.py index 977042fee..e04667352 100644 --- a/Cassiopee/KCore/Dist.py +++ b/Cassiopee/KCore/Dist.py @@ -86,7 +86,7 @@ def getDataFolderName(name='Data'): if not '_i8' in elsaprod and EDOUBLEINT: print("Warning: ELSAPROD {} compiled in i8 but recommended suffix " "'_i8' is missing".format(elsaprod)) - if not elsaprod.endswith('_DBG') and DEBUG: + if not '_DBG' in elsaprod and DEBUG: print("Warning: ELSAPROD {} compiled in DEBUG but recommended " "suffix '_DBG' is missing".format(elsaprod)) name += '_' + elsaprod @@ -320,7 +320,14 @@ def writeInstallPath(): p.write('libPath = \'%s/local/%s\'\n'%(prefix,Lib)) else: p.write('libPath = \'%s/%s\'\n'%(prefix,Lib)) - p.write('includePath = \'%s\'\n'%(os.getcwd())) + cwd = os.getcwd() + p.write('includePath = \'%s\'\n'%(cwd)) + gitOrigin = getGitOrigin(cwd) + gitBranch = getGitBranch(cwd) + gitHash = getGitHash(cwd)[:7] + p.write('gitOrigin = \'%s\'\n'%(gitOrigin)) + p.write('gitBranch = \'%s\'\n'%(gitBranch)) + p.write('gitHash = \'%s\'\n'%(gitHash)) p.close() #============================================================================== diff --git a/Cassiopee/KCore/switchDebugMode.py b/Cassiopee/KCore/switchDebugMode.py index 3de977c9b..fddace7dd 100644 --- a/Cassiopee/KCore/switchDebugMode.py +++ b/Cassiopee/KCore/switchDebugMode.py @@ -59,9 +59,9 @@ def writeDist(contents): def check_elsaprod(dbgMode): elsaprod = os.getenv("ELSAPROD") if elsaprod is not None: - if dbgMode and not elsaprod.endswith("_DBG"): + if dbgMode and not "_DBG" in elsaprod: print("Add '_DBG' suffix to $ELSAPROD: {}_DBG".format(elsaprod)) - elif not dbgMode and elsaprod.endswith("_DBG"): + elif not dbgMode and "_DBG" in elsaprod: print("Remove '_DBG' suffix from $ELSAPROD: {}".format(elsaprod[:-4])) return diff --git a/Cassiopee/KCore/switchIntSize.py b/Cassiopee/KCore/switchIntSize.py index 77d89d5fe..e582e101e 100644 --- a/Cassiopee/KCore/switchIntSize.py +++ b/Cassiopee/KCore/switchIntSize.py @@ -80,7 +80,7 @@ def check_elsaprod(intSize): print("Remove '_i8' suffix from $ELSAPROD: {}".format( elsaprod.replace('_i8', ''))) elif intSize == 8 and "_i8" not in elsaprod: - if elsaprod.endswith('_DBG'): + if '_DBG' in elsaprod: print("Add '_i8_DBG' suffix to $ELSAPROD: {}_i8_DBG".format( elsaprod[:-4])) else: