From 38a1732c5a8f85203747c96c5414b2ed5fd9696b Mon Sep 17 00:00:00 2001 From: jthies Date: Tue, 30 Oct 2018 14:12:15 +0100 Subject: Jthies/xsdk add phist (#8980) * packages/phist: add variant 'fortran' to enable/disable building the Fortran bindings * xsdk: add phist * packages/xsdk: add a comment reg. updating phist dependency * packages/phist: +fortran variant is only for versions 1.7: * packages/phist: update comments * xsdk: forgot to specify kernel library for phist (picked tpetra, assuming trilinos+tpetra will be installed) * packages/phist: add variant 'openmp' to allow disabling OpenMP * phist: fix compile error due to missing -lm * flake8: fix warnings * packages/phist: fix cmake flag: XSDK_ENABLE_Fortran (rather than XSDK_BUILD_Fortran) * packages/phist: allow disabling building the scamac matrix generator (which causes trouble on some systems) * packages/xsdk: disable scamac within phist because it caused problems for @balay and is not essential for now * packages/phist: actually disable scamac via cmake if ~scamac * phist: disable openmp from xsdk --- var/spack/repos/builtin/packages/phist/package.py | 33 ++++++++++++++++++++--- var/spack/repos/builtin/packages/xsdk/package.py | 7 +++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/var/spack/repos/builtin/packages/phist/package.py b/var/spack/repos/builtin/packages/phist/package.py index 50aa96640c..aa593157b5 100644 --- a/var/spack/repos/builtin/packages/phist/package.py +++ b/var/spack/repos/builtin/packages/phist/package.py @@ -38,6 +38,7 @@ class Phist(CMakePackage): 'petsc', 'eigen', 'ghost']) + variant(name='outlev', default='2', values=['0', '1', '2', '3', '4', '5'], description='verbosity. 0: errors 1: +warnings 2: +info ' '3: +verbose 4: +extreme 5; +debug') @@ -48,9 +49,18 @@ class Phist(CMakePackage): variant('mpi', default=True, description='enable/disable MPI (note that the kernel library may ' 'not support this choice)') + + variant('openmp', default=True, + description='enable/disable OpenMP') + variant('parmetis', default=False, description='enable/disable ParMETIS partitioning (only actually ' 'used with kernel_lib=builtin)') + + variant('scamac', default=True, + description='enable/disable building the "SCAlable MAtrix ' + 'Collection" matrix generators.') + variant('trilinos', default=False, description='enable/disable Trilinos third-party libraries. ' 'For all kernel_libs, we can use Belos and Anasazi ' @@ -58,12 +68,19 @@ class Phist(CMakePackage): '(kernel_lib=epetra|tpetra) we can use preconditioner ' 'packages such as Ifpack, Ifpack2 and ML.') + variant('fortran', default=True, + description='generate Fortran 2003 bindings (requires Python3 and ' + 'a Fortran compiler)') + # ###################### Dependencies ########################## depends_on('cmake@3.8:', type='build') depends_on('blas') depends_on('lapack') - depends_on('python@3:', when='@1.7:', type='build') + # Python 3 or later is required for generating the Fortran 2003 bindings + # since version 1.7, you can get rid of the dependency by switching off + # the feature (e.g. use the '~fortran' variant) + depends_on('python@3:', when='@1.7: +fortran', type='build') depends_on('mpi', when='+mpi') depends_on('trilinos+anasazi+belos+teuchos', when='+trilinos') depends_on('trilinos@12:+tpetra', when='kernel_lib=tpetra') @@ -76,14 +93,18 @@ class Phist(CMakePackage): depends_on('trilinos', when='+trilinos') depends_on('parmetis ^metis+int64', when='+parmetis') + # Fortran 2003 bindings were included in version 1.7, previously they + # required a separate package + conflicts('+fortran', when='@:1.6.99') + def cmake_args(self): spec = self.spec kernel_lib = spec.variants['kernel_lib'].value outlev = spec.variants['outlev'].value - lapacke_libs = \ - (spec['lapack:c'].libs + spec['blas:c'].libs).joined(';') + lapacke_libs = (spec['lapack:c'].libs + spec['blas:c'].libs + + find_system_libraries(['libm'])).joined(';') lapacke_include_dir = spec['lapack:c'].headers.directories[0] args = ['-DPHIST_KERNEL_LIB=%s' % kernel_lib, @@ -92,14 +113,20 @@ class Phist(CMakePackage): '-DTPL_LAPACKE_INCLUDE_DIRS=%s' % lapacke_include_dir, '-DPHIST_ENABLE_MPI:BOOL=%s' % ('ON' if '+mpi' in spec else 'OFF'), + '-DPHIST_ENABLE_OPENMP=%s' + % ('ON' if '+openmp' in spec else 'OFF'), '-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if '+shared' in spec else 'OFF'), + '-DPHIST_ENABLE_SCAMAC:BOOL=%s' + % ('ON' if '+scamac' in spec else 'OFF'), '-DPHIST_USE_TRILINOS_TPLS:BOOL=%s' % ('ON' if '+trilinos' in spec else 'OFF'), '-DPHIST_USE_SOLVER_TPLS:BOOL=%s' % ('ON' if '+trilinos' in spec else 'OFF'), '-DPHIST_USE_PRECON_TPLS:BOOL=%s' % ('ON' if '+trilinos' in spec else 'OFF'), + '-DXSDK_ENABLE_Fortran:BOOL=%s' + % ('ON' if '+fortran' in spec else 'OFF'), ] return args diff --git a/var/spack/repos/builtin/packages/xsdk/package.py b/var/spack/repos/builtin/packages/xsdk/package.py index 187b3e7744..21f71b9abd 100644 --- a/var/spack/repos/builtin/packages/xsdk/package.py +++ b/var/spack/repos/builtin/packages/xsdk/package.py @@ -75,6 +75,13 @@ class Xsdk(Package): depends_on('slepc@develop', when='@develop') + # the Fortran 2003 bindings of phist require python@3:, but this + # creates a conflict with other packages like petsc@develop. Actually + # these are type='build' dependencies, but spack reports a conflict anyway. + # This will be fixed once the new concretizer becomes available + # (says @adamjsteward) + depends_on('phist@develop kernel_lib=tpetra ~fortran ~scamac ~openmp', when='@develop') + # xSDKTrilinos depends on the version of Trilinos built with # +tpetra which is turned off for faster xSDK # depends_on('xsdktrilinos@xsdk-0.2.0', when='@xsdk-0.2.0') -- cgit v1.2.3-60-g2f50