diff --git a/var/spack/repos/builtin/packages/bison/nvhpc.patch b/var/spack/repos/builtin/packages/bison/nvhpc-3.6.patch similarity index 100% rename from var/spack/repos/builtin/packages/bison/nvhpc.patch rename to var/spack/repos/builtin/packages/bison/nvhpc-3.6.patch diff --git a/var/spack/repos/builtin/packages/bison/nvhpc-3.7.patch b/var/spack/repos/builtin/packages/bison/nvhpc-3.7.patch new file mode 100644 index 00000000000..d678cda57e5 --- /dev/null +++ b/var/spack/repos/builtin/packages/bison/nvhpc-3.7.patch @@ -0,0 +1,38 @@ +--- a/lib/xalloc-oversized.h ++++ b/lib/xalloc-oversized.h +@@ -41,10 +41,10 @@ + positive and N must be nonnegative. This is a macro, not a + function, so that it works correctly even when SIZE_MAX < N. */ + +-#if 7 <= __GNUC__ && !defined __clang__ ++#if 7 <= __GNUC__ && !defined __clang__ && !defined __NVCOMPILER + # define xalloc_oversized(n, s) \ + __builtin_mul_overflow_p (n, s, (__xalloc_count_type) 1) +-#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ ++#elif 5 <= __GNUC__ && !defined __ICC && !__STRICT_ANSI__ && !defined __NVCOMPILER + # define xalloc_oversized(n, s) \ + (__builtin_constant_p (n) && __builtin_constant_p (s) \ + ? __xalloc_oversized (n, s) \ +--- a/lib/intprops.h ++++ b/lib/intprops.h +@@ -226,9 +226,9 @@ + + /* True if __builtin_add_overflow (A, B, P) and __builtin_sub_overflow + (A, B, P) work when P is non-null. */ +-#if 5 <= __GNUC__ && !defined __ICC ++#if 5 <= __GNUC__ && !defined __ICC && !defined __NVCOMPILER + # define _GL_HAS_BUILTIN_ADD_OVERFLOW 1 +-#elif defined __has_builtin ++#elif defined __has_builtin && !defined __NVCOMPILER + # define _GL_HAS_BUILTIN_ADD_OVERFLOW __has_builtin (__builtin_add_overflow) + #else + # define _GL_HAS_BUILTIN_ADD_OVERFLOW 0 +@@ -249,7 +249,7 @@ + presumably run afoul of Clang bug 16404. */ + # define _GL_HAS_BUILTIN_OVERFLOW_P 0 + #else +-# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__) ++# define _GL_HAS_BUILTIN_OVERFLOW_P (7 <= __GNUC__ && !defined __NVCOMPILER) + #endif + + /* The _GL*_OVERFLOW macros have the same restrictions as the diff --git a/var/spack/repos/builtin/packages/bison/package.py b/var/spack/repos/builtin/packages/bison/package.py index b7e2be8c053..0f5a6910c83 100644 --- a/var/spack/repos/builtin/packages/bison/package.py +++ b/var/spack/repos/builtin/packages/bison/package.py @@ -51,7 +51,10 @@ class Bison(AutotoolsPackage, GNUMirrorPackage): depends_on('help2man', type='build') patch('pgi.patch', when='@3.0.4') - patch('nvhpc.patch', when='%nvhpc') + # The NVIDIA compilers do not currently support some GNU builtins. + # Detect this case and use the fallback path. + patch('nvhpc-3.6.patch', when='@3.6.0:3.6.99 %nvhpc') + patch('nvhpc-3.7.patch', when='@3.7.0:3.7.99 %nvhpc') conflicts('%intel@:14', when='@3.4.2:', msg="Intel 14 has immature C11 support") diff --git a/var/spack/repos/builtin/packages/bzip2/package.py b/var/spack/repos/builtin/packages/bzip2/package.py index f85760a01ed..067a2ceadf3 100644 --- a/var/spack/repos/builtin/packages/bzip2/package.py +++ b/var/spack/repos/builtin/packages/bzip2/package.py @@ -52,7 +52,7 @@ def patch(self): ) # The Makefiles use GCC flags that are incompatible with PGI - if self.spec.satisfies('%pgi') or self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%pgi') or self.spec.satisfies('%nvhpc@:20.11'): filter_file('-Wall -Winline', '-Minform=inform', 'Makefile') filter_file('-Wall -Winline', '-Minform=inform', 'Makefile-libbz2_so') diff --git a/var/spack/repos/builtin/packages/ember/package.py b/var/spack/repos/builtin/packages/ember/package.py index d5423950223..1952b18191f 100644 --- a/var/spack/repos/builtin/packages/ember/package.py +++ b/var/spack/repos/builtin/packages/ember/package.py @@ -61,7 +61,7 @@ def build_targets(self): targets = [] cc = self.spec['mpi'].mpicc cflags = '-O3' - if not self.spec.satisfies('%nvhpc'): + if not self.spec.satisfies('%nvhpc@:20.11'): cflags = '-O3 -std=c99' oshmem_cc = 'cc' oshmem_c_flags = '-O3 -g' diff --git a/var/spack/repos/builtin/packages/gromacs/package.py b/var/spack/repos/builtin/packages/gromacs/package.py index 22007dbe3ad..07089af6abb 100644 --- a/var/spack/repos/builtin/packages/gromacs/package.py +++ b/var/spack/repos/builtin/packages/gromacs/package.py @@ -237,7 +237,10 @@ def cmake_args(self): options.append('-DGMX_SIMD=AVX_128_FMA') elif 'vsx' in target: # IBM Power 7 and beyond - options.append('-DGMX_SIMD=IBM_VSX') + if self.spec.satisfies('%nvhpc'): + options.append('-DGMX_SIMD=None') + else: + options.append('-DGMX_SIMD=IBM_VSX') elif target.family == 'aarch64': # ARMv8 if self.spec.satisfies('%nvhpc'): diff --git a/var/spack/repos/builtin/packages/libpciaccess/package.py b/var/spack/repos/builtin/packages/libpciaccess/package.py index cf889de3479..319da38371a 100644 --- a/var/spack/repos/builtin/packages/libpciaccess/package.py +++ b/var/spack/repos/builtin/packages/libpciaccess/package.py @@ -34,7 +34,7 @@ class Libpciaccess(AutotoolsPackage, XorgPackage): def configure_args(self): config_args = [] - if (self.spec.satisfies('%nvhpc') and + if (self.spec.satisfies('%nvhpc@:20.11') and (self.spec.target.family == 'aarch64' or self.spec.target.family == 'ppc64le')): config_args.append('--disable-strict-compilation') diff --git a/var/spack/repos/builtin/packages/libtiff/package.py b/var/spack/repos/builtin/packages/libtiff/package.py index 508c24069df..5cc0c4df162 100644 --- a/var/spack/repos/builtin/packages/libtiff/package.py +++ b/var/spack/repos/builtin/packages/libtiff/package.py @@ -26,6 +26,6 @@ class Libtiff(AutotoolsPackage): def patch(self): # Remove flags not recognized by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): filter_file('vl_cv_prog_cc_warnings="-Wall -W"', 'vl_cv_prog_cc_warnings="-Wall"', 'configure') diff --git a/var/spack/repos/builtin/packages/libtool/package.py b/var/spack/repos/builtin/packages/libtool/package.py index 001327c78f3..bce8c932c70 100644 --- a/var/spack/repos/builtin/packages/libtool/package.py +++ b/var/spack/repos/builtin/packages/libtool/package.py @@ -55,7 +55,7 @@ def _make_executable(self, name): def patch(self): # Remove flags not recognized by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): filter_file('-fno-builtin', '-Mnobuiltin', 'configure') filter_file('-fno-builtin', '-Mnobuiltin', 'libltdl/configure') diff --git a/var/spack/repos/builtin/packages/libx11/package.py b/var/spack/repos/builtin/packages/libx11/package.py index 3407f290128..1a731e40c72 100644 --- a/var/spack/repos/builtin/packages/libx11/package.py +++ b/var/spack/repos/builtin/packages/libx11/package.py @@ -33,7 +33,7 @@ def configure_args(self): config_args = [] # -Werror flags are not properly interpreted by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): config_args.append('--disable-selective-werror') return config_args diff --git a/var/spack/repos/builtin/packages/libxcb/package.py b/var/spack/repos/builtin/packages/libxcb/package.py index 8ebe0ac754c..e6fbaf5b997 100644 --- a/var/spack/repos/builtin/packages/libxcb/package.py +++ b/var/spack/repos/builtin/packages/libxcb/package.py @@ -53,7 +53,7 @@ def configure_args(self): config_args = [] # -Werror flags are not properly interpreted by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): config_args.append('--disable-selective-werror') return config_args diff --git a/var/spack/repos/builtin/packages/lz4/package.py b/var/spack/repos/builtin/packages/lz4/package.py index a2e3db43a46..4294210ac5b 100644 --- a/var/spack/repos/builtin/packages/lz4/package.py +++ b/var/spack/repos/builtin/packages/lz4/package.py @@ -51,7 +51,7 @@ def install(self, spec, prefix): def patch(self): # Remove flags not recognized by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): filter_file('-fvisibility=hidden', '', 'Makefile') filter_file('-fvisibility=hidden', '', 'lib/Makefile') filter_file('-pedantic', '', 'Makefile') diff --git a/var/spack/repos/builtin/packages/matio/package.py b/var/spack/repos/builtin/packages/matio/package.py index 3035a240119..1ee705ceffd 100644 --- a/var/spack/repos/builtin/packages/matio/package.py +++ b/var/spack/repos/builtin/packages/matio/package.py @@ -49,7 +49,7 @@ def configure_args(self): return args def patch(self): - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): # workaround anonymous version tag linker error for the NVIDIA # compilers filter_file('${wl}-version-script ' diff --git a/var/spack/repos/builtin/packages/nasm/package.py b/var/spack/repos/builtin/packages/nasm/package.py index 620bae7c93a..a45c02716d8 100644 --- a/var/spack/repos/builtin/packages/nasm/package.py +++ b/var/spack/repos/builtin/packages/nasm/package.py @@ -29,7 +29,7 @@ class Nasm(AutotoolsPackage): def patch(self): # Remove flags not recognized by the NVIDIA compiler - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): filter_file(r'CFLAGS="\$pa_add_cflags__old_cflags -Werror=.*"', 'CFLAGS="$pa_add_cflags__old_cflags"', 'configure') filter_file(r'CFLAGS="\$pa_add_flags__old_flags -Werror=.*"', diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index e529760b26d..ca58f59bad8 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -173,7 +173,7 @@ class Openmpi(AutotoolsPackage): patch('nag_pthread/2.0.0_2.1.1.patch', when='@2.0.0:2.1.1%nag') patch('nag_pthread/1.10.4_1.10.999.patch', when='@1.10.4:1.10.999%nag') - patch('nvhpc-libtool.patch', when='%nvhpc@develop') + patch('nvhpc-libtool.patch', when='@develop %nvhpc') patch('nvhpc-configure.patch', when='%nvhpc') # Fix MPI_Sizeof() in the "mpi" Fortran module for compilers that do not @@ -756,7 +756,7 @@ def configure_args(self): else: config_args.append('--without-cuda') - if spec.satisfies('%nvhpc'): + if spec.satisfies('%nvhpc@:20.11'): # Workaround compiler issues config_args.append('CFLAGS=-O1') diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 75e5c222083..11c74c9b7f9 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -114,7 +114,7 @@ def install(self, spec, prefix): if spec.satisfies('@1.0'): options.append('no-krb5') # clang does not support the .arch directive in assembly files. - if 'clang' in self.compiler.cc and \ + if ('clang' in self.compiler.cc or 'nvc' in self.compiler.cc) and \ 'aarch64' in spack.architecture.sys_type(): options.append('no-asm') diff --git a/var/spack/repos/builtin/packages/perl/nvhpc-5.32.patch b/var/spack/repos/builtin/packages/perl/nvhpc-5.32.patch new file mode 100644 index 00000000000..655e560412f --- /dev/null +++ b/var/spack/repos/builtin/packages/perl/nvhpc-5.32.patch @@ -0,0 +1,42 @@ +--- a/Configure 2021-01-19 09:35:25.337234880 -0800 ++++ b/Configure 2021-01-19 09:36:43.001275967 -0800 +@@ -4979,7 +4979,7 @@ + # and usrinc directly from the compiler. + # Note that ccname for clang is also gcc. + case "$ccname" in +- gcc) ++ XXX) + $echo 'extern int foo;' > try.c + set X `$cppstdin -v try.c 2>&1 | $awk '/^#include >$Makefile <>$Makefile <<'!NO!SUBS!' + install.perl: $(INSTALL_DEPENDENCE) installperl +- $(RUN_PERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) ++ $(MINIPERL) installperl --destdir=$(DESTDIR) $(INSTALLFLAGS) $(STRIPFLAGS) + -@test ! -s extras.lst || PATH="`pwd`:\${PATH}" PERL5LIB="`pwd`/lib" \$(RUN_PERL) -Ilib -MCPAN -e '@ARGV&&install(@ARGV)' `cat extras.lst` + + !NO!SUBS! diff --git a/var/spack/repos/builtin/packages/perl/package.py b/var/spack/repos/builtin/packages/perl/package.py index b68bc12bc69..07b452caf27 100644 --- a/var/spack/repos/builtin/packages/perl/package.py +++ b/var/spack/repos/builtin/packages/perl/package.py @@ -78,8 +78,11 @@ class Perl(Package): # Perl doesn't use Autotools, it should subclass Package patch('macos-11-version-check.patch', when='@5.24.1:5.32.0 platform=darwin') # Enable builds with the NVIDIA compiler + # The Configure script assumes some gcc specific behavior, and use + # the mini Perl environment to bootstrap installation. patch('nvhpc-5.30.patch', when='@5.30.0:5.30.99 %nvhpc') - conflicts('@5.32.0:', when='%nvhpc', + patch('nvhpc-5.32.patch', when='@5.32.0:5.32.99 %nvhpc') + conflicts('@5.32.0:', when='%nvhpc@:20.11', msg='The NVIDIA compilers are incompatible with version 5.32 and later') # Installing cpanm alongside the core makes it safe and simple for diff --git a/var/spack/repos/builtin/packages/popt/package.py b/var/spack/repos/builtin/packages/popt/package.py index 28247062997..2a28509c5ba 100644 --- a/var/spack/repos/builtin/packages/popt/package.py +++ b/var/spack/repos/builtin/packages/popt/package.py @@ -18,6 +18,6 @@ class Popt(AutotoolsPackage): def patch(self): # Remove flags not recognized by the NVIDIA compilers - if self.spec.satisfies('%nvhpc'): + if self.spec.satisfies('%nvhpc@:20.11'): filter_file('CFLAGS="$CFLAGS -Wall -W"', 'CFLAGS="$CFLAGS -Wall"', 'configure', string=True) diff --git a/var/spack/repos/builtin/packages/xsbench/package.py b/var/spack/repos/builtin/packages/xsbench/package.py index da4e7263bef..bccd05786d3 100644 --- a/var/spack/repos/builtin/packages/xsbench/package.py +++ b/var/spack/repos/builtin/packages/xsbench/package.py @@ -41,7 +41,7 @@ def build_targets(self): targets = [] cflags = '' - if not self.spec.satisfies('%nvhpc'): + if not self.spec.satisfies('%nvhpc@:20.11'): cflags = '-std=gnu99' if '+mpi' in self.spec: diff --git a/var/spack/repos/builtin/packages/xxhash/package.py b/var/spack/repos/builtin/packages/xxhash/package.py index d6549f1e47b..4573ed37f86 100644 --- a/var/spack/repos/builtin/packages/xxhash/package.py +++ b/var/spack/repos/builtin/packages/xxhash/package.py @@ -32,7 +32,8 @@ def build_targets(self): targets = [] if '%nvhpc' in self.spec: - targets.append('CFLAGS=-O1') + if self.spec.satisfies('%nvhpc@:20.11'): + targets.append('CFLAGS=-O1') if 'avx512' in self.spec.target: # Workaround AVX512 compiler issue