From deb1cb4805a9f02330a2380ccd68b72a48c84f13 Mon Sep 17 00:00:00 2001 From: "Adam J. Stewart" Date: Thu, 29 Sep 2016 14:35:10 -0500 Subject: Add libint package (#1264) * Add libint package * Add Intel optimization flags recommended by CP2K * Add new version and Intel compiler optimization flags for libxc * Add older version of libint * Libint depends on GMP C++ library --- var/spack/repos/builtin/packages/gmp/package.py | 9 +- var/spack/repos/builtin/packages/libint/package.py | 103 +++++++++++++++++++++ var/spack/repos/builtin/packages/libxc/package.py | 20 +++- 3 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 var/spack/repos/builtin/packages/libint/package.py diff --git a/var/spack/repos/builtin/packages/gmp/package.py b/var/spack/repos/builtin/packages/gmp/package.py index d85330dd6e..3ce784c6c1 100644 --- a/var/spack/repos/builtin/packages/gmp/package.py +++ b/var/spack/repos/builtin/packages/gmp/package.py @@ -37,9 +37,12 @@ class Gmp(Package): version('6.0.0a', 'b7ff2d88cae7f8085bd5006096eed470') version('6.0.0', '6ef5869ae735db9995619135bd856b84') - depends_on("m4", type='build') + depends_on('m4', type='build') def install(self, spec, prefix): - configure("--prefix=%s" % prefix) + configure('--prefix={0}'.format(prefix), + '--enable-cxx') + make() - make("install") + make('check') + make('install') diff --git a/var/spack/repos/builtin/packages/libint/package.py b/var/spack/repos/builtin/packages/libint/package.py new file mode 100644 index 0000000000..1962d8cbec --- /dev/null +++ b/var/spack/repos/builtin/packages/libint/package.py @@ -0,0 +1,103 @@ +############################################################################## +# 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 Libint(Package): + """Libint is a high-performance library for computing + Gaussian integrals in quantum mechanics.""" + + homepage = "https://github.com/evaleev/libint" + url = "https://github.com/evaleev/libint/archive/v2.1.0.tar.gz" + + version('2.1.0', 'd0dcb985fe32ddebc78fe571ce37e2d6') + version('1.1.6', '990f67b55f49ecc18f32c58da9240684') + version('1.1.5', '379b7d0718ff398715d6898807adf628') + + # Build dependencies + depends_on('autoconf@2.52:', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + + # Libint 2 dependencies + depends_on('boost', when='@2:') + depends_on('gmp', when='@2:') + + def url_for_version(self, version): + base_url = "https://github.com/evaleev/libint/archive" + if version == Version('1.0.0'): + return "{0}/LIBINT_1_00.tar.gz".format(base_url) + elif version < Version('2.1.0'): + return "{0}/release-{1}.tar.gz".format(base_url, version.dashed) + else: + return "{0}/v{1}.tar.gz".format(base_url, version) + + def install(self, spec, prefix): + # Generate configure + libtoolize() + aclocal('-I', 'lib/autoconf') + autoconf() + + config_args = [ + '--prefix={0}'.format(prefix) + ] + + # Optimizations for the Intel compiler, suggested by CP2K + optflags = '-O2' + if self.compiler.name == 'intel': + optflags += ' -xAVX -axCORE-AVX2 -ipo' + if which('xiar'): + env['AR'] = 'xiar' + + env['CFLAGS'] = optflags + env['CXXFLAGS'] = optflags + + # Optimization flag names have changed in libint 2 + if self.version < Version('2.0.0'): + config_args.extend([ + '--with-cc-optflags={0}'.format(optflags), + '--with-cxx-optflags={0}'.format(optflags) + ]) + else: + config_args.extend([ + '--with-cxx-optflags={0}'.format(optflags), + '--with-cxxgen-optflags={0}'.format(optflags) + ]) + + # Options required by CP2K, removed in libint 2 + if self.version < Version('2.0.0'): + config_args.extend([ + '--with-libint-max-am=5', + '--with-libderiv-max-am1=4' + ]) + + configure(*config_args) + make() + + # Testing suite was added in libint 2 + if self.version >= Version('2.0.0'): + make('check') + + make('install') diff --git a/var/spack/repos/builtin/packages/libxc/package.py b/var/spack/repos/builtin/packages/libxc/package.py index 9ea4d1c326..fe82613ce2 100644 --- a/var/spack/repos/builtin/packages/libxc/package.py +++ b/var/spack/repos/builtin/packages/libxc/package.py @@ -32,11 +32,27 @@ class Libxc(Package): 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('3.0.0', '8227fa3053f8fc215bd9d7b0d36de03c') version('2.2.2', 'd9f90a0d6e36df6c1312b6422280f2ec') def install(self, spec, prefix): - configure('--prefix=%s' % prefix, + # Optimizations for the Intel compiler, suggested by CP2K + optflags = '-O2' + if self.compiler.name == 'intel': + optflags += ' -xAVX -axCORE-AVX2 -ipo' + if which('xiar'): + env['AR'] = 'xiar' + + env['CFLAGS'] = optflags + env['FCFLAGS'] = optflags + + configure('--prefix={0}'.format(prefix), '--enable-shared') make() - make("install") + + # libxc provides a testsuite, but many tests fail + # http://www.tddft.org/pipermail/libxc/2013-February/000032.html + # make('check') + + make('install') -- cgit v1.2.3-70-g09d2