diff --git a/Cassiopee/CPlot/CPlot/Data.h b/Cassiopee/CPlot/CPlot/Data.h index 8645ef0b4..8dea49867 100644 --- a/Cassiopee/CPlot/CPlot/Data.h +++ b/Cassiopee/CPlot/CPlot/Data.h @@ -47,7 +47,11 @@ #ifdef __MESA__ #define GLAPI extern -//#define APIENTRY // added for ubuntu, to be checked on other linux +#ifdef _WIN32 + #define APIENTRY __stdcall +#else + #define APIENTRY +#endif #include #endif diff --git a/Cassiopee/CPlot/CPlot/GLEW/glew.c b/Cassiopee/CPlot/CPlot/GLEW/glew.c index ed8032bb7..42cf494d8 100644 --- a/Cassiopee/CPlot/CPlot/GLEW/glew.c +++ b/Cassiopee/CPlot/CPlot/GLEW/glew.c @@ -38,7 +38,11 @@ #if defined(GLEW_OSMESA) # define GLAPI extern -//# define APIENTRY // added for ubuntu, to be checked on other linux +# ifdef _WIN32 +# define APIENTRY __stdcall +# else +# define APIENTRY +# endif # include #elif defined(GLEW_EGL) # include diff --git a/Cassiopee/Envs/sh_Cassiopee_local b/Cassiopee/Envs/sh_Cassiopee_local index b5abf0194..41375f104 100644 --- a/Cassiopee/Envs/sh_Cassiopee_local +++ b/Cassiopee/Envs/sh_Cassiopee_local @@ -43,22 +43,35 @@ MAC0=$(echo $KC | grep 'WDAAA161Z'); if [ "$MAC0" != "" ]; then export MAC="WDAA # Detect the type of integer that is used INTTYPE="" -posend=${#MACHINE} -posbeg=$((posend - 3)) -if [ "${MACHINE:posbeg:posend}" = _i8 ]; then - export MAC=${MACHINE%"_i8"} - INTTYPE="_i8" -elif [ "$MACHINE" = "i8" ]; then - INTTYPE="_i8" -elif [ -n "$MACHINE" ]; then - export MAC=$MACHINE -fi +DBGMODE="" +case $MACHINE in + *_DBG) + MACHINE_TMP=${MACHINE%"_DBG"} + DBGMODE="_DBG" + ;; + *) + MACHINE_TMP=$MACHINE + ;; +esac +case $MACHINE_TMP in + *_i8*) + export MAC=${MACHINE_TMP%"_i8"} + INTTYPE="_i8" + ;; + i8) + INTTYPE="_i8" + ;; + *) + export MAC=$MACHINE_TMP + ;; +esac +unset MACHINE_TMP # ----------------------------- Prods ------------------------------------------ if [ "$MAC" = "ld_eos8" ]; then #------------------------------- ld centos 8 + python 3 ----------------------------------- export ELSAPROD=eos8_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE #module unload $(module -t list 2>&1 | grep -i intel) #module purge module unload intel/19.0.5 @@ -80,7 +93,7 @@ if [ "$MAC" = "ld_eos8" ]; then elif [ "$MAC" = "ld" ]; then #------------------------------- ld rocky 8 + python 3 ----------------------------------- export ELSAPROD=ld - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE . /etc/profile.d/modules-onera.sh module purge module load occt/7.6.1-gnu831 @@ -89,7 +102,7 @@ elif [ "$MAC" = "ld" ]; then module load lapack/3.9.1-gnu831 module load hdf5/1.10.5-gnu831-ompi405 export PRODMODE=1 - setenv PIP_DISABLE_PIP_VERSION_CHECK 1 + export PIP_DISABLE_PIP_VERSION_CHECK=1 export PYTHONEXE=python3 # Nbre de threads ncpu=$(grep processor /proc/cpuinfo | tail -1 | cut -f2 -d: ) @@ -101,7 +114,7 @@ elif [ "$MAC" = "ld" ]; then elif [ "$MAC" = "ld_python2" ]; then #------------------------------- ld centos 7 ----------------------------------- export ELSAPROD=x86_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE module unload $(module -t list 2>&1 | grep -i intel) module load python/2.7.8 module load intel/17.0.4 @@ -119,7 +132,7 @@ elif [ "$MAC" = "ld_python2" ]; then elif [ "$MAC" = "macosx" ]; then #----------------------------- Mac OSX----------------------------------------- export ELSAPROD=macosx - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE export OMP_NUM_THREADS=2 export MACOSX_DEPLOYMENT_TARGET=10.10 unset BUNDLE @@ -128,7 +141,7 @@ elif [ "$MAC" = "macosx" ]; then elif [ "$MAC" = "ubuntu" ]; then #-------------------------------- ubuntu -------------------------------------- export ELSAPROD=ubuntu - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE export OMP_NUM_THREADS=4 export PYTHONEXE=python3 export PRODMODE=1 @@ -137,7 +150,7 @@ elif [ "$MAC" = "ubuntu" ]; then elif [ "$MAC" = "visio" ]; then #----------------------------- visio ----------------------------------------- export ELSAPROD=vis_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE . /etc/profile.d/modules-dri.sh module load subversion/1.7.6 module load python/2.7.8 @@ -151,7 +164,7 @@ elif [ "$MAC" = "visio" ]; then elif [ "$MAC" = "spiro_gcc" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_gcc - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 module purge @@ -168,7 +181,7 @@ elif [ "$MAC" = "spiro_gcc" ]; then elif [ "$MAC" = "visung" ]; then #----------------------------- visung ----------------------------------------- export ELSAPROD=visung_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=72 . /etc/profile.d/modules-onera.sh @@ -186,7 +199,7 @@ elif [ "$MAC" = "visung" ]; then elif [ "$MAC" = "visung_el8" ]; then #----------------------------- visung ----------------------------------------- export ELSAPROD=visung_el8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE #. /etc/profile.d/modules-dri.sh module purge module load subversion @@ -202,7 +215,7 @@ elif [ "$MAC" = "visung_el8" ]; then elif [ "$MAC" = "austri" ]; then #----------------------------- austri ----------------------------------------- export ELSAPROD=aus_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 export KMP_AFFINITY="verbose,granularity=fine,proclist=[0,2,4,6,8,10,12,14,16,18,20,22,1,3,5,7,9,11,13,15,17,19,21,23],explicit" @@ -218,7 +231,7 @@ elif [ "$MAC" = "austri" ]; then elif [ "$MAC" = "giulia" ]; then #----------------------------- giulia ----------------------------------------- export ELSAPROD=giu_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads ncpu=$(grep processor /proc/cpuinfo |tail -1 |cut -f2 -d: ) ncpu=$((ncpu + 1 )) @@ -239,7 +252,7 @@ elif [ "$MAC" = "giulia" ]; then elif [ "$MAC" = "cobalt" ]; then #-------------------------------- cobalt ----------------------------------------- export ELSAPROD=cob_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=28 @@ -255,7 +268,7 @@ elif [ "$MAC" = "cobalt" ]; then elif [ "$MAC" = "tgcc_irene" ]; then #-------------------------------- irene ----------------------------------------- export ELSAPROD=irene_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -269,7 +282,7 @@ elif [ "$MAC" = "tgcc_irene" ]; then elif [ "$MAC" = "jean-zay" ]; then #-------------------------------- jean-zay ----------------------------------------- export ELSAPROD=jz_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE module load python/3.8.2 module load gcc/9.1.0-cuda-openacc module load openmpi/4.1.1-cuda @@ -282,7 +295,7 @@ elif [ "$MAC" = "jean-zay" ]; then elif [ "$MAC" = "spiro" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -301,7 +314,7 @@ elif [ "$MAC" = "spiro" ]; then elif [ "$MAC" = "spiro_sky" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_sky_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -319,7 +332,7 @@ elif [ "$MAC" = "spiro_sky" ]; then elif [ "$MAC" = "spiro_cas" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_cas_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -337,7 +350,7 @@ elif [ "$MAC" = "spiro_cas" ]; then elif [ "$MAC" = "spiro_amdRM" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_amdrm_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=32 # modules @@ -354,7 +367,7 @@ elif [ "$MAC" = "spiro_amdRM" ]; then elif [ "$MAC" = "spiro_amdNP" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_amdnp_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=32 # modules @@ -371,7 +384,7 @@ elif [ "$MAC" = "spiro_amdNP" ]; then elif [ "$MAC" = "spiro_socle6" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_socle_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -386,7 +399,7 @@ elif [ "$MAC" = "spiro_socle6" ]; then elif [ "$MAC" = "spiro_sonics" ]; then #----------------------------- spiro sonics ----------------------------------------- export ELSAPROD=linux64 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -399,7 +412,7 @@ elif [ "$MAC" = "spiro_sonics" ]; then elif [ "$MAC" = "spiro_python2" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -414,7 +427,7 @@ elif [ "$MAC" = "spiro_python2" ]; then elif [ "$MAC" = "spiro_anaconda" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_acda - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -433,7 +446,7 @@ elif [ "$MAC" = "spiro_anaconda" ]; then elif [ "$MAC" = "spiro_el8" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_el8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -460,7 +473,7 @@ elif [ "$MAC" = "spiro_el8" ]; then elif [ "$MAC" = "spiro_intel" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_intel - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE echo $ELSAPROD # Nbre de threads export OMP_NUM_THREADS=24 @@ -474,7 +487,7 @@ elif [ "$MAC" = "spiro_intel" ]; then elif [ "$MAC" = "spiro_coda" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_coda - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 # modules @@ -487,7 +500,7 @@ elif [ "$MAC" = "spiro_coda" ]; then elif [ "$MAC" = "spiro_arm" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_arm - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=56 export PYTHONEXE=python3 @@ -495,7 +508,7 @@ elif [ "$MAC" = "spiro_arm" ]; then elif [ "$MAC" = "spiro_pgi" ]; then #----------------------------- spiro ----------------------------------------- export ELSAPROD=spiro_pgi - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=24 export PYTHONEXE=python3 @@ -507,7 +520,7 @@ elif [ "$MAC" = "spiro_pgi" ]; then elif [ "$MAC" = "spiro_gpu" ]; then #----------------------------- spiro gpu ------------------------------------ export ELSAPROD=spiro_gpu - export ELSAPROD="$ELSAPROD$INTTYPE" + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE source /opt/tools/Modules/init/bash module purge module load python/3.12.2-gnu850 @@ -525,7 +538,7 @@ elif [ "$MAC" = "spiro_gpu" ]; then elif [ "$MAC" = "juno" ]; then #----------------------------- juno ----------------------------------------- export ELSAPROD=juno - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=48 # modules @@ -552,7 +565,7 @@ elif [ "$MAC" = "juno" ]; then elif [ "$MAC" = "juno_gcc" ]; then #----------------------------- juno gcc --------------------------------------- export ELSAPROD=juno_gcc - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=48 # modules @@ -577,7 +590,7 @@ elif [ "$MAC" = "juno_gcc" ]; then elif [ "$MAC" = "juno_gpu" ]; then #----------------------------- juno gpu ------------------------------------ export ELSAPROD=juno_gpu - export ELSAPROD="$ELSAPROD$INTTYPE" + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE source /opt/tools/Modules/init/bash module purge module load python/3.12.2-gnu850 @@ -595,7 +608,7 @@ elif [ "$MAC" = "juno_gpu" ]; then elif [ "$MAC" = "juno_coda" ]; then #----------------------------- juno ----------------------------------------- export ELSAPROD=juno_coda - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=48 # modules @@ -608,7 +621,7 @@ elif [ "$MAC" = "juno_coda" ]; then elif [ "$MAC" = "sator_brw" ]; then #----------------------------- sator for broadwell ----------------------------------------- export ELSAPROD=sat_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE . /etc/profile.d/module.sh module purge module load python/3.7.4-intel2120 @@ -629,7 +642,7 @@ elif [ "$MAC" = "sator_brw" ]; then elif [ "$MAC" = "topaze" ]; then #----------------------------- topaze ccrt proc amd milan --------------------------------------- export ELSAPROD=topaze_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE . /etc/profile.d/module.sh module purge module load intel/20 mpi/openmpi/4 flavor/hdf5/parallel hdf5/1.8.20 @@ -647,7 +660,7 @@ elif [ "$MAC" = "topaze" ]; then elif [ "$MAC" = "sator_sky" ]; then #----------------------------- sator skylake --------------------------------------- export ELSAPROD=sat_sky_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE . /etc/profile.d/module.sh module purge #module load socle-cfd/5.0-intel2120-impi @@ -665,7 +678,7 @@ elif [ "$MAC" = "sator_sky" ]; then elif [ "$MAC" = "sator_cas" ]; then #----------------------------- sator for cascade --------------------------------------- export ELSAPROD=sat_cas_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=48 export KMP_AFFINITY="compact,1,0,granularity=fine,verbose" @@ -685,7 +698,7 @@ elif [ "$MAC" = "sator_cas" ]; then elif [ "$MAC" = "sator_sph" ]; then #----------------------------- sator for saphire --------------------------------------- export ELSAPROD=sat_sph - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=48 module purge @@ -704,7 +717,7 @@ elif [ "$MAC" = "sator_sph" ]; then elif [ "$MAC" = "jean-zay" ]; then #-----------------------------jean-zay IDRIS --------------------------------------- export ELSAPROD=jz_r8 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=40 export KMP_AFFINITY="compact,1,0,granularity=fine,verbose" @@ -719,7 +732,7 @@ elif [ "$MAC" = "jean-zay" ]; then elif [ "$MAC" = "aryen" ]; then #----------------------------- Aryen msys2 --------------------------------------- export ELSAPROD=win64 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=2 # modules @@ -729,7 +742,7 @@ elif [ "$MAC" = "aryen" ]; then elif [ "$MAC" = "WDAAA161Z" ]; then #----------------------------- msys64 "AlainRE" --------------------------------------- export ELSAPROD=win64 - export ELSAPROD=$ELSAPROD$INTTYPE + export ELSAPROD=$ELSAPROD$INTTYPE$DBGMODE # Nbre de threads export OMP_NUM_THREADS=4 # modules diff --git a/Cassiopee/KCore/switchDebugMode.py b/Cassiopee/KCore/switchDebugMode.py new file mode 100644 index 000000000..3de977c9b --- /dev/null +++ b/Cassiopee/KCore/switchDebugMode.py @@ -0,0 +1,74 @@ +# Switch debug mode in KCore/Dist.py, ie, toggles DEBUG +# Usage: python switchDebugMode.py --activate +# python switchDebugMode.py --deactivate +import os +import sys +import argparse + +# Parse command-line arguments +def parseArgs(): + # Create argument parser + parser = argparse.ArgumentParser() + parser.add_argument("-a", "--activate", action="store_true", + help="Activate debug mode.") + # Parse arguments + return parser.parse_args() + +# Get installation path of Cassiopee +def getInstallPath(): + try: + try: import KCore.installPath as installPath + except: import installPath + cassiopeeIncDir = installPath.includePath + cassiopeeIncDir = os.path.dirname(cassiopeeIncDir) + return cassiopeeIncDir + except ImportError: + print("Warning: KCore library is required to use this script. Skipping...") + sys.exit() + +# Read KCore/Dist +def readDist(): + cassiopeeIncDir = getInstallPath() + filename = os.path.join(cassiopeeIncDir, "KCore/Dist.py") + if not os.access(filename, os.R_OK): + raise Exception("Dist.py can't be read at: {}".format(filename)) + contents = [] + with open (filename, 'r') as f: + for line in f: contents.append(line) + return contents + +# Edit Dist +def editDist(contents, dbgMode): + for i, line in enumerate(contents): + if "DEBUG =" in line: + contents[i] = "DEBUG = " + dbgMode + '\n' + return + return + +# Write KCore/Dist +def writeDist(contents): + cassiopeeIncDir = getInstallPath() + filename = os.path.join(cassiopeeIncDir, "KCore/Dist.py") + if not os.access(filename, os.W_OK): + raise Exception("Modified Dist.py can't be written at: {}".format(filename)) + with open (filename, 'w') as f: + for line in contents: f.write(line) + return + +# Check ELSAPROD +def check_elsaprod(dbgMode): + elsaprod = os.getenv("ELSAPROD") + if elsaprod is not None: + if dbgMode and not elsaprod.endswith("_DBG"): + print("Add '_DBG' suffix to $ELSAPROD: {}_DBG".format(elsaprod)) + elif not dbgMode and elsaprod.endswith("_DBG"): + print("Remove '_DBG' suffix from $ELSAPROD: {}".format(elsaprod[:-4])) + return + +if __name__ == '__main__': + args = parseArgs() + dbgMode = "True" if args.activate else "False" + contents = readDist() + editDist(contents, dbgMode) + writeDist(contents) + check_elsaprod(args.activate)