From 9a00be7a53f0dcf19875540a4aa38b4d6f86e44b Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Thu, 21 May 2026 13:06:31 +0200 Subject: [PATCH 01/10] Improve Yambo and DeviceXlib Spack recipes with GPU and HPC support * add CUDA-Fortran support for GPU-accelerated Yambo builds * add DeviceXlib dependency and integration * extend compiler support (NVHPC, GCC, Intel, oneAPI) * add optional ScaLAPACK, PETSc, and SLEPc support * improve MPI/OpenMP and parallel I/O handling * add variants for optional Yambo projects (ph, rt, sc, nl) * improve dependency management, patches, and build compatibility across HPC systems --- .../builtin/packages/devicexlib/package.py | 142 ++++ .../builtin/packages/yambo/cuda_runtime.patch | 90 +++ .../builtin/packages/yambo/hdf5.patch | 11 + .../builtin/packages/yambo/package.py | 616 +++++++++++++----- .../builtin/packages/yambo/s_psi.patch | 54 ++ 5 files changed, 732 insertions(+), 181 deletions(-) create mode 100644 repos/spack_repo/builtin/packages/devicexlib/package.py create mode 100644 repos/spack_repo/builtin/packages/yambo/cuda_runtime.patch create mode 100644 repos/spack_repo/builtin/packages/yambo/hdf5.patch create mode 100644 repos/spack_repo/builtin/packages/yambo/s_psi.patch diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py new file mode 100644 index 00000000000..a399c6608c8 --- /dev/null +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -0,0 +1,142 @@ +# Copyright Spack Project Developers. See COPYRIGHT file for details. +# +# SPDX-License-Identifier: (Apache-2.0 OR MIT) + +from spack_repo.builtin.build_systems.autotools import AutotoolsPackage +from spack_repo.builtin.build_systems.cuda import CudaPackage +from spack_repo.builtin.build_systems.rocm import ROCmPackage +from spack.package import * + + +class Devicexlib(AutotoolsPackage,CudaPackage,ROCmPackage): + """deviceXlib is a library that wraps device-oriented routines and utilities, + such as device data allocation, host-device data transfers. deviceXlib supports CUDA language, + together with OpenACC and OpenMP programming paradigms. deviceXlib wraps a subset of functions + from Nvidia cuBLAS, Intel oneMKL BLAS and AMD rocBLAS libraries. + """ + + homepage = "https://gitlab.com/max-centre/components/devicexlib" + url = "https://gitlab.com/max-centre/components/devicexlib/-/archive/0.8.3/devicexlib-0.8.3.tar.gz" + git = "https://gitlab.com/max-centre/components/devicexlib" + + maintainers = ['nicspalla'] + + version('develop', branch='develop') + version("0.9.1", sha256="900fe8b0849d451e7c541d00a1b92c723e0969bae47ebcabd295e14ebcc17d1e") + version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") + version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") + version("0.8.5", sha256="498d5c6804e697123d382d9dd35dedeb4b64228704f84711877c842b851d37df") + version("0.8.4", sha256="d1b1432300dfd4dfcb31703e873ad68f3b33b492c596d0b8c668ff38c2cc3b5e") + version("0.8.3", sha256="3d2d4264df8c57da2791b0f94def52d789d67c6fe7ad5960f96c96dfc6c25cb2") + version("0.8.2", sha256="c184de73f424e9437e352eb0e35716514348a7cd88ebac3ad7a52c66c4e4ba9c") + + depends_on("c", type="build") + depends_on("fortran", type="build") + + variant('openmp', default=False, description='Enable OpenMP support') + variant('openmp5', default=False, description='Build with OpenMP-GPU support') + variant('openacc', default=False, description='Build with OpenACC') + with when("@0.9.0: +openacc"): + variant('openacc-develop', default=False, description='Enable OpenACC DEBUG macro') + variant('cuda-fortran', default=False, description='Build with CUDA-Fortran') + + with when('+cuda-fortran'): + requires('%nvhpc', msg="CUDA-Fortran available only with Nvidia compilers") + with when('+openacc'): + requires('%nvhpc', '%gcc@10:+nvptx', policy="one_of", + msg="OpenACC available only with Nvidia or GCC compilers") + with when('+openmp5'): + requires('%oneapi', '%cce', '%gcc@10:+nvptx', policy="one_of", + msg="OpenMP offloading available only with GCC or oneAPI or Cray compilers") + + variant('nvtx', default=False, description='Enable NVTX support', when='+cuda') + variant('roctx', default=False, description='Enable ROCTX support', when='+rocm') + variant('mkl', default=False, description='Enable MKL-GPU support') + with when('+cuda'): + variant('cuda_rt', values=str, default='none', when='%nvhpc', + description='Specify the CUDA runtime version (e.g. "11.8") only if you want the secondary version installed with the NVHPC SDK.') + + depends_on("blas") + # depends_on("lapack") + depends_on('intel-oneapi-mkl', when='+mkl') + conflicts('cuda_arch=none', when='+cuda', msg='CUDA architecture is required') + conflicts('cuda_arch=none', when='+cuda-fortran', msg='CUDA architecture is required') + conflicts('cuda_rt=none', when='@:0.8.5 +cuda', msg='CUDA runtime version is required') + + with when("+openmp"): + depends_on("openblas threads=openmp", when="^openblas") + + def enable_or_disable_openmp(self, activated): + return '--enable-openmp' if activated else '--disable-openmp' + + def enable_or_disable_cuda(self, activated): + return '--enable-cublas=yes' if activated else '--enable-cublas=no' + + def enable_or_disable_rocm(self, activated): + return '--enable-rocblas=yes' if activated else '--enable-rocblas=no' + + def enable_or_disable_mkl(self, activated): + return '--enable-mkl-gpu=yes' if activated else '--enable-mkl-gpu=no' + + def setup_build_environment(self, env): + spec = self.spec + if '%nvhpc' in spec: + env.set('CC', "nvc") + env.set('FC', "nvfortran") + env.set('F90', "nvfortran") + env.set('CPP', "cpp -E") + env.set('FPP', "nvfortran -Mpreprocess -E") + env.set('F90SUFFIX', ".f90") + if '%gcc' in spec: + env.set('CC', "gcc") + env.set('FC', "gfortran") + env.set('F90', "gfortran") + env.set('CPP', "gcc -E -P") + env.set('FPP', "gfortran -E -P") + env.set('F90SUFFIX', ".f90") + + def configure_args(self): + spec = self.spec + args = ['--enable-cuda-env-check=no --enable-parallel=no'] + + # OpenMP + args.extend(self.enable_or_disable('openmp')) + + # GPU offloading + if '+cuda-fortran' in spec: + args.append('--enable-cuda-fortran') + if '+openacc' in spec: + args.append('--enable-openacc') + if '+openacc-debug' in spec: + args.append('--enable-openacc-debug') + if '+openmp5' in spec: + args.append('--enable-openmp5') + + # BLAS + if '^nvhpc+blas' in spec: + args.append('--with-blas-libs={0}'.format('-lblas')) + else: + args.append('--with-blas-libs={0}'.format(spec['blas'].libs)) + + # CUDA + args.extend(self.enable_or_disable('cuda')) + if '+cuda' in spec: + args.append('--with-cuda-cc={0}'.format(*spec.variants['cuda_arch'].value)) + if spec.variants['cuda_rt'].value != 'none': + args.append('--with-cuda-runtime={0}'.format(spec.variants['cuda_rt'].value)) + if '%nvhpc' not in spec: + args.append('--with-cuda-path={0}'.format(spec['cuda'].home)) + + # ROCm + args.extend(self.enable_or_disable('rocm')) + if '+rocm' in spec: + args.append('--with-rocm-path={0}'.format(spec['hip'].home)) + + # MKL + args.extend(self.enable_or_disable('mkl')) + + return args + + @property + def build_targets(self): + return ['all'] diff --git a/repos/spack_repo/builtin/packages/yambo/cuda_runtime.patch b/repos/spack_repo/builtin/packages/yambo/cuda_runtime.patch new file mode 100644 index 00000000000..de55c996a5c --- /dev/null +++ b/repos/spack_repo/builtin/packages/yambo/cuda_runtime.patch @@ -0,0 +1,90 @@ +--- a/configure ++++ b/configure +@@ -1860,7 +1860,8 @@ Optional Packages: + --with-cuda-path= Path to libcuda install directory + --with-cuda-cc=VAL GPU architecture (Kepler: 35, Pascal: 60, Volta: 70, + Ampere: 80) [default=70] +- --with-cuda-runtime=VAL CUDA runtime (Pascal: 8+, Volta: 9+) [default=10.1] ++ --with-cuda-runtime=VAL CUDA runtime (Pascal: 8+, Volta: 9+) [default=none, ++ checks if the NVHPC_CUDA_HOME variable is set.] + --with-cuda-int-libs=VAL + CUDA internal libraries () + [default=cuda,cufft,cublas,cusolver,cudart] +@@ -16049,7 +16050,7 @@ if test ${with_cuda_runtime+y} + then : + withval=$with_cuda_runtime; + else $as_nop +- with_cuda_runtime=10.1 ++ with_cuda_runtime=none + fi + + # +@@ -16194,17 +16195,26 @@ if test x"$enable_cuda_fortran" != "xno" ; then + # + # Flags to be passed to the devicexlib library + # +- DEVXLIB_FLAGS="--enable-openmp --enable-cuda-fortran --with-cuda-cc=${with_cuda_cc} --with-cuda-runtime=${with_cuda_runtime}" ++ DEVXLIB_FLAGS="--enable-openmp --enable-cuda-fortran --with-cuda-cc=${with_cuda_cc}" ++ if test "x$with_cuda_runtime" != "xnone" ; then ++ DEVXLIB_FLAGS+=" --with-cuda-runtime=${with_cuda_runtime}" ++ fi + # + case "${FCVERSION}" in + *nvfortran*) +- GPU_FLAGS="-cuda -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime}" ++ GPU_FLAGS="-cuda -gpu=cc${with_cuda_cc}" ++ if test "x$with_cuda_runtime" != "xnone" ; then ++ GPU_FLAGS+=" -gpu=cuda${with_cuda_runtime}"; ++ fi + if test x"$use_int_cuda_libs" = "xyes" ; then + GPU_FLAGS+=" -cudalib=${with_cuda_int_libs}"; + fi + ;; + *) +- GPU_FLAGS="-Mcuda=cc${with_cuda_cc},cuda${with_cuda_runtime}" ++ GPU_FLAGS="-Mcuda=cc${with_cuda_cc}" ++ if test "x$with_cuda_runtime" != "xnone" ; then ++ GPU_FLAGS+=" -gpu=cuda${with_cuda_runtime}" ++ fi + if test x"$use_int_cuda_libs" = "xyes" ; then + GPU_FLAGS+=" -Mcudalib=${with_cuda_int_libs}" + fi +@@ -16338,14 +16348,17 @@ if test x"$enable_openacc" != "xno" ; then + case "${FCVERSION}" in + *nvfortran*) + DEVXLIB_FLAGS+="--enable-openmp" +- GPU_FLAGS="-acc=gpu,multicore -acclibs -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime} " # -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime}" ++ GPU_FLAGS="-acc=gpu,multicore -acclibs -gpu=cc${with_cuda_cc}" ++ if test "x$with_cuda_runtime" != "xnone" ; then ++ GPU_FLAGS+=" -gpu=cuda${with_cuda_runtime}" ++ fi + if test x"$use_int_cuda_libs" = "xyes" ; then + GPU_FLAGS+=" -cudalib=${with_cuda_int_libs}"; + fi + ;; + *pgfortran*) + DEVXLIB_FLAGS+="--enable-openmp" +- GPU_FLAGS="-acc -acclibs -ta=tesla:cc${with_cuda_cc} " # -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime}" ++ GPU_FLAGS="-acc -acclibs -ta=tesla:cc${with_cuda_cc} " + if test x"$use_int_cuda_libs" = "xyes" ; then + GPU_FLAGS+=" -cudalib=${with_cuda_int_libs}"; + fi +@@ -16354,7 +16367,6 @@ if test x"$enable_openacc" != "xno" ; then + GPU_FLAGS="-fopenacc -foffload=-lm -foffload=-lgfortran" + # -foffload=nvptx-none + # -foffload=amdgcn-amdhsa -foffload=-march=gfx908 +- # -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime} + esac + # + fi +@@ -16366,8 +16378,8 @@ if test x"$enable_openmp5" != "xno" ; then + # Flags to be passed to the devicexlib library + # + def_gpu="-D_GPU -D_OPENMP_GPU" +- GPU_FLAGS="-fopenmp" # -gpu=cc${with_cuda_cc},cuda${with_cuda_runtime}" +- DEVXLIB_FLAGS="--enable-openmp5" # --with-cuda-cc=${with_cuda_cc} --with-cuda-runtime=${with_cuda_runtime}" ++ GPU_FLAGS="-fopenmp" ++ DEVXLIB_FLAGS="--enable-openmp5" + if test x"$LIBROCM_LIBS" != "x" ; then + DEVXLIB_FLAGS+=" --enable-rocblas --with-rocm-libs=$LIBROCM_LIBS"; + def_gpu="$def_gpu -D_HIP" diff --git a/repos/spack_repo/builtin/packages/yambo/hdf5.patch b/repos/spack_repo/builtin/packages/yambo/hdf5.patch new file mode 100644 index 00000000000..89ce4c6af02 --- /dev/null +++ b/repos/spack_repo/builtin/packages/yambo/hdf5.patch @@ -0,0 +1,11 @@ +--- a/configure ++++ b/configure +@@ -12970,7 +12970,7 @@ ac_compiler_gnu=$ac_cv_fc_compiler_gnu + # + if test x"$with_hdf5_libs" != "x" ; then try_HDF5_LIBS="$with_hdf5_libs" ; fi + # +- if test -d "$try_hdf5_libdir" ; then try_HDF5_LIBS="-L$try_hdf5_libdir -lhdf5hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5" ; fi ++ if test -d "$try_hdf5_libdir" ; then try_HDF5_LIBS="-L$try_hdf5_libdir -lhdf5_hl_fortran -lhdf5_fortran -lhdf5_hl -lhdf5" ; fi + # + if test -d "$try_hdf5_incdir" ; then try_HDF5_INCS="$IFLAG$try_hdf5_incdir" ; fi + # diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index e23baf8fd60..d1f30e3cd66 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -3,224 +3,478 @@ # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack_repo.builtin.build_systems.autotools import AutotoolsPackage - +from spack_repo.builtin.build_systems.cuda import CudaPackage from spack.package import * -class Yambo(AutotoolsPackage): - """Yambo is a FORTRAN/C code for Many-Body calculations in solid - state and molecular physics. - """ - - homepage = "https://www.yambo-code.org/index.php" - url = "https://github.com/yambo-code/yambo/archive/4.2.2.tar.gz" - - maintainers("LydDeb") - - license("GPL-2.0-or-later") +class Yambo(AutotoolsPackage,CudaPackage): + """YAMBO is an open-source code released within the GPL licence. - version("5.3.0", sha256="97b6867c28af6ea690bb02446745e817adcedf95bcd568f132ef3510abbb1cfe") - version("5.2.4", sha256="7c3f2602389fc29a0d8570c2fe85fe3768d390cfcbb2d371e83e75c6c951d5fc") - version("5.1.1", sha256="c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6") + YAMBO implements Many-Body Perturbation Theory (MBPT) methods + (such as GW and BSE) and Time-Dependent Density Functional Theory + (TDDFT), which allows for accurate prediction of fundamental + properties as band gaps of semiconductors, band alignments, defect + quasi-particle energies, optics and out-of-equilibrium properties + of materials. - with default_args(deprecated=True): - version("5.2.3", sha256="a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c") - version("5.2.1", sha256="0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046") - version("4.2.2", sha256="86b4ebe679387233266aba49948246c85a32b1e6840d024f162962bd0112448c") - version("4.2.1", sha256="8ccd0ca75cc32d9266d4a37edd2a7396cf5038f3a68be07c0f0f77d1afc72bdc") - version("4.2.0", sha256="9f78c4237ff363ff4e9ea5eeea671b6fff783d9a6078cc31b0b1abeb1f040f4d") + The code resorts to previously computed electronic structure, + usually at the Density Functional Theory (DFT) level and for this + reason it is interfaced with two of the most used planewave DFT + codes used in scientific community, Quantum ESPRESSO and Abinit. + """ - variant("dp", default=False, description="Enable double precision") - variant( - "profile", - values=any_combination_of("time", "memory"), - description="Activate profiling of specific sections", - ) - variant( - "io", - default="iotk", - values=("iotk", "etsf-io"), - multi=True, - description="Activate support for different io formats", - ) + homepage = "http://www.yambo-code.eu" + url = "https://github.com/yambo-code/yambo/archive/5.3.0.tar.gz" + git = "https://github.com/yambo-code/yambo.git" + + maintainers = ['nicspalla'] + + version('5.3.0', sha256='97b6867c28af6ea690bb02446745e817adcedf95bcd568f132ef3510abbb1cfe') + version('5.2.4', sha256='7c3f2602389fc29a0d8570c2fe85fe3768d390cfcbb2d371e83e75c6c951d5fc') + version('5.2.3', sha256='a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c') + version('5.2.2', sha256='2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4') + version('5.2.1', sha256='0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046') + version('5.2.0', sha256='eb41e83df716eb87261cf130ffe7f930e7dc2e123343d47b73d5a3c69fea7316') + version('5.1.4', sha256='f2dfa1b4cb6a28bd54efb56a9333f51e6da9bd248d92ca3f6e945cb9ac9fe82c') + version('5.1.3', sha256='eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37') + version('5.1.2', sha256='9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e') + version('5.1.1', sha256='c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6') + version('5.0.4', sha256='1841ded51cc31a4293fa79252d7ce893d998acea7ccc836e321c3edba19eae8a') + version('5.0.3', sha256='7a5a5f3939bdb6438a3f41a3d26fff0ea6f77339e4daf6a5d850cf2a51da4414') + version('5.0.2', sha256='a2cc0f880dd915b47efa0d5dd88cb94edffbebaff37a252183efb9e23dbd3fab') + version('5.0.1', sha256='bbdbd08f7219d575a0f479ff05dac1f1a7b25f7e20f2165abf1b2cf28aedae92') + version('5.0.0', sha256='b1cbc0b3805538f892b2b8691901c4cc794e75e056a4bd9ad9cf585899cf0aa9') + version('4.5.3', sha256='04f89b5445d35443325c071784376c7b5c25cc900d1fdcc92971a441f8c05985') + version('4.5.2', sha256='0b4f8b82c1d37fce472228bdffb6f6f44b86104d170677a5d55e77a2db832cf0') + version('4.5.1', sha256='6ef202535e38f334a69bd75bd24ff8403b0a4c6b8c60a28b69d4b1c5808aeff5') + version('4.5.0', sha256='c68b2c79acc31b3d48e7edb46e4049c1108d60feee80bf4fcdc4afe4b12b6928') + version('4.4.1', sha256='2daf80f394a861301a9bbad559aaf58de283ce60395c9875e9f7d7fa57fcf16d') + version('4.3.3', sha256='790fa1147044c7f33f0e8d336ccb48089b48d5b894c956779f543e0c7e77de19') + + # Workaround for this https://github.com/yambo-code/yambo-devel/issues/619 + # patch('hdf5.patch', sha256='b9362020b0a29abec535afd7d782b8bb643678fe9215815ca8dc9e4941cb169f', when='@4.3:5.0.99') + # See https://github.com/yambo-code/yambo-devel/issues/643 + patch('s_psi.patch', sha256='981a0783a9a2c21a89faa358eaf277213837ed712c936152842f8cf7620f52cd', when='@:5.1.99 %gcc@12.0.0:') + # See https://github.com/yambo-code/yambo/issues/190 + patch('cuda_runtime.patch', sha256='bfd5ade95ef5ca9502c7ad1b375e4517fbf77a32bf97041fd580bb36304fd755', when='@5.3.0+cuda') + + depends_on("c", type="build") + depends_on("fortran", type="build") + depends_on("tar", type="build") + # MPI + OpenMP parallelism - variant("mpi", default=True, description="Enable MPI support") - variant("openmp", default=False, description="Enable OpenMP support") - - depends_on("c", type="build") # generated - depends_on("fortran", type="build") # generated - - depends_on("blas") - depends_on("lapack") - - # MPI dependencies are forced, until we have proper forwarding of variants - # - # Note that yambo is used as an application, and not linked as a library, - # thus there will be no case where another package pulls-in e.g. - # netcdf-c+mpi and wants to depend on yambo~mpi. + variant('mpi', default=True, description='Enable MPI support') + variant('openmp', default=True, description='Enable OpenMP support') + + # Linear Algebra and Parallel I/O + variant('slepc', default=False, description='Activate support for linear algebra with SLEPc and PETSc') + with when('+mpi'): + variant('scalapack', default=False, description='Activate support for parallel linear algebra with SCALAPACK') + variant('parallel_io', default=True, when='@4.4.0:', description='Activate the HDF5 parallel I/O') + + # Other variants + variant('dp', default=False, description='Enable double precision') + variant('time', default=False, description='Activate time profiling of specific sections') + variant('memory', default=False, description='Activate memory profiling of specific sections') + variant('ph', default=False, description='Compile Electron-phonon coupling project executables: yambo_ph ypp_ph') + variant('rt', default=False, description='Compile Real-time dynamics project executables: yambo_rt ypp_rt') + variant('sc', default=False, description='Compile Self-consistent (COHSEX, HF, DFT) project executables: yambo_sc ypp_sc') + variant('nl', default=False, description='Compile Non-linear optics project executables: yambo_nl ypp_nl') + + with when('+mpi'): + depends_on('mpi') + + # Linar Algebra + depends_on('blas') + depends_on('lapack') + + with when('+scalapack'): + depends_on('scalapack') + conflicts('+scalapack', when='~mpi', msg="Parallel linear algebra available only with +mpi") + + with when('+slepc'): + depends_on('petsc+complex~superlu-dist~hypre~metis') + depends_on('petsc+mpi', when='+mpi') + depends_on('petsc~mpi', when='~mpi') + depends_on('petsc+double', when='+dp') + depends_on('petsc~double', when='~dp') + depends_on('petsc~cuda', when='@:5.2.0') + depends_on('petsc@:3.20.5', when='@:5.2.99') + depends_on('petsc@:3.22.2', when='@:5.3.0') + depends_on('slepc~arpack') + depends_on('slepc~cuda', when='@:5.2.0') + + # FFTW dependecies + depends_on('fftw-api@3') with when("+mpi"): - depends_on("mpi") - depends_on("scalapack") - depends_on("netcdf-c+mpi") - depends_on("hdf5+mpi") - depends_on("fftw+mpi") - + depends_on('fftw +mpi', when='^[virtuals=fftw-api] fftw') with when("~mpi"): - depends_on("netcdf-c~mpi") - depends_on("hdf5~mpi") - depends_on("fftw~mpi") - - depends_on("hdf5+fortran") - depends_on("netcdf-c") - depends_on("netcdf-fortran") - depends_on("libxc@2.0.3:5") - - depends_on("etsf-io", when="io=etsf-io") - - build_targets = ["all"] - - parallel = False - - sanity_check_is_file = ["bin/yambo"] + depends_on('fftw ~mpi', when='^[virtuals=fftw-api] fftw') + + # HDF5 and NetCDF dependecies + with when("+parallel_io"): + depends_on('hdf5+fortran+hl+mpi') + depends_on('netcdf-c+mpi') + with when("~parallel_io"): + depends_on('hdf5+fortran+hl~mpi') + depends_on('netcdf-c~mpi') + depends_on('hdf5@:1.12.3', when='@:5.2.99') + conflicts('hdf5+mpi', when='@:4.4.0', msg="Parallel I/O available from version 4.4.1") + depends_on('netcdf-fortran') + + # LIBXC dependecies + depends_on('libxc@2.0.3:3.0.0~cuda', when='@:5.0.99') + depends_on('libxc@5.0.0:6.2.2~cuda', when='@5.1.0:') + + # GPU variants and dependecies + with when('+cuda'): + variant('cuda_rt', values=str, default='none', when='%nvhpc', + description='Specify the CUDA runtime version (e.g. "11.8") only if you want the secondary version installed with the NVHPC SDK.') + conflicts('cuda_rt=none', when='@:5.2.99 +cuda', msg='CUDA runtime version is required') + variant('cuda-fortran', default=False, description='Build with CUDA-Fortran') + with when('+cuda-fortran'): + conflicts('~cuda', + msg="CUDA required when +cuda-fortran") + conflicts('cuda_arch=none', + msg="CUDA architecture is required when +cuda") + conflicts('@:4.5.3', + msg="CUDA-Fortran available only from version 5.0.0") + conflicts('%gcc', + msg="CUDA-Fortran available only with NV or PGI compilers") + conflicts('%intel', + msg="CUDA-Fortran available only with NV or PGI compilers") + conflicts('%oneapi', + msg="CUDA-Fortran available only with NV or PGI compilers") + + # DeviceXlib + with when('@5.3.0:'): + depends_on('devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5', when='~cuda-fortran') + depends_on('devicexlib@0.8.6: +cuda-fortran+cuda', when='+cuda-fortran+cuda') + + with when("+openmp"): + depends_on("openblas threads=openmp", when="^[virtuals=lapack] openblas") + depends_on("intel-oneapi-mkl threads=openmp", when="^[virtuals=lapack] intel-oneapi-mkl") + depends_on("fftw +openmp", when="^[virtuals=fftw-api] fftw") + depends_on("petsc +openmp", when="^[virtuals=petsc] petsc") + + # IOTK external resource + resource( + name='iotk', + url='https://github.com/yambo-code/yambo-libraries/raw/master/external/iotk-y1.2.2.tar.gz', + sha256='64af6a4b98f3b62fcec603e4e1b00ef994f95a0efa53ab6593ebcfe6de1739ef', + placement={'iotk-y1.2.2.tar.gz': 'lib/archive/iotk-y1.2.2.tar.gz'}, + expand=False + ) + # Yambo Driver external resource + resource( + name='Ydriver', + url='https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-0.0.2.tar.gz', + sha256='63984c3eb2d28320b320f1d9b3a2c1efcd3c9505a10d887c8bbd54513442202c', + placement={'Ydriver-0.0.2.tar.gz': 'lib/archive/Ydriver-0.0.2.tar.gz'}, + when='@5.0.0:5.0.99', + expand=False + ) resource( - when="@5.2.4", - name="ydriver", - url="https://github.com/yambo-code/Ydriver/archive/refs/tags/1.4.2.tar.gz", - sha256="c242f0700a224325ff59326767614a561b02ce16ddb2ce6c13ddd2d5901cc3e4", - destination="lib/archive", - placement={"1.4.2.tar.gz": "Ydriver-1.4.2.tar.gz"}, - expand=False, + name='Ydriver', + url='https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-1.1.0.tar.gz', + sha256='6c316d613f5a41ddd15efad7ba97e4712f87d7e56c073ba5458caf424afcb97a', + placement={'Ydriver-1.1.0.tar.gz': 'lib/archive/Ydriver-1.1.0.tar.gz'}, + when='@5.1.0:5.1.99', + expand=False ) resource( - when="@5.2.1:5.2.3", - name="ydriver", - url="https://github.com/yambo-code/Ydriver/archive/refs/tags/1.2.0.tar.gz", - sha256="0f29a44e9c4b49d3f6be3f159a7ef415932b2ae2f2fdba163af60a0673befe6e", - destination="lib/archive", - placement={"1.2.0.tar.gz": "Ydriver-1.2.0.tar.gz"}, - expand=False, + name='Ydriver', + url='https://github.com/yambo-code/Ydriver/archive/refs/tags/1.2.0.tar.gz', + sha256='0f29a44e9c4b49d3f6be3f159a7ef415932b2ae2f2fdba163af60a0673befe6e', + placement={'1.2.0.tar.gz': 'lib/archive/Ydriver-1.2.0.tar.gz'}, + when='@5.2.0:5.2.3', + expand=False ) resource( - when="@5.2:5.3", - name="iotk", - url="https://github.com/yambo-code/yambo-libraries/raw/0bb3a9c5d57fbad5a22ea2bb2e9c9e2fc04a7381/external/iotk-y1.2.2.tar.gz", - sha256="64af6a4b98f3b62fcec603e4e1b00ef994f95a0efa53ab6593ebcfe6de1739ef", - destination="lib/archive", - placement={"iotk-y1.2.2.tar.gz": "iotk-y1.2.2.tar.gz"}, - expand=False, + name='Ydriver', + url='https://github.com/yambo-code/Ydriver/archive/refs/tags/1.4.2.tar.gz', + sha256='c242f0700a224325ff59326767614a561b02ce16ddb2ce6c13ddd2d5901cc3e4', + placement={'1.4.2.tar.gz': 'lib/archive/Ydriver-1.4.2.tar.gz'}, + when='@5.2.4', + expand=False ) + sanity_check_is_file = ["bin/yambo", "bin/ypp", "bin/a2y", "bin/c2y", "bin/p2y"] + + @property + def build_targets(self): + spec = self.spec + if '+ph' in spec and '+rt' in spec and '+sc' in spec and '+nl' in spec: + return ['all'] + bt = ['core'] + if '+ph' in spec: + bt.append('ph-project') + if '+rt' in spec: + bt.append('rt-project') + if '+sc' in spec: + bt.append('sc-project') + if '+nl' in spec: + bt.append('nl-project') + return bt + + @run_before('configure') + def filter_configure(self): + spec = self.spec + # The configure in the package has the string 'cat config/report' + # hard-coded, which causes a failure at configure time due to the + # current working directory in Spack. Fix this by using the absolute + # path to the file. + report_abspath = join_path(self.build_directory, 'config', 'report') + filter_file('cat config/report', 'cat '+report_abspath, 'configure') + # fix petsc bad recognition + filter_file('#include ', '#include ', 'configure') + # fix hdf5 bad linking and include flags + filter_file('.+try_HDF5_LIBS=..h5pfc -show .+', '#', 'configure') + filter_file('.+try_hdf5_incdir=..h5pfc -show .+', '#', 'configure') + filter_file('.+try_HDF5_LIBS=..h5fc -show .+', '#', 'configure') + filter_file('.+try_hdf5_incdir=..h5fc -show .+', '#', 'configure') + + @run_before('configure') + def filter_linking_issue(self): + # fix linking issues with intel-oneapi-compilers + spec = self.spec + if '@5.1.2:' in spec and '%intel-oneapi-compilers' in spec: + filter_file('libs="-lint_modules $libs $llocal $lPLA $lIO $lextlibs -lm"', + r'libs="-lint_modules $libs $llocal $lSL $lPLA $lIO $lextlibs -lm"', + 'sbin/compilation/libraries.sh', + string=True) + filter_file('$libs $llocal', + r'-Wl,--start-group $libs $llocal', + 'sbin/compilation/libraries.sh', + string=True) + filter_file('$lextlibs', + r'$lextlibs -Wl,--end-group', + 'sbin/compilation/libraries.sh', + string=True) + filter_file('libs=" "', 'libs=" -l_Y_tddft "', 'sbin/compilation/libraries.sh', string=True) + + @run_before('configure') + def filter_oneapi(self): + spec = self.spec + # fix oneapi ifx issues + if ('%oneapi' in spec or '%intel-oneapi-compilers' in spec) and '@5.0.0:5.2.99' in spec: + filter_file('*ifort*', '*ifx*', 'configure', string=True) + filter_file('2021', '2023', 'configure') + filter_file('FC="$(fc)"', 'FC=mpiifort', 'lib/iotk/Makefile.loc', string=True) + filter_file('#include ', + '#if defined _ypp || defined _a2y || defined _p2y || defined _c2y || defined _e2y || defined _eph2y\n #include \n#endif', + 'lib/yambo/Ydriver/src/main/options_maker.c', + string=True) + + @run_before('configure') + def filter_time(self): + spec = self.spec + # To always have the times written in seconds in the report, useful for benchmarking + if '+time' in spec and '@5.0.0:' in spec: + filter_file('total_time(i_c)<600.', 'total_time(i_c)<604800.', 'src/timing/TIMING_clock_write.F', string=True) + filter_file("ch=' [Time-Profile]: '//trim(time_string(total_time))", + "write (ch,'(a,f11.4,a)') ' [Time-Profile]: ',total_time,'s'", + 'src/modules/mod_timing.F', string=True) + def enable_or_disable_time(self, activated): - return "--enable-time-profile" if activated else "--disable-time-profile" + return '--enable-time-profile' if activated else '--disable-time-profile' def enable_or_disable_memory(self, activated): - return "--enable-memory-profile" if activated else "--disable-memory-profile" + return '--enable-memory-profile' if activated else '--disable-memory-profile' def enable_or_disable_openmp(self, activated): - return "--enable-open-mp" if activated else "--disable-open-mp" - - def configure_args(self): - spec = self.spec - args = [ - f"--with-hdf5-path={spec['hdf5'].prefix}", - f"--prefix={self.stage.source_path}", - f"--exec-prefix={self.stage.source_path}", - f"--with-blas-libs={spec['blas'].libs}", - f"--with-lapack-libs={spec['lapack'].libs}", - f"--with-netcdf-path={spec['netcdf-c'].prefix}", - f"--with-netcdff-path={spec['netcdf-fortran'].prefix}", - f"--with-fft-path={spec['fftw'].prefix}", - f"--with-libxc-path={spec['libxc'].prefix}", - "--enable-hdf5-p2y-support", - ] - # Double precision - args.extend(self.enable_or_disable("dp")) - - # Application profiling - args.extend(self.enable_or_disable("profile")) + return '--enable-open-mp' if activated else '--disable-open-mp' - # MPI + threading - args.extend(self.enable_or_disable("mpi")) - args.extend(self.enable_or_disable("openmp")) - - if spec.satisfies("+mpi"): - args.append(f"--with-scalapack-libs={spec['scalapack'].libs}") - - # iotk is always needed (lib/qe_pseudo uses it regardless of io variant) - # io=iotk controls whether p2y is built / io=etsf-io adds etsf-io support - args.extend(self.enable_or_disable("io")) - - if spec.satisfies("io=etsf-io"): - args.append(f"--with-etsf-io-path={spec['etsf-io'].prefix}") - - return args + def enable_or_disable_parallel_io(self, activated): + return '--enable-hdf5-par-io' if activated else '--disable-hdf5-par-io' - # The configure in the package has the string 'cat config/report' - # hard-coded, which causes a failure at configure time due to the - # current working directory in Spack. Fix this by using the absolute - # path to the file. - @run_before("configure", when="@4.2.1") - def filter_configure(self): - report_abspath = join_path(self.build_directory, "config", "report") - filter_file("config/report", report_abspath, "configure") + def setup_build_environment(self, env): + spec = self.spec + if spec['mpi'].name == 'openmpi': + env.set('MPICC', 'mpicc') + env.set('MPICXX', 'mpicxx') + env.set('MPIF77', 'mpif77') + env.set('MPIFC', 'mpif90') + if spec['mpi'].name == 'fujitsu-mpi': + env.set('MPICC', 'mpicc') + env.set('MPICXX', 'mpicxx') + env.set('MPIF77', 'mpifort') + env.set('MPIFC', 'mpifort') + if '%nvhpc' in spec: + env.set('FC', "nvfortran") + env.set('CPP', "cpp -E -P") + env.set('FPP', "nvfortran -Mpreprocess -E") + env.set('F90SUFFIX', ".f90") + env.unset('CUDA_HOME') + if '%intel' in spec: + env.set('FPP', "ifort -E -free -P") + env.set('FC', "ifort") + env.set('F77', "ifort") + env.set('CC', "icc") + env.set('CPP', "icc -E -ansi") + if 'intel' in spec['mpi'].name: + env.set('MPICC', 'mpiicc') + env.set('MPICXX', 'mpiicpc') + env.set('MPIF77', 'mpiifort') + env.set('MPIFC', 'mpiifort') + if '%oneapi' in spec: + env.set('FC', "ifx") + env.set('F77', "ifx") + env.set('CC', "icx") + env.set('FPP', "ifx -E -free -P") + env.set('CPP', "icx -E -ansi") + if 'intel' in spec['mpi'].name: + if '^intel-oneapi-mpi@2021.10.0' in spec: + env.set('MPICC', 'mpiicc -cc=icx') + env.set('MPIF77', 'mpiifort -fc=ifx') + env.set('MPIFC', 'mpiifort -fc=ifx') + else: + env.set('MPICC', 'mpiicx') + env.set('MPIF77', 'mpiifx') + env.set('MPIFC', 'mpiifx') - @when("@4.2.1") def configure_args(self): + spec = self.spec + args = [ - # As of version 4.2.1 there are hard-coded paths that make - # the build process fail if the target prefix is not the - # configure directory - f"--prefix={self.stage.source_path}", - "--disable-keep-objects", - "--with-editor=none", + '--enable-msgs-comps', + '--disable-keep-objects', + '--with-editor=none', + '--enable-keep-src' ] - spec = self.spec + + # There are hard-coded paths that make the build process fail if the + # target prefix is not the configure directory + args.append('--prefix={0}'.format(self.stage.source_path)) + if '@:4.5.3' in spec: + if '%gcc@9.0.0:' in spec: + args.append('FCFLAGS=-fallow-argument-mismatch') # Double precision - args.extend(self.enable_or_disable("dp")) + args.extend(self.enable_or_disable('dp')) # Application profiling - args.extend(self.enable_or_disable("profile")) + args.extend(self.enable_or_disable('time')) + args.extend(self.enable_or_disable('memory')) # MPI + threading - args.extend(self.enable_or_disable("mpi")) - args.extend(self.enable_or_disable("openmp")) - - # LAPACK - if spec.satisfies("+mpi"): - args.append( - "--with-scalapack-libs={0}".format( - spec["scalapack"].libs + spec["lapack"].libs + spec["blas"].libs - ) - ) - - args.extend( - [f"--with-blas-libs={spec['blas'].libs}", f"--with-lapack-libs={spec['lapack'].libs}"] - ) - - # Netcdf - args.extend( - [ - "--enable-netcdf-hdf5", - "--enable-hdf5-compression", - f"--with-hdf5-libs={spec['hdf5'].libs}", - f"--with-netcdf-path={spec['netcdf-c'].prefix}", - f"--with-netcdff-path={spec['netcdf-fortran'].prefix}", - ] - ) - - args.extend(self.enable_or_disable("io")) + args.extend(self.enable_or_disable('mpi')) + args.extend(self.enable_or_disable('openmp')) + + # MKL + mkl_lines = { + 'intel': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', + 'intel_thr': '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5', + 'oneapi': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', + 'oneapi_thr': '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5', + 'gcc': '-Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core', + 'gcc_thr': '-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp', + 'nvhpc': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', + 'nvhpc_thr': '-lmkl_intel_lp64 -lmkl_pgi_thread -lmkl_core -pgf90libs -mp', + } + mkl_line='' + if 'mkl' in spec or 'intel-oneapi-mkl' in spec: + mkl_line = "-L{0}/lib/intel64 ".format(env['MKLROOT']) + if '%intel-oneapi-compilers' in spec or '%oneapi' in spec: + comp = "oneapi" + elif '%intel' in spec: + comp = "intel" + elif '%gcc' in spec: + comp = "gnu" + elif '%nvhpc' in spec: + comp = "nvhpc" + if "+openmp" in spec: + comp += "_thr" + mkl_line += mkl_lines[comp] + mkl_line += ' -lpthread -lm -ldl' + + # BLAS/LAPACK + args.append('--with-blas-libs={0}'.format(mkl_line)) + args.append('--with-lapack-libs={0}'.format(mkl_line)) + # FFT + args.extend([ + '--with-fft-libs={0}'.format(mkl_line), + '--with-fft-includedir={0}/include/fftw'.format(env['MKLROOT']) + ]) + else: + # BLAS/LAPACK + args.extend([ + '--with-blas-libs={0}'.format(spec['blas'].libs), + '--with-lapack-libs={0}'.format(spec['lapack'].libs), + ]) + # FFT + args.append('--with-fft-path={0}'.format(spec['fftw-api'].prefix)) + + # ScaLAPACK + if '+scalapack' in spec: + args.append('--enable-par-linalg') + if ('mkl' in spec or 'intel-oneapi-mkl' in spec) and 'netlib-scalapack' not in spec: + args.extend([ + '--with-blacs-libs=-L{0}/lib/intel64 ' + '-lmkl_blacs_intelmpi_lp64'.format(env['MKLROOT']), + '--with-scalapack-libs=-L{0}/lib/intel64 ' + '-lmkl_scalapack_lp64'.format(env['MKLROOT']), + ]) + else: + args.extend([ + '--with-blacs-libs={0}'.format(spec['scalapack'].libs), + '--with-scalapack-libs={0}'.format(spec['scalapack'].libs), + ]) + + # PETSc + SLEPc + if '+slepc' in spec: + args.extend([ + '--enable-slepc-linalg', + '--with-petsc-path={0}'.format(spec['petsc'].prefix), + '--with-slepc-path={0}'.format(spec['slepc'].prefix), + ]) + + # I/O + args.extend([ + '--with-netcdf-path={0}'.format(spec['netcdf-c'].prefix), + '--with-netcdff-path={0}'.format(spec['netcdf-fortran'].prefix), + '--with-hdf5-path={0}'.format(spec['hdf5'].prefix) + ]) + + # Parallel I/O + if '@4.4.0:' in spec: + args.extend(self.enable_or_disable('parallel_io')) # Other dependencies - args.append(f"--with-fft-path={spec['fftw'].prefix}") - args.append(f"--with-libxc-path={spec['libxc'].prefix}") + args.append('--with-libxc-path={0}'.format(spec['libxc'].prefix)) + if '@5.3.0:' in spec: + args.append('--with-devxlib-path={0}'.format(spec['devicexlib'].home)) + + # GPU + if '+cuda-fortran' in spec: args.append('--enable-cuda-fortran') + if '+cuda' in spec: + if '@5.3.0:' in spec: + args.append('--with-cuda-cc={0}'.format(*spec.variants['cuda_arch'].value)) + if spec.variants['cuda_rt'].value != 'none': + args.append('--with-cuda-runtime={0}'.format(spec.variants['cuda_rt'].value)) + # args.append('--with-cuda-path={0}'.format(spec['cuda'].prefix)) + else: + enable_cuda = '--enable-cuda=cuda{0}.{1}'.format(*spec['cuda'].version) + enable_cuda += ',cc{0}'.format(*spec.variants['cuda_arch'].value) + args.append(enable_cuda) + if '%nvhpc' not in spec: + args.append('--with-cuda-path={0}'.format(spec['cuda'].home)) return args def install(self, spec, prefix): - # yambo has no "make install" - install_tree("bin", prefix.bin) - install_tree("lib", prefix.lib) - install_tree("include", prefix.include) - install_tree("driver", prefix.driver) + # 'install' target is not present + install_tree('bin', prefix.bin) + + def build(self, spec, prefix): + print(f"Using compiler: {spec.compiler.name} {spec.compiler.version}") + if spec.satisfies('%nvhpc') and spec.compiler.version >= Version('24.11') : + # Modify the config/setup file that was created by configure + config_file = join_path(self.stage.source_path, 'config', 'setup') + # Handle the -Mcuda=A,X pattern + filter_file( r'-Mcuda=([^,\s]+),([^,\s]+)', r'-cuda -gpu=\1,\2', config_file ) + # Handle the -Mcudalib pattern + filter_file( r'-Mcudalib=([^,\s][^,\s]*(?:,[^,\s]+)*)', r'-cudalib=\1', config_file ) + # Then proceed with the actual build + super(Yambo, self).build(spec, prefix) diff --git a/repos/spack_repo/builtin/packages/yambo/s_psi.patch b/repos/spack_repo/builtin/packages/yambo/s_psi.patch new file mode 100644 index 00000000000..176cc966320 --- /dev/null +++ b/repos/spack_repo/builtin/packages/yambo/s_psi.patch @@ -0,0 +1,54 @@ +--- a/lib/qe_pseudo/s_psi.F ++++ b/lib/qe_pseudo/s_psi.F +@@ -94,7 +94,12 @@ + ! + IF ( gamma_only ) THEN + ! ++#if defined _TOSOLVE + CALL s_psi_gamma() ++#else ++ CALL error(& ++ "s_psi, the process flow should not go through gamma only.") ++#endif + ! + ELSE IF ( noncolin ) THEN + ! +@@ -125,6 +130,7 @@ + ! + CONTAINS + ! ++#if defined _TOSOLVE + !----------------------------------------------------------------------- + SUBROUTINE s_psi_gamma() + !----------------------------------------------------------------------- +@@ -205,18 +211,18 @@ + ! IF( becp%comm == mp_get_comm_null() ) THEN + IF ( m == 1 ) THEN + #if defined _DOUBLE +- CALL DGEMV( 'N', 2 * n, nkb, 1.D0, real(vkb,SP), & ++ CALL DGEMV( 'N', 2 * n, nkb, 1.D0, vkb, & + 2 * lda, ps, 1, 1.D0, spsi, 1 ) + #else +- CALL SGEMV( 'N', 2 * n, nkb, 1.0_SP, real(vkb,SP), & ++ CALL SGEMV( 'N', 2 * n, nkb, 1.0_SP, vkb, & + 2 * lda, ps, 1, 1.0_SP, spsi, 1 ) + #endif + ELSE + #if defined _DOUBLE +- CALL DGEMM( 'N', 'N', 2 * n, m, nkb, 1.D0, real(vkb,SP), & ++ CALL DGEMM( 'N', 'N', 2 * n, m, nkb, 1.D0, vkb, & + 2 * lda, ps, nkb, 1.D0, spsi, 2 * lda ) + #else +- CALL SGEMM( 'N', 'N', 2 * n, m, nkb, 1.0_SP, real(vkb,SP), & ++ CALL SGEMM( 'N', 'N', 2 * n, m, nkb, 1.0_SP, vkb, & + 2 * lda, ps, nkb, 1.0_SP, spsi, 2 * lda ) + #endif + END IF +@@ -254,6 +260,7 @@ + RETURN + ! + END SUBROUTINE s_psi_gamma ++#endif + ! + !----------------------------------------------------------------------- + SUBROUTINE s_psi_k() From 33e0d4dbec03161bae3315a699b30f8b929450eb Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Tue, 26 May 2026 11:46:11 +0200 Subject: [PATCH 02/10] Fix checksum verification failures --- repos/spack_repo/builtin/packages/devicexlib/package.py | 2 +- repos/spack_repo/builtin/packages/yambo/package.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index a399c6608c8..b82e43c706e 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -26,7 +26,7 @@ class Devicexlib(AutotoolsPackage,CudaPackage,ROCmPackage): version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") version("0.8.5", sha256="498d5c6804e697123d382d9dd35dedeb4b64228704f84711877c842b851d37df") - version("0.8.4", sha256="d1b1432300dfd4dfcb31703e873ad68f3b33b492c596d0b8c668ff38c2cc3b5e") + version("0.8.4", sha256="6c50bb6d51a26429f17c9bbb00e81b279ed7f731b2a73f4689b7b30a8e30f115") version("0.8.3", sha256="3d2d4264df8c57da2791b0f94def52d789d67c6fe7ad5960f96c96dfc6c25cb2") version("0.8.2", sha256="c184de73f424e9437e352eb0e35716514348a7cd88ebac3ad7a52c66c4e4ba9c") diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index d1f30e3cd66..bf8b5760fbf 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -34,7 +34,7 @@ class Yambo(AutotoolsPackage,CudaPackage): version('5.2.3', sha256='a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c') version('5.2.2', sha256='2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4') version('5.2.1', sha256='0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046') - version('5.2.0', sha256='eb41e83df716eb87261cf130ffe7f930e7dc2e123343d47b73d5a3c69fea7316') + version('5.2.0', sha256='88fd6de5c9be49b8af89a2634b3c2da6db5a614eff8e19a7ec5c48ef12bafc8b') version('5.1.4', sha256='f2dfa1b4cb6a28bd54efb56a9333f51e6da9bd248d92ca3f6e945cb9ac9fe82c') version('5.1.3', sha256='eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37') version('5.1.2', sha256='9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e') From bc6c6b705db3ff66a847f86664ef625b7e7a042e Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Tue, 26 May 2026 12:40:54 +0200 Subject: [PATCH 03/10] Fix style/formatting check issues --- .../builtin/packages/devicexlib/package.py | 256 ++++-- .../builtin/packages/yambo/package.py | 814 +++++++++--------- 2 files changed, 604 insertions(+), 466 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index b82e43c706e..6bf0ca37a67 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -8,20 +8,23 @@ from spack.package import * -class Devicexlib(AutotoolsPackage,CudaPackage,ROCmPackage): - """deviceXlib is a library that wraps device-oriented routines and utilities, - such as device data allocation, host-device data transfers. deviceXlib supports CUDA language, - together with OpenACC and OpenMP programming paradigms. deviceXlib wraps a subset of functions - from Nvidia cuBLAS, Intel oneMKL BLAS and AMD rocBLAS libraries. +class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): + """Library wrapping device-oriented routines and utilities. + + deviceXlib provides wrappers for device data allocation and host-device data + transfers. It supports CUDA, OpenACC, and OpenMP programming paradigms, and + wraps a subset of routines from NVIDIA cuBLAS, Intel oneMKL BLAS, and AMD + rocBLAS libraries. """ homepage = "https://gitlab.com/max-centre/components/devicexlib" - url = "https://gitlab.com/max-centre/components/devicexlib/-/archive/0.8.3/devicexlib-0.8.3.tar.gz" + url = "https://gitlab.com/max-centre/components/devicexlib/-/archive/0.9.0/devicexlib-0.9.0.tar.gz" git = "https://gitlab.com/max-centre/components/devicexlib" - maintainers = ['nicspalla'] + maintainers = ["nicspalla"] version('develop', branch='develop') + version("0.9.1", sha256="900fe8b0849d451e7c541d00a1b92c723e0969bae47ebcabd295e14ebcc17d1e") version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") @@ -32,111 +35,204 @@ class Devicexlib(AutotoolsPackage,CudaPackage,ROCmPackage): depends_on("c", type="build") depends_on("fortran", type="build") - - variant('openmp', default=False, description='Enable OpenMP support') - variant('openmp5', default=False, description='Build with OpenMP-GPU support') - variant('openacc', default=False, description='Build with OpenACC') + + variant("openmp", default=False, description="Enable OpenMP support") + + variant( + "openmp5", + default=False, + description="Build with OpenMP-GPU support", + ) + + variant( + "openacc", + default=False, + description="Build with OpenACC", + ) + + variant( + "cuda-fortran", + default=False, + description="Build with CUDA Fortran", + ) + + variant( + "nvtx", + default=False, + description="Enable NVTX support", + when="+cuda", + ) + + variant( + "roctx", + default=False, + description="Enable ROCTX support", + when="+rocm", + ) + + variant( + "mkl", + default=False, + description="Enable MKL-GPU support", + ) + with when("@0.9.0: +openacc"): - variant('openacc-develop', default=False, description='Enable OpenACC DEBUG macro') - variant('cuda-fortran', default=False, description='Build with CUDA-Fortran') - - with when('+cuda-fortran'): - requires('%nvhpc', msg="CUDA-Fortran available only with Nvidia compilers") - with when('+openacc'): - requires('%nvhpc', '%gcc@10:+nvptx', policy="one_of", - msg="OpenACC available only with Nvidia or GCC compilers") - with when('+openmp5'): - requires('%oneapi', '%cce', '%gcc@10:+nvptx', policy="one_of", - msg="OpenMP offloading available only with GCC or oneAPI or Cray compilers") - - variant('nvtx', default=False, description='Enable NVTX support', when='+cuda') - variant('roctx', default=False, description='Enable ROCTX support', when='+rocm') - variant('mkl', default=False, description='Enable MKL-GPU support') - with when('+cuda'): - variant('cuda_rt', values=str, default='none', when='%nvhpc', - description='Specify the CUDA runtime version (e.g. "11.8") only if you want the secondary version installed with the NVHPC SDK.') + variant( + "openacc-debug", + default=False, + description="Enable OpenACC DEBUG macro", + ) + + with when("+cuda"): + variant( + "cuda_rt", + values=str, + default="none", + when="%nvhpc", + description=( + 'Specify the CUDA runtime version, e.g. "11.8", only if you ' + "want the secondary version installed with the NVHPC SDK." + ), + ) + + with when("+cuda-fortran"): + requires( + "%nvhpc", + msg="CUDA Fortran is available only with NVIDIA compilers", + ) + + with when("+openacc"): + requires( + "%nvhpc", + "%gcc@10:+nvptx", + policy="one_of", + msg="OpenACC is available only with NVIDIA or GCC compilers", + ) + + with when("+openmp5"): + requires( + "%oneapi", + "%cce", + "%gcc@10:+nvptx", + policy="one_of", + msg=( + "OpenMP offloading is available only with GCC, oneAPI, " + "or Cray compilers" + ), + ) depends_on("blas") - # depends_on("lapack") - depends_on('intel-oneapi-mkl', when='+mkl') - conflicts('cuda_arch=none', when='+cuda', msg='CUDA architecture is required') - conflicts('cuda_arch=none', when='+cuda-fortran', msg='CUDA architecture is required') - conflicts('cuda_rt=none', when='@:0.8.5 +cuda', msg='CUDA runtime version is required') + + depends_on("intel-oneapi-mkl", when="+mkl") with when("+openmp"): - depends_on("openblas threads=openmp", when="^openblas") + depends_on("openblas threads=openmp", when="^[virtuals=blas] openblas") + + conflicts( + "cuda_arch=none", + when="+cuda", + msg="CUDA architecture is required", + ) + + conflicts( + "cuda_arch=none", + when="+cuda-fortran", + msg="CUDA architecture is required", + ) + + conflicts( + "cuda_rt=none", + when="@:0.8.5 +cuda", + msg="CUDA runtime version is required", + ) def enable_or_disable_openmp(self, activated): - return '--enable-openmp' if activated else '--disable-openmp' + return "--enable-openmp" if activated else "--disable-openmp" def enable_or_disable_cuda(self, activated): - return '--enable-cublas=yes' if activated else '--enable-cublas=no' + return "--enable-cublas=yes" if activated else "--enable-cublas=no" def enable_or_disable_rocm(self, activated): - return '--enable-rocblas=yes' if activated else '--enable-rocblas=no' + return "--enable-rocblas=yes" if activated else "--enable-rocblas=no" def enable_or_disable_mkl(self, activated): - return '--enable-mkl-gpu=yes' if activated else '--enable-mkl-gpu=no' + return "--enable-mkl-gpu=yes" if activated else "--enable-mkl-gpu=no" def setup_build_environment(self, env): spec = self.spec - if '%nvhpc' in spec: - env.set('CC', "nvc") - env.set('FC', "nvfortran") - env.set('F90', "nvfortran") - env.set('CPP', "cpp -E") - env.set('FPP', "nvfortran -Mpreprocess -E") - env.set('F90SUFFIX', ".f90") - if '%gcc' in spec: - env.set('CC', "gcc") - env.set('FC', "gfortran") - env.set('F90', "gfortran") - env.set('CPP', "gcc -E -P") - env.set('FPP', "gfortran -E -P") - env.set('F90SUFFIX', ".f90") - + + if "%nvhpc" in spec: + env.set("CC", "nvc") + env.set("FC", "nvfortran") + env.set("F90", "nvfortran") + env.set("CPP", "cpp -E") + env.set("FPP", "nvfortran -Mpreprocess -E") + env.set("F90SUFFIX", ".f90") + + if "%gcc" in spec: + env.set("CC", "gcc") + env.set("FC", "gfortran") + env.set("F90", "gfortran") + env.set("CPP", "gcc -E -P") + env.set("FPP", "gfortran -E -P") + env.set("F90SUFFIX", ".f90") + def configure_args(self): spec = self.spec - args = ['--enable-cuda-env-check=no --enable-parallel=no'] + + args = [ + "--enable-cuda-env-check=no", + "--enable-parallel=no", + ] # OpenMP - args.extend(self.enable_or_disable('openmp')) + args.extend(self.enable_or_disable("openmp")) # GPU offloading - if '+cuda-fortran' in spec: - args.append('--enable-cuda-fortran') - if '+openacc' in spec: - args.append('--enable-openacc') - if '+openacc-debug' in spec: - args.append('--enable-openacc-debug') - if '+openmp5' in spec: - args.append('--enable-openmp5') + if "+cuda-fortran" in spec: + args.append("--enable-cuda-fortran") + + if "+openacc" in spec: + args.append("--enable-openacc") + + if "+openacc-debug" in spec: + args.append("--enable-openacc-debug") + + if "+openmp5" in spec: + args.append("--enable-openmp5") # BLAS - if '^nvhpc+blas' in spec: - args.append('--with-blas-libs={0}'.format('-lblas')) + if "^nvhpc+blas" in spec: + args.append("--with-blas-libs=-lblas") else: - args.append('--with-blas-libs={0}'.format(spec['blas'].libs)) + args.append(f"--with-blas-libs={spec['blas'].libs}") # CUDA - args.extend(self.enable_or_disable('cuda')) - if '+cuda' in spec: - args.append('--with-cuda-cc={0}'.format(*spec.variants['cuda_arch'].value)) - if spec.variants['cuda_rt'].value != 'none': - args.append('--with-cuda-runtime={0}'.format(spec.variants['cuda_rt'].value)) - if '%nvhpc' not in spec: - args.append('--with-cuda-path={0}'.format(spec['cuda'].home)) - + args.extend(self.enable_or_disable("cuda")) + + if "+cuda" in spec: + cuda_arch = spec.variants["cuda_arch"].value[0] + args.append(f"--with-cuda-cc={cuda_arch}") + + if spec.variants["cuda_rt"].value != "none": + args.append( + f"--with-cuda-runtime={spec.variants['cuda_rt'].value}" + ) + + if "%nvhpc" not in spec: + args.append(f"--with-cuda-path={spec['cuda'].home}") + # ROCm - args.extend(self.enable_or_disable('rocm')) - if '+rocm' in spec: - args.append('--with-rocm-path={0}'.format(spec['hip'].home)) + args.extend(self.enable_or_disable("rocm")) + + if "+rocm" in spec: + args.append(f"--with-rocm-path={spec['hip'].home}") # MKL - args.extend(self.enable_or_disable('mkl')) + args.extend(self.enable_or_disable("mkl")) return args @property def build_targets(self): - return ['all'] + return ["all"] diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index bf8b5760fbf..554585c1dfa 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -7,197 +7,198 @@ from spack.package import * -class Yambo(AutotoolsPackage,CudaPackage): +class Yambo(AutotoolsPackage, CudaPackage): """YAMBO is an open-source code released within the GPL licence. YAMBO implements Many-Body Perturbation Theory (MBPT) methods - (such as GW and BSE) and Time-Dependent Density Functional Theory - (TDDFT), which allows for accurate prediction of fundamental - properties as band gaps of semiconductors, band alignments, defect - quasi-particle energies, optics and out-of-equilibrium properties - of materials. - - The code resorts to previously computed electronic structure, - usually at the Density Functional Theory (DFT) level and for this - reason it is interfaced with two of the most used planewave DFT - codes used in scientific community, Quantum ESPRESSO and Abinit. + such as GW and BSE, and Time-Dependent Density Functional Theory + (TDDFT), allowing accurate predictions of fundamental properties + such as band gaps, band alignments, defect quasi-particle energies, + optical properties, and out-of-equilibrium properties of materials. """ homepage = "http://www.yambo-code.eu" url = "https://github.com/yambo-code/yambo/archive/5.3.0.tar.gz" git = "https://github.com/yambo-code/yambo.git" - maintainers = ['nicspalla'] - - version('5.3.0', sha256='97b6867c28af6ea690bb02446745e817adcedf95bcd568f132ef3510abbb1cfe') - version('5.2.4', sha256='7c3f2602389fc29a0d8570c2fe85fe3768d390cfcbb2d371e83e75c6c951d5fc') - version('5.2.3', sha256='a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c') - version('5.2.2', sha256='2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4') - version('5.2.1', sha256='0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046') - version('5.2.0', sha256='88fd6de5c9be49b8af89a2634b3c2da6db5a614eff8e19a7ec5c48ef12bafc8b') - version('5.1.4', sha256='f2dfa1b4cb6a28bd54efb56a9333f51e6da9bd248d92ca3f6e945cb9ac9fe82c') - version('5.1.3', sha256='eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37') - version('5.1.2', sha256='9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e') - version('5.1.1', sha256='c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6') - version('5.0.4', sha256='1841ded51cc31a4293fa79252d7ce893d998acea7ccc836e321c3edba19eae8a') - version('5.0.3', sha256='7a5a5f3939bdb6438a3f41a3d26fff0ea6f77339e4daf6a5d850cf2a51da4414') - version('5.0.2', sha256='a2cc0f880dd915b47efa0d5dd88cb94edffbebaff37a252183efb9e23dbd3fab') - version('5.0.1', sha256='bbdbd08f7219d575a0f479ff05dac1f1a7b25f7e20f2165abf1b2cf28aedae92') - version('5.0.0', sha256='b1cbc0b3805538f892b2b8691901c4cc794e75e056a4bd9ad9cf585899cf0aa9') - version('4.5.3', sha256='04f89b5445d35443325c071784376c7b5c25cc900d1fdcc92971a441f8c05985') - version('4.5.2', sha256='0b4f8b82c1d37fce472228bdffb6f6f44b86104d170677a5d55e77a2db832cf0') - version('4.5.1', sha256='6ef202535e38f334a69bd75bd24ff8403b0a4c6b8c60a28b69d4b1c5808aeff5') - version('4.5.0', sha256='c68b2c79acc31b3d48e7edb46e4049c1108d60feee80bf4fcdc4afe4b12b6928') - version('4.4.1', sha256='2daf80f394a861301a9bbad559aaf58de283ce60395c9875e9f7d7fa57fcf16d') - version('4.3.3', sha256='790fa1147044c7f33f0e8d336ccb48089b48d5b894c956779f543e0c7e77de19') - - # Workaround for this https://github.com/yambo-code/yambo-devel/issues/619 - # patch('hdf5.patch', sha256='b9362020b0a29abec535afd7d782b8bb643678fe9215815ca8dc9e4941cb169f', when='@4.3:5.0.99') + maintainers = ["nicspalla"] + + version("5.3.0", sha256="97b6867c28af6ea690bb02446745e817adcedf95bcd568f132ef3510abbb1cfe") + version("5.2.4", sha256="7c3f2602389fc29a0d8570c2fe85fe3768d390cfcbb2d371e83e75c6c951d5fc") + version("5.2.3", sha256="a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c") + version("5.2.2", sha256="2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4") + version("5.2.1", sha256="0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046") + version("5.2.0", sha256="88fd6de5c9be49b8af89a2634b3c2da6db5a614eff8e19a7ec5c48ef12bafc8b") + version("5.1.4", sha256="f2dfa1b4cb6a28bd54efb56a9333f51e6da9bd248d92ca3f6e945cb9ac9fe82c") + version("5.1.3", sha256="eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37") + version("5.1.2", sha256="9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e") + version("5.1.1", sha256="c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6") + version("5.0.4", sha256="1841ded51cc31a4293fa79252d7ce893d998acea7ccc836e321c3edba19eae8a") + version("5.0.3", sha256="7a5a5f3939bdb6438a3f41a3d26fff0ea6f77339e4daf6a5d850cf2a51da4414") + version("5.0.2", sha256="a2cc0f880dd915b47efa0d5dd88cb94edffbebaff37a252183efb9e23dbd3fab") + version("5.0.1", sha256="bbdbd08f7219d575a0f479ff05dac1f1a7b25f7e20f2165abf1b2cf28aedae92") + version("5.0.0", sha256="b1cbc0b3805538f892b2b8691901c4cc794e75e056a4bd9ad9cf585899cf0aa9") + version("4.5.3", sha256="04f89b5445d35443325c071784376c7b5c25cc900d1fdcc92971a441f8c05985") + version("4.5.2", sha256="0b4f8b82c1d37fce472228bdffb6f6f44b86104d170677a5d55e77a2db832cf0") + version("4.5.1", sha256="6ef202535e38f334a69bd75bd24ff8403b0a4c6b8c60a28b69d4b1c5808aeff5") + version("4.5.0", sha256="c68b2c79acc31b3d48e7edb46e4049c1108d60feee80bf4fcdc4afe4b12b6928") + version("4.4.1", sha256="2daf80f394a861301a9bbad559aaf58de283ce60395c9875e9f7d7fa57fcf16d") + version("4.3.3", sha256="790fa1147044c7f33f0e8d336ccb48089b48d5b894c956779f543e0c7e77de19") + # See https://github.com/yambo-code/yambo-devel/issues/643 - patch('s_psi.patch', sha256='981a0783a9a2c21a89faa358eaf277213837ed712c936152842f8cf7620f52cd', when='@:5.1.99 %gcc@12.0.0:') + patch( + "s_psi.patch", + sha256="981a0783a9a2c21a89faa358eaf277213837ed712c936152842f8cf7620f52cd", + when="@:5.1.99 %gcc@12.0.0:", + ) # See https://github.com/yambo-code/yambo/issues/190 - patch('cuda_runtime.patch', sha256='bfd5ade95ef5ca9502c7ad1b375e4517fbf77a32bf97041fd580bb36304fd755', when='@5.3.0+cuda') + patch( + "cuda_runtime.patch", + sha256="bfd5ade95ef5ca9502c7ad1b375e4517fbf77a32bf97041fd580bb36304fd755", + when="@5.3.0+cuda", + ) depends_on("c", type="build") depends_on("fortran", type="build") depends_on("tar", type="build") - - # MPI + OpenMP parallelism - variant('mpi', default=True, description='Enable MPI support') - variant('openmp', default=True, description='Enable OpenMP support') - - # Linear Algebra and Parallel I/O - variant('slepc', default=False, description='Activate support for linear algebra with SLEPc and PETSc') - with when('+mpi'): - variant('scalapack', default=False, description='Activate support for parallel linear algebra with SCALAPACK') - variant('parallel_io', default=True, when='@4.4.0:', description='Activate the HDF5 parallel I/O') - - # Other variants - variant('dp', default=False, description='Enable double precision') - variant('time', default=False, description='Activate time profiling of specific sections') - variant('memory', default=False, description='Activate memory profiling of specific sections') - variant('ph', default=False, description='Compile Electron-phonon coupling project executables: yambo_ph ypp_ph') - variant('rt', default=False, description='Compile Real-time dynamics project executables: yambo_rt ypp_rt') - variant('sc', default=False, description='Compile Self-consistent (COHSEX, HF, DFT) project executables: yambo_sc ypp_sc') - variant('nl', default=False, description='Compile Non-linear optics project executables: yambo_nl ypp_nl') - - with when('+mpi'): - depends_on('mpi') - - # Linar Algebra - depends_on('blas') - depends_on('lapack') - - with when('+scalapack'): - depends_on('scalapack') - conflicts('+scalapack', when='~mpi', msg="Parallel linear algebra available only with +mpi") - - with when('+slepc'): - depends_on('petsc+complex~superlu-dist~hypre~metis') - depends_on('petsc+mpi', when='+mpi') - depends_on('petsc~mpi', when='~mpi') - depends_on('petsc+double', when='+dp') - depends_on('petsc~double', when='~dp') - depends_on('petsc~cuda', when='@:5.2.0') - depends_on('petsc@:3.20.5', when='@:5.2.99') - depends_on('petsc@:3.22.2', when='@:5.3.0') - depends_on('slepc~arpack') - depends_on('slepc~cuda', when='@:5.2.0') - - # FFTW dependecies - depends_on('fftw-api@3') + + variant("mpi", default=True, description="Enable MPI support") + variant("openmp", default=True, description="Enable OpenMP support") + variant("slepc", default=False, description="Activate support for SLEPc and PETSc") + variant("dp", default=False, description="Enable double precision") + variant("time", default=False, description="Activate time profiling of specific sections") + variant("memory", default=False, description="Activate memory profiling of specific sections") + variant("ph", default=False, description="Compile Electron-phonon coupling executables") + variant("rt", default=False, description="Compile Real-time dynamics executables") + variant("sc", default=False, description="Compile Self-consistent project executables") + variant("nl", default=False, description="Compile Non-linear optics executables") + variant("cuda-fortran", default=False, description="Build with CUDA Fortran") + with when("+mpi"): - depends_on('fftw +mpi', when='^[virtuals=fftw-api] fftw') - with when("~mpi"): - depends_on('fftw ~mpi', when='^[virtuals=fftw-api] fftw') + variant( + "scalapack", + default=False, + description="Activate parallel linear algebra with ScaLAPACK", + ) + variant( + "parallel_io", + default=True, + when="@4.4.0:", + description="Activate HDF5 parallel I/O", + ) + depends_on("mpi") + + depends_on("blas") + depends_on("lapack") + + with when("+scalapack"): + depends_on("scalapack") + + conflicts("+scalapack", when="~mpi", msg="Parallel linear algebra available only with +mpi") + + with when("+slepc"): + depends_on("petsc+complex~superlu-dist~hypre~metis") + depends_on("petsc+mpi", when="+mpi") + depends_on("petsc~mpi", when="~mpi") + depends_on("petsc+double", when="+dp") + depends_on("petsc~double", when="~dp") + depends_on("petsc~cuda", when="@:5.2.0") + depends_on("petsc@:3.20.5", when="@:5.2.99") + depends_on("petsc@:3.22.2", when="@:5.3.0") + depends_on("slepc~arpack") + depends_on("slepc~cuda", when="@:5.2.0") + + depends_on("fftw-api@3") + depends_on("fftw+mpi", when="+mpi ^[virtuals=fftw-api] fftw") + depends_on("fftw~mpi", when="~mpi ^[virtuals=fftw-api] fftw") - # HDF5 and NetCDF dependecies with when("+parallel_io"): - depends_on('hdf5+fortran+hl+mpi') - depends_on('netcdf-c+mpi') + depends_on("hdf5+fortran+hl+mpi") + depends_on("netcdf-c+mpi") + with when("~parallel_io"): - depends_on('hdf5+fortran+hl~mpi') - depends_on('netcdf-c~mpi') - depends_on('hdf5@:1.12.3', when='@:5.2.99') - conflicts('hdf5+mpi', when='@:4.4.0', msg="Parallel I/O available from version 4.4.1") - depends_on('netcdf-fortran') - - # LIBXC dependecies - depends_on('libxc@2.0.3:3.0.0~cuda', when='@:5.0.99') - depends_on('libxc@5.0.0:6.2.2~cuda', when='@5.1.0:') - - # GPU variants and dependecies - with when('+cuda'): - variant('cuda_rt', values=str, default='none', when='%nvhpc', - description='Specify the CUDA runtime version (e.g. "11.8") only if you want the secondary version installed with the NVHPC SDK.') - conflicts('cuda_rt=none', when='@:5.2.99 +cuda', msg='CUDA runtime version is required') - variant('cuda-fortran', default=False, description='Build with CUDA-Fortran') - with when('+cuda-fortran'): - conflicts('~cuda', - msg="CUDA required when +cuda-fortran") - conflicts('cuda_arch=none', - msg="CUDA architecture is required when +cuda") - conflicts('@:4.5.3', - msg="CUDA-Fortran available only from version 5.0.0") - conflicts('%gcc', - msg="CUDA-Fortran available only with NV or PGI compilers") - conflicts('%intel', - msg="CUDA-Fortran available only with NV or PGI compilers") - conflicts('%oneapi', - msg="CUDA-Fortran available only with NV or PGI compilers") - - # DeviceXlib - with when('@5.3.0:'): - depends_on('devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5', when='~cuda-fortran') - depends_on('devicexlib@0.8.6: +cuda-fortran+cuda', when='+cuda-fortran+cuda') - + depends_on("hdf5+fortran+hl~mpi") + depends_on("netcdf-c~mpi") + + depends_on("hdf5@:1.12.3", when="@:5.2.99") + depends_on("netcdf-fortran") + + conflicts("hdf5+mpi", when="@:4.4.0", msg="Parallel I/O available from version 4.4.1") + + depends_on("libxc@2.0.3:3.0.0~cuda", when="@:5.0.99") + depends_on("libxc@5.0.0:6.2.2~cuda", when="@5.1.0:") + + with when("+cuda"): + variant( + "cuda_rt", + values=str, + default="none", + when="%nvhpc", + description=( + 'Specify the CUDA runtime version, e.g. "11.8", only if you ' + "want the secondary version installed with the NVHPC SDK." + ), + ) + + conflicts("cuda_rt=none", when="@:5.2.99 +cuda", msg="CUDA runtime version is required") + + with when("+cuda-fortran"): + conflicts("~cuda", msg="CUDA required when +cuda-fortran") + conflicts("cuda_arch=none", msg="CUDA architecture is required when +cuda") + conflicts("@:4.5.3", msg="CUDA Fortran available only from version 5.0.0") + conflicts("%gcc", msg="CUDA Fortran available only with NV or PGI compilers") + conflicts("%intel", msg="CUDA Fortran available only with NV or PGI compilers") + conflicts("%oneapi", msg="CUDA Fortran available only with NV or PGI compilers") + + with when("@5.3.0:"): + depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5", when="~cuda-fortran") + depends_on("devicexlib@0.8.6: +cuda-fortran+cuda", when="+cuda-fortran+cuda") + with when("+openmp"): depends_on("openblas threads=openmp", when="^[virtuals=lapack] openblas") depends_on("intel-oneapi-mkl threads=openmp", when="^[virtuals=lapack] intel-oneapi-mkl") - depends_on("fftw +openmp", when="^[virtuals=fftw-api] fftw") - depends_on("petsc +openmp", when="^[virtuals=petsc] petsc") + depends_on("fftw+openmp", when="^[virtuals=fftw-api] fftw") + depends_on("petsc+openmp", when="^[virtuals=petsc] petsc") - # IOTK external resource resource( - name='iotk', - url='https://github.com/yambo-code/yambo-libraries/raw/master/external/iotk-y1.2.2.tar.gz', - sha256='64af6a4b98f3b62fcec603e4e1b00ef994f95a0efa53ab6593ebcfe6de1739ef', - placement={'iotk-y1.2.2.tar.gz': 'lib/archive/iotk-y1.2.2.tar.gz'}, - expand=False + name="iotk", + url="https://github.com/yambo-code/yambo-libraries/raw/master/external/iotk-y1.2.2.tar.gz", + sha256="64af6a4b98f3b62fcec603e4e1b00ef994f95a0efa53ab6593ebcfe6de1739ef", + placement={"iotk-y1.2.2.tar.gz": "lib/archive/iotk-y1.2.2.tar.gz"}, + expand=False, ) - # Yambo Driver external resource resource( - name='Ydriver', - url='https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-0.0.2.tar.gz', - sha256='63984c3eb2d28320b320f1d9b3a2c1efcd3c9505a10d887c8bbd54513442202c', - placement={'Ydriver-0.0.2.tar.gz': 'lib/archive/Ydriver-0.0.2.tar.gz'}, - when='@5.0.0:5.0.99', - expand=False + name="Ydriver", + url="https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-0.0.2.tar.gz", + sha256="63984c3eb2d28320b320f1d9b3a2c1efcd3c9505a10d887c8bbd54513442202c", + placement={"Ydriver-0.0.2.tar.gz": "lib/archive/Ydriver-0.0.2.tar.gz"}, + when="@5.0.0:5.0.99", + expand=False, ) resource( - name='Ydriver', - url='https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-1.1.0.tar.gz', - sha256='6c316d613f5a41ddd15efad7ba97e4712f87d7e56c073ba5458caf424afcb97a', - placement={'Ydriver-1.1.0.tar.gz': 'lib/archive/Ydriver-1.1.0.tar.gz'}, - when='@5.1.0:5.1.99', - expand=False + name="Ydriver", + url="https://github.com/yambo-code/yambo-libraries/raw/master/external/Ydriver-1.1.0.tar.gz", + sha256="6c316d613f5a41ddd15efad7ba97e4712f87d7e56c073ba5458caf424afcb97a", + placement={"Ydriver-1.1.0.tar.gz": "lib/archive/Ydriver-1.1.0.tar.gz"}, + when="@5.1.0:5.1.99", + expand=False, ) resource( - name='Ydriver', - url='https://github.com/yambo-code/Ydriver/archive/refs/tags/1.2.0.tar.gz', - sha256='0f29a44e9c4b49d3f6be3f159a7ef415932b2ae2f2fdba163af60a0673befe6e', - placement={'1.2.0.tar.gz': 'lib/archive/Ydriver-1.2.0.tar.gz'}, - when='@5.2.0:5.2.3', - expand=False + name="Ydriver", + url="https://github.com/yambo-code/Ydriver/archive/refs/tags/1.2.0.tar.gz", + sha256="0f29a44e9c4b49d3f6be3f159a7ef415932b2ae2f2fdba163af60a0673befe6e", + placement={"1.2.0.tar.gz": "lib/archive/Ydriver-1.2.0.tar.gz"}, + when="@5.2.0:5.2.3", + expand=False, ) resource( - name='Ydriver', - url='https://github.com/yambo-code/Ydriver/archive/refs/tags/1.4.2.tar.gz', - sha256='c242f0700a224325ff59326767614a561b02ce16ddb2ce6c13ddd2d5901cc3e4', - placement={'1.4.2.tar.gz': 'lib/archive/Ydriver-1.4.2.tar.gz'}, - when='@5.2.4', - expand=False + name="Ydriver", + url="https://github.com/yambo-code/Ydriver/archive/refs/tags/1.4.2.tar.gz", + sha256="c242f0700a224325ff59326767614a561b02ce16ddb2ce6c13ddd2d5901cc3e4", + placement={"1.4.2.tar.gz": "lib/archive/Ydriver-1.4.2.tar.gz"}, + when="@5.2.4", + expand=False, ) sanity_check_is_file = ["bin/yambo", "bin/ypp", "bin/a2y", "bin/c2y", "bin/p2y"] @@ -205,276 +206,317 @@ class Yambo(AutotoolsPackage,CudaPackage): @property def build_targets(self): spec = self.spec - if '+ph' in spec and '+rt' in spec and '+sc' in spec and '+nl' in spec: - return ['all'] - bt = ['core'] - if '+ph' in spec: - bt.append('ph-project') - if '+rt' in spec: - bt.append('rt-project') - if '+sc' in spec: - bt.append('sc-project') - if '+nl' in spec: - bt.append('nl-project') - return bt - - @run_before('configure') + + if "+ph" in spec and "+rt" in spec and "+sc" in spec and "+nl" in spec: + return ["all"] + + targets = ["core"] + + if "+ph" in spec: + targets.append("ph-project") + if "+rt" in spec: + targets.append("rt-project") + if "+sc" in spec: + targets.append("sc-project") + if "+nl" in spec: + targets.append("nl-project") + + return targets + + @run_before("configure") def filter_configure(self): - spec = self.spec - # The configure in the package has the string 'cat config/report' - # hard-coded, which causes a failure at configure time due to the - # current working directory in Spack. Fix this by using the absolute - # path to the file. - report_abspath = join_path(self.build_directory, 'config', 'report') - filter_file('cat config/report', 'cat '+report_abspath, 'configure') - # fix petsc bad recognition - filter_file('#include ', '#include ', 'configure') - # fix hdf5 bad linking and include flags - filter_file('.+try_HDF5_LIBS=..h5pfc -show .+', '#', 'configure') - filter_file('.+try_hdf5_incdir=..h5pfc -show .+', '#', 'configure') - filter_file('.+try_HDF5_LIBS=..h5fc -show .+', '#', 'configure') - filter_file('.+try_hdf5_incdir=..h5fc -show .+', '#', 'configure') - - @run_before('configure') + report_abspath = join_path(self.build_directory, "config", "report") + filter_file("cat config/report", f"cat {report_abspath}", "configure") + + filter_file( + "#include ", + "#include ", + "configure", + ) + + filter_file(".+try_HDF5_LIBS=..h5pfc -show .+", "#", "configure") + filter_file(".+try_hdf5_incdir=..h5pfc -show .+", "#", "configure") + filter_file(".+try_HDF5_LIBS=..h5fc -show .+", "#", "configure") + filter_file(".+try_hdf5_incdir=..h5fc -show .+", "#", "configure") + + @run_before("configure") def filter_linking_issue(self): - # fix linking issues with intel-oneapi-compilers spec = self.spec - if '@5.1.2:' in spec and '%intel-oneapi-compilers' in spec: - filter_file('libs="-lint_modules $libs $llocal $lPLA $lIO $lextlibs -lm"', - r'libs="-lint_modules $libs $llocal $lSL $lPLA $lIO $lextlibs -lm"', - 'sbin/compilation/libraries.sh', - string=True) - filter_file('$libs $llocal', - r'-Wl,--start-group $libs $llocal', - 'sbin/compilation/libraries.sh', - string=True) - filter_file('$lextlibs', - r'$lextlibs -Wl,--end-group', - 'sbin/compilation/libraries.sh', - string=True) - filter_file('libs=" "', 'libs=" -l_Y_tddft "', 'sbin/compilation/libraries.sh', string=True) - - @run_before('configure') + + if "@5.1.2:" in spec and "%intel-oneapi-compilers" in spec: + filter_file( + 'libs="-lint_modules $libs $llocal $lPLA $lIO $lextlibs -lm"', + r'libs="-lint_modules $libs $llocal $lSL $lPLA $lIO $lextlibs -lm"', + "sbin/compilation/libraries.sh", + string=True, + ) + filter_file( + "$libs $llocal", + r"-Wl,--start-group $libs $llocal", + "sbin/compilation/libraries.sh", + string=True, + ) + filter_file( + "$lextlibs", + r"$lextlibs -Wl,--end-group", + "sbin/compilation/libraries.sh", + string=True, + ) + filter_file( + 'libs=" "', + 'libs=" -l_Y_tddft "', + "sbin/compilation/libraries.sh", + string=True, + ) + + @run_before("configure") def filter_oneapi(self): spec = self.spec - # fix oneapi ifx issues - if ('%oneapi' in spec or '%intel-oneapi-compilers' in spec) and '@5.0.0:5.2.99' in spec: - filter_file('*ifort*', '*ifx*', 'configure', string=True) - filter_file('2021', '2023', 'configure') - filter_file('FC="$(fc)"', 'FC=mpiifort', 'lib/iotk/Makefile.loc', string=True) - filter_file('#include ', - '#if defined _ypp || defined _a2y || defined _p2y || defined _c2y || defined _e2y || defined _eph2y\n #include \n#endif', - 'lib/yambo/Ydriver/src/main/options_maker.c', - string=True) - - @run_before('configure') + + if ( + ("%oneapi" in spec or "%intel-oneapi-compilers" in spec) + and "@5.0.0:5.2.99" in spec + ): + filter_file("*ifort*", "*ifx*", "configure", string=True) + filter_file("2021", "2023", "configure") + filter_file("FC=\"$(fc)\"", "FC=mpiifort", "lib/iotk/Makefile.loc", string=True) + filter_file( + "#include ", + "#if defined _ypp || defined _a2y || defined _p2y || " + "defined _c2y || defined _e2y || defined _eph2y\n" + " #include \n#endif", + "lib/yambo/Ydriver/src/main/options_maker.c", + string=True, + ) + + @run_before("configure") def filter_time(self): spec = self.spec - # To always have the times written in seconds in the report, useful for benchmarking - if '+time' in spec and '@5.0.0:' in spec: - filter_file('total_time(i_c)<600.', 'total_time(i_c)<604800.', 'src/timing/TIMING_clock_write.F', string=True) - filter_file("ch=' [Time-Profile]: '//trim(time_string(total_time))", - "write (ch,'(a,f11.4,a)') ' [Time-Profile]: ',total_time,'s'", - 'src/modules/mod_timing.F', string=True) - + + if "+time" in spec and "@5.0.0:" in spec: + filter_file( + "total_time(i_c)<600.", + "total_time(i_c)<604800.", + "src/timing/TIMING_clock_write.F", + string=True, + ) + filter_file( + "ch=' [Time-Profile]: '//trim(time_string(total_time))", + "write (ch,'(a,f11.4,a)') ' [Time-Profile]: ',total_time,'s'", + "src/modules/mod_timing.F", + string=True, + ) + def enable_or_disable_time(self, activated): - return '--enable-time-profile' if activated else '--disable-time-profile' + return "--enable-time-profile" if activated else "--disable-time-profile" def enable_or_disable_memory(self, activated): - return '--enable-memory-profile' if activated else '--disable-memory-profile' + return "--enable-memory-profile" if activated else "--disable-memory-profile" def enable_or_disable_openmp(self, activated): - return '--enable-open-mp' if activated else '--disable-open-mp' + return "--enable-open-mp" if activated else "--disable-open-mp" def enable_or_disable_parallel_io(self, activated): - return '--enable-hdf5-par-io' if activated else '--disable-hdf5-par-io' + return "--enable-hdf5-par-io" if activated else "--disable-hdf5-par-io" def setup_build_environment(self, env): spec = self.spec - if spec['mpi'].name == 'openmpi': - env.set('MPICC', 'mpicc') - env.set('MPICXX', 'mpicxx') - env.set('MPIF77', 'mpif77') - env.set('MPIFC', 'mpif90') - if spec['mpi'].name == 'fujitsu-mpi': - env.set('MPICC', 'mpicc') - env.set('MPICXX', 'mpicxx') - env.set('MPIF77', 'mpifort') - env.set('MPIFC', 'mpifort') - if '%nvhpc' in spec: - env.set('FC', "nvfortran") - env.set('CPP', "cpp -E -P") - env.set('FPP', "nvfortran -Mpreprocess -E") - env.set('F90SUFFIX', ".f90") - env.unset('CUDA_HOME') - if '%intel' in spec: - env.set('FPP', "ifort -E -free -P") - env.set('FC', "ifort") - env.set('F77', "ifort") - env.set('CC', "icc") - env.set('CPP', "icc -E -ansi") - if 'intel' in spec['mpi'].name: - env.set('MPICC', 'mpiicc') - env.set('MPICXX', 'mpiicpc') - env.set('MPIF77', 'mpiifort') - env.set('MPIFC', 'mpiifort') - if '%oneapi' in spec: - env.set('FC', "ifx") - env.set('F77', "ifx") - env.set('CC', "icx") - env.set('FPP', "ifx -E -free -P") - env.set('CPP', "icx -E -ansi") - if 'intel' in spec['mpi'].name: - if '^intel-oneapi-mpi@2021.10.0' in spec: - env.set('MPICC', 'mpiicc -cc=icx') - env.set('MPIF77', 'mpiifort -fc=ifx') - env.set('MPIFC', 'mpiifort -fc=ifx') + + if "+mpi" in spec: + if spec["mpi"].name == "openmpi": + env.set("MPICC", "mpicc") + env.set("MPICXX", "mpicxx") + env.set("MPIF77", "mpif77") + env.set("MPIFC", "mpif90") + + if spec["mpi"].name == "fujitsu-mpi": + env.set("MPICC", "mpicc") + env.set("MPICXX", "mpicxx") + env.set("MPIF77", "mpifort") + env.set("MPIFC", "mpifort") + + if "%nvhpc" in spec: + env.set("FC", "nvfortran") + env.set("CPP", "cpp -E -P") + env.set("FPP", "nvfortran -Mpreprocess -E") + env.set("F90SUFFIX", ".f90") + env.unset("CUDA_HOME") + + if "%intel" in spec: + env.set("FPP", "ifort -E -free -P") + env.set("FC", "ifort") + env.set("F77", "ifort") + env.set("CC", "icc") + env.set("CPP", "icc -E -ansi") + + if "+mpi" in spec and "intel" in spec["mpi"].name: + env.set("MPICC", "mpiicc") + env.set("MPICXX", "mpiicpc") + env.set("MPIF77", "mpiifort") + env.set("MPIFC", "mpiifort") + + if "%oneapi" in spec: + env.set("FC", "ifx") + env.set("F77", "ifx") + env.set("CC", "icx") + env.set("FPP", "ifx -E -free -P") + env.set("CPP", "icx -E -ansi") + + if "+mpi" in spec and "intel" in spec["mpi"].name: + if "^intel-oneapi-mpi@2021.10.0" in spec: + env.set("MPICC", "mpiicc -cc=icx") + env.set("MPIF77", "mpiifort -fc=ifx") + env.set("MPIFC", "mpiifort -fc=ifx") else: - env.set('MPICC', 'mpiicx') - env.set('MPIF77', 'mpiifx') - env.set('MPIFC', 'mpiifx') + env.set("MPICC", "mpiicx") + env.set("MPIF77", "mpiifx") + env.set("MPIFC", "mpiifx") def configure_args(self): spec = self.spec args = [ - '--enable-msgs-comps', - '--disable-keep-objects', - '--with-editor=none', - '--enable-keep-src' + "--enable-msgs-comps", + "--disable-keep-objects", + "--with-editor=none", + "--enable-keep-src", + f"--prefix={self.stage.source_path}", ] - # There are hard-coded paths that make the build process fail if the - # target prefix is not the configure directory - args.append('--prefix={0}'.format(self.stage.source_path)) - if '@:4.5.3' in spec: - if '%gcc@9.0.0:' in spec: - args.append('FCFLAGS=-fallow-argument-mismatch') - - # Double precision - args.extend(self.enable_or_disable('dp')) - - # Application profiling - args.extend(self.enable_or_disable('time')) - args.extend(self.enable_or_disable('memory')) + if "@:4.5.3" in spec and "%gcc@9.0.0:" in spec: + args.append("FCFLAGS=-fallow-argument-mismatch") - # MPI + threading - args.extend(self.enable_or_disable('mpi')) - args.extend(self.enable_or_disable('openmp')) + args.extend(self.enable_or_disable("dp")) + args.extend(self.enable_or_disable("time")) + args.extend(self.enable_or_disable("memory")) + args.extend(self.enable_or_disable("mpi")) + args.extend(self.enable_or_disable("openmp")) - # MKL mkl_lines = { - 'intel': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', - 'intel_thr': '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5', - 'oneapi': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', - 'oneapi_thr': '-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5', - 'gcc': '-Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core', - 'gcc_thr': '-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp', - 'nvhpc': '-lmkl_intel_lp64 -lmkl_sequential -lmkl_core', - 'nvhpc_thr': '-lmkl_intel_lp64 -lmkl_pgi_thread -lmkl_core -pgf90libs -mp', + "intel": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", + "intel_thr": "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5", + "oneapi": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", + "oneapi_thr": "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5", + "gcc": "-Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core", + "gcc_thr": "-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp", + "nvhpc": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", + "nvhpc_thr": "-lmkl_intel_lp64 -lmkl_pgi_thread -lmkl_core -pgf90libs -mp", } - mkl_line='' - if 'mkl' in spec or 'intel-oneapi-mkl' in spec: - mkl_line = "-L{0}/lib/intel64 ".format(env['MKLROOT']) - if '%intel-oneapi-compilers' in spec or '%oneapi' in spec: + + if "mkl" in spec or "intel-oneapi-mkl" in spec: + mkl_line = f"-L{env['MKLROOT']}/lib/intel64 " + + if "%intel-oneapi-compilers" in spec or "%oneapi" in spec: comp = "oneapi" - elif '%intel' in spec: + elif "%intel" in spec: comp = "intel" - elif '%gcc' in spec: - comp = "gnu" - elif '%nvhpc' in spec: + elif "%gcc" in spec: + comp = "gcc" + elif "%nvhpc" in spec: comp = "nvhpc" + if "+openmp" in spec: comp += "_thr" + mkl_line += mkl_lines[comp] - mkl_line += ' -lpthread -lm -ldl' - - # BLAS/LAPACK - args.append('--with-blas-libs={0}'.format(mkl_line)) - args.append('--with-lapack-libs={0}'.format(mkl_line)) - # FFT - args.extend([ - '--with-fft-libs={0}'.format(mkl_line), - '--with-fft-includedir={0}/include/fftw'.format(env['MKLROOT']) - ]) + mkl_line += " -lpthread -lm -ldl" + + args.append(f"--with-blas-libs={mkl_line}") + args.append(f"--with-lapack-libs={mkl_line}") + args.extend( + [ + f"--with-fft-libs={mkl_line}", + f"--with-fft-includedir={env['MKLROOT']}/include/fftw", + ] + ) else: - # BLAS/LAPACK - args.extend([ - '--with-blas-libs={0}'.format(spec['blas'].libs), - '--with-lapack-libs={0}'.format(spec['lapack'].libs), - ]) - # FFT - args.append('--with-fft-path={0}'.format(spec['fftw-api'].prefix)) - - # ScaLAPACK - if '+scalapack' in spec: - args.append('--enable-par-linalg') - if ('mkl' in spec or 'intel-oneapi-mkl' in spec) and 'netlib-scalapack' not in spec: - args.extend([ - '--with-blacs-libs=-L{0}/lib/intel64 ' - '-lmkl_blacs_intelmpi_lp64'.format(env['MKLROOT']), - '--with-scalapack-libs=-L{0}/lib/intel64 ' - '-lmkl_scalapack_lp64'.format(env['MKLROOT']), - ]) + args.extend( + [ + f"--with-blas-libs={spec['blas'].libs}", + f"--with-lapack-libs={spec['lapack'].libs}", + f"--with-fft-path={spec['fftw-api'].prefix}", + ] + ) + + if "+scalapack" in spec: + args.append("--enable-par-linalg") + + if ("mkl" in spec or "intel-oneapi-mkl" in spec) and "netlib-scalapack" not in spec: + args.extend( + [ + f"--with-blacs-libs=-L{env['MKLROOT']}/lib/intel64 " + "-lmkl_blacs_intelmpi_lp64", + f"--with-scalapack-libs=-L{env['MKLROOT']}/lib/intel64 " + "-lmkl_scalapack_lp64", + ] + ) else: - args.extend([ - '--with-blacs-libs={0}'.format(spec['scalapack'].libs), - '--with-scalapack-libs={0}'.format(spec['scalapack'].libs), - ]) - - # PETSc + SLEPc - if '+slepc' in spec: - args.extend([ - '--enable-slepc-linalg', - '--with-petsc-path={0}'.format(spec['petsc'].prefix), - '--with-slepc-path={0}'.format(spec['slepc'].prefix), - ]) - - # I/O - args.extend([ - '--with-netcdf-path={0}'.format(spec['netcdf-c'].prefix), - '--with-netcdff-path={0}'.format(spec['netcdf-fortran'].prefix), - '--with-hdf5-path={0}'.format(spec['hdf5'].prefix) - ]) - - # Parallel I/O - if '@4.4.0:' in spec: - args.extend(self.enable_or_disable('parallel_io')) - - # Other dependencies - args.append('--with-libxc-path={0}'.format(spec['libxc'].prefix)) - if '@5.3.0:' in spec: - args.append('--with-devxlib-path={0}'.format(spec['devicexlib'].home)) - - # GPU - if '+cuda-fortran' in spec: args.append('--enable-cuda-fortran') - if '+cuda' in spec: - if '@5.3.0:' in spec: - args.append('--with-cuda-cc={0}'.format(*spec.variants['cuda_arch'].value)) - if spec.variants['cuda_rt'].value != 'none': - args.append('--with-cuda-runtime={0}'.format(spec.variants['cuda_rt'].value)) - # args.append('--with-cuda-path={0}'.format(spec['cuda'].prefix)) + args.extend( + [ + f"--with-blacs-libs={spec['scalapack'].libs}", + f"--with-scalapack-libs={spec['scalapack'].libs}", + ] + ) + + if "+slepc" in spec: + args.extend( + [ + "--enable-slepc-linalg", + f"--with-petsc-path={spec['petsc'].prefix}", + f"--with-slepc-path={spec['slepc'].prefix}", + ] + ) + + args.extend( + [ + f"--with-netcdf-path={spec['netcdf-c'].prefix}", + f"--with-netcdff-path={spec['netcdf-fortran'].prefix}", + f"--with-hdf5-path={spec['hdf5'].prefix}", + ] + ) + + if "@4.4.0:" in spec: + args.extend(self.enable_or_disable("parallel_io")) + + args.append(f"--with-libxc-path={spec['libxc'].prefix}") + + if "@5.3.0:" in spec: + args.append(f"--with-devxlib-path={spec['devicexlib'].home}") + + if "+cuda-fortran" in spec: + args.append("--enable-cuda-fortran") + + if "+cuda" in spec: + cuda_arch = spec.variants["cuda_arch"].value[0] + + if "@5.3.0:" in spec: + args.append(f"--with-cuda-cc={cuda_arch}") + + if spec.variants["cuda_rt"].value != "none": + args.append(f"--with-cuda-runtime={spec.variants['cuda_rt'].value}") else: - enable_cuda = '--enable-cuda=cuda{0}.{1}'.format(*spec['cuda'].version) - enable_cuda += ',cc{0}'.format(*spec.variants['cuda_arch'].value) + cuda_version = spec["cuda"].version + enable_cuda = f"--enable-cuda=cuda{cuda_version[0]}.{cuda_version[1]}" + enable_cuda += f",cc{cuda_arch}" args.append(enable_cuda) - if '%nvhpc' not in spec: - args.append('--with-cuda-path={0}'.format(spec['cuda'].home)) + + if "%nvhpc" not in spec: + args.append(f"--with-cuda-path={spec['cuda'].home}") return args def install(self, spec, prefix): - # 'install' target is not present - install_tree('bin', prefix.bin) + install_tree("bin", prefix.bin) def build(self, spec, prefix): - print(f"Using compiler: {spec.compiler.name} {spec.compiler.version}") - if spec.satisfies('%nvhpc') and spec.compiler.version >= Version('24.11') : - # Modify the config/setup file that was created by configure - config_file = join_path(self.stage.source_path, 'config', 'setup') - # Handle the -Mcuda=A,X pattern - filter_file( r'-Mcuda=([^,\s]+),([^,\s]+)', r'-cuda -gpu=\1,\2', config_file ) - # Handle the -Mcudalib pattern - filter_file( r'-Mcudalib=([^,\s][^,\s]*(?:,[^,\s]+)*)', r'-cudalib=\1', config_file ) - # Then proceed with the actual build - super(Yambo, self).build(spec, prefix) + if spec.satisfies("%nvhpc") and spec.compiler.version >= Version("24.11"): + config_file = join_path(self.stage.source_path, "config", "setup") + + filter_file(r"-Mcuda=([^,\s]+),([^,\s]+)", r"-cuda -gpu=\1,\2", config_file) + filter_file( + r"-Mcudalib=([^,\s][^,\s]*(?:,[^,\s]+)*)", + r"-cudalib=\1", + config_file, + ) + + super().build(spec, prefix) From 2d693edc01fb155af4b2e903d2a1c7cc1a46bae6 Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Tue, 26 May 2026 12:43:38 +0200 Subject: [PATCH 04/10] Fix style/formatting check issues --- repos/spack_repo/builtin/packages/devicexlib/package.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index 6bf0ca37a67..10c59f7785e 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -36,7 +36,11 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): depends_on("c", type="build") depends_on("fortran", type="build") - variant("openmp", default=False, description="Enable OpenMP support") + variant( + "openmp", + default=False, + description="Enable OpenMP support", + ) variant( "openmp5", @@ -91,7 +95,7 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): when="%nvhpc", description=( 'Specify the CUDA runtime version, e.g. "11.8", only if you ' - "want the secondary version installed with the NVHPC SDK." + 'want the secondary version installed with the NVHPC SDK.' ), ) From 5911be9820a9f0032ef51bb2c6ea2499bac8dba6 Mon Sep 17 00:00:00 2001 From: nicspalla <32565160+nicspalla@users.noreply.github.com> Date: Wed, 27 May 2026 04:51:47 +0000 Subject: [PATCH 05/10] [@spackbot] updating style on behalf of nicspalla --- .../builtin/packages/devicexlib/package.py | 14 +++++--------- repos/spack_repo/builtin/packages/yambo/package.py | 8 +++----- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index 10c59f7785e..916b338380d 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -5,6 +5,7 @@ from spack_repo.builtin.build_systems.autotools import AutotoolsPackage from spack_repo.builtin.build_systems.cuda import CudaPackage from spack_repo.builtin.build_systems.rocm import ROCmPackage + from spack.package import * @@ -23,7 +24,7 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): maintainers = ["nicspalla"] - version('develop', branch='develop') + version("develop", branch="develop") version("0.9.1", sha256="900fe8b0849d451e7c541d00a1b92c723e0969bae47ebcabd295e14ebcc17d1e") version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") @@ -95,7 +96,7 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): when="%nvhpc", description=( 'Specify the CUDA runtime version, e.g. "11.8", only if you ' - 'want the secondary version installed with the NVHPC SDK.' + "want the secondary version installed with the NVHPC SDK." ), ) @@ -119,10 +120,7 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): "%cce", "%gcc@10:+nvptx", policy="one_of", - msg=( - "OpenMP offloading is available only with GCC, oneAPI, " - "or Cray compilers" - ), + msg=("OpenMP offloading is available only with GCC, oneAPI, or Cray compilers"), ) depends_on("blas") @@ -219,9 +217,7 @@ def configure_args(self): args.append(f"--with-cuda-cc={cuda_arch}") if spec.variants["cuda_rt"].value != "none": - args.append( - f"--with-cuda-runtime={spec.variants['cuda_rt'].value}" - ) + args.append(f"--with-cuda-runtime={spec.variants['cuda_rt'].value}") if "%nvhpc" not in spec: args.append(f"--with-cuda-path={spec['cuda'].home}") diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index 554585c1dfa..d724e8c3192 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -4,6 +4,7 @@ from spack_repo.builtin.build_systems.autotools import AutotoolsPackage from spack_repo.builtin.build_systems.cuda import CudaPackage + from spack.package import * @@ -273,13 +274,10 @@ def filter_linking_issue(self): def filter_oneapi(self): spec = self.spec - if ( - ("%oneapi" in spec or "%intel-oneapi-compilers" in spec) - and "@5.0.0:5.2.99" in spec - ): + if ("%oneapi" in spec or "%intel-oneapi-compilers" in spec) and "@5.0.0:5.2.99" in spec: filter_file("*ifort*", "*ifx*", "configure", string=True) filter_file("2021", "2023", "configure") - filter_file("FC=\"$(fc)\"", "FC=mpiifort", "lib/iotk/Makefile.loc", string=True) + filter_file('FC="$(fc)"', "FC=mpiifort", "lib/iotk/Makefile.loc", string=True) filter_file( "#include ", "#if defined _ypp || defined _a2y || defined _p2y || " From 841b4343b50149ebe0a1944aeeda9ca5bf6481b2 Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Sat, 6 Jun 2026 14:49:25 +0200 Subject: [PATCH 06/10] updates suggested in PR #4923 --- .../builtin/packages/devicexlib/package.py | 22 +++------ .../builtin/packages/yambo/package.py | 45 ++++++++++--------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index 916b338380d..4d18cc4c279 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -22,17 +22,15 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): url = "https://gitlab.com/max-centre/components/devicexlib/-/archive/0.9.0/devicexlib-0.9.0.tar.gz" git = "https://gitlab.com/max-centre/components/devicexlib" - maintainers = ["nicspalla"] + license("MIT") + maintainers("nicspalla") version("develop", branch="develop") - version("0.9.1", sha256="900fe8b0849d451e7c541d00a1b92c723e0969bae47ebcabd295e14ebcc17d1e") - version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") - version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") - version("0.8.5", sha256="498d5c6804e697123d382d9dd35dedeb4b64228704f84711877c842b851d37df") - version("0.8.4", sha256="6c50bb6d51a26429f17c9bbb00e81b279ed7f731b2a73f4689b7b30a8e30f115") - version("0.8.3", sha256="3d2d4264df8c57da2791b0f94def52d789d67c6fe7ad5960f96c96dfc6c25cb2") - version("0.8.2", sha256="c184de73f424e9437e352eb0e35716514348a7cd88ebac3ad7a52c66c4e4ba9c") + with default_args(deprecated=True): + version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") + version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") + version("0.8.5", sha256="498d5c6804e697123d382d9dd35dedeb4b64228704f84711877c842b851d37df") depends_on("c", type="build") depends_on("fortran", type="build") @@ -148,9 +146,6 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): msg="CUDA runtime version is required", ) - def enable_or_disable_openmp(self, activated): - return "--enable-openmp" if activated else "--disable-openmp" - def enable_or_disable_cuda(self, activated): return "--enable-cublas=yes" if activated else "--enable-cublas=no" @@ -204,10 +199,7 @@ def configure_args(self): args.append("--enable-openmp5") # BLAS - if "^nvhpc+blas" in spec: - args.append("--with-blas-libs=-lblas") - else: - args.append(f"--with-blas-libs={spec['blas'].libs}") + args.append(f"--with-blas-libs={spec['blas'].libs}") # CUDA args.extend(self.enable_or_disable("cuda")) diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index d724e8c3192..948583586ff 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -22,29 +22,33 @@ class Yambo(AutotoolsPackage, CudaPackage): url = "https://github.com/yambo-code/yambo/archive/5.3.0.tar.gz" git = "https://github.com/yambo-code/yambo.git" - maintainers = ["nicspalla"] + maintainers("nicspalla", "LydDeb") + + license("GPL-2.0-or-later") version("5.3.0", sha256="97b6867c28af6ea690bb02446745e817adcedf95bcd568f132ef3510abbb1cfe") version("5.2.4", sha256="7c3f2602389fc29a0d8570c2fe85fe3768d390cfcbb2d371e83e75c6c951d5fc") - version("5.2.3", sha256="a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c") - version("5.2.2", sha256="2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4") - version("5.2.1", sha256="0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046") - version("5.2.0", sha256="88fd6de5c9be49b8af89a2634b3c2da6db5a614eff8e19a7ec5c48ef12bafc8b") version("5.1.4", sha256="f2dfa1b4cb6a28bd54efb56a9333f51e6da9bd248d92ca3f6e945cb9ac9fe82c") - version("5.1.3", sha256="eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37") - version("5.1.2", sha256="9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e") - version("5.1.1", sha256="c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6") - version("5.0.4", sha256="1841ded51cc31a4293fa79252d7ce893d998acea7ccc836e321c3edba19eae8a") - version("5.0.3", sha256="7a5a5f3939bdb6438a3f41a3d26fff0ea6f77339e4daf6a5d850cf2a51da4414") - version("5.0.2", sha256="a2cc0f880dd915b47efa0d5dd88cb94edffbebaff37a252183efb9e23dbd3fab") - version("5.0.1", sha256="bbdbd08f7219d575a0f479ff05dac1f1a7b25f7e20f2165abf1b2cf28aedae92") - version("5.0.0", sha256="b1cbc0b3805538f892b2b8691901c4cc794e75e056a4bd9ad9cf585899cf0aa9") - version("4.5.3", sha256="04f89b5445d35443325c071784376c7b5c25cc900d1fdcc92971a441f8c05985") - version("4.5.2", sha256="0b4f8b82c1d37fce472228bdffb6f6f44b86104d170677a5d55e77a2db832cf0") - version("4.5.1", sha256="6ef202535e38f334a69bd75bd24ff8403b0a4c6b8c60a28b69d4b1c5808aeff5") - version("4.5.0", sha256="c68b2c79acc31b3d48e7edb46e4049c1108d60feee80bf4fcdc4afe4b12b6928") - version("4.4.1", sha256="2daf80f394a861301a9bbad559aaf58de283ce60395c9875e9f7d7fa57fcf16d") - version("4.3.3", sha256="790fa1147044c7f33f0e8d336ccb48089b48d5b894c956779f543e0c7e77de19") + + with default_args(deprecated=True): + version("5.2.3", sha256="a6168d1fa820af857ac51217bd6ad26dda4cc89c07e035bd7dc230038ae1ab9c") + version("5.2.2", sha256="2ddd6356830ce9302e304b7627cff3aa973846cf893f91742b4390d0b53d63d4") + version("5.2.1", sha256="0ac362854313927d75bbf87be98ff58447f3805f79724c38dc79df07f03a7046") + version("5.2.0", sha256="88fd6de5c9be49b8af89a2634b3c2da6db5a614eff8e19a7ec5c48ef12bafc8b") + version("5.1.3", sha256="eb12297990030e785a58db6b9c9f0e34809eb2f095082e0aeca89eeaaf14ff37") + version("5.1.2", sha256="9625d8a96bd9a3ff3713ebe53228d5ac9be0a98adecbe2a2bad67234c0e26a2e") + version("5.1.1", sha256="c85036ca60507e627c47b6c6aee8241830349e88110e1ce9132ef03ab2c4e9f6") + version("5.0.4", sha256="1841ded51cc31a4293fa79252d7ce893d998acea7ccc836e321c3edba19eae8a") + version("5.0.3", sha256="7a5a5f3939bdb6438a3f41a3d26fff0ea6f77339e4daf6a5d850cf2a51da4414") + version("5.0.2", sha256="a2cc0f880dd915b47efa0d5dd88cb94edffbebaff37a252183efb9e23dbd3fab") + version("5.0.1", sha256="bbdbd08f7219d575a0f479ff05dac1f1a7b25f7e20f2165abf1b2cf28aedae92") + version("5.0.0", sha256="b1cbc0b3805538f892b2b8691901c4cc794e75e056a4bd9ad9cf585899cf0aa9") + version("4.5.3", sha256="04f89b5445d35443325c071784376c7b5c25cc900d1fdcc92971a441f8c05985") + version("4.5.2", sha256="0b4f8b82c1d37fce472228bdffb6f6f44b86104d170677a5d55e77a2db832cf0") + version("4.5.1", sha256="6ef202535e38f334a69bd75bd24ff8403b0a4c6b8c60a28b69d4b1c5808aeff5") + version("4.5.0", sha256="c68b2c79acc31b3d48e7edb46e4049c1108d60feee80bf4fcdc4afe4b12b6928") + version("4.4.1", sha256="2daf80f394a861301a9bbad559aaf58de283ce60395c9875e9f7d7fa57fcf16d") + version("4.3.3", sha256="790fa1147044c7f33f0e8d336ccb48089b48d5b894c956779f543e0c7e77de19") # See https://github.com/yambo-code/yambo-devel/issues/643 patch( @@ -152,7 +156,8 @@ class Yambo(AutotoolsPackage, CudaPackage): conflicts("%oneapi", msg="CUDA Fortran available only with NV or PGI compilers") with when("@5.3.0:"): - depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5", when="~cuda-fortran") + depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5~openmp", when="~cuda-fortran~openmp") + depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5+openmp", when="~cuda-fortran+openmp") depends_on("devicexlib@0.8.6: +cuda-fortran+cuda", when="+cuda-fortran+cuda") with when("+openmp"): From c82ac4ebd8c03053b242008a953f86659071ee6c Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Tue, 9 Jun 2026 07:22:36 +0000 Subject: [PATCH 07/10] cleanup of the cuda-fortran installation with nvhpc --- .../builtin/packages/devicexlib/package.py | 31 +-- .../builtin/packages/yambo/package.py | 177 +++++++++--------- 2 files changed, 94 insertions(+), 114 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index 4d18cc4c279..c3448002089 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -27,10 +27,8 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): version("develop", branch="develop") version("0.9.1", sha256="900fe8b0849d451e7c541d00a1b92c723e0969bae47ebcabd295e14ebcc17d1e") - with default_args(deprecated=True): - version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") - version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") - version("0.8.5", sha256="498d5c6804e697123d382d9dd35dedeb4b64228704f84711877c842b851d37df") + version("0.9.0", sha256="77c57a31381a69a2eb2a77138b131a553c96aff03ca934c88b8a6d8434b39460") + version("0.8.6", sha256="36e6222bc59cf0ed7268cc3652a3661887109f7fe072cefe06884dcd6de2407d") depends_on("c", type="build") depends_on("fortran", type="build") @@ -86,18 +84,6 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): description="Enable OpenACC DEBUG macro", ) - with when("+cuda"): - variant( - "cuda_rt", - values=str, - default="none", - when="%nvhpc", - description=( - 'Specify the CUDA runtime version, e.g. "11.8", only if you ' - "want the secondary version installed with the NVHPC SDK." - ), - ) - with when("+cuda-fortran"): requires( "%nvhpc", @@ -122,7 +108,6 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): ) depends_on("blas") - depends_on("intel-oneapi-mkl", when="+mkl") with when("+openmp"): @@ -140,12 +125,6 @@ class Devicexlib(AutotoolsPackage, CudaPackage, ROCmPackage): msg="CUDA architecture is required", ) - conflicts( - "cuda_rt=none", - when="@:0.8.5 +cuda", - msg="CUDA runtime version is required", - ) - def enable_or_disable_cuda(self, activated): return "--enable-cublas=yes" if activated else "--enable-cublas=no" @@ -208,12 +187,6 @@ def configure_args(self): cuda_arch = spec.variants["cuda_arch"].value[0] args.append(f"--with-cuda-cc={cuda_arch}") - if spec.variants["cuda_rt"].value != "none": - args.append(f"--with-cuda-runtime={spec.variants['cuda_rt'].value}") - - if "%nvhpc" not in spec: - args.append(f"--with-cuda-path={spec['cuda'].home}") - # ROCm args.extend(self.enable_or_disable("rocm")) diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index 948583586ff..34b54352052 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -77,7 +77,6 @@ class Yambo(AutotoolsPackage, CudaPackage): variant("rt", default=False, description="Compile Real-time dynamics executables") variant("sc", default=False, description="Compile Self-consistent project executables") variant("nl", default=False, description="Compile Non-linear optics executables") - variant("cuda-fortran", default=False, description="Build with CUDA Fortran") with when("+mpi"): variant( @@ -108,10 +107,13 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("petsc+double", when="+dp") depends_on("petsc~double", when="~dp") depends_on("petsc~cuda", when="@:5.2.0") - depends_on("petsc@:3.20.5", when="@:5.2.99") - depends_on("petsc@:3.22.2", when="@:5.3.0") + depends_on("petsc@:3.20", when="@:5.2.4") + depends_on("petsc@:3.22", when="@:5.3.0") depends_on("slepc~arpack") depends_on("slepc~cuda", when="@:5.2.0") + conflicts("+slepc", when="@:5.1.4 %nvhpc", + msg="SLEPc support not available with this combination of version and compiler.") + depends_on("fftw-api@3") depends_on("fftw+mpi", when="+mpi ^[virtuals=fftw-api] fftw") @@ -125,7 +127,7 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("hdf5+fortran+hl~mpi") depends_on("netcdf-c~mpi") - depends_on("hdf5@:1.12.3", when="@:5.2.99") + # depends_on("hdf5@:1.12.3", when="@:5.2.99") depends_on("netcdf-fortran") conflicts("hdf5+mpi", when="@:4.4.0", msg="Parallel I/O available from version 4.4.1") @@ -134,31 +136,15 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("libxc@5.0.0:6.2.2~cuda", when="@5.1.0:") with when("+cuda"): - variant( - "cuda_rt", - values=str, - default="none", - when="%nvhpc", - description=( - 'Specify the CUDA runtime version, e.g. "11.8", only if you ' - "want the secondary version installed with the NVHPC SDK." - ), - ) - - conflicts("cuda_rt=none", when="@:5.2.99 +cuda", msg="CUDA runtime version is required") - - with when("+cuda-fortran"): - conflicts("~cuda", msg="CUDA required when +cuda-fortran") - conflicts("cuda_arch=none", msg="CUDA architecture is required when +cuda") conflicts("@:4.5.3", msg="CUDA Fortran available only from version 5.0.0") conflicts("%gcc", msg="CUDA Fortran available only with NV or PGI compilers") conflicts("%intel", msg="CUDA Fortran available only with NV or PGI compilers") conflicts("%oneapi", msg="CUDA Fortran available only with NV or PGI compilers") with when("@5.3.0:"): - depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5~openmp", when="~cuda-fortran~openmp") - depends_on("devicexlib@0.8.6: ~cuda-fortran~openacc~openmp5+openmp", when="~cuda-fortran+openmp") - depends_on("devicexlib@0.8.6: +cuda-fortran+cuda", when="+cuda-fortran+cuda") + depends_on("devicexlib ~cuda-fortran~openacc~openmp5~openmp", when="~cuda~openmp") + depends_on("devicexlib ~cuda-fortran~openacc~openmp5+openmp", when="~cuda+openmp") + depends_on("devicexlib +cuda-fortran+cuda", when="+cuda") with when("+openmp"): depends_on("openblas threads=openmp", when="^[virtuals=lapack] openblas") @@ -310,6 +296,23 @@ def filter_time(self): string=True, ) + @run_before("configure") + def filter_makev1(self): + spec = self.spec + if "@:5.1.4" in spec: + filter_file( + "$(MAKE) $(MAKEFLAGS) -f Makefile.loc all ;", + "$(MAKE) -f Makefile.loc $(MAKEFLAGS) all ;", + "config/mk/global/functions/get_libraries.mk", + string=True, + ) + filter_file( + "$(MAKE) $(MAKEFLAGS) -f Makefile.loc $$LIB2DO ;", + "$(MAKE) -f Makefile.loc $(MAKEFLAGS) $$LIB2DO ;", + "config/mk/global/functions/get_libraries.mk", + string=True, + ) + def enable_or_disable_time(self, activated): return "--enable-time-profile" if activated else "--disable-time-profile" @@ -325,55 +328,69 @@ def enable_or_disable_parallel_io(self, activated): def setup_build_environment(self, env): spec = self.spec - if "+mpi" in spec: - if spec["mpi"].name == "openmpi": - env.set("MPICC", "mpicc") - env.set("MPICXX", "mpicxx") - env.set("MPIF77", "mpif77") - env.set("MPIFC", "mpif90") - - if spec["mpi"].name == "fujitsu-mpi": - env.set("MPICC", "mpicc") - env.set("MPICXX", "mpicxx") - env.set("MPIF77", "mpifort") - env.set("MPIFC", "mpifort") - - if "%nvhpc" in spec: - env.set("FC", "nvfortran") + if "%c=nvhpc" in spec: env.set("CPP", "cpp -E -P") + if "%fortran=nvhpc" in spec: env.set("FPP", "nvfortran -Mpreprocess -E") env.set("F90SUFFIX", ".f90") - env.unset("CUDA_HOME") - - if "%intel" in spec: - env.set("FPP", "ifort -E -free -P") - env.set("FC", "ifort") - env.set("F77", "ifort") - env.set("CC", "icc") + if "%c=intel" in spec: env.set("CPP", "icc -E -ansi") - - if "+mpi" in spec and "intel" in spec["mpi"].name: - env.set("MPICC", "mpiicc") - env.set("MPICXX", "mpiicpc") - env.set("MPIF77", "mpiifort") - env.set("MPIFC", "mpiifort") - - if "%oneapi" in spec: - env.set("FC", "ifx") - env.set("F77", "ifx") - env.set("CC", "icx") - env.set("FPP", "ifx -E -free -P") + if "%fortran=intel" in spec: + env.set("FPP", "ifort -E -free -P") + if "%c=oneapi" in spec: env.set("CPP", "icx -E -ansi") + if "%fortran=oneapi" in spec: + env.set("FPP", "ifx -E -free -P") - if "+mpi" in spec and "intel" in spec["mpi"].name: - if "^intel-oneapi-mpi@2021.10.0" in spec: - env.set("MPICC", "mpiicc -cc=icx") - env.set("MPIF77", "mpiifort -fc=ifx") - env.set("MPIFC", "mpiifort -fc=ifx") - else: - env.set("MPICC", "mpiicx") - env.set("MPIF77", "mpiifx") - env.set("MPIFC", "mpiifx") +# if "+mpi" in spec: +# if spec["mpi"].name == "openmpi": +# env.set("MPICC", "mpicc") +# env.set("MPICXX", "mpicxx") +# env.set("MPIF77", "mpif77") +# env.set("MPIFC", "mpif90") +# +# if spec["mpi"].name == "fujitsu-mpi": +# env.set("MPICC", "mpicc") +# env.set("MPICXX", "mpicxx") +# env.set("MPIF77", "mpifort") +# env.set("MPIFC", "mpifort") +# +# if "%nvhpc" in spec: +# env.set("FC", "nvfortran") +# env.set("CPP", "cpp -E -P") +# env.set("FPP", "nvfortran -Mpreprocess -E") +# env.set("F90SUFFIX", ".f90") +# env.unset("CUDA_HOME") +# +# if "%intel" in spec: +# env.set("FPP", "ifort -E -free -P") +# env.set("FC", "ifort") +# env.set("F77", "ifort") +# env.set("CC", "icc") +# env.set("CPP", "icc -E -ansi") +# +# if "+mpi" in spec and "intel" in spec["mpi"].name: +# env.set("MPICC", "mpiicc") +# env.set("MPICXX", "mpiicpc") +# env.set("MPIF77", "mpiifort") +# env.set("MPIFC", "mpiifort") +# +# if "%oneapi" in spec: +# env.set("FC", "ifx") +# env.set("F77", "ifx") +# env.set("CC", "icx") +# env.set("FPP", "ifx -E -free -P") +# env.set("CPP", "icx -E -ansi") +# +# if "+mpi" in spec and "intel" in spec["mpi"].name: +# if "^intel-oneapi-mpi@2021.10.0" in spec: +# env.set("MPICC", "mpiicc -cc=icx") +# env.set("MPIF77", "mpiifort -fc=ifx") +# env.set("MPIFC", "mpiifort -fc=ifx") +# else: +# env.set("MPICC", "mpiicx") +# env.set("MPIF77", "mpiifx") +# env.set("MPIFC", "mpiifx") def configure_args(self): spec = self.spec @@ -398,8 +415,6 @@ def configure_args(self): mkl_lines = { "intel": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", "intel_thr": "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5", - "oneapi": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", - "oneapi_thr": "-lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5", "gcc": "-Wl,--no-as-needed -lmkl_gf_lp64 -lmkl_sequential -lmkl_core", "gcc_thr": "-lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -lgomp", "nvhpc": "-lmkl_intel_lp64 -lmkl_sequential -lmkl_core", @@ -409,9 +424,7 @@ def configure_args(self): if "mkl" in spec or "intel-oneapi-mkl" in spec: mkl_line = f"-L{env['MKLROOT']}/lib/intel64 " - if "%intel-oneapi-compilers" in spec or "%oneapi" in spec: - comp = "oneapi" - elif "%intel" in spec: + if "%intel-oneapi-compilers" in spec or "%oneapi" in spec or "%intel" in spec: comp = "intel" elif "%gcc" in spec: comp = "gcc" @@ -486,25 +499,13 @@ def configure_args(self): if "@5.3.0:" in spec: args.append(f"--with-devxlib-path={spec['devicexlib'].home}") - if "+cuda-fortran" in spec: - args.append("--enable-cuda-fortran") - if "+cuda" in spec: cuda_arch = spec.variants["cuda_arch"].value[0] - if "@5.3.0:" in spec: + args.append("--enable-cuda-fortran") args.append(f"--with-cuda-cc={cuda_arch}") - - if spec.variants["cuda_rt"].value != "none": - args.append(f"--with-cuda-runtime={spec.variants['cuda_rt'].value}") else: - cuda_version = spec["cuda"].version - enable_cuda = f"--enable-cuda=cuda{cuda_version[0]}.{cuda_version[1]}" - enable_cuda += f",cc{cuda_arch}" - args.append(enable_cuda) - - if "%nvhpc" not in spec: - args.append(f"--with-cuda-path={spec['cuda'].home}") + args.append(f"--enable-cuda=cc{cuda_arch}") return args @@ -521,5 +522,11 @@ def build(self, spec, prefix): r"-cudalib=\1", config_file, ) + filter_file(r"-Mcuda=([^,\s]+)", r"-cuda -gpu=\1", config_file) + filter_file( + r"-Mcudalib=([^,\s][^,\s]*(?:,[^,\s]+)*)", + r"-cudalib=\1", + config_file, + ) super().build(spec, prefix) From 8ce836b051ee0fe025d2414c24a8e549f1a41afa Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Tue, 9 Jun 2026 10:50:11 +0000 Subject: [PATCH 08/10] additional cleanup in yambo and devicexlib packages --- .../builtin/packages/devicexlib/package.py | 14 +-- .../builtin/packages/yambo/package.py | 95 ++++--------------- 2 files changed, 23 insertions(+), 86 deletions(-) diff --git a/repos/spack_repo/builtin/packages/devicexlib/package.py b/repos/spack_repo/builtin/packages/devicexlib/package.py index c3448002089..94d451ca50a 100644 --- a/repos/spack_repo/builtin/packages/devicexlib/package.py +++ b/repos/spack_repo/builtin/packages/devicexlib/package.py @@ -137,22 +137,12 @@ def enable_or_disable_mkl(self, activated): def setup_build_environment(self, env): spec = self.spec - if "%nvhpc" in spec: - env.set("CC", "nvc") - env.set("FC", "nvfortran") - env.set("F90", "nvfortran") + if "%c=nvhpc" in spec: env.set("CPP", "cpp -E") + if "%fortran=nvhpc" in spec: env.set("FPP", "nvfortran -Mpreprocess -E") env.set("F90SUFFIX", ".f90") - if "%gcc" in spec: - env.set("CC", "gcc") - env.set("FC", "gfortran") - env.set("F90", "gfortran") - env.set("CPP", "gcc -E -P") - env.set("FPP", "gfortran -E -P") - env.set("F90SUFFIX", ".f90") - def configure_args(self): spec = self.spec diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index 34b54352052..755871f68b0 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -78,6 +78,9 @@ class Yambo(AutotoolsPackage, CudaPackage): variant("sc", default=False, description="Compile Self-consistent project executables") variant("nl", default=False, description="Compile Non-linear optics executables") + conflicts("%oneapi", when="@:5.2.4", + msg="oneapi compilation supported only from version 5.3.0") + with when("+mpi"): variant( "scalapack", @@ -112,7 +115,7 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("slepc~arpack") depends_on("slepc~cuda", when="@:5.2.0") conflicts("+slepc", when="@:5.1.4 %nvhpc", - msg="SLEPc support not available with this combination of version and compiler.") + msg="SLEPc support not available with this version of Yambo and nvhpc compiler.") depends_on("fftw-api@3") @@ -137,9 +140,8 @@ class Yambo(AutotoolsPackage, CudaPackage): with when("+cuda"): conflicts("@:4.5.3", msg="CUDA Fortran available only from version 5.0.0") - conflicts("%gcc", msg="CUDA Fortran available only with NV or PGI compilers") - conflicts("%intel", msg="CUDA Fortran available only with NV or PGI compilers") - conflicts("%oneapi", msg="CUDA Fortran available only with NV or PGI compilers") + requires("%nvhpc", + msg="CUDA-Fortran support available only with NVIDIA compilers") with when("@5.3.0:"): depends_on("devicexlib ~cuda-fortran~openacc~openmp5~openmp", when="~cuda~openmp") @@ -261,23 +263,6 @@ def filter_linking_issue(self): string=True, ) - @run_before("configure") - def filter_oneapi(self): - spec = self.spec - - if ("%oneapi" in spec or "%intel-oneapi-compilers" in spec) and "@5.0.0:5.2.99" in spec: - filter_file("*ifort*", "*ifx*", "configure", string=True) - filter_file("2021", "2023", "configure") - filter_file('FC="$(fc)"', "FC=mpiifort", "lib/iotk/Makefile.loc", string=True) - filter_file( - "#include ", - "#if defined _ypp || defined _a2y || defined _p2y || " - "defined _c2y || defined _e2y || defined _eph2y\n" - " #include \n#endif", - "lib/yambo/Ydriver/src/main/options_maker.c", - string=True, - ) - @run_before("configure") def filter_time(self): spec = self.spec @@ -342,55 +327,20 @@ def setup_build_environment(self, env): if "%fortran=oneapi" in spec: env.set("FPP", "ifx -E -free -P") -# if "+mpi" in spec: -# if spec["mpi"].name == "openmpi": -# env.set("MPICC", "mpicc") -# env.set("MPICXX", "mpicxx") -# env.set("MPIF77", "mpif77") -# env.set("MPIFC", "mpif90") -# -# if spec["mpi"].name == "fujitsu-mpi": -# env.set("MPICC", "mpicc") -# env.set("MPICXX", "mpicxx") -# env.set("MPIF77", "mpifort") -# env.set("MPIFC", "mpifort") -# -# if "%nvhpc" in spec: -# env.set("FC", "nvfortran") -# env.set("CPP", "cpp -E -P") -# env.set("FPP", "nvfortran -Mpreprocess -E") -# env.set("F90SUFFIX", ".f90") -# env.unset("CUDA_HOME") -# -# if "%intel" in spec: -# env.set("FPP", "ifort -E -free -P") -# env.set("FC", "ifort") -# env.set("F77", "ifort") -# env.set("CC", "icc") -# env.set("CPP", "icc -E -ansi") -# -# if "+mpi" in spec and "intel" in spec["mpi"].name: -# env.set("MPICC", "mpiicc") -# env.set("MPICXX", "mpiicpc") -# env.set("MPIF77", "mpiifort") -# env.set("MPIFC", "mpiifort") -# -# if "%oneapi" in spec: -# env.set("FC", "ifx") -# env.set("F77", "ifx") -# env.set("CC", "icx") -# env.set("FPP", "ifx -E -free -P") -# env.set("CPP", "icx -E -ansi") -# -# if "+mpi" in spec and "intel" in spec["mpi"].name: -# if "^intel-oneapi-mpi@2021.10.0" in spec: -# env.set("MPICC", "mpiicc -cc=icx") -# env.set("MPIF77", "mpiifort -fc=ifx") -# env.set("MPIFC", "mpiifort -fc=ifx") -# else: -# env.set("MPICC", "mpiicx") -# env.set("MPIF77", "mpiifx") -# env.set("MPIFC", "mpiifx") + def flag_handler(self, name, flags): + if name == "cflags": + if self.spec.satisfies("%gcc") and self.spec.satisfies("@:5.1.4"): + flags.extend([ + "-Wno-error=implicit-function-declaration", + "-Wno-error=deprecated-declarations", + ]) + if name == "fcflags": + if self.spec.satisfies("%gcc@9:") and self.spec.satisfies("@:4.5.3"): + flags.extend([ + "-fallow-argument-mismatch", + ]) + + return (flags, None, None) def configure_args(self): spec = self.spec @@ -403,9 +353,6 @@ def configure_args(self): f"--prefix={self.stage.source_path}", ] - if "@:4.5.3" in spec and "%gcc@9.0.0:" in spec: - args.append("FCFLAGS=-fallow-argument-mismatch") - args.extend(self.enable_or_disable("dp")) args.extend(self.enable_or_disable("time")) args.extend(self.enable_or_disable("memory")) @@ -424,7 +371,7 @@ def configure_args(self): if "mkl" in spec or "intel-oneapi-mkl" in spec: mkl_line = f"-L{env['MKLROOT']}/lib/intel64 " - if "%intel-oneapi-compilers" in spec or "%oneapi" in spec or "%intel" in spec: + if "%oneapi" in spec or "%intel" in spec: comp = "intel" elif "%gcc" in spec: comp = "gcc" From 85038548c3ddf5a0ee73348901471d5c2b78eb8f Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Wed, 10 Jun 2026 09:59:14 +0000 Subject: [PATCH 09/10] fix style --- repos/spack_repo/builtin/packages/yambo/package.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index 755871f68b0..8f4d2c104b9 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -339,7 +339,7 @@ def flag_handler(self, name, flags): flags.extend([ "-fallow-argument-mismatch", ]) - + return (flags, None, None) def configure_args(self): From 6052a09a21fd4cb4ab95a4f046bd63760354caa5 Mon Sep 17 00:00:00 2001 From: Nicola Spallanzani Date: Wed, 10 Jun 2026 11:25:53 +0000 Subject: [PATCH 10/10] fix style --- .../builtin/packages/yambo/package.py | 35 +++++++++++-------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/repos/spack_repo/builtin/packages/yambo/package.py b/repos/spack_repo/builtin/packages/yambo/package.py index 8f4d2c104b9..35ee60d8ad8 100644 --- a/repos/spack_repo/builtin/packages/yambo/package.py +++ b/repos/spack_repo/builtin/packages/yambo/package.py @@ -78,8 +78,9 @@ class Yambo(AutotoolsPackage, CudaPackage): variant("sc", default=False, description="Compile Self-consistent project executables") variant("nl", default=False, description="Compile Non-linear optics executables") - conflicts("%oneapi", when="@:5.2.4", - msg="oneapi compilation supported only from version 5.3.0") + conflicts( + "%oneapi", when="@:5.2.4", msg="oneapi compilation supported only from version 5.3.0" + ) with when("+mpi"): variant( @@ -114,9 +115,11 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("petsc@:3.22", when="@:5.3.0") depends_on("slepc~arpack") depends_on("slepc~cuda", when="@:5.2.0") - conflicts("+slepc", when="@:5.1.4 %nvhpc", - msg="SLEPc support not available with this version of Yambo and nvhpc compiler.") - + conflicts( + "+slepc", + when="@:5.1.4 %nvhpc", + msg="SLEPc support not available with this version of Yambo and nvhpc compiler.", + ) depends_on("fftw-api@3") depends_on("fftw+mpi", when="+mpi ^[virtuals=fftw-api] fftw") @@ -130,7 +133,6 @@ class Yambo(AutotoolsPackage, CudaPackage): depends_on("hdf5+fortran+hl~mpi") depends_on("netcdf-c~mpi") - # depends_on("hdf5@:1.12.3", when="@:5.2.99") depends_on("netcdf-fortran") conflicts("hdf5+mpi", when="@:4.4.0", msg="Parallel I/O available from version 4.4.1") @@ -140,8 +142,7 @@ class Yambo(AutotoolsPackage, CudaPackage): with when("+cuda"): conflicts("@:4.5.3", msg="CUDA Fortran available only from version 5.0.0") - requires("%nvhpc", - msg="CUDA-Fortran support available only with NVIDIA compilers") + requires("%nvhpc", msg="CUDA-Fortran support available only with NVIDIA compilers") with when("@5.3.0:"): depends_on("devicexlib ~cuda-fortran~openacc~openmp5~openmp", when="~cuda~openmp") @@ -330,15 +331,19 @@ def setup_build_environment(self, env): def flag_handler(self, name, flags): if name == "cflags": if self.spec.satisfies("%gcc") and self.spec.satisfies("@:5.1.4"): - flags.extend([ - "-Wno-error=implicit-function-declaration", - "-Wno-error=deprecated-declarations", - ]) + flags.extend( + [ + "-Wno-error=implicit-function-declaration", + "-Wno-error=deprecated-declarations", + ] + ) if name == "fcflags": if self.spec.satisfies("%gcc@9:") and self.spec.satisfies("@:4.5.3"): - flags.extend([ - "-fallow-argument-mismatch", - ]) + flags.extend( + [ + "-fallow-argument-mismatch", + ] + ) return (flags, None, None)