From 27b9727926139ae2cfde6d3cdcdf5746ed28e03d Mon Sep 17 00:00:00 2001 From: Andreas Baumbach Date: Sat, 22 Aug 2020 21:42:46 +0200 Subject: [PATCH] Add new package arbor (#11914) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add new package arbor Change-Id: I70a442d6ad74979d13bd9f599df238c085d4baf9 * Update package.py * add additional dependencies * change download to tar-ball * py26 compatibility * restrict noqas and expand comment Co-authored-by: Eric Müller --- .../repos/builtin/packages/arbor/package.py | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 var/spack/repos/builtin/packages/arbor/package.py diff --git a/var/spack/repos/builtin/packages/arbor/package.py b/var/spack/repos/builtin/packages/arbor/package.py new file mode 100644 index 0000000000..7ed69fe47c --- /dev/null +++ b/var/spack/repos/builtin/packages/arbor/package.py @@ -0,0 +1,70 @@ +# Copyright 2013-2019 Lawrence Livermore National Security, LLC and other +# Spack Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack import * + + +class Arbor(CMakePackage): + """Arbor is a high-performance library for computational neuroscience + simulations.""" + + homepage = "https://github.com/arbor-sim/arbor/" + url = "https://github.com/arbor-sim/arbor/archive/v0.2.tar.gz" + + version('0.2', sha256='43c9181c03be5f3c9820b2b50592d7b41344f37e1200980119ad347eb7bcf4eb') + + variant('vectorize', default=False, + description='Enable vectorization of computational kernels') + variant('gpu', default=False, description='Enable GPU support') + variant('mpi', default=False, description='Enable MPI support') + variant('python', default=False, + description='Enable Python frontend support') + variant('unwind', default=False, + description='Enable libunwind for pretty stack traces') + + depends_on('cuda', when='+gpu') + depends_on('mpi', when='+mpi') + depends_on('libunwind', when='+unwind') + + extends('python@3.6:', when='+python') + depends_on('py-mpi4py', when='+mpi+python', type=('build', 'run')) + + depends_on('cmake@3.9:', type='build') + # mentioned in documentation but shouldn't be necessary when + # using the archive + # depends_on('git@2.0:', type='build') + + # compiler dependencies + # depends_on(C++14) + # depends_on('gcc@6.1.0:', type='build') + # depends_on('llvm@4:', type='build') + # depends_on('clang-apple@9:', type='build') + + # when building documentation, this could be an optional dependency + depends_on('py-sphinx', type='build') + + def patch(self): + filter_file( + r'find_library\(_unwind_library_target unwind-\${libunwind_arch}', + r'find_library(_unwind_library_target unwind-${_libunwind_arch}', + 'cmake/FindUnwind.cmake' + ) + filter_file( + r'target_compile_definitions\(arbor-private-deps ARB_WITH_UNWIND\)', # noqa: E501 + r'target_compile_definitions(arbor-private-deps INTERFACE WITH_UNWIND)', # noqa: E501 + 'CMakeLists.txt' + ) + + def cmake_args(self): + args = [ + '-DARB_VECTORIZE=' + ('ON' if '+vectorize' in self.spec else 'OFF'), # noqa: E501 + '-DARB_WITH_GPU=' + ('ON' if '+gpu' in self.spec else 'OFF'), + '-DARB_WITH_PYTHON=' + ('ON' if '+python' in self.spec else 'OFF'), + ] + + if '+unwind' in self.spec: + args.append('-DUnwind_ROOT_DIR={0}'.format(self.spec['libunwind'].prefix)) # noqa: E501 + + return args