Skip to content

Commit

Permalink
neuron: add build_type=FastDebug, drop debug variant (#1814)
Browse files Browse the repository at this point in the history
* neuron: add build_type=FastDebug variant
* neuron: remove debug variant
  • Loading branch information
olupton committed Jan 26, 2023
1 parent c0e857d commit 22ef8c4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 16 deletions.
2 changes: 1 addition & 1 deletion bluebrain/deployment/environments/applications_hpc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ spack:
- neurodamus-neocortex+ngv+metabolism+caliper%intel
- neurodamus-thalamus+coreneuron+caliper%intel
- neurodamus-thalamus+coreneuron+caliper%intel^neuron+knl
- neuron%intel+coreneuron+debug build_type=Debug
- neuron%intel+coreneuron build_type=Debug
- nmodl
- parquet-converters
- [email protected]
Expand Down
4 changes: 2 additions & 2 deletions bluebrain/deployment/environments/applications_libraries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spack:
- gmsh
- hdf5+mpi
- highfive+mpi
- neuron+mpi~debug%intel
- neuron+mpi%intel
- omega-h
- petsc+int64+mpi
- py-cgal-pybind
Expand Down Expand Up @@ -38,7 +38,7 @@ spack:
- highfive+mpi
- hypre+int64+mpi
- metis+int64
- neuron+mpi~debug%intel
- neuron+mpi%intel
- omega-h+gmsh
- petsc~int64+mpi
- petsc+int64+mpi
Expand Down
37 changes: 24 additions & 13 deletions bluebrain/repo-patches/packages/neuron/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,14 @@ class Neuron(CMakePackage):

variant("binary", default=True, description="Create special as a binary instead of shell script (8.0.x and earlier)")
conflicts("~binary", when='@8.0.999:')
variant(
"build_type",
default="RelWithDebInfo",
description="CMake build type",
values=("Debug", "FastDebug", "RelWithDebInfo", "Release"),
)
variant("coreneuron", default=True, description="Enable CoreNEURON support")
variant("mod-compatibility", default=True, description="Enable CoreNEURON compatibility for MOD files")
variant("debug", default=False, description="Build with flags -g -O0")
variant("interviews", default=False, description="Enable GUI with INTERVIEWS")
variant("legacy-fr", default=True, description="Use original faraday, R, etc. instead of 2019 nist constants")
variant("memacs", default=True, description="Enable use of memacs")
Expand Down Expand Up @@ -110,11 +115,6 @@ class Neuron(CMakePackage):
depends_on("coreneuron+legacy-unit+caliper", when="@:8.99+coreneuron+legacy-unit+caliper")
depends_on("coreneuron~legacy-unit+caliper", when="@:8.99+coreneuron~legacy-unit+caliper")

# TODO: if +debug variant is used (e.g. in CIs), we have to make sure
# coreneuron with Debug build is used. This can be removed when we
# remove +debug variant from this recipe.
depends_on("coreneuron build_type=Debug", when="@:8.99+coreneuron+debug")

# dependencies from coreneuron package
depends_on('python', type=('build', 'run'))
depends_on('boost', when='@8.99:+tests+coreneuron')
Expand Down Expand Up @@ -182,8 +182,17 @@ def cmake_enable_option(spec_requiremement):
if "+python" in self.spec:
args.append("-DPYTHON_EXECUTABLE:FILEPATH="
+ self.spec["python"].command.path)
if "+debug" in self.spec:
compilation_flags += ['-g', '-O0']
if self.spec.variants["build_type"].value == "FastDebug":
# Do *not* add -DNDEBUG, so assertions are enabled
# Good debug information and stack traces
compilation_flags.append("-g")
if '%nvhpc' not in self.spec:
compilation_flags.append("-fno-omit-frame-pointer")
# Moderate optimisation by default
compilation_flags.append("-O1")
if "%intel" in self.spec:
# This one definitely seems wise
compilation_flags += ["-fp-model", "consistent"]
# Remove default flags (RelWithDebInfo etc.)
args.append("-DCMAKE_BUILD_TYPE=Custom")

Expand All @@ -207,11 +216,13 @@ def cmake_enable_option(spec_requiremement):
args.append("-DNRN_AVOID_ABSOLUTE_PATHS=ON")
# Pass Spack's target architecture flags in explicitly so that they're
# saved to the nrnivmodl Makefile.
if "~debug" in self.spec:
compilation_flags.append(
self.spec.architecture.target.optimization_flags(self.spec.compiler)
)
compilation_flags = ' '.join(compilation_flags)
compilation_flags.append(
self.spec.architecture.target.optimization_flags(self.spec.compiler)
)
if "%intel" in self.spec:
# icpc: command line warning #10121: overriding '-march=skylake' with '-march=skylake'
compilation_flags.append("-diag-disable=10121")
compilation_flags = " ".join(compilation_flags)
args.append("-DCMAKE_C_FLAGS=" + compilation_flags)
args.append("-DCMAKE_CXX_FLAGS=" + compilation_flags)
if "+caliper" in self.spec:
Expand Down

0 comments on commit 22ef8c4

Please sign in to comment.