Skip to content
Snippets Groups Projects
Commit b009cd5f authored by Athanasios Karmas's avatar Athanasios Karmas
Browse files

Merge branch 'update_nest_package' into 'master'

Update of NEST package

See merge request akarmas/ebrains-spack-builds!1
parents a0e326fe 512df053
No related branches found
No related tags found
No related merge requests found
diff --git b/CMakeLists.txt a/CMakeLists.txt
index d879164a8..e92b21e70 100644
--- b/CMakeLists.txt
+++ a/CMakeLists.txt
@@ -83,7 +83,7 @@ set( target-bits-split "standard" CACHE STRING "Split of the 64-bit target neuro
################################################################################
# In general use the CMAKE_INSTALL_<dir> and CMAKE_INSTALL_FULL_<dir> vars from
-# GNUInstallDirs (included after calling nest_process_with_python()), but the
+# GNUInstallDirs (included after calling nest_process_with_python()), but the
# CMAKE_INSTALL_DATADIR is usually just CMAKE_INSTALL_DATAROOTDIR
# and we want it to be CMAKE_INSTALL_DATAROOTDIR/PROJECT_NAME
set( CMAKE_INSTALL_DATADIR "share/${PROJECT_NAME}" CACHE STRING "Relative directory, where NEST installs its data (share/nest)" )
@@ -130,6 +130,7 @@ nest_set_default_compiler_flags()
# of GNUInstallDirs defining CMAKE_INSTALL_<dir> and CMAKE_INSTALL_FULL_<dir>.
nest_process_with_python()
include( GNUInstallDirs )
+nest_post_process_with_python()
nest_process_with_optimize()
nest_process_with_debug()
nest_process_with_intel_compiler_flags()
diff --git b/cmake/ProcessOptions.cmake a/cmake/ProcessOptions.cmake
index 1d69c1a84..7e47db25b 100644
--- b/cmake/ProcessOptions.cmake
+++ a/cmake/ProcessOptions.cmake
@@ -399,25 +399,25 @@ function( NEST_PROCESS_WITH_PYTHON )
execute_process( COMMAND "${Python_EXECUTABLE}" "-c"
"import sys, os; print(int(bool(os.environ.get('CONDA_DEFAULT_ENV', False)) or (sys.prefix != sys.base_prefix)))"
OUTPUT_VARIABLE Python_InVirtualEnv OUTPUT_STRIP_TRAILING_WHITESPACE )
-
+
if ( NOT Python_InVirtualEnv AND CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
message( FATAL_ERROR "No virtual Python environment found and no installation prefix specified. "
"Please either build and install NEST in a virtual Python environment or specify CMake option -DCMAKE_INSTALL_PREFIX=<nest_install_dir>.")
endif()
-
+
# Setting CMAKE_INSTALL_PREFIX effects the inclusion of GNUInstallDirs defining CMAKE_INSTALL_<dir> and CMAKE_INSTALL_FULL_<dir>
get_filename_component( Python_EnvRoot "${Python_SITELIB}/../../.." ABSOLUTE)
set ( CMAKE_INSTALL_PREFIX "${Python_EnvRoot}" CACHE PATH "Default install prefix for the active Python interpreter" FORCE )
endif ( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT )
- set( HAVE_PYTHON ON PARENT_SCOPE )
-
# export found variables to parent scope
+ set( HAVE_PYTHON ON PARENT_SCOPE )
set( Python_FOUND "${Python_FOUND}" PARENT_SCOPE )
set( Python_EXECUTABLE ${Python_EXECUTABLE} PARENT_SCOPE )
set( PYTHON ${Python_EXECUTABLE} PARENT_SCOPE )
set( Python_VERSION ${Python_VERSION} PARENT_SCOPE )
-
+ set( Python_VERSION_MAJOR ${Python_VERSION_MAJOR} PARENT_SCOPE )
+ set( Python_VERSION_MINOR ${Python_VERSION_MINOR} PARENT_SCOPE )
set( Python_INCLUDE_DIRS "${Python_INCLUDE_DIRS}" PARENT_SCOPE )
set( Python_LIBRARIES "${Python_LIBRARIES}" PARENT_SCOPE )
@@ -431,7 +431,6 @@ function( NEST_PROCESS_WITH_PYTHON )
set( CYTHON_VERSION "${CYTHON_VERSION}" PARENT_SCOPE )
endif ()
endif ()
- set( PYEXECDIR "lib/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" PARENT_SCOPE )
endif ()
elseif ( ${with-python} STREQUAL "OFF" )
else ()
@@ -439,6 +438,12 @@ function( NEST_PROCESS_WITH_PYTHON )
endif ()
endfunction()
+function( NEST_POST_PROCESS_WITH_PYTHON )
+ if ( Python_FOUND )
+ set( PYEXECDIR "${CMAKE_INSTALL_LIBDIR}/python${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/site-packages" PARENT_SCOPE )
+ endif()
+endfunction()
+
function( NEST_PROCESS_WITH_OPENMP )
# Find OPENMP
if ( with-openmp )
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details. # Spack Project Developers. See the top-level COPYRIGHT file for details.
# #
# SPDX-License-Identifier: (Apache-2.0 OR MIT) # SPDX-License-Identifier: (Apache-2.0 OR MIT)
...@@ -8,15 +8,24 @@ from spack import * ...@@ -8,15 +8,24 @@ from spack import *
class Nest(CMakePackage): class Nest(CMakePackage):
"""NEST is a simulator for spiking neural network models """NEST is a simulator for spiking neural network models
It focuses on the dynamics, size and structure of neural systems rather It focuses on the dynamics, size and structure of neural systems rather
than on the exact morphology of individual neurons.""" than on the exact morphology of individual neurons."""
homepage = "http://www.nest-simulator.org" homepage = "http://www.nest-simulator.org"
url = "https://github.com/nest/nest-simulator/archive/refs/tags/v2.20.0.tar.gz" urls = [
'https://github.com/nest/nest-simulator/releases/download/v2.12.0/nest-2.12.0.tar.gz',
'https://github.com/nest/nest-simulator/archive/v3.0.tar.gz',
]
git = "https://github.com/nest/nest-simulator.git" git = "https://github.com/nest/nest-simulator.git"
version('master', branch='master') version('master', branch='master')
version('3.0', sha256='d481ea67f3251fe3aadf5252ab0a999172f0cd5536c5985366d271d772e686e6')
patch('2021-07-17_fix-pyexecdir.patch', when='@3.0')
version('2.20.1', sha256='df3d32b5899d5d444f708037b290f889ac6ff8eae6b7be9e9faee2c0d660d8e5')
version('2.20.0', sha256='40e33187c22d6e843d80095b221fa7fd5ebe4dbc0116765a91fc5c425dd0eca4') version('2.20.0', sha256='40e33187c22d6e843d80095b221fa7fd5ebe4dbc0116765a91fc5c425dd0eca4')
version('2.18.0', sha256='7295c936fbdd5486395b06f54f0d4d35d9a1b6ee50b7b844186ec2c92de641d1')
version('2.16.0', sha256='abfeb61719dec54da9477be035bef1d9d764f4e7663f63f6a6d9211f967e0490')
version('2.14.0', sha256='d6316d6c9153100a3220488abfa738958c4b65bf2622bd15540e4aa81e79f17f') version('2.14.0', sha256='d6316d6c9153100a3220488abfa738958c4b65bf2622bd15540e4aa81e79f17f')
version('2.12.0', sha256='bac578f38bb0621618ee9d5f2f1febfee60cddc000ff32e51a5f5470bb3df40d') version('2.12.0', sha256='bac578f38bb0621618ee9d5f2f1febfee60cddc000ff32e51a5f5470bb3df40d')
version('2.10.0', sha256='2b6fc562cd6362e812d94bb742562a5a685fb1c7e08403765dbe123d59b0996c') version('2.10.0', sha256='2b6fc562cd6362e812d94bb742562a5a685fb1c7e08403765dbe123d59b0996c')
...@@ -24,11 +33,9 @@ class Nest(CMakePackage): ...@@ -24,11 +33,9 @@ class Nest(CMakePackage):
version('2.6.0', sha256='5fe4924bc57d0c7dd820aa371de935eedf7e813832c0eee2c976b33c9a8db4cf') version('2.6.0', sha256='5fe4924bc57d0c7dd820aa371de935eedf7e813832c0eee2c976b33c9a8db4cf')
version('2.4.2', sha256='8f86e58c1a12b733ffabd8b0400326e5a3494a458149ea8ebe9f19674d05b91b') version('2.4.2', sha256='8f86e58c1a12b733ffabd8b0400326e5a3494a458149ea8ebe9f19674d05b91b')
maintainers = ['ikitayama'] variant('python', default=True,
variant('python', default=False,
description='Build the PyNest interface') description='Build the PyNest interface')
variant('mpi', default=False, variant('mpi', default=True,
description='Build with MPI bindings') description='Build with MPI bindings')
variant('openmp', default=True, variant('openmp', default=True,
description='"Enable OpenMP support"') description='"Enable OpenMP support"')
...@@ -49,17 +56,19 @@ class Nest(CMakePackage): ...@@ -49,17 +56,19 @@ class Nest(CMakePackage):
conflicts('~openmp', when='@:2.10.99', conflicts('~openmp', when='@:2.10.99',
msg='Option only introduced for non-ancient versions.') msg='Option only introduced for non-ancient versions.')
depends_on('python@2.6:', when='+python', type=('build', 'run')) #depends_on('python@2.6:2.99', when='@:2.14+python', type=('build', 'run'))
depends_on('python@2.6:2.99', when='@:2.15.99+python', type=('build', 'run'))
depends_on('python@2.6:', when='@2.16:+python', type=('build', 'run'))
depends_on('python@3.8:', when='@3:', type=('build', 'run'))
depends_on('py-numpy@:1.16.99', when='@:2.14.99+python', type=('build', 'run'))
depends_on('py-numpy', when='+python', type=('build', 'run')) depends_on('py-numpy', when='+python', type=('build', 'run'))
depends_on('py-scipy', when='+python', type=('run'))
depends_on('py-cython@0.19.2:', when='+python', type='build') depends_on('py-cython@0.19.2:', when='+python', type='build')
depends_on('py-nose', when='+python', type='test') depends_on('py-nose', when='+python', type='test')
depends_on('py-setuptools', when='+python', type='build') depends_on('py-setuptools', when='+python', type='build')
depends_on('py-setuptools@:44.99.99', when='@:2.15.99+python', type='build')
depends_on('mpi', when='+mpi') depends_on('mpi', when='+mpi')
depends_on('doxygen', type='build') depends_on('doxygen', type='build')
depends_on('gsl', when='+gsl') depends_on('gsl', when='+gsl')
depends_on('readline') depends_on('readline')
depends_on('libtool') depends_on('libtool')
...@@ -78,6 +87,7 @@ class Nest(CMakePackage): ...@@ -78,6 +87,7 @@ class Nest(CMakePackage):
@when('@:2.10.99') @when('@:2.10.99')
def install(self, spec, prefix): def install(self, spec, prefix):
# calculate the "./configure" flags (not cmake!)
configure_args = ["CXXFLAGS=-std=c++03", configure_args = ["CXXFLAGS=-std=c++03",
"--prefix=" + prefix, "--prefix=" + prefix,
"--with-openmp"] "--with-openmp"]
...@@ -94,36 +104,45 @@ class Nest(CMakePackage): ...@@ -94,36 +104,45 @@ class Nest(CMakePackage):
else: else:
configure_args.append("--without-optimize") configure_args.append("--without-optimize")
configure(*configure_args) if 'mpi' in spec:
env['CC'] = spec['mpi'].mpicc
env['CXX'] = spec['mpi'].mpicxx
env['F77'] = spec['mpi'].mpif77
env['FC'] = spec['mpi'].mpifc
configure(*self.cmake_args(spec, prefix))
make() make()
make("install") make("install")
def cmake_args(self): def cmake_args(self):
args = [] args = [
"--prefix=" + prefix,
]
if '+mpi' in self.spec: if '+mpi' in self.spec:
args.append('-Dwith-mpi=ON') args.append('-Dwith-mpi=ON')
else: else:
args.append('-Dwith-mpi=OFF') args.append('-Dwith-mpi=OFF')
if '+python' in self.spec: if '+gsl' in self.spec:
args.append('-Dwith-python=ON') args.append('-Dwith-gsl=' + self.spec['gsl'].prefix)
args.append('-Dcythonize-pynest=' + self.spec['py-cython'].prefix)
else: else:
args.append('-Dwith-python=OFF') args.append('-Dwith-gsl=OFF')
args.append('-Dcythonize-pynest=OFF')
if self.spec.satisfies('@:2.999'):
if '+python':
version = self.spec['python'].version[0]
args.append('-Dwith-python={0}'.format(version))
args.append('-Dcythonize-pynest=' + self.spec['py-cython'].prefix)
else:
args.append('-Dwith-python=OFF')
args.append('-Dcythonize-pynest=OFF')
if '+optimize' in self.spec: if '+optimize' in self.spec:
args.append('-Dwith-optimize=ON') args.append('-Dwith-optimize=ON')
else: else:
args.append('-Dwith-optimize=OFF') args.append('-Dwith-optimize=OFF')
if '+gsl' in self.spec:
args.append('-Dwith-gsl=' + self.spec['gsl'].prefix)
else:
args.append('-Dwith-gsl=OFF')
if '+openmp' in self.spec: if '+openmp' in self.spec:
args.append('-Dwith-openmp=ON') args.append('-Dwith-openmp=ON')
else: else:
...@@ -151,5 +170,7 @@ class Nest(CMakePackage): ...@@ -151,5 +170,7 @@ class Nest(CMakePackage):
self.stage.source_path, recursive=True): self.stage.source_path, recursive=True):
install(f, path_headers) install(f, path_headers)
def setup_run_environment(self, env): @run_after('install')
env.set("NEST_INSTALL_DIR", self.spec.prefix) @on_package_attributes(run_tests=True)
def installcheck(self):
make("installcheck")
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment