PETSc: split install() into configure(), build(), install() (#29126)

This commit is contained in:
JDBetteridge 2022-03-18 12:59:11 +00:00 committed by GitHub
parent 56ba61c52f
commit e0e3443f3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -326,6 +326,8 @@ class Petsc(Package, CudaPackage, ROCmPackage):
depends_on('kokkos-kernels+cuda', when='+kokkos +cuda') depends_on('kokkos-kernels+cuda', when='+kokkos +cuda')
depends_on('kokkos+rocm', when='+kokkos +rocm') depends_on('kokkos+rocm', when='+kokkos +rocm')
phases = ['configure', 'build', 'install']
# Using the following tarballs # Using the following tarballs
# * petsc-3.12 (and older) - includes docs # * petsc-3.12 (and older) - includes docs
# * petsc-lite-3.13, petsc-lite-3.14 (without docs) # * petsc-lite-3.13, petsc-lite-3.14 (without docs)
@ -358,7 +360,8 @@ def mpi_dependent_options(self):
compiler_opts.append('--FC_LINKER_FLAGS=-lintlc') compiler_opts.append('--FC_LINKER_FLAGS=-lintlc')
return compiler_opts return compiler_opts
def install(self, spec, prefix): def configure_options(self):
spec = self.spec
options = ['--with-ssl=0', options = ['--with-ssl=0',
'--download-c2html=0', '--download-c2html=0',
'--download-sowing=0', '--download-sowing=0',
@ -403,7 +406,7 @@ def install(self, spec, prefix):
if spec.satisfies('^trilinos+boost'): if spec.satisfies('^trilinos+boost'):
options.append('--with-boost=1') options.append('--with-boost=1')
if self.spec.satisfies('clanguage=C++'): if spec.satisfies('clanguage=C++'):
options.append('--with-clanguage=C++') options.append('--with-clanguage=C++')
else: else:
options.append('--with-clanguage=C') options.append('--with-clanguage=C')
@ -532,20 +535,30 @@ def install(self, spec, prefix):
if '+hpddm' in spec: if '+hpddm' in spec:
options.append('--download-hpddm') options.append('--download-hpddm')
return options
def revert_kokkos_nvcc_wrapper(self):
# revert changes by kokkos-nvcc-wrapper # revert changes by kokkos-nvcc-wrapper
if spec.satisfies('^kokkos+cuda+wrapper'): if self.spec.satisfies('^kokkos+cuda+wrapper'):
env['MPICH_CXX'] = env['CXX'] env['MPICH_CXX'] = env['CXX']
env['OMPI_CXX'] = env['CXX'] env['OMPI_CXX'] = env['CXX']
env['MPICXX_CXX'] = env['CXX'] env['MPICXX_CXX'] = env['CXX']
python('configure', '--prefix=%s' % prefix, *options) def configure(self, spec, prefix):
self.revert_kokkos_nvcc_wrapper()
python('configure', '--prefix=%s' % prefix, *self.configure_options())
def build(self, spec, prefix):
self.revert_kokkos_nvcc_wrapper()
# PETSc has its own way of doing parallel make. # PETSc has its own way of doing parallel make.
make('V=1 MAKE_NP=%s' % make_jobs, parallel=False) make('V=1 MAKE_NP=%s' % make_jobs, parallel=False)
def install(self, spec, prefix):
self.revert_kokkos_nvcc_wrapper()
make("install") make("install")
if self.run_tests: if self.run_tests:
make('check PETSC_ARCH="" PETSC_DIR={0}'.format(self.prefix), make('check PETSC_ARCH="" PETSC_DIR={0}'.format(prefix),
parallel=False) parallel=False)
def setup_build_environment(self, env): def setup_build_environment(self, env):