summaryrefslogtreecommitdiff
path: root/var
diff options
context:
space:
mode:
authorJon Rood <jon.rood@nrel.gov>2016-11-23 14:26:00 -0700
committerbecker33 <becker33@llnl.gov>2016-11-23 13:26:00 -0800
commita6db0bfae2663951dca1f4e51cb631f332a6f430 (patch)
treed9b3895ce4cf4ff9bd5e145a1ce98df5116e2bce /var
parentc3aa5443b9ae5538a32e2ef474e94e73b0592012 (diff)
downloadspack-a6db0bfae2663951dca1f4e51cb631f332a6f430.tar.gz
spack-a6db0bfae2663951dca1f4e51cb631f332a6f430.tar.bz2
spack-a6db0bfae2663951dca1f4e51cb631f332a6f430.tar.xz
spack-a6db0bfae2663951dca1f4e51cb631f332a6f430.zip
Updating SuperLU package file with ability to build version 4.3. (#2390)
* Updating SuperLU package file with ability to build version 4.3 (before they added cmake) with external blas or internal blas, and added capability to build the latest version 5.2.1 (with cmake) with internal blas. * Updating SuperLU package file with suggested changes, i.e. reorganizing installation methods based on version, adding cmake dependency when necessary, removing any use of internal blas, and also adding fpic variant. * Fixing flake8 failures.
Diffstat (limited to 'var')
-rw-r--r--var/spack/repos/builtin/packages/superlu/package.py77
1 files changed, 74 insertions, 3 deletions
diff --git a/var/spack/repos/builtin/packages/superlu/package.py b/var/spack/repos/builtin/packages/superlu/package.py
index d9cff650b6..8e23a2a14e 100644
--- a/var/spack/repos/builtin/packages/superlu/package.py
+++ b/var/spack/repos/builtin/packages/superlu/package.py
@@ -23,6 +23,8 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
+import glob
+import os
class Superlu(Package):
@@ -34,21 +36,90 @@ class Superlu(Package):
url = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_5.2.1.tar.gz"
version('5.2.1', '3a1a9bff20cb06b7d97c46d337504447')
+ version('4.3', 'b72c6309f25e9660133007b82621ba7c')
+ variant('fpic', default=False,
+ description='Build with position independent code')
+
+ depends_on('cmake', when='@5.2.1:', type='build')
depends_on('blas')
+ # CMake installation method
+ @when('@5.2.1:')
def install(self, spec, prefix):
cmake_args = [
- '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
- # BLAS support
'-Denable_blaslib=OFF',
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_libs.joined())
]
+ if '+fpic' in spec:
+ cmake_args.extend([
+ '-DCMAKE_POSITION_INDEPENDENT_CODE=ON'
+ ])
+
cmake_args.extend(std_cmake_args)
with working_dir('spack-build', create=True):
cmake('..', *cmake_args)
-
make()
make('install')
+
+ # Pre-cmake installation method
+ @when('@4.3')
+ def install(self, spec, prefix):
+ config = []
+
+ # Define make.inc file
+ config.extend([
+ 'PLAT = _x86_64',
+ 'SuperLUroot = %s' % self.stage.source_path,
+ # 'SUPERLULIB = $(SuperLUroot)/lib/libsuperlu$(PLAT).a',
+ 'SUPERLULIB = $(SuperLUroot)/lib/libsuperlu_{0}.a' \
+ .format(self.spec.version),
+ 'BLASDEF = -DUSE_VENDOR_BLAS',
+ 'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags),
+ # or BLASLIB = -L/usr/lib64 -lblas
+ 'TMGLIB = libtmglib.a',
+ 'LIBS = $(SUPERLULIB) $(BLASLIB)',
+ 'ARCH = ar',
+ 'ARCHFLAGS = cr',
+ 'RANLIB = {0}'.format('ranlib' if which('ranlib') else 'echo'),
+ 'CC = {0}'.format(os.environ['CC']),
+ 'FORTRAN = {0}'.format(os.environ['FC']),
+ 'LOADER = {0}'.format(os.environ['CC']),
+ 'CDEFS = -DAdd_'
+ ])
+
+ if '+fpic' in spec:
+ config.extend([
+ # Use these lines instead when pic_flag capability arrives
+ # 'CFLAGS = -O3 {0}'.format(self.compiler.pic_flag),
+ # 'NOOPTS = {0}'.format(self.compiler.pic_flag),
+ # 'FFLAGS = -O2 {0}'.format(self.compiler.pic_flag),
+ # 'LOADOPTS = {0}'.format(self.compiler.pic_flag)
+ 'CFLAGS = -O3 -fPIC',
+ 'NOOPTS = -fPIC',
+ 'FFLAGS = -O2 -fPIC',
+ 'LOADOPTS = -fPIC'
+ ])
+ else:
+ config.extend([
+ 'CFLAGS = -O3',
+ 'NOOPTS = ',
+ 'FFLAGS = -O2',
+ 'LOADOPTS = '
+ ])
+
+ # Write configuration options to make.inc file
+ with open('make.inc', 'w') as inc:
+ for option in config:
+ inc.write('{0}\n'.format(option))
+
+ make(parallel=False)
+
+ # Install manually
+ install_tree('lib', prefix.lib)
+ headers = glob.glob(join_path('SRC', '*.h'))
+ mkdir(prefix.include)
+ for h in headers:
+ install(h, prefix.include)