Fix OpenBLAS 0.2 build, 0.38+ Intel builds, and variant name (#15419)
* Remove ARCH argument in OpenBLAS < 0.3.0 * Fix Intel OpenBLAS that uses lapack 0.3.9 * Improve variant name consistency see https://github.com/spack/spack/issues/15239
This commit is contained in:
parent
fc78456547
commit
8ac06ece3d
2 changed files with 44 additions and 19 deletions
|
@ -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
|
|
@ -38,7 +38,7 @@ class Openblas(MakefilePackage):
|
||||||
variant('ilp64', default=False, description='Force 64-bit Fortran native integers')
|
variant('ilp64', default=False, description='Force 64-bit Fortran native integers')
|
||||||
variant('pic', default=True, description='Build position independent code')
|
variant('pic', default=True, description='Build position independent code')
|
||||||
variant('shared', default=True, description='Build shared libraries')
|
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(
|
variant(
|
||||||
'threads', default='none',
|
'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_openmp.patch', when='@:0.2.20%intel@16.0:')
|
||||||
patch('openblas_icc_fortran.patch', when='%intel@16.0:')
|
patch('openblas_icc_fortran.patch', when='%intel@16.0:')
|
||||||
patch('openblas_icc_fortran2.patch', when='%intel@18.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
|
# Fixes compilation error on POWER8 with GCC 7
|
||||||
# https://github.com/xianyi/OpenBLAS/pull/1098
|
# https://github.com/xianyi/OpenBLAS/pull/1098
|
||||||
|
@ -94,7 +96,10 @@ class Openblas(MakefilePackage):
|
||||||
# Add conditions to f_check to determine the Fujitsu compiler
|
# Add conditions to f_check to determine the Fujitsu compiler
|
||||||
patch('openblas_fujitsu.patch', when='%fj')
|
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('%intel@16', when='@0.2.15:0.2.19')
|
||||||
|
conflicts('+consistent_fpcsr', when='threads=none',
|
||||||
|
msg='FPCSR consistency only applies to multithreading')
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def parallel(self):
|
def parallel(self):
|
||||||
|
@ -137,12 +142,23 @@ def _read_targets(target_file):
|
||||||
|
|
||||||
return micros
|
return micros
|
||||||
|
|
||||||
@staticmethod
|
def _microarch_target_args(self):
|
||||||
def _microarch_target_args(microarch, available_targets):
|
|
||||||
"""Given a spack microarchitecture and a list of targets found in
|
"""Given a spack microarchitecture and a list of targets found in
|
||||||
OpenBLAS' TargetList.txt, determine the best command-line arguments.
|
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
|
# List of available architectures, and possible aliases
|
||||||
openblas_arch = set(['alpha', 'arm', 'ia64', 'mips', 'mips64',
|
openblas_arch = set(['alpha', 'arm', 'ia64', 'mips', 'mips64',
|
||||||
|
@ -166,6 +182,9 @@ def _microarch_target_args(microarch, available_targets):
|
||||||
if microarch.name in available_targets:
|
if microarch.name in available_targets:
|
||||||
break
|
break
|
||||||
|
|
||||||
|
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
|
arch_name = microarch.family.name
|
||||||
if arch_name in openblas_arch:
|
if arch_name in openblas_arch:
|
||||||
# Apply possible spack->openblas arch name mapping
|
# Apply possible spack->openblas arch name mapping
|
||||||
|
@ -190,8 +209,6 @@ def _microarch_target_args(microarch, available_targets):
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def make_defs(self):
|
def make_defs(self):
|
||||||
spec = self.spec
|
|
||||||
|
|
||||||
# Configure fails to pick up fortran from FC=/abs/path/to/fc, but
|
# Configure fails to pick up fortran from FC=/abs/path/to/fc, but
|
||||||
# works fine with FC=/abs/path/to/gfortran.
|
# works fine with FC=/abs/path/to/gfortran.
|
||||||
# When mixing compilers make sure that
|
# 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
|
make_defs.append('MAKE_NB_JOBS=0') # flag provided by OpenBLAS
|
||||||
|
|
||||||
# Add target and architecture flags
|
# Add target and architecture flags
|
||||||
targetlist_name = join_path(self.stage.source_path, "TargetList.txt")
|
make_defs += self._microarch_target_args()
|
||||||
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)
|
|
||||||
|
|
||||||
if '~shared' in self.spec:
|
if '~shared' in self.spec:
|
||||||
if '+pic' in self.spec:
|
if '+pic' in self.spec:
|
||||||
|
@ -242,7 +253,7 @@ def make_defs(self):
|
||||||
|
|
||||||
# Synchronize floating-point control and status register (FPCSR)
|
# Synchronize floating-point control and status register (FPCSR)
|
||||||
# between threads (x86/x86_64 only).
|
# between threads (x86/x86_64 only).
|
||||||
if '+consistentFPCSR' in self.spec:
|
if '+consistent_fpcsr' in self.spec:
|
||||||
make_defs += ['CONSISTENT_FPCSR=1']
|
make_defs += ['CONSISTENT_FPCSR=1']
|
||||||
|
|
||||||
# Prevent errors in `as` assembler from newer instructions
|
# Prevent errors in `as` assembler from newer instructions
|
||||||
|
|
Loading…
Reference in a new issue