espresso: fixed compilation for 6.1 (elpa) and added support for hdf5 (#4483)
* espresso: fixed compilation for 6.1 (elpa) and added support for hdf5 * espresso: addressed items in @davydden review * espresso: fixed behavior for espresso@:5.4.0
This commit is contained in:
parent
df6d8d913b
commit
9defe2c1c2
@ -53,8 +53,11 @@ def url_for_version(self, version):
|
|||||||
# override default implementation which returns static lib
|
# override default implementation which returns static lib
|
||||||
@property
|
@property
|
||||||
def libs(self):
|
def libs(self):
|
||||||
|
|
||||||
|
libname = 'libelpa_openmp' if '+openmp' in self.spec else 'libelpa'
|
||||||
|
|
||||||
return find_libraries(
|
return find_libraries(
|
||||||
['libelpa'], root=self.prefix, shared=True, recurse=True
|
libname, root=self.prefix, shared=True, recurse=True
|
||||||
)
|
)
|
||||||
|
|
||||||
build_directory = 'spack-build'
|
build_directory = 'spack-build'
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
diff -ruN LAXlib-orig/dspev_drv.f90 LAXlib/dspev_drv.f90
|
||||||
|
--- a/LAXlib/dspev_drv.f90 2017-06-12 15:00:46.157372185 +0200
|
||||||
|
+++ b/LAXlib/dspev_drv.f90 2017-06-12 15:01:19.937371580 +0200
|
||||||
|
@@ -708,11 +708,11 @@
|
||||||
|
|
||||||
|
#if defined(__ELPA_2016)
|
||||||
|
! -> ELPA 2016.11.001_pre
|
||||||
|
- ierr = elpa_get_communicators(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
- success = solve_evp_real_1stage(n, n, s, lds, w, vv, lds,SIZE(s,2),nb ,mpi_comm_rows, mpi_comm_cols, ortho_comm)
|
||||||
|
+ !ierr = elpa_get_communicators(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ !success = solve_evp_real_1stage(n, n, s, lds, w, vv, lds,SIZE(s,2),nb ,mpi_comm_rows, mpi_comm_cols, ortho_comm)
|
||||||
|
! -> ELPA 2016.05.003
|
||||||
|
- !ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
- !success = solve_evp_real_1stage(n, n, s, lds, w, vv, lds,SIZE(s,2),nb ,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ success = solve_evp_real_1stage(n, n, s, lds, w, vv, lds,SIZE(s,2),nb ,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
#elif defined(__ELPA_2015)
|
||||||
|
ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
ierr = solve_evp_real(n, n, s, lds, w, vv, lds,SIZE(s,2),nb ,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
diff -ruN LAXlib-orig/zhpev_drv.f90 LAXlib/zhpev_drv.f90
|
||||||
|
--- a/LAXlib/zhpev_drv.f90 2017-06-12 15:00:46.157372185 +0200
|
||||||
|
+++ b/LAXlib/zhpev_drv.f90 2017-06-12 15:02:09.309370696 +0200
|
||||||
|
@@ -1519,13 +1519,13 @@
|
||||||
|
|
||||||
|
#if defined(__ELPA_2016)
|
||||||
|
! -> ELPA 2016.11.001_pre
|
||||||
|
- ierr = elpa_get_communicators(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
- success = solve_evp_complex_1stage_double(n, n, h, size(h,1), w, v, size(h,1), size(h,2), nb, &
|
||||||
|
- mpi_comm_rows, mpi_comm_cols, ortho_comm)
|
||||||
|
+ !ierr = elpa_get_communicators(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ !success = solve_evp_complex_1stage_double(n, n, h, size(h,1), w, v, size(h,1), size(h,2), nb, &
|
||||||
|
+ ! mpi_comm_rows, mpi_comm_cols, ortho_comm)
|
||||||
|
! -> ELPA 2016.05.003
|
||||||
|
- !ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
- !success = solve_evp_complex(n, n, h, size(h,1), w, v, size(h,1), size(h,2), nb, &
|
||||||
|
- ! mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
+ success = solve_evp_complex(n, n, h, size(h,1), w, v, size(h,1), size(h,2), nb, &
|
||||||
|
+ mpi_comm_rows, mpi_comm_cols)
|
||||||
|
#elif defined(__ELPA_2015)
|
||||||
|
ierr = get_elpa_row_col_comms(ortho_comm, my_prow, my_pcol,mpi_comm_rows, mpi_comm_cols)
|
||||||
|
ierr = solve_evp_complex(n, n, h, size(h,1), w, v, size(h,1), size(h,2), nb, &
|
@ -22,16 +22,17 @@
|
|||||||
# License along with this program; if not, write to the Free Software
|
# License along with this program; if not, write to the Free Software
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
import glob
|
||||||
|
import os.path
|
||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
import os
|
|
||||||
from glob import glob
|
|
||||||
|
|
||||||
|
|
||||||
class Espresso(Package):
|
class Espresso(Package):
|
||||||
"""QE is an integrated suite of Open-Source computer codes for
|
"""Quantum-ESPRESSO is an integrated suite of Open-Source computer codes
|
||||||
electronic-structure calculations and materials modeling at
|
for electronic-structure calculations and materials modeling at the
|
||||||
the nanoscale. It is based on density-functional theory, plane
|
nanoscale. It is based on density-functional theory, plane waves, and
|
||||||
waves, and pseudopotentials.
|
pseudopotentials.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
homepage = 'http://quantum-espresso.org'
|
homepage = 'http://quantum-espresso.org'
|
||||||
@ -55,34 +56,43 @@ class Espresso(Package):
|
|||||||
variant('scalapack', default=True, description='Enables scalapack support')
|
variant('scalapack', default=True, description='Enables scalapack support')
|
||||||
variant('elpa', default=True, description='Uses elpa as an eigenvalue solver')
|
variant('elpa', default=True, description='Uses elpa as an eigenvalue solver')
|
||||||
|
|
||||||
|
# Support for HDF5 has been added starting in version 6.1.0 and is
|
||||||
|
# still experimental, therefore we default to False for the variant
|
||||||
|
variant('hdf5', default=False, description='Builds with HDF5 support')
|
||||||
|
|
||||||
depends_on('blas')
|
depends_on('blas')
|
||||||
depends_on('lapack')
|
depends_on('lapack')
|
||||||
|
|
||||||
depends_on('mpi', when='+mpi')
|
depends_on('mpi', when='+mpi')
|
||||||
depends_on('fftw~mpi', when='~mpi')
|
|
||||||
depends_on('fftw+mpi', when='+mpi')
|
|
||||||
# TODO : + mpi needed to avoid false dependencies installation
|
|
||||||
depends_on('scalapack', when='+scalapack+mpi')
|
depends_on('scalapack', when='+scalapack+mpi')
|
||||||
depends_on('elpa@2016.11.001.pre', when='@6.1.0+elpa')
|
|
||||||
|
depends_on('fftw+mpi', when='+mpi')
|
||||||
|
depends_on('fftw~mpi', when='~mpi')
|
||||||
|
depends_on('elpa+openmp', when='+elpa+openmp')
|
||||||
|
depends_on('elpa~openmp', when='+elpa~openmp')
|
||||||
|
depends_on('hdf5', when='+hdf5')
|
||||||
|
|
||||||
|
patch('dspev_drv_elpa.patch', when='@6.1 ^elpa@2016.05.004')
|
||||||
|
patch('dspev_drv_elpa.patch', when='@6.1 ^elpa@2016.05.003')
|
||||||
|
|
||||||
|
# We can't ask for scalapack or elpa if we don't want MPI
|
||||||
|
conflicts('+scalapack', when='~mpi')
|
||||||
|
conflicts('+elpa', when='~mpi')
|
||||||
|
|
||||||
|
# Elpa is formally supported by @:5.4.0, but QE configure searches
|
||||||
|
# for it in the wrong folders (or tries to download it within
|
||||||
|
# the build directory). Instead of patching Elpa to provide the
|
||||||
|
# folder QE expects as a link, we issue a conflict here.
|
||||||
|
conflicts('+elpa', when='@:5.4.0')
|
||||||
|
conflicts('+hdf5', when='@:5.4.0')
|
||||||
|
|
||||||
# Spurious problems running in parallel the Makefile
|
# Spurious problems running in parallel the Makefile
|
||||||
# generated by the configure
|
# generated by the configure
|
||||||
parallel = False
|
parallel = False
|
||||||
|
|
||||||
def check_variants(self, spec):
|
|
||||||
error = 'you cannot ask for \'+{variant}\' when \'+mpi\' is not active'
|
|
||||||
if '+scalapack' in spec and '~mpi' in spec:
|
|
||||||
raise RuntimeError(error.format(variant='scalapack'))
|
|
||||||
if '+elpa' in spec and ('~mpi' in spec or '~scalapack' in spec):
|
|
||||||
raise RuntimeError(error.format(variant='elpa'))
|
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
def install(self, spec, prefix):
|
||||||
self.check_variants(spec)
|
|
||||||
|
|
||||||
options = [
|
prefix_path = prefix.bin if '@:5.4.0' in spec else prefix
|
||||||
'-prefix=%s' % (prefix.bin if spec.satisfies('@:5.4.0') else
|
options = ['-prefix={0}'.format(prefix_path)]
|
||||||
prefix)
|
|
||||||
]
|
|
||||||
|
|
||||||
if '+mpi' in spec:
|
if '+mpi' in spec:
|
||||||
options.append('--enable-parallel')
|
options.append('--enable-parallel')
|
||||||
@ -91,38 +101,53 @@ def install(self, spec, prefix):
|
|||||||
options.append('--enable-openmp')
|
options.append('--enable-openmp')
|
||||||
|
|
||||||
if '+scalapack' in spec:
|
if '+scalapack' in spec:
|
||||||
options.append('--with-scalapack=yes')
|
scalapack_option = 'intel' if '^intel-mkl' in spec else 'yes'
|
||||||
|
options.append('--with-scalapack={0}'.format(scalapack_option))
|
||||||
|
|
||||||
if '+elpa' in spec:
|
if '+elpa' in spec:
|
||||||
if spec.satisfies('@:5.4.0'):
|
|
||||||
options.append('--with-elpa=yes')
|
# Spec for elpa
|
||||||
else:
|
elpa = spec['elpa']
|
||||||
options.extend([
|
|
||||||
'--with-elpa-include={0}'.format(
|
# Find where the Fortran module resides
|
||||||
join_path(spec['elpa'].prefix,
|
elpa_module = find(elpa.prefix, 'elpa.mod')
|
||||||
'include',
|
|
||||||
'elpa-{0}'.format(str(spec['elpa'].version)),
|
# Compute the include directory from there: versions
|
||||||
'modules')
|
# of espresso prior to 6.1 requires -I in front of the directory
|
||||||
),
|
elpa_include = '' if '@6.1:' in spec else '-I'
|
||||||
'--with-elpa-lib={0}'.format(spec['elpa'].libs.joined())
|
elpa_include += os.path.dirname(elpa_module[0])
|
||||||
])
|
|
||||||
|
options.extend([
|
||||||
|
'--with-elpa-include={0}'.format(elpa_include),
|
||||||
|
'--with-elpa-lib={0}'.format(elpa.libs[0])
|
||||||
|
])
|
||||||
|
|
||||||
|
if '+hdf5' in spec:
|
||||||
|
options.append('--with-hdf5={0}'.format(spec['hdf5'].prefix))
|
||||||
|
|
||||||
# Add a list of directories to search
|
# Add a list of directories to search
|
||||||
search_list = []
|
search_list = []
|
||||||
for dependency_spec in spec.dependencies():
|
for dependency_spec in spec.dependencies():
|
||||||
search_list.extend([dependency_spec.prefix.lib,
|
search_list.extend([
|
||||||
dependency_spec.prefix.lib64])
|
dependency_spec.prefix.lib,
|
||||||
|
dependency_spec.prefix.lib64
|
||||||
|
])
|
||||||
|
|
||||||
search_list = " ".join(search_list)
|
search_list = " ".join(search_list)
|
||||||
options.append('LIBDIRS=%s' % search_list)
|
|
||||||
options.append('F90=%s' % os.environ['FC'])
|
options.extend([
|
||||||
|
'LIBDIRS={0}'.format(search_list),
|
||||||
|
'F90={0}'.format(env['SPACK_FC']),
|
||||||
|
'CC={0}'.format(env['SPACK_CC'])
|
||||||
|
])
|
||||||
|
|
||||||
configure(*options)
|
configure(*options)
|
||||||
|
|
||||||
make('all')
|
make('all')
|
||||||
|
|
||||||
if spec.satisfies('platform=darwin'):
|
if 'platform=darwin' in spec:
|
||||||
mkdirp(prefix.bin)
|
mkdirp(prefix.bin)
|
||||||
for filename in glob("bin/*.x"):
|
for filename in glob.glob("bin/*.x"):
|
||||||
install(filename, prefix.bin)
|
install(filename, prefix.bin)
|
||||||
else:
|
else:
|
||||||
make('install')
|
make('install')
|
||||||
|
Loading…
Reference in New Issue
Block a user