From ad0b2564073ce91dfad2a49998c285525148a28a Mon Sep 17 00:00:00 2001 From: Dom Heinzeller Date: Fri, 25 Oct 2024 13:17:49 -0600 Subject: Intel/Oneapi compilers: suppress warnings when using Cray wrappers (#47046) #44588 we added logic to suppress deprecation warnings for the Intel classic compilers. This depended on matching against * The compiler names (looking for icc, icpc, ifort) * The compiler version When using an Intel compiler with fortran wrappers, the first check always fails. To support using the fortran wrappers (in combination with the classic Intel compilers), we remove the first check and suppress if just the version matches. This works because: * The newer compilers like icx can handle (ignore) the flags that suppress deprecation warnings * The Cray wrappers pass the underlying compiler version (e.g. they report what icc would report) --- lib/spack/spack/compilers/intel.py | 5 ++--- lib/spack/spack/compilers/oneapi.py | 9 ++++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/spack/spack/compilers/intel.py b/lib/spack/spack/compilers/intel.py index 4990da3cb0..3002ba7f6e 100644 --- a/lib/spack/spack/compilers/intel.py +++ b/lib/spack/spack/compilers/intel.py @@ -124,9 +124,8 @@ class Intel(Compiler): # Edge cases for Intel's oneAPI compilers when using the legacy classic compilers: # Always pass flags to disable deprecation warnings, since these warnings can # confuse tools that parse the output of compiler commands (e.g. version checks). - if self.cc and self.cc.endswith("icc") and self.real_version >= Version("2021"): + if self.real_version >= Version("2021") and self.real_version <= Version("2023"): env.append_flags("SPACK_ALWAYS_CFLAGS", "-diag-disable=10441") - if self.cxx and self.cxx.endswith("icpc") and self.real_version >= Version("2021"): env.append_flags("SPACK_ALWAYS_CXXFLAGS", "-diag-disable=10441") - if self.fc and self.fc.endswith("ifort") and self.real_version >= Version("2021"): + if self.real_version >= Version("2021") and self.real_version <= Version("2024"): env.append_flags("SPACK_ALWAYS_FFLAGS", "-diag-disable=10448") diff --git a/lib/spack/spack/compilers/oneapi.py b/lib/spack/spack/compilers/oneapi.py index b0cfadc505..c06a55f396 100644 --- a/lib/spack/spack/compilers/oneapi.py +++ b/lib/spack/spack/compilers/oneapi.py @@ -151,11 +151,14 @@ class Oneapi(Compiler): # Edge cases for Intel's oneAPI compilers when using the legacy classic compilers: # Always pass flags to disable deprecation warnings, since these warnings can # confuse tools that parse the output of compiler commands (e.g. version checks). - if self.cc and self.cc.endswith("icc") and self.real_version >= Version("2021"): + # This is really only needed for Fortran, since oneapi@ should be using either + # icx+icpx+ifx or icx+icpx+ifort. But to be on the safe side (some users may + # want to try to swap icpx against icpc, for example), and since the Intel LLVM + # compilers accept these diag-disable flags, we apply them for all compilers. + if self.real_version >= Version("2021") and self.real_version <= Version("2023"): env.append_flags("SPACK_ALWAYS_CFLAGS", "-diag-disable=10441") - if self.cxx and self.cxx.endswith("icpc") and self.real_version >= Version("2021"): env.append_flags("SPACK_ALWAYS_CXXFLAGS", "-diag-disable=10441") - if self.fc and self.fc.endswith("ifort") and self.real_version >= Version("2021"): + if self.real_version >= Version("2021") and self.real_version <= Version("2024"): env.append_flags("SPACK_ALWAYS_FFLAGS", "-diag-disable=10448") # 2024 release bumped the libsycl version because of an ABI -- cgit v1.2.3-70-g09d2