diff --git a/var/spack/repos/builtin/packages/openblas/lapack-0.3.9-xerbl.patch b/var/spack/repos/builtin/packages/openblas/lapack-0.3.9-xerbl.patch new file mode 100644 index 0000000000..a61f3b3c00 --- /dev/null +++ b/var/spack/repos/builtin/packages/openblas/lapack-0.3.9-xerbl.patch @@ -0,0 +1,14 @@ +diff --git a/lapack-netlib/SRC/sorhr_col.f b/lapack-netlib/SRC/sorhr_col.f +index 38976245..600c19fb 100644 +--- a/lapack-netlib/SRC/sorhr_col.f ++++ b/lapack-netlib/SRC/sorhr_col.f +@@ -282,7 +282,8 @@ + $ NPLUSONE + * .. + * .. External Subroutines .. +- EXTERNAL SCOPY, SLAORHR_COL_GETRFNP, SSCAL, STRSM, XERBLA ++ EXTERNAL SCOPY, SLAORHR_COL_GETRFNP, SSCAL, STRSM, ++ $ XERBLA + * .. + * .. Intrinsic Functions .. + INTRINSIC MAX, MIN diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index b98085c19c..71d2ec4a6b 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -38,7 +38,7 @@ class Openblas(MakefilePackage): variant('ilp64', default=False, description='Force 64-bit Fortran native integers') variant('pic', default=True, description='Build position independent code') variant('shared', default=True, description='Build shared libraries') - variant('consistentFPCSR', default=False, description='Synchronize FP CSR between threads (x86/x86_64 only)') + variant('consistent_fpcsr', default=False, description='Synchronize FP CSR between threads (x86/x86_64 only)') variant( 'threads', default='none', @@ -60,6 +60,8 @@ class Openblas(MakefilePackage): patch('openblas_icc_openmp.patch', when='@:0.2.20%intel@16.0:') patch('openblas_icc_fortran.patch', when='%intel@16.0:') patch('openblas_icc_fortran2.patch', when='%intel@18.0:') + # See https://github.com/spack/spack/issues/15385 + patch('lapack-0.3.9-xerbl.patch', when='@0.3.8: %intel') # Fixes compilation error on POWER8 with GCC 7 # https://github.com/xianyi/OpenBLAS/pull/1098 @@ -94,7 +96,10 @@ class Openblas(MakefilePackage): # Add conditions to f_check to determine the Fujitsu compiler patch('openblas_fujitsu.patch', when='%fj') + # See https://github.com/spack/spack/issues/3036 conflicts('%intel@16', when='@0.2.15:0.2.19') + conflicts('+consistent_fpcsr', when='threads=none', + msg='FPCSR consistency only applies to multithreading') @property def parallel(self): @@ -137,12 +142,23 @@ def _read_targets(target_file): return micros - @staticmethod - def _microarch_target_args(microarch, available_targets): + def _microarch_target_args(self): """Given a spack microarchitecture and a list of targets found in OpenBLAS' TargetList.txt, determine the best command-line arguments. """ - args = [] # Return value + # Read available openblas targets + targetlist_name = join_path(self.stage.source_path, "TargetList.txt") + if os.path.exists(targetlist_name): + with open(targetlist_name) as f: + available_targets = self._read_targets(f) + else: + available_targets = [] + + # Get our build microarchitecture + microarch = self.spec.target + + # List of arguments returned by this function + args = [] # List of available architectures, and possible aliases openblas_arch = set(['alpha', 'arm', 'ia64', 'mips', 'mips64', @@ -166,11 +182,14 @@ def _microarch_target_args(microarch, available_targets): if microarch.name in available_targets: break - arch_name = microarch.family.name - if arch_name in openblas_arch: - # Apply possible spack->openblas arch name mapping - arch_name = openblas_arch_map.get(arch_name, arch_name) - args.append('ARCH=' + arch_name) + if self.version >= Version("0.3"): + # 'ARCH' argument causes build errors in older OpenBLAS + # see https://github.com/spack/spack/issues/15385 + arch_name = microarch.family.name + if arch_name in openblas_arch: + # Apply possible spack->openblas arch name mapping + arch_name = openblas_arch_map.get(arch_name, arch_name) + args.append('ARCH=' + arch_name) if microarch.vendor == 'generic': # User requested a generic platform, or we couldn't find a good @@ -190,8 +209,6 @@ def _microarch_target_args(microarch, available_targets): @property def make_defs(self): - spec = self.spec - # Configure fails to pick up fortran from FC=/abs/path/to/fc, but # works fine with FC=/abs/path/to/gfortran. # When mixing compilers make sure that @@ -209,13 +226,7 @@ def make_defs(self): make_defs.append('MAKE_NB_JOBS=0') # flag provided by OpenBLAS # Add target and architecture flags - targetlist_name = join_path(self.stage.source_path, "TargetList.txt") - if os.path.exists(targetlist_name): - with open(targetlist_name) as f: - avail_targets = self._read_targets(f) - else: - avail_targets = [] - make_defs += self._microarch_target_args(spec.target, avail_targets) + make_defs += self._microarch_target_args() if '~shared' in self.spec: if '+pic' in self.spec: @@ -242,7 +253,7 @@ def make_defs(self): # Synchronize floating-point control and status register (FPCSR) # between threads (x86/x86_64 only). - if '+consistentFPCSR' in self.spec: + if '+consistent_fpcsr' in self.spec: make_defs += ['CONSISTENT_FPCSR=1'] # Prevent errors in `as` assembler from newer instructions