From f4746ab2231d7182168423a3397220d32511c12f Mon Sep 17 00:00:00 2001 From: benoit128 Date: Fri, 25 Oct 2024 11:16:20 +0200 Subject: [PATCH] Envs: mod. env pour adastra --- Cassiopee/Envs/sh_Cassiopee_local | 18 ++++++++++-- Cassiopee/KCore/Dist.py | 48 +++++++++++++++++++++++++++++-- Cassiopee/KCore/installBase.py | 23 ++++++++++++--- 3 files changed, 80 insertions(+), 9 deletions(-) diff --git a/Cassiopee/Envs/sh_Cassiopee_local b/Cassiopee/Envs/sh_Cassiopee_local index 5937b0df6..92ff209bc 100644 --- a/Cassiopee/Envs/sh_Cassiopee_local +++ b/Cassiopee/Envs/sh_Cassiopee_local @@ -766,6 +766,7 @@ elif [ "$MAC" = "adastra_cpu" ]; then export ELSAPROD=adastra_cpu export ELSAPROD=$ELSAPROD$EXT export OMP_NUM_THREADS=48 + export OMP_PLACES=cores export PRODMODE=1 module purge @@ -793,13 +794,24 @@ elif [ "$MAC" = "adastra_gpu" ]; then export ELSAPROD=adastra_gpu export ELSAPROD=$ELSAPROD$EXT export OMP_NUM_THREADS=12 + export OMP_PLACES=cores export PRODMODE=1 + + #module purge + #module load CCE-GPU-3.1.0 + #module load rocm + #module load cray-python/3.11.5 + #module load cray-hdf5-parallel/1.12.2.5 + module purge - #craype-accel-amd-gfx90 - module load CCE-GPU-3.1.0 + module load cpe/23.12 + module load craype-accel-amd-gfx90a craype-x86-trento + module load PrgEnv-cray + module load rocm module load cray-python/3.11.5 module load cray-hdf5-parallel/1.12.2.5 - export LD_LIBRARY_PATH="$CRAY_LD_LIBRARY_PATH":"$LD_LIBRARY_PATH" + + #export LD_LIBRARY_PATH="$CRAY_LD_LIBRARY_PATH":"$LD_LIBRARY_PATH" export LD_LIBRARY_PATH="$LD_LIBRARY_PATH":"/opt/cray/pe/python/3.11.5/lib" export PYTHONEXE=python3 diff --git a/Cassiopee/KCore/Dist.py b/Cassiopee/KCore/Dist.py index e04667352..1b42b9679 100644 --- a/Cassiopee/KCore/Dist.py +++ b/Cassiopee/KCore/Dist.py @@ -479,7 +479,11 @@ def writeSetupCfg(): elif Cppcompiler == 'craycc' or Cppcompiler == 'craycxx': p = open("./setup.cfg", 'w') p.write('[build_ext]\ncompiler=unix\n') - p.close() + p.close() + elif Cppcompiler == 'cc' or Cppcompiler == 'cc': + p = open("./setup.cfg", 'w') + p.write('[build_ext]\ncompiler=unix\n') + p.close() else: p = open("./setup.cfg", 'w') p.write('[build_ext]\ncompiler=%s\n'%Cppcompiler) @@ -514,6 +518,9 @@ def getDistUtilsCompilers(): elif Cppcompiler == 'craycxx': vars[0] = Cppcompiler.replace('craycxx', 'craycc'); vars[1] = Cppcompiler + elif Cppcompiler == 'cc': + vars[0] = Cppcompiler; vars[1] = Cppcompiler + elif Cppcompiler == 'nvc': vars[0] = Cppcompiler; vars[1] = Cppcompiler.replace('nvc', 'nvc++') elif Cppcompiler == 'nvc++': @@ -957,6 +964,14 @@ def getCArgs(): else: options += ['-fPIC'] options += getSimdOptions() return options + elif Cppcompiler == "cc": + if DEBUG: options += ['-g', '-O0', '-Wall', '-D_GLIBCXX_DEBUG_PEDANTIC'] + else: options += ['-DNDEBUG', '-O3', '-Wall'] + if useOMP() == 1: options += ['-fopenmp'] + if useStatic() == 1: options += ['--static', '-static-libstdc++', '-static-libgcc'] + else: options += ['-fPIC'] + options += getSimdOptions() + return options else: return options # Options pour le compilateur C++ @@ -1075,6 +1090,15 @@ def getForArgs(): options += getSimdOptions() if EDOUBLEINT: options += ['-i8'] return options + elif f77compiler == "ftn": + if useStatic() == 1: options += ['-static'] + else: options += ['-fPIC'] + if DEBUG: options += ['-g', '-O0'] + else: options += ['-O3'] + if useOMP() == 1: options += ['-fopenmp'] + options += getSimdOptions() + if EDOUBLEINT: options += ['-i8'] + return options else: return options #============================================================================== @@ -1108,6 +1132,10 @@ def getLinkArgs(): if useStatic() == 1: out += ['-static'] else: out += ['-shared'] if useOMP() == 1: out += ['-fopenmp'] + elif Cppcompiler == 'cc': + if useStatic() == 1: out += ['-static'] + else: out += ['-shared'] + if useOMP() == 1: out += ['-fopenmp'] mySystem = getSystem()[0] if mySystem == 'Darwin': if useStatic() == 0: out += ['-dynamiclib'] @@ -2270,7 +2298,22 @@ def checkCppLibs(additionalLibs=[], additionalLibPaths=[], Cppcompiler=None, # if l is not None: # libs += ['omp']; paths += [l] # else: ret = False - + # craycc + + if Cppcompiler == 'cc': + os.environ['CC'] = 'cc' # forced to overide setup.cfg + os.environ['CXX'] = 'cc' + os.environ['LDSHARED'] = 'ftn' + from distutils import sysconfig + cflags = sysconfig.get_config_var('CFLAGS') + sysconfig._config_vars['CFLAGS'] = '' # kill setup flags for CC + sysconfig._config_vars['LDFLAGS'] = '' # kill setup flags for LD + l = checkLibFile__('libsci_cray.so*', additionalLibPaths) + if l is None: + l = checkLibFile__('libsci_cray.a', additionalLibPaths) + if l is not None: + libs += ['sci_cray']; paths += [l] + return (ret, libs, paths) #============================================================================== @@ -2520,6 +2563,7 @@ def createExtensions(module, srcs, includeDirs, libraryDirs, libraries, # doit voir #============================================================================== def getEnvForScons(): + #return dict(os.environ) # for adastra return {'PATH': getenv('PATH'), 'LD_LIBRARY_PATH': getenv('LD_LIBRARY_PATH'), 'LM_LICENSE_FILE': getenv('LM_LICENSE_FILE'), diff --git a/Cassiopee/KCore/installBase.py b/Cassiopee/KCore/installBase.py index 9bdd49fe0..75b195a87 100644 --- a/Cassiopee/KCore/installBase.py +++ b/Cassiopee/KCore/installBase.py @@ -714,12 +714,12 @@ ], ############################################################################### 'adastra_cpu': [ 'Machine CINES Cray', -'crayftn', # f77compiler -'crayftn', # f90compiler -'craycc', # Cppcompiler +'gfortran', # f77compiler +'gfortran', # f90compiler +'gcc', # Cppcompiler [], # CppAdditionalOptions [], # f77AdditionalOptions -False, # useOMP +True, # useOMP False, # static [], # additionalIncludePaths [], # additionalLibs @@ -728,6 +728,21 @@ [] # NvccAdditionalOptions ], ############################################################################### +'adastra_gpu': [ 'Machine CINES Cray', +'ftn', # f77compiler +'ftn', # f90compiler +'cc', # Cppcompiler +[], # CppAdditionalOptions +[], # f77AdditionalOptions +True, # useOMP +False, # static +[], # additionalIncludePaths +[], # additionalLibs +[], # additionalLibPaths +False, # useCuda +[] # NvccAdditionalOptions +], +############################################################################### 'ubuntu': [ 'Linux ubuntu 24.04', 'gfortran', # f77compiler 'gfortran', # f90compiler