From 44136223f79dd61642f8f56a2056c21378b1952d Mon Sep 17 00:00:00 2001 From: RĂ©mi Lacroix Date: Fri, 23 Apr 2021 18:19:15 +0200 Subject: MUMPS: allow for more optimized builds (#23161) * MUMPS: Use GEMMT BLAS extension when possible. This should improve the performance and is recommanded by the developers. * MUMPS: Add a new "openmp" variant. * MUMPS: Add a "blr_mt" variant. This improves performance when using OpenMP but might not be compatible with all multithreaded BLAS. --- var/spack/repos/builtin/packages/mumps/package.py | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'var') diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index d7acaf4c90..b82d143013 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -43,6 +43,11 @@ class Mumps(Package): variant('int64', default=False, description='Use int64_t/integer*8 as default index type') variant('shared', default=True, description='Build shared libraries') + variant('openmp', default=False, + description='Compile MUMPS with OpenMP support') + variant('blr_mt', default=False, + description='Allow BLAS calls in OpenMP regions ' + + '(warning: might not be supported by all multithread BLAS)') depends_on('scotch + esmumps', when='~ptscotch+scotch') depends_on('scotch + esmumps ~ metis + mpi', when='+ptscotch') @@ -66,6 +71,8 @@ class Mumps(Package): msg="You cannot use the parmetis variant without metis") conflicts('+ptscotch', when='~mpi', msg="You cannot use the ptscotch variant without mpi") + conflicts('+blr_mt', when='~openmp', + msg="You cannot use the blr_mt variant without openmp") def write_makefile_inc(self): # The makefile variables LIBBLAS, LSCOTCH, LMETIS, and SCALAP are only @@ -173,6 +180,23 @@ class Mumps(Package): if using_xlf: optf.append('-qfixed') + # As of version 5.2.0, MUMPS is able to take advantage + # of the GEMMT BLAS extension. MKL is currently the only + # known BLAS implementation supported. + if '@5.2.0: ^mkl' in self.spec: + optf.append('-DGEMMT_AVAILABLE') + + if '+openmp' in self.spec: + optc.append(self.compiler.openmp_flag) + optf.append(self.compiler.openmp_flag) + optl.append(self.compiler.openmp_flag) + + # Using BLR_MT might not be supported by all multithreaded BLAS + # (MKL is known to work) but it is not something we can easily + # check so we trust that the user knows what he/she is doing. + if '+blr_mt' in self.spec: + optf.append('-DBLR_MT') + makefile_conf.extend([ 'OPTC = {0}'.format(' '.join(optc)), 'OPTF = {0}'.format(' '.join(optf)), -- cgit v1.2.3-70-g09d2