Add elk package
This commit is contained in:
parent
e73caad0d7
commit
cb6c6fb374
116
var/spack/repos/builtin/packages/elk/package.py
Normal file
116
var/spack/repos/builtin/packages/elk/package.py
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
from spack import *
|
||||||
|
import spack
|
||||||
|
|
||||||
|
class Elk(Package):
|
||||||
|
'''An all-electron full-potential linearised augmented-plane wave
|
||||||
|
(FP-LAPW) code with many advanced features.'''
|
||||||
|
|
||||||
|
homepage = 'http://elk.sourceforge.net/'
|
||||||
|
url = 'https://sourceforge.net/projects/elk/files/elk-3.3.17.tgz'
|
||||||
|
|
||||||
|
version('3.3.17', 'f57f6230d14f3b3b558e5c71f62f0592')
|
||||||
|
|
||||||
|
# Elk provides these libraries, but allows you to specify your own
|
||||||
|
variant('blas', default=True, description='Build with custom BLAS library')
|
||||||
|
variant('lapack', default=True, description='Build with custom LAPACK library')
|
||||||
|
variant('fft', default=True, description='Build with custom FFT library')
|
||||||
|
|
||||||
|
# Elk does not provide these libraries, but allows you to use them
|
||||||
|
variant('mpi', default=True, description='Enable MPI parallelism')
|
||||||
|
variant('openmp', default=True, description='Enable OpenMP support')
|
||||||
|
variant('libxc', default=True, description='Link to Libxc functional library')
|
||||||
|
|
||||||
|
depends_on('blas', when='+blas')
|
||||||
|
depends_on('lapack', when='+lapack')
|
||||||
|
depends_on('fftw', when='+fft')
|
||||||
|
depends_on('mpi', when='+mpi')
|
||||||
|
depends_on('libxc', when='+libxc')
|
||||||
|
|
||||||
|
# Cannot be built in parallel
|
||||||
|
parallel = False
|
||||||
|
|
||||||
|
|
||||||
|
def configure(self, spec):
|
||||||
|
# Dictionary of configuration options
|
||||||
|
config = {
|
||||||
|
'MAKE': 'make',
|
||||||
|
'F90': join_path(spack.build_env_path, 'f90'),
|
||||||
|
'F77': join_path(spack.build_env_path, 'f77'),
|
||||||
|
'AR': 'ar',
|
||||||
|
'LIB_FFT': 'fftlib.a',
|
||||||
|
'SRC_MPI': 'mpi_stub.f90',
|
||||||
|
'SRC_OMP': 'omp_stub.f90',
|
||||||
|
'SRC_libxc': 'libxcifc_stub.f90',
|
||||||
|
'SRC_FFT': 'zfftifc.f90'
|
||||||
|
}
|
||||||
|
|
||||||
|
# Compiler-specific flags
|
||||||
|
flags = ''
|
||||||
|
if self.compiler.name == 'intel':
|
||||||
|
flags = '-O3 -ip -unroll -no-prec-div -openmp'
|
||||||
|
elif self.compiler.name == 'gcc':
|
||||||
|
flags = '-O3 -ffast-math -funroll-loops -fopenmp'
|
||||||
|
elif self.compiler.name == 'pgi':
|
||||||
|
flags = '-O3 -mp -lpthread'
|
||||||
|
elif self.compiler.name == 'g95':
|
||||||
|
flags = '-O3 -fno-second-underscore'
|
||||||
|
elif self.compiler.name == 'nag':
|
||||||
|
flags = '-O4 -kind=byte -dusty -dcfuns'
|
||||||
|
elif self.compiler.name == 'xl':
|
||||||
|
flags = '-O3 -qsmp=omp'
|
||||||
|
config['F90_OPTS'] = flags
|
||||||
|
config['F77_OPTS'] = flags
|
||||||
|
|
||||||
|
# BLAS/LAPACK support
|
||||||
|
blas = 'blas.a'
|
||||||
|
lapack = 'lapack.a'
|
||||||
|
if '+blas' in spec:
|
||||||
|
blas = join_path(spec['blas'].prefix.lib, 'libblas.so')
|
||||||
|
if '+lapack' in spec:
|
||||||
|
lapack = join_path(spec['lapack'].prefix.lib, 'liblapack.so')
|
||||||
|
config['LIB_LPK'] = ' '.join([lapack, blas]) # lapack must come before blas
|
||||||
|
|
||||||
|
# FFT support
|
||||||
|
if '+fft' in spec:
|
||||||
|
config['LIB_FFT'] = join_path(spec['fftw'].prefix.lib, 'libfftw3.so')
|
||||||
|
config['SRC_FFT'] = 'zfftifc_fftw.f90'
|
||||||
|
|
||||||
|
# MPI support
|
||||||
|
if '+mpi' in spec:
|
||||||
|
config.pop('SRC_MPI')
|
||||||
|
config['F90'] = join_path(spec['mpi'].prefix.bin, 'mpif90')
|
||||||
|
config['F77'] = join_path(spec['mpi'].prefix.bin, 'mpif77')
|
||||||
|
|
||||||
|
# OpenMP support
|
||||||
|
if '+openmp' in spec:
|
||||||
|
config.pop('SRC_OMP')
|
||||||
|
|
||||||
|
# Libxc support
|
||||||
|
if '+libxc' in spec:
|
||||||
|
config['LIB_libxc'] = ' '.join([
|
||||||
|
join_path(spec['libxc'].prefix.lib, 'libxcf90.so'),
|
||||||
|
join_path(spec['libxc'].prefix.lib, 'libxc.so')
|
||||||
|
])
|
||||||
|
config['SRC_libxc'] = ' '.join([
|
||||||
|
'libxc_funcs.f90',
|
||||||
|
'libxc.f90',
|
||||||
|
'libxcifc.f90'
|
||||||
|
])
|
||||||
|
|
||||||
|
# Write configuration options to include file
|
||||||
|
with open('make.inc', 'w') as inc:
|
||||||
|
for key in config:
|
||||||
|
inc.write('{0} = {1}\n'.format(key, config[key]))
|
||||||
|
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
self.configure(spec)
|
||||||
|
|
||||||
|
make()
|
||||||
|
make('test')
|
||||||
|
|
||||||
|
mkdirp(prefix.bin)
|
||||||
|
|
||||||
|
install('src/elk', prefix.bin)
|
||||||
|
install('src/eos/eos', prefix.bin)
|
||||||
|
install('src/spacegroup/spacegroup', prefix.bin)
|
18
var/spack/repos/builtin/packages/libxc/package.py
Normal file
18
var/spack/repos/builtin/packages/libxc/package.py
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
from spack import *
|
||||||
|
|
||||||
|
class Libxc(Package):
|
||||||
|
"""Libxc is a library of exchange-correlation functionals for
|
||||||
|
density-functional theory."""
|
||||||
|
|
||||||
|
homepage = "http://www.tddft.org/programs/octopus/wiki/index.php/Libxc"
|
||||||
|
url = "http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.2.tar.gz"
|
||||||
|
|
||||||
|
version('2.2.2', 'd9f90a0d6e36df6c1312b6422280f2ec')
|
||||||
|
|
||||||
|
|
||||||
|
def install(self, spec, prefix):
|
||||||
|
configure('--prefix=%s' % prefix,
|
||||||
|
'--enable-shared')
|
||||||
|
|
||||||
|
make()
|
||||||
|
make("install")
|
@ -12,6 +12,7 @@ class Openblas(Package):
|
|||||||
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
|
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
|
||||||
|
|
||||||
variant('shared', default=True, description="Build shared libraries as well as static libs.")
|
variant('shared', default=True, description="Build shared libraries as well as static libs.")
|
||||||
|
variant('openmp', default=True, description="Enable OpenMP support.")
|
||||||
|
|
||||||
# virtual dependency
|
# virtual dependency
|
||||||
provides('blas')
|
provides('blas')
|
||||||
@ -37,6 +38,11 @@ def install(self, spec, prefix):
|
|||||||
if spec.satisfies('@0.2.16'):
|
if spec.satisfies('@0.2.16'):
|
||||||
make_defs += ['BUILD_LAPACK_DEPRECATED=1']
|
make_defs += ['BUILD_LAPACK_DEPRECATED=1']
|
||||||
|
|
||||||
|
# Add support for OpenMP
|
||||||
|
# Note: Make sure your compiler supports OpenMP
|
||||||
|
if '+openmp' in spec:
|
||||||
|
make_defs += ['USE_OPENMP=1']
|
||||||
|
|
||||||
make_args = make_defs + make_targets
|
make_args = make_defs + make_targets
|
||||||
make(*make_args)
|
make(*make_args)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user