Skip to content

Commit

Permalink
Fix #346 - Accept & Provide ENV{MFC_CUDA_CC} (#361)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryleberre authored Mar 2, 2024
1 parent a55a4e5 commit cfcfb66
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 40 deletions.
56 changes: 16 additions & 40 deletions toolchain/bootstrap/modules.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ if [[ -z "$COMPUTER" ]]; then
return
fi

MODULES=($(__extract "$u_c-$cg") $(__combine $(__extract "$u_c-all")))

log "Loading modules for $M$COMPUTER$CR on $M$CG$CR"'s:'
log "Loading modules (& env variables) for $M$COMPUTER$CR on $M$CG$CR"'s:'

# Reset modules to default system configuration
if [ "$u_c" != 'p' ]; then
Expand All @@ -80,51 +78,29 @@ else
module purge > /dev/null 2>&1
fi

# Find length of longest module_name in $MODULES for $COMPUTER
max_module_length="0"
for module_name in ${MODULES[@]}; do
module_length="${#module_name}"
ELEMENTS=($(__extract "$u_c-$cg") $(__combine $(__extract "$u_c-all")))

if [ "$module_length" -gt "$max_module_length" ]; then
max_module_length="$module_length"
fi
done
for element in ${ELEMENTS[@]}; do
if [[ "$element" != *'='* ]]; then
log " $ module load $M$element$CR"
module load "$element" > /dev/null 2>&1

# Load modules ($MODULES)
for module_name in ${MODULES[@]}; do
log_n " - $CYAN$module_name$COLOR_RESET "

# Add padding spaces
module_length="${#module_name}"
delta="$((max_module_length-module_length-1))"
if [ "$delta" -ge "0" ]; then
printf "%0.s " $(seq 0 $delta)
fi
# Handle Success / Failure
code=$?
if [ "$code" != '0' ]; then
error "Failed to load module $M$element$CR:"

# Load the module
module load "$module_name" > /dev/null 2>&1
# Run load again to show error message
module load "$element"

# Handle Success / Failure
code=$?
if [ "$code" == '0' ]; then
echo -e "[$G""SUCCESS$W]"
return
fi
else
echo -e "[$R""FAILURE$W]"

# Run load again to show error message
module load "$module_name"

return
log " $ export $M$element$CR"
export $element
fi
done

if [ "$cg" == 'gpu' ]; then
isnv=$($FC --version | grep NVIDIA | wc -l)
if [ $isnv -eq 0 ]; then
export CC=nvc CXX=nvc++ FC=nvfortran
fi
fi
ok 'All modules and environment variables have been loaded.'


return
7 changes: 7 additions & 0 deletions toolchain/modules
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ s-all python/3.8.10 darshan-runtime/3.3.1-lite hsi/5.0.2.p5 xalt/1.2.1
s-cpu lsf-tools/2.0 cmake/3.23.2 ninja/1.10.2 spectrum-mpi/10.4.0.3-20210112
s-cpu gcc/12.1.0
s-gpu nvhpc/22.11 cuda/nvhpc
s-gpu CC=nvc CXX=nvc++ FC=nvfortran

b PSC Bridges2
b-all python/3.8.6
b-cpu allocations/1.0 gcc/10.2.0 openmpi/4.0.5-gcc10.2.0
b-gpu openmpi/4.0.5-nvhpc22.9 nvhpc/22.9 cuda
b-gpu CC=nvc CXX=nvc++ FC=nvfortran

a OLCF Ascent
a-all python cmake/3.22.2
a-cpu gcc/11.1.0 spectrum-mpi cuda
a-gpu nvhpc/21.11 spectrum-mpi cuda/nvhpc nsight-compute nsight-systems
a-gpu CC=nvc CXX=nvc++ FC=nvfortran

r Richardson
r-all python/3.7
Expand All @@ -30,16 +33,19 @@ w OLCF Wombat
w-all cmake/3.25.1 python/3.10.8
w-cpu gcc/11.1.0 openmpi/4.0.5_gcc
w-gpu nvhpc/22.11
w-gpu CC=nvc CXX=nvc++ FC=nvfortran

e SDSC Expanse
e-all python/3.8.5
e-cpu cpu/0.15.4 gcc/9.2.0 openmpi/4.1.1 cmake/3.18.2
e-gpu gpu/0.15.4 cuda/11.0.2 nvhpc/22.2 openmpi/4.0.5 cmake/3.19.8
e-gpu CC=nvc CXX=nvc++ FC=nvfortran

p GT Phoenix
p-all python/3.9.12-rkxvr6 cmake/3.23.1-327dbl
p-cpu gcc/10.3.0-o57x6h openmpi/4.1.4
p-gpu cuda/11.7.0-7sdye3 nvhpc/22.11
p-gpu MFC_CUDA_CC=70,80 CC=nvc CXX=nvc++ FC=nvfortran

c OLCF Crusher
c-all cmake/3.23.2 cray-fftw/3.3.10.2 hdf5/1.12.1 cray-python/3.9.13.1
Expand All @@ -51,3 +57,4 @@ d NCSA Delta
d-all python/3.11.6
d-cpu gcc/11.4.0 openmpi
d-gpu nvhpc/22.11 openmpi+cuda/4.1.5+cuda cmake
d-gpu CC=nvc CXX=nvc++ FC=nvfortran

0 comments on commit cfcfb66

Please sign in to comment.