Skip to content

Commit

Permalink
Merge pull request #211 from vincentcasseau/main
Browse files Browse the repository at this point in the history
KCore, Envs: create a prod for a specific branch
  • Loading branch information
vincentcasseau authored Oct 24, 2024
2 parents a24bed4 + 5346df5 commit 20518f2
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 138 deletions.
151 changes: 76 additions & 75 deletions Cassiopee/Converter/Converter/kpython
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
59 changes: 32 additions & 27 deletions Cassiopee/Envs/env_Cassiopee_local
Original file line number Diff line number Diff line change
Expand Up @@ -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*."
Expand Down Expand Up @@ -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 ------------------------------------------
Expand Down
64 changes: 33 additions & 31 deletions Cassiopee/Envs/sh_Cassiopee_local
Original file line number Diff line number Diff line change
Expand Up @@ -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*."
Expand Down Expand Up @@ -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
Expand Down
11 changes: 9 additions & 2 deletions Cassiopee/KCore/Dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()

#==============================================================================
Expand Down
4 changes: 2 additions & 2 deletions Cassiopee/KCore/switchDebugMode.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion Cassiopee/KCore/switchIntSize.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 20518f2

Please sign in to comment.