|
| 1 | +# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other |
| 2 | +# Spack Project Developers. See the top-level COPYRIGHT file for details. |
| 3 | +# |
| 4 | +# SPDX-License-Identifier: (Apache-2.0 OR MIT) |
| 5 | + |
| 6 | +from spack import * |
| 7 | + |
| 8 | + |
| 9 | +class Genn(PythonPackage): |
| 10 | + """GeNN is a GPU-enhanced Neuronal Network simulation environment based on |
| 11 | + code generation for Nvidia CUDA.""" |
| 12 | + |
| 13 | + homepage = "https://genn-team.github.io/genn/" |
| 14 | + url = "https://github.com/genn-team/genn/archive/refs/tags/4.6.0.tar.gz" |
| 15 | + |
| 16 | + version('4.6.0', sha256='5e5ca94fd3a56b5b963a4911ea1b2130df6fa7dcdde3b025bd8cb85d4c2d3236') |
| 17 | + |
| 18 | + conflicts('%gcc@:4.9.3') |
| 19 | + depends_on('gmake', type='build') |
| 20 | + |
| 21 | + variant('cuda', default=True, description='Enable CUDA support') |
| 22 | + depends_on('cuda', when='+cuda') |
| 23 | + |
| 24 | + variant('python', default=True, description='Enable PyGeNN') |
| 25 | + extends('python', when='+python') |
| 26 | + depends_on( '[email protected]:', when='+python') |
| 27 | + depends_on( '[email protected]:', when='+python') |
| 28 | + depends_on('py-six', when='+python') |
| 29 | + depends_on('py-deprecated', when='+python') |
| 30 | + depends_on('py-psutil', when='+python') |
| 31 | + depends_on( '[email protected]:', when='+python') |
| 32 | + depends_on('swig', when='+python') |
| 33 | + |
| 34 | + patch('include_path.patch') |
| 35 | + |
| 36 | + def build(self, spec, prefix): |
| 37 | + make('PREFIX={}'.format(prefix), 'install') |
| 38 | + if '+python' in self.spec: |
| 39 | + make('DYNAMIC=1', 'LIBRARY_DIRECTORY={}/pygenn/genn_wrapper/'.format(self.stage.source_path)) |
| 40 | + super(Genn, self).build(spec, prefix) |
| 41 | + |
| 42 | + def install(self, spec, prefix): |
| 43 | + install_tree('bin', prefix.bin) |
| 44 | + install_tree('include', prefix.include) |
| 45 | + mkdirp(prefix.src.genn) |
| 46 | + install_tree('src/genn', prefix.src.genn) |
| 47 | + if '+python' in self.spec: |
| 48 | + super(Genn, self).install(spec, prefix) |
| 49 | + |
| 50 | + def setup_run_environment(self, env): |
| 51 | + env.append_path('CPLUS_INCLUDE_PATH', self.prefix.include) |
| 52 | + if '+cuda' in self.spec: |
| 53 | + env.append_path('CUDA_PATH', self.spec['cuda'].prefix) |
| 54 | + if '+python' in self.spec: |
| 55 | + super(Genn, self).setup_run_environment(env) |
0 commit comments