From 6d971c4493d881755f227e8979eb2df27f75f2ef Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Fri, 22 Mar 2019 10:58:48 +0100 Subject: add ginkgo package, use it in dealii along with symengine (#10917) --- var/spack/repos/builtin/packages/dealii/package.py | 19 ++++++++-- var/spack/repos/builtin/packages/ginkgo/package.py | 43 ++++++++++++++++++++++ .../repos/builtin/packages/ginkgo/static.patch | 17 +++++++++ 3 files changed, 76 insertions(+), 3 deletions(-) create mode 100644 var/spack/repos/builtin/packages/ginkgo/package.py create mode 100644 var/spack/repos/builtin/packages/ginkgo/static.patch diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 420a71d5b5..e46dba7bc6 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -41,6 +41,7 @@ class Dealii(CMakePackage, CudaPackage): description='Compile with Adol-c') variant('doc', default=False, description='Compile with documentation') + variant('ginkgo', default=False, description='Compile wit Ginkgo') variant('gmsh', default=True, description='Compile with GMSH') variant('gsl', default=True, description='Compile with GSL') variant('hdf5', default=True, @@ -61,6 +62,8 @@ class Dealii(CMakePackage, CudaPackage): description='Compile with Sundials') variant('slepc', default=True, description='Compile with Slepc (only with Petsc and MPI)') + variant('symengine', default=False, + description='Compile with SymEngine') variant('trilinos', default=True, description='Compile with Trilinos (only with MPI)') variant('python', default=False, @@ -115,16 +118,17 @@ class Dealii(CMakePackage, CudaPackage): depends_on('assimp', when='@9.0:+assimp') depends_on('doxygen+graphviz', when='+doc') depends_on('graphviz', when='+doc') + depends_on('ginkgo', when='@9.1:+ginkgo') depends_on('gmsh+tetgen+netgen+oce', when='@9.0:+gmsh', type=('build', 'run')) depends_on('gsl', when='@8.5.0:+gsl') # FIXME: next line fixes concretization with petsc depends_on('hdf5+mpi+hl+fortran', when='+hdf5+mpi+petsc') depends_on('hdf5+mpi+hl', when='+hdf5+mpi~petsc') depends_on('cuda@8:', when='+cuda') - depends_on('cmake@3.9:', when='+cuda') + depends_on('cmake@3.9:', when='+cuda', type='build') # older version of deal.II do not build with Cmake 3.10, see # https://github.com/dealii/dealii/issues/5510 - depends_on('cmake@:3.9.99', when='@:8.99') + depends_on('cmake@:3.9.99', when='@:8.99', type='build') # FIXME: concretizer bug. The two lines mimic what comes from PETSc # but we should not need it depends_on('metis@5:+int64', when='+metis+int64') @@ -144,6 +148,7 @@ class Dealii(CMakePackage, CudaPackage): depends_on('slepc@:3.6.3', when='@:8.4.1+slepc+petsc+mpi') depends_on('slepc~arpack', when='+slepc+petsc+mpi+int64') depends_on('sundials@:3~pthread', when='@9.0:+sundials') + depends_on('symengine@0.3:', when='@9.1:+symengine') # do not require +rol to make concretization of xsdk possible depends_on('trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos', when='+trilinos+mpi~int64~cuda') depends_on('trilinos+amesos+aztec+epetra+ifpack+ml+muelu+sacado+teuchos~hypre', when='+trilinos+mpi+int64~cuda') @@ -172,6 +177,13 @@ class Dealii(CMakePackage, CudaPackage): 'onwards. Please explicitly disable this variant ' 'via ~{0}'.format(p)) + # interfaces added in 9.1.0: + for p in ['ginkgo', 'symengine']: + conflicts('+{0}'.format(p), when='@:9.0', + msg='The interface to {0} is supported from version 9.1.0 ' + 'onwards. Please explicitly disable this variant ' + 'via ~{0}'.format(p)) + conflicts('+slepc', when='~petsc', msg='It is not possible to enable slepc interfaces ' 'without petsc.') @@ -310,7 +322,8 @@ class Dealii(CMakePackage, CudaPackage): # variables: for library in ( 'gsl', 'hdf5', 'p4est', 'petsc', 'slepc', 'trilinos', 'metis', - 'sundials', 'nanoflann', 'assimp', 'gmsh', 'muparser'): + 'sundials', 'nanoflann', 'assimp', 'gmsh', 'muparser', + 'symengine', 'ginkgo'): if ('+' + library) in spec: options.extend([ '-D%s_DIR=%s' % (library.upper(), spec[library].prefix), diff --git a/var/spack/repos/builtin/packages/ginkgo/package.py b/var/spack/repos/builtin/packages/ginkgo/package.py new file mode 100644 index 0000000000..6cbfe5bf84 --- /dev/null +++ b/var/spack/repos/builtin/packages/ginkgo/package.py @@ -0,0 +1,43 @@ +# 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 * +import sys + + +class Ginkgo(CMakePackage, CudaPackage): + """High-performance linear algebra library for manycore systems, + with a focus on sparse solution of linear systems.""" + + homepage = "https://github.com/ginkgo-project/ginkgo" + url = "https://github.com/ginkgo-project/ginkgo.git" + git = "https://github.com/ginkgo-project/ginkgo.git" + + version('develop', branch='develop') + + # Ginkgo has problems with circular dependencies and shared libs, see + # https://github.com/ginkgo-project/ginkgo/issues/203 + # Thus keep default to False for now + variant('shared', default=False, description='Build shared libraries') + variant('openmp', default=sys.platform != 'darwin', description='Build with OpenMP') + variant('build_type', default='Release', + description='The build type to build', + values=('Debug', 'Release')) + + depends_on('cmake@3.9:', type='build') + depends_on('cuda@9:', when='+cuda') + + # issues with ** expression, see + # https://github.com/ginkgo-project/ginkgo/issues/270#issuecomment-473901621 + patch('static.patch') + + def cmake_args(self): + spec = self.spec + return [ + '-DGINKGO_BUILD_CUDA=%s' % ('ON' if '+cuda' in spec else 'OFF'), + '-DGINKGO_BUILD_OMP=%s' % ('ON' if '+openmp' in spec else 'OFF'), + '-DBUILD_SHARED_LIBS=%s' % ('ON' if '+shared' in spec else 'OFF'), + '-DGINKGO_BUILD_BENCHMARKS=OFF' + ] diff --git a/var/spack/repos/builtin/packages/ginkgo/static.patch b/var/spack/repos/builtin/packages/ginkgo/static.patch new file mode 100644 index 0000000000..9aa7aec3f2 --- /dev/null +++ b/var/spack/repos/builtin/packages/ginkgo/static.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e5fae68..807a7dc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -109,9 +109,9 @@ if(GINKGO_DEVEL_TOOLS) + endif() + + # Generate the global `ginkgo/ginkgo.hpp` header with every call of make +-add_custom_target(generate_ginkgo_header ALL +- COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/update_ginkgo_header.sh +- WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR}) ++# add_custom_target(generate_ginkgo_header ALL ++# COMMAND ${Ginkgo_SOURCE_DIR}/dev_tools/scripts/update_ginkgo_header.sh ++# WORKING_DIRECTORY ${Ginkgo_SOURCE_DIR}) + + if(GINKGO_BUILD_DOC) + add_subdirectory(doc) -- cgit v1.2.3-60-g2f50