Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 6fd2f1d

Browse files
pramodkolupton
andcommitted
Add NVHPC/21.11 and CUDA/11.5.1. (#1392)
* Add + deploy NVIDIA HPC SDK 21.11. * Add + deploy CUDA 11.5.1 to match it. * Do not define CMAKE_C_FLAGS in `coreneuron+nmodl`. * Run `makelocalrc` for `nvhpc` in a cleaner environment. * Add `-mno-abm` to [Core]NEURON recipes for `[email protected]`. Co-authored-by: Olli Lupton <[email protected]>
1 parent 7cff6b6 commit 6fd2f1d

File tree

7 files changed

+69
-4
lines changed

7 files changed

+69
-4
lines changed

deploy/deploy.lib

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,13 @@ configure_compilers() {
339339
# standard library from the deployed version of GCC.
340340
NVHPC_DIR=$(dirname $(which makelocalrc))
341341
NVHPC_TMPDIR=$(mktemp -d -p .)
342-
makelocalrc ${NVHPC_DIR} -d "${NVHPC_TMPDIR}" -gcc ${GCC_DIR}/bin/gcc -gpp ${GCC_DIR}/bin/g++ -g77 ${GCC_DIR}/bin/gfortran -x
342+
# Try and avoid autoloaded dependencies of other compilers (looking
343+
# at you, LLVM) polluting the localrc of the NVIDIA compilers
344+
(
345+
module purge
346+
${cmd}
347+
makelocalrc ${NVHPC_DIR} -d "${NVHPC_TMPDIR}" -gcc ${GCC_DIR}/bin/gcc -gpp ${GCC_DIR}/bin/g++ -g77 ${GCC_DIR}/bin/gfortran -x
348+
)
343349
# olupton 2021-10-15: is this still needed? Not sure.
344350
echo "set PREOPTIONS=-D__GCC_ATOMIC_TEST_AND_SET_TRUEVAL=1;" >> "${NVHPC_TMPDIR}/localrc"
345351
log "NVIDIA localrc template"

deploy/environments/externals.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ spack:
6363
6464
- [email protected] install_type=network
6565
66+
6667
- arm-forge
6768
- bison
6869
- blender
@@ -74,6 +75,7 @@ spack:
7475
- cmake
7576
7677
78+
7779
7880
- darshan-runtime
7981
- darshan-util

deploy/set-compiler-flags.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import argparse
2+
import spack
3+
from spack.config import config
4+
5+
parser = argparse.ArgumentParser(
6+
description="Add C/C++ compiler flags to Spack configuration."
7+
)
8+
parser.add_argument(
9+
"--scope", default="user", help="Configuration scope to read/write."
10+
)
11+
parser.add_argument("--compiler-spec", type=str, help="Compiler spec to modify.")
12+
parser.add_argument(
13+
"--fields",
14+
type=str,
15+
nargs="+",
16+
help="Which type of flags to write.",
17+
default=["cflags", "cxxflags"],
18+
choices=["cflags", "cxxflags", "cppflags", "fflags", "ldflags", "ldlibs"],
19+
)
20+
parser.add_argument(
21+
"flags", type=str, nargs="+", help="Compiler flags to set in the configuration."
22+
)
23+
args = parser.parse_args()
24+
flags_str = " ".join(args.flags)
25+
compiler_configs = config.get("compilers", scope=args.scope)
26+
for compiler_config in compiler_configs:
27+
compiler_spec = spack.spec.Spec(compiler_config["compiler"]["spec"])
28+
if compiler_spec.satisfies(args.compiler_spec):
29+
compiler_flags = compiler_config["compiler"].get("flags", {})
30+
for field in args.fields:
31+
compiler_flags[field] = flags_str
32+
compiler_config["compiler"]["flags"] = compiler_flags
33+
config.update_config("compilers", compiler_configs, scope=args.scope)

var/spack/repos/builtin/packages/coreneuron/package.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ def get_flags(self):
127127
flags = '-xHost -qopt-report=5'
128128
if '+knl' in spec:
129129
flags = '-xMIC-AVX512 -qopt-report=5'
130+
# NVHPC 21.11 detects ABM support and defines __ABM__, which breaks
131+
# Random123 compilation
132+
if spec.satisfies('%[email protected]'):
133+
flags += ' -mno-abm'
130134
# when pdt is used for instrumentation, the gcc's unint128 extension
131135
# is activated from random123 which results in compilation error
132136
if '+profile' in spec:
@@ -143,7 +147,6 @@ def get_cmake_args(self):
143147

144148
options =\
145149
['-DCORENRN_ENABLE_SPLAYTREE_QUEUING=ON',
146-
'-DCMAKE_C_FLAGS=%s' % flags,
147150
'-DCMAKE_CXX_FLAGS=%s' % flags,
148151
'-DCORENRN_ENABLE_REPORTING=%s'
149152
% ('ON' if '+report' in spec else 'OFF'),
@@ -156,6 +159,11 @@ def get_cmake_args(self):
156159
'-DPYTHON_EXECUTABLE=%s' % spec["python"].command.path
157160
]
158161

162+
# Versions after this only used C++, but we might still need C
163+
# flags if mod2c is being built as a submodule.
164+
if spec.satisfies('@:1.0.0.20210708') or spec.satisfies('~nmodl'):
165+
options.append('-DCMAKE_C_FLAGS=%s' % flags)
166+
159167
if spec.satisfies('+caliper'):
160168
options.append('-DCORENRN_ENABLE_CALIPER_PROFILING=ON')
161169

var/spack/repos/builtin/packages/cuda/package.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
# format returned by platform.system() and 'arch' by platform.machine()
2626

2727
_versions = {
28+
'11.5.1': {
29+
'Linux-aarch64': ('73e1d0e97c7fa686efe7e00fb1e5f179372c4eec8e14d4f44ab58d5f6cf57f63', 'https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux_sbsa.run'),
30+
'Linux-x86_64': ('60bea2fc0fac95574015f865355afbf599422ec2c85554f5f052b292711a4bca', 'https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux.run'),
31+
'Linux-ppc64le': ('9e0e494d945634fe8ad3e12d7b91806aa4220ed27487bb211030d651b27c67a9', 'https://developer.download.nvidia.com/compute/cuda/11.5.1/local_installers/cuda_11.5.1_495.29.05_linux_ppc64le.run')},
2832
'11.5.0': {
2933
'Linux-aarch64': ('6ea9d520cc956cc751a5ac54f4acc39109627f4e614dd0b1a82cc86f2aa7d8c4', 'https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux_sbsa.run'),
3034
'Linux-x86_64': ('ae0a1693d9497cf3d81e6948943e3794636900db71c98d58eefdacaf7f1a1e4c', 'https://developer.download.nvidia.com/compute/cuda/11.5.0/local_installers/cuda_11.5.0_495.29.05_linux.run'),

var/spack/repos/builtin/packages/neuron/package.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,7 @@ def cmake_enable_option(spec_requiremement):
143143
"+rx3d",
144144
"+coreneuron",
145145
"+tests"]]
146+
compilation_flags = []
146147
if self.spec.variants['model_tests'].value != ("None",):
147148
args.append('-DNRN_ENABLE_MODEL_TESTS=' + ",".join(
148149
model for model in self.spec.variants["model_tests"].value))
@@ -156,8 +157,8 @@ def cmake_enable_option(spec_requiremement):
156157
args.append("-DPYTHON_EXECUTABLE:FILEPATH="
157158
+ self.spec["python"].command.path)
158159
if "+debug" in self.spec:
159-
args.append("-DCMAKE_C_FLAGS=-g -O0")
160-
args.append("-DCMAKE_CXX_FLAGS=-g -O0")
160+
compilation_flags += ['-g', '-O0']
161+
# Remove default flags (RelWithDebInfo etc.)
161162
args.append("-DCMAKE_BUILD_TYPE=Custom")
162163
if "+mod-compatibility" in self.spec:
163164
args.append("-DNRN_ENABLE_MOD_COMPATIBILITY:BOOL=ON")
@@ -167,6 +168,13 @@ def cmake_enable_option(spec_requiremement):
167168
args.append('-DNRN_DYNAMIC_UNITS_USE_LEGACY=ON')
168169
if "+coreneuron" in self.spec:
169170
args.append('-DCORENEURON_DIR=' + self.spec["coreneuron"].prefix)
171+
# NVHPC 21.11 detects ABM support and defines __ABM__, which breaks
172+
# Random123 compilation
173+
if self.spec.satisfies('%[email protected]'):
174+
compilation_flags.append('-mno-abm')
175+
compilation_flags = ' '.join(compilation_flags)
176+
args.append("-DCMAKE_C_FLAGS=" + compilation_flags)
177+
args.append("-DCMAKE_CXX_FLAGS=" + compilation_flags)
170178
return args
171179

172180
# Create symlink in share/nrn/lib for the python libraries

var/spack/repos/builtin/packages/nvhpc/package.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
# - package key must be in the form '{os}-{arch}' where 'os' is in the
2323
# format returned by platform.system() and 'arch' by platform.machine()
2424
_versions = {
25+
'21.11': {
26+
'Linux-aarch64': ('3b11bcd9cca862fabfce1e7bcaa2050ea12130c7e897f4e7859ba4c155d20720', 'https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_aarch64_cuda_multi.tar.gz'),
27+
'Linux-ppc64le': ('ac51ed92de4eb5e1bdb064ada5bbace5b89ac732ad6c6473778edfb8d29a6527', 'https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_ppc64le_cuda_multi.tar.gz'),
28+
'Linux-x86_64': ('d8d8ccd0e558d22bcddd955f2233219c96f7de56aa8e09e7be833e384d32d6aa', 'https://developer.download.nvidia.com/hpc-sdk/21.11/nvhpc_2021_2111_Linux_x86_64_cuda_multi.tar.gz')},
2529
'21.9': {
2630
'Linux-aarch64': ('52c2c66e30043add4afccedf0ba77daa0000bf42e0db844baa630bb635b91a7d', 'https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_aarch64_cuda_multi.tar.gz'),
2731
'Linux-ppc64le': ('cff0b55fb782be1982bfeec1d9763b674ddbf84ff2c16b364495299266320289', 'https://developer.download.nvidia.com/hpc-sdk/21.9/nvhpc_2021_219_Linux_ppc64le_cuda_multi.tar.gz'),

0 commit comments

Comments
 (0)