phist: Fix build of 1.9.6, fix build- and install-tests (#26727)

Primary fix:

Due to a typo in a version range, overlapping PR merges resulted
in a build failure of the latest version:
Don't attempt to remove a non-existing file for version 1.9.6.

Secondary fixes:

update_tpetra_gotypes.patch was mentioned twice, and the version
range has to exclude @1.4.2, to which it cannot be applied.

Add depend_on() py-pytest, py-numpy and pkgconfig with type='test'

@:1.9.0 fail with 'Rank mismatch with gfortran@10:, add a conflicts().

raise InstallError('~mpi not possible with kernel_lib=builtin!')
when applicable.

Fixes for spack install --test=root phist:

mpiexec -n12 puts a lot of stress on a pod and gets stuck in a loop
very often: Reduce the mpiexec procs and the number of threads.

Remove @run_after('build') @on_package_attributes(run_tests=True):
from 'def check()': fixes it from getting called twice

The build script of 'make test_install' for the installcheck expects
the examples to be copied to self.stage.path: Provide them.
This commit is contained in:
Bernhard Kaindl 2021-10-14 14:14:25 +02:00 committed by GitHub
parent 8c1399ff7c
commit a61853816f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3,8 +3,6 @@
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
import os
import spack.hooks.sbang as sbang
from spack import *
@ -21,7 +19,7 @@ class Phist(CMakePackage):
"""
homepage = "https://bitbucket.org/essex/phist/"
url = "https://bitbucket.org/essex/phist/get/phist-1.4.3.tar.gz"
url = "https://bitbucket.org/essex/phist/get/phist-1.9.6.tar.gz"
git = "https://bitbucket.org/essex/phist.git"
maintainers = ['jthies']
@ -108,8 +106,7 @@ class Phist(CMakePackage):
# Only applies to 1.9.4: While SSE instructions are handled correctly,
# build fails on ppc64le unless -DNO_WARN_X86_INTRINSICS is defined.
patch('ppc64_sse.patch', when='@1.9.4')
patch('update_tpetra_gotypes.patch', when='@:1.8')
patch('update_tpetra_gotypes.patch', when='@:1.8.99')
patch('update_tpetra_gotypes.patch', when='@1.6:1.8')
patch('sbang.patch', when='+fortran')
# ###################### Dependencies ##########################
@ -134,6 +131,10 @@ class Phist(CMakePackage):
depends_on('trilinos+anasazi+belos', when='+trilinos')
depends_on('parmetis+int64', when='+parmetis+int64')
depends_on('parmetis~int64', when='+parmetis~int64')
depends_on('py-pytest', type='test')
depends_on('py-numpy', type='test', when='+mpi')
# The test_install compiles the examples and needs pkgconfig for it
depends_on('pkgconfig', type='test')
# Fortran 2003 bindings were included in version 1.7, previously they
# required a separate package
@ -142,12 +143,20 @@ class Phist(CMakePackage):
# older gcc's may produce incorrect SIMD code and fail
# to compile some OpenMP statements
conflicts('%gcc@:4.9.1')
# gcc@10: Error: Rank mismatch between actual argument at (1)
# and actual argument at (2) (scalar and rank-1)
conflicts('%gcc@10:', when='@:1.9.0')
# the phist repo came with it's own FindMPI.cmake before, which may cause some other
# MPI installation to be used than the one spack wants.
@when('@:1.9.6')
def patch(self):
os.unlink('cmake/FindMPI.cmake')
if self.spec.satisfies('@:1.9.5'):
force_remove('cmake/FindMPI.cmake')
# mpiexec -n12 puts a lot of stress on a pod and gets stuck in a loop very often
test = FileFilter('CMakeLists.txt')
test.filter('1 2 3 12', '1 2 3')
test.filter('12/', '6/')
test.filter('TEST_DRIVERS_NUM_THREADS 6', 'TEST_DRIVERS_NUM_THREADS 3')
def setup_build_environment(self, env):
env.set('SPACK_SBANG', sbang.sbang_install_path())
@ -156,6 +165,9 @@ def cmake_args(self):
spec = self.spec
define = CMakePackage.define
if spec.satisfies('kernel_lib=builtin') and spec.satisfies('~mpi'):
raise InstallError('~mpi not possible with kernel_lib=builtin!')
kernel_lib = spec.variants['kernel_lib'].value
outlev = spec.variants['outlev'].value
@ -195,8 +207,7 @@ def cmake_args(self):
return args
@run_after('build')
@on_package_attributes(run_tests=True)
# removing @run_after('build') fixes it from getting called twice
def check(self):
with working_dir(self.build_directory):
make("check")
@ -204,5 +215,8 @@ def check(self):
@run_after('install')
@on_package_attributes(run_tests=True)
def test_install(self):
# The build script of test_install expects the sources to be copied here:
install_tree(join_path(self.stage.source_path, 'exampleProjects'),
join_path(self.stage.path, 'exampleProjects'))
with working_dir(self.build_directory):
make("test_install")