From f66ae104bfdc2546780bf7a3556538642d57a380 Mon Sep 17 00:00:00 2001 From: Jonas Thies <16190001+jthies@users.noreply.github.com> Date: Tue, 12 Oct 2021 17:11:00 +0200 Subject: phist: force MPI compiler wrappers (#26312) * packages/phist, re #26002: force phist to use MPI compiler wrappers (copied from trilinos package) * packages/phist re #26002, use cmake-provded FindMPI module only * packages/phist source code formatting * packages/phist: set MPI_HOME rather than MPI_BASE_DIR, thanks @sethri. * phist: delete own FindMPI.cmake for older versions (rather than patching it away) * packages/phist: remove blank line * phist: adjust sorting of imports * phist: change order of imports --- var/spack/repos/builtin/packages/phist/package.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/phist/package.py b/var/spack/repos/builtin/packages/phist/package.py index 87ce1d2ae3..d0d46e12d7 100644 --- a/var/spack/repos/builtin/packages/phist/package.py +++ b/var/spack/repos/builtin/packages/phist/package.py @@ -3,6 +3,7 @@ # # SPDX-License-Identifier: (Apache-2.0 OR MIT) +import os import spack.hooks.sbang as sbang from spack import * @@ -107,6 +108,7 @@ class Phist(CMakePackage): # error will occur unless -DNO_WARN_X86_INTRINSICS is defined. patch('ppc64_sse.patch', when='@1.7.4:1.9.4') patch('update_tpetra_gotypes.patch', when='@:1.8') + patch('update_tpetra_gotypes.patch', when='@:1.8.99') patch('sbang.patch', when='+fortran') # ###################### Dependencies ########################## @@ -140,11 +142,18 @@ class Phist(CMakePackage): # to compile some OpenMP statements conflicts('%gcc@:4.9.1') + # 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') + def setup_build_environment(self, env): env.set('SPACK_SBANG', sbang.sbang_install_path()) def cmake_args(self): spec = self.spec + define = CMakePackage.define kernel_lib = spec.variants['kernel_lib'].value outlev = spec.variants['outlev'].value @@ -173,6 +182,15 @@ class Phist(CMakePackage): % ('64' if '+int64' in spec else '32'), self.define_from_variant('PHIST_HOST_OPTIMIZE', 'host'), ] + # Force phist to use the MPI wrappers instead of raw compilers + # (see issue #26002 and the comment in the trilinos package.py) + if '+mpi' in spec: + args.extend( + [define('CMAKE_C_COMPILER', spec['mpi'].mpicc), + define('CMAKE_CXX_COMPILER', spec['mpi'].mpicxx), + define('CMAKE_Fortran_COMPILER', spec['mpi'].mpifc), + define('MPI_HOME', spec['mpi'].prefix), + ]) return args -- cgit v1.2.3-70-g09d2