From 9a79a2345d20a8da871b1d12d0a49f9470e8530d Mon Sep 17 00:00:00 2001 From: "Nichols A. Romero" Date: Tue, 16 Apr 2019 14:04:40 -0500 Subject: QMCPACK package: Remove Spack MKL hack for older version (#11127) A Spack hack for MKL usage was needed in QMCPACK prior to version 3.5 when non-Intel compilers were used. This Spack hack could have undesirable side-effects and led to ugly code that was extra work to maintain. For older versions of QMCPACK, we throw a conflict if you want to use Intel MKL with the other compilers commonly found on x86. Note that there is no impact to version of QMCPACK since 3.5. --- .../repos/builtin/packages/qmcpack/package.py | 41 ++++++++++++---------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/var/spack/repos/builtin/packages/qmcpack/package.py b/var/spack/repos/builtin/packages/qmcpack/package.py index 8ce3e56de2..e8f88f825f 100644 --- a/var/spack/repos/builtin/packages/qmcpack/package.py +++ b/var/spack/repos/builtin/packages/qmcpack/package.py @@ -92,6 +92,19 @@ class Qmcpack(CMakePackage, CudaPackage): conflicts('%pgi@:17', when='@3.6.0:', msg=compiler_warning) conflicts('%llvm@:3.4', when='@3.6.0:', msg=compiler_warning) + # Prior to QMCPACK 3.5.0 Intel MKL was not properly detected with + # non-Intel compilers without a Spack-based hack. This hack + # had the potential for negative side effects and led to more + # complex Python code that would have been difficult to maintain + # long term. Note that this has not been an issue since QMCPACK 3.5.0. + # For older versions of QMCPACK, we issue a conflict below if you + # try to use Intel MKL with a non-Intel compiler. + mkl_warning = 'QMCPACK releases prior to 3.5.0 require the ' \ + 'Intel compiler when linking against Intel MKL' + conflicts('%gcc', when='@:3.4.0 ^intel-mkl', msg=mkl_warning) + conflicts('%pgi', when='@:3.4.0 ^intel-mkl', msg=mkl_warning) + conflicts('%llvm', when='@:3.4.0 ^intel-mkl', msg=mkl_warning) + # Dependencies match those in the QMCPACK manual. # FIXME: once concretizer can unite unconditional and conditional # dependencies, some of the '~mpi' variants below will not be necessary. @@ -258,35 +271,27 @@ class Qmcpack(CMakePackage, CudaPackage): # https://github.com/spack/spack/blob/develop/var/spack/repos/builtin/packages/dealii/package.py # # Basically, we override CMake's auto-detection mechanism - # and use the Spack's interface instead + # and use the Spack's interface instead. + # + # For version of QMCPACK prior to 3.5.0, the lines + # below are used for detection of all math libraries. + # For QMCPACK 3.5.0 and later, the lines below are only + # needed when MKL is *not* used. Thus, it is redundant + # but there are no negative side effects. lapack_blas = spec['lapack'].libs + spec['blas'].libs args.extend([ '-DLAPACK_FOUND=true', '-DLAPACK_LIBRARIES=%s' % lapack_blas.joined(';') ]) - # Additionally, we need to pass the BLAS+LAPACK include directory for - # header files. This is to insure vectorized math and FFT libraries - # get properly detected. Intel MKL requires special case due to - # differences in Darwin vs. Linux $MKLROOT naming schemes. This section - # of code is intentionally redundant for backwards compatibility. + # Next two environment variables were introduced in QMCPACK 3.5.0 + # Prior to v3.5.0, these lines should be benign but CMake + # may issue a warning. if 'intel-mkl' in spec: - lapack_dir = format(join_path(env['MKLROOT'], 'include')) - # Next two lines were introduced in QMCPACK 3.5.0 and later. - # Prior to v3.5.0, these lines should be benign. args.append('-DENABLE_MKL=1') args.append('-DMKL_ROOT=%s' % env['MKLROOT']) else: args.append('-DENABLE_MKL=0') - lapack_dir = ':'.join(( - spec['lapack'].prefix.include, - spec['blas'].prefix.include - )) - - args.extend([ - '-DCMAKE_CXX_FLAGS=-I%s' % lapack_dir, - '-DCMAKE_C_FLAGS=-I%s' % lapack_dir - ]) return args -- cgit v1.2.3-60-g2f50