Skip to content

Commit cfcfb66

Browse files
authored
Fix #346 - Accept & Provide ENV{MFC_CUDA_CC} (#361)
1 parent a55a4e5 commit cfcfb66

File tree

2 files changed

+23
-40
lines changed

2 files changed

+23
-40
lines changed

toolchain/bootstrap/modules.sh

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,7 @@ if [[ -z "$COMPUTER" ]]; then
6363
return
6464
fi
6565

66-
MODULES=($(__extract "$u_c-$cg") $(__combine $(__extract "$u_c-all")))
67-
68-
log "Loading modules for $M$COMPUTER$CR on $M$CG$CR"'s:'
66+
log "Loading modules (& env variables) for $M$COMPUTER$CR on $M$CG$CR"'s:'
6967

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

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

88-
if [ "$module_length" -gt "$max_module_length" ]; then
89-
max_module_length="$module_length"
90-
fi
91-
done
83+
for element in ${ELEMENTS[@]}; do
84+
if [[ "$element" != *'='* ]]; then
85+
log " $ module load $M$element$CR"
86+
module load "$element" > /dev/null 2>&1
9287

93-
# Load modules ($MODULES)
94-
for module_name in ${MODULES[@]}; do
95-
log_n " - $CYAN$module_name$COLOR_RESET "
96-
97-
# Add padding spaces
98-
module_length="${#module_name}"
99-
delta="$((max_module_length-module_length-1))"
100-
if [ "$delta" -ge "0" ]; then
101-
printf "%0.s " $(seq 0 $delta)
102-
fi
88+
# Handle Success / Failure
89+
code=$?
90+
if [ "$code" != '0' ]; then
91+
error "Failed to load module $M$element$CR:"
10392

104-
# Load the module
105-
module load "$module_name" > /dev/null 2>&1
93+
# Run load again to show error message
94+
module load "$element"
10695

107-
# Handle Success / Failure
108-
code=$?
109-
if [ "$code" == '0' ]; then
110-
echo -e "[$G""SUCCESS$W]"
96+
return
97+
fi
11198
else
112-
echo -e "[$R""FAILURE$W]"
113-
114-
# Run load again to show error message
115-
module load "$module_name"
116-
117-
return
99+
log " $ export $M$element$CR"
100+
export $element
118101
fi
119102
done
120103

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

129-
130106
return

toolchain/modules

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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
1111
s-cpu lsf-tools/2.0 cmake/3.23.2 ninja/1.10.2 spectrum-mpi/10.4.0.3-20210112
1212
s-cpu gcc/12.1.0
1313
s-gpu nvhpc/22.11 cuda/nvhpc
14+
s-gpu CC=nvc CXX=nvc++ FC=nvfortran
1415

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

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

2528
r Richardson
2629
r-all python/3.7
@@ -30,16 +33,19 @@ w OLCF Wombat
3033
w-all cmake/3.25.1 python/3.10.8
3134
w-cpu gcc/11.1.0 openmpi/4.0.5_gcc
3235
w-gpu nvhpc/22.11
36+
w-gpu CC=nvc CXX=nvc++ FC=nvfortran
3337

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

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

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

0 commit comments

Comments
 (0)