Add Armadillo and SuperLU packages

This commit is contained in:
Adam J. Stewart 2016-06-08 14:11:14 -05:00
parent 30e8e77fb6
commit 65896ff2ed
3 changed files with 146 additions and 16 deletions

View File

@ -0,0 +1,67 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Armadillo(Package):
"""Armadillo is a high quality linear algebra library (matrix maths)
for the C++ language, aiming towards a good balance between speed and
ease of use."""
homepage = "http://arma.sourceforge.net/"
url = "http://sourceforge.net/projects/arma/files/armadillo-7.200.1.tar.xz"
version('7.200.1', 'ed86d6df0058979e107502e1fe3e469e')
variant('hdf5', default=False, description='Include HDF5 support')
depends_on('arpack')
depends_on('blas')
depends_on('lapack')
depends_on('superlu@5.2:')
depends_on('hdf5', when='+hdf5')
def install(self, spec, prefix):
cmake_args = [
# ARPACK support
'-DARPACK_LIBRARY={0}/libarpack.a'.format(
spec['arpack'].prefix.lib),
# BLAS support
'-DBLAS_LIBRARY={0}'.format(spec['blas'].blas_shared_lib),
# LAPACK support
'-DLAPACK_LIBRARY={0}'.format(spec['lapack'].lapack_shared_lib),
# SuperLU support
'-DSuperLU_INCLUDE_DIR={0}'.format(spec['superlu'].prefix.include),
'-DSuperLU_LIBRARY={0}/libsuperlu.a'.format(
spec['superlu'].prefix.lib64),
# HDF5 support
'-DDETECT_HDF5={0}'.format('ON' if '+hdf5' in spec else 'OFF')
]
cmake_args.extend(std_cmake_args)
cmake('.', *cmake_args)
make()
make('install')

View File

@ -24,12 +24,12 @@
##############################################################################
from spack import *
import os
import shutil
class Arpack(Package):
"""A collection of Fortran77 subroutines designed to solve large scale
eigenvalue problems.
"""
eigenvalue problems."""
homepage = "http://www.caam.rice.edu/software/ARPACK/"
url = "http://www.caam.rice.edu/software/ARPACK/SRC/arpack96.tar.gz"
@ -39,27 +39,35 @@ class Arpack(Package):
depends_on('lapack')
def patch(self):
# Filter the cray makefile to make a spack one.
shutil.move('ARMAKES/ARmake.CRAY', 'ARmake.inc')
makefile = FileFilter('ARmake.inc')
# Be sure to use Spack F77 wrapper
makefile.filter('^FC.*', 'FC = f77')
makefile.filter('^FFLAGS.*', 'FFLAGS = -O2 -g')
# Section 1: Paths and Libraries
# Set up some variables.
makefile.filter('^PLAT.*', 'PLAT = ')
makefile.filter('^home.*', 'home = %s' % os.getcwd())
makefile.filter('^BLASdir.*', 'BLASdir = %s' % self.spec['blas'].prefix)
makefile.filter('^LAPACKdir.*', 'LAPACKdir = %s' % self.spec['lapack'].prefix)
# Change the build directory
makefile.filter('^home.*', 'home = %s' % os.getcwd())
# build the library in our own prefix.
makefile.filter('^ARPACKLIB.*', 'ARPACKLIB = %s/libarpack.a' % os.getcwd())
# Use external BLAS/LAPACK
makefile.filter('^BLASdir.*',
'BLASdir = %s' % self.spec['blas'].prefix)
makefile.filter('^LAPACKdir.*',
'LAPACKdir = %s' % self.spec['lapack'].prefix)
# Do not include the platform in the library name
makefile.filter('^PLAT.*', 'PLAT = ')
makefile.filter('^ARPACKLIB.*', 'ARPACKLIB = $(home)/libarpack.a')
# Section 2: Compilers
# Be sure to use the Spack compiler wrapper
makefile.filter('^FC.*', 'FC = {0}'.format(os.environ['F77']))
makefile.filter('^FFLAGS.*', 'FFLAGS = -O2 -g -fPIC')
if not which('ranlib'):
makefile.filter('^RANLIB.*', 'RANLIB = touch')
def install(self, spec, prefix):
with working_dir('SRC'):
make('all')
mkdirp(prefix.lib)
mkdir(prefix.lib)
install('libarpack.a', prefix.lib)

View File

@ -0,0 +1,55 @@
##############################################################################
# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-647188
#
# For details, see https://github.com/llnl/spack
# Please also see the LICENSE file for our notice and the LGPL.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License (as
# published by the Free Software Foundation) version 2.1, February 1999.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
# conditions of the GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
class Superlu(Package):
"""SuperLU is a general purpose library for the direct solution of large,
sparse, nonsymmetric systems of linear equations on high performance
machines. SuperLU is designed for sequential machines."""
homepage = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/#superlu"
url = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_5.2.1.tar.gz"
version('5.2.1', '3a1a9bff20cb06b7d97c46d337504447')
depends_on('blas')
def install(self, spec, prefix):
cmake_args = [
'-DCMAKE_C_FLAGS=-fPIC',
'-DCMAKE_Fortran_FLAGS=-fPIC',
# BLAS support
'-Denable_blaslib=OFF',
'-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_shared_lib)
]
cmake_args.extend(std_cmake_args)
with working_dir('spack-build', create=True):
cmake('..', *cmake_args)
make()
make('install')