From f1fb816d93821a19046474a9252a5b6fb2c9cd00 Mon Sep 17 00:00:00 2001 From: Dan Lipsa Date: Tue, 2 Nov 2021 17:36:53 -0400 Subject: Add build editions for catalyst builds. (#22676) * Add build editions for catalyst builds. * Fix style. * Build edition works only for 5.8: --- .../repos/builtin/packages/catalyst/package.py | 23 +++++++++++++------- .../repos/builtin/packages/paraview/package.py | 25 ++++++++++++++++++---- 2 files changed, 36 insertions(+), 12 deletions(-) diff --git a/var/spack/repos/builtin/packages/catalyst/package.py b/var/spack/repos/builtin/packages/catalyst/package.py index 7536f7d95e..51a308911c 100644 --- a/var/spack/repos/builtin/packages/catalyst/package.py +++ b/var/spack/repos/builtin/packages/catalyst/package.py @@ -13,9 +13,12 @@ from spack import * class Catalyst(CMakePackage): - """Catalyst is an in situ use case library, with an adaptable application - programming interface (API), that orchestrates the alliance between - simulation and analysis and/or visualization tasks.""" + """Catalyst is an in situ library, with an adaptable application + programming interface (API), that orchestrates the alliance + between simulation and analysis and/or visualization tasks. For + versions 5.7 and greater use the paraview package. + + """ homepage = 'http://www.paraview.org' url = "https://www.paraview.org/files/v5.5/ParaView-v5.5.2.tar.gz" @@ -60,11 +63,15 @@ class Catalyst(CMakePackage): # extends('python', when='+python') extends('python', when='+python') extends('python', when='+python3') + # VTK < 8.2.1 can't handle Python 3.8 + # This affects Paraview <= 5.7 (VTK 8.2.0) + # https://gitlab.kitware.com/vtk/vtk/-/issues/17670 + depends_on('python@3:3.7', when='@:5.7 +python3', type=('build', 'run')) + depends_on('python@3:', when='@5.8:+python3', type=('build', 'run')) + depends_on('python@2.7:2.8', when='+python', type=('build', 'link', 'run')) depends_on('git', type='build') depends_on('mpi') - depends_on('python@2.7:2.8', when='+python', type=('build', 'link', 'run')) - depends_on('python@3:', when='+python3', type=('build', 'link', 'run')) depends_on('py-numpy', when='+python', type=('build', 'run')) depends_on('py-numpy', when='+python3', type=('build', 'run')) @@ -137,9 +144,9 @@ class Catalyst(CMakePackage): catalyst_source_dir = os.path.abspath(self.root_cmakelists_dir) python_path = (os.path.realpath( - spec['python3'].command.path if '+python3' in self.spec else - spec['python'].command.path if '+python' in self.spec else - sys.executable)) + self.spec['python'].command.path + if ('+python3' in self.spec or '+python' in self.spec) + else sys.executable)) command = [python_path, catalyst_script, '-r', self.stage.source_path, diff --git a/var/spack/repos/builtin/packages/paraview/package.py b/var/spack/repos/builtin/packages/paraview/package.py index 93f7aca922..3fd99be7e2 100644 --- a/var/spack/repos/builtin/packages/paraview/package.py +++ b/var/spack/repos/builtin/packages/paraview/package.py @@ -11,7 +11,11 @@ from spack import * class Paraview(CMakePackage, CudaPackage): """ParaView is an open-source, multi-platform data analysis and - visualization application.""" + visualization application. This package includes the Catalyst + in-situ library for versions 5.7 and greater, othewise use the + catalyst package. + + """ homepage = 'https://www.paraview.org' url = "https://www.paraview.org/files/v5.7/ParaView-v5.7.0.tar.xz" @@ -42,8 +46,8 @@ class Paraview(CMakePackage, CudaPackage): version('5.0.1', sha256='caddec83ec284162a2cbc46877b0e5a9d2cca59fb4ab0ea35b0948d2492950bb') version('4.4.0', sha256='c2dc334a89df24ce5233b81b74740fc9f10bc181cd604109fd13f6ad2381fc73') - variant('plugins', default=True, - description='Install include files for plugins support') + variant('development_files', default=True, + description='Install include files for Catalyst or plugins support') variant('python', default=False, description='Enable Python support') variant('python3', default=False, description='Enable Python3 support') variant('mpi', default=True, description='Enable MPI support') @@ -59,6 +63,11 @@ class Paraview(CMakePackage, CudaPackage): variant('adios2', default=False, description='Enable ADIOS2 support') variant('advanced_debug', default=False, description="Enable all other debug flags beside build_type, such as VTK_DEBUG_LEAK") + variant('build_edition', default='canonical', multi=False, + values=('canonical', 'catalyst_rendering', + 'catalyst', 'rendering', 'core'), + description='Build editions include only certain modules. ' + 'Editions are listed in decreasing order of size.') conflicts('+python', when='+python3') # Python 2 support dropped with 5.9.0 @@ -68,6 +77,11 @@ class Paraview(CMakePackage, CudaPackage): # Legacy rendering dropped in 5.5 # See commit: https://gitlab.kitware.com/paraview/paraview/-/commit/798d328c conflicts('~opengl2', when='@5.5:') + # in 5.7 you cannot reduce the size of the code for Catalyst builds. + conflicts('build_edition=catalyst_rendering', when='@:5.7') + conflicts('build_edition=catalyst', when='@:5.7') + conflicts('build_edition=rendering', when='@:5.7') + conflicts('build_edition=core', when='@:5.7') # We only support one single Architecture for _arch, _other_arch in itertools.permutations(CudaPackage.cuda_arch_values, 2): @@ -280,7 +294,7 @@ class Paraview(CMakePackage, CudaPackage): return variant_bool(feature, on='OFF', off='ON') rendering = variant_bool('+opengl2', 'OpenGL2', 'OpenGL') - includes = variant_bool('+plugins') + includes = variant_bool('+development_files') cmake_args = [ '-DVTK_OPENGL_HAS_OSMESA:BOOL=%s' % variant_bool('+osmesa'), @@ -303,12 +317,15 @@ class Paraview(CMakePackage, CudaPackage): if spec.satisfies('@5.7:'): if spec.satisfies('@5.8:'): cmake_args.extend([ + '-DPARAVIEW_BUILD_EDITION:STRING=%s' % + spec.variants['build_edition'].value, '-DPARAVIEW_USE_QT:BOOL=%s' % variant_bool('+qt'), '-DPARAVIEW_BUILD_WITH_EXTERNAL=ON']) if spec.satisfies('%cce'): cmake_args.append('-DVTK_PYTHON_OPTIONAL_LINK:BOOL=OFF') else: # @5.7: cmake_args.extend([ + '-DPARAVIEW_ENABLE_CATALYST:BOOL=ON', '-DPARAVIEW_BUILD_QT_GUI:BOOL=%s' % variant_bool('+qt'), '-DPARAVIEW_USE_EXTERNAL:BOOL=ON']) -- cgit v1.2.3-60-g2f50