zoltan: use autotools for new architecture host (#11924)
* use autoreconf to regenerate configure script and config.guess for newer architectures * Add perl build dependency for older versions. The required perl version is constrained because the perl script uses syntax that is deprecated in older versions
This commit is contained in:
parent
68dd327d62
commit
a718d8af08
@ -6,11 +6,9 @@
|
|||||||
|
|
||||||
from spack import *
|
from spack import *
|
||||||
import re
|
import re
|
||||||
import os
|
|
||||||
import glob
|
|
||||||
|
|
||||||
|
|
||||||
class Zoltan(Package):
|
class Zoltan(AutotoolsPackage):
|
||||||
"""The Zoltan library is a toolkit of parallel combinatorial algorithms
|
"""The Zoltan library is a toolkit of parallel combinatorial algorithms
|
||||||
for parallel, unstructured, and/or adaptive scientific
|
for parallel, unstructured, and/or adaptive scientific
|
||||||
applications. Zoltan's largest component is a suite of dynamic
|
applications. Zoltan's largest component is a suite of dynamic
|
||||||
@ -43,15 +41,43 @@ class Zoltan(Package):
|
|||||||
depends_on('parmetis@4:', when='+parmetis')
|
depends_on('parmetis@4:', when='+parmetis')
|
||||||
depends_on('metis', when='+parmetis')
|
depends_on('metis', when='+parmetis')
|
||||||
|
|
||||||
|
depends_on('perl@:5.21', type='build', when='@:3.6')
|
||||||
|
depends_on('autoconf', type='build')
|
||||||
|
depends_on('automake', type='build')
|
||||||
|
depends_on('m4', type='build')
|
||||||
|
|
||||||
conflicts('+parmetis', when='~mpi')
|
conflicts('+parmetis', when='~mpi')
|
||||||
|
|
||||||
def install(self, spec, prefix):
|
build_directory = 'spack-build'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def configure_directory(self):
|
||||||
|
spec = self.spec
|
||||||
|
|
||||||
# FIXME: The older Zoltan versions fail to compile the F90 MPI wrappers
|
# FIXME: The older Zoltan versions fail to compile the F90 MPI wrappers
|
||||||
# because of some complicated generic type problem.
|
# because of some complicated generic type problem.
|
||||||
if spec.satisfies('@:3.6+fortran+mpi'):
|
if spec.satisfies('@:3.6+fortran+mpi'):
|
||||||
raise RuntimeError(('Cannot build Zoltan v{0} with +fortran and '
|
raise RuntimeError(('Cannot build Zoltan v{0} with +fortran and '
|
||||||
'+mpi; please disable one of these features '
|
'+mpi; please disable one of these features '
|
||||||
'or upgrade versions.').format(self.version))
|
'or upgrade versions.').format(self.version))
|
||||||
|
if spec.satisfies('@:3.6'):
|
||||||
|
zoltan_path = 'Zoltan_v{0}'.format(self.version)
|
||||||
|
return zoltan_path
|
||||||
|
return '.'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def parallel(self):
|
||||||
|
# NOTE: Earlier versions of Zoltan cannot be built in parallel
|
||||||
|
# because they contain nested Makefile dependency bugs.
|
||||||
|
return not self.spec.satisfies('@:3.6+fortran')
|
||||||
|
|
||||||
|
def autoreconf(self, spec, prefix):
|
||||||
|
autoreconf = which('autoreconf')
|
||||||
|
with working_dir(self.configure_directory):
|
||||||
|
autoreconf('-ivf')
|
||||||
|
|
||||||
|
def configure_args(self):
|
||||||
|
spec = self.spec
|
||||||
|
|
||||||
config_args = [
|
config_args = [
|
||||||
self.get_config_flag('f90interface', 'fortran'),
|
self.get_config_flag('f90interface', 'fortran'),
|
||||||
@ -63,8 +89,10 @@ def install(self, spec, prefix):
|
|||||||
]
|
]
|
||||||
|
|
||||||
if '+shared' in spec:
|
if '+shared' in spec:
|
||||||
config_args.append('RANLIB=echo')
|
config_args.extend([
|
||||||
config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o')
|
'RANLIB=echo',
|
||||||
|
'--with-ar=$(CXX) -shared $(LDFLAGS) -o'
|
||||||
|
])
|
||||||
config_cflags.append(self.compiler.pic_flag)
|
config_cflags.append(self.compiler.pic_flag)
|
||||||
if spec.satisfies('%gcc'):
|
if spec.satisfies('%gcc'):
|
||||||
config_args.append('--with-libs=-lgfortran')
|
config_args.append('--with-libs=-lgfortran')
|
||||||
@ -72,66 +100,54 @@ def install(self, spec, prefix):
|
|||||||
config_args.append('--with-libs=-lifcore')
|
config_args.append('--with-libs=-lifcore')
|
||||||
|
|
||||||
if '+parmetis' in spec:
|
if '+parmetis' in spec:
|
||||||
config_args.append('--with-parmetis')
|
parmetis_prefix = spec['parmetis'].prefix
|
||||||
config_args.append('--with-parmetis-libdir={0}'
|
config_args.extend([
|
||||||
.format(spec['parmetis'].prefix.lib))
|
'--with-parmetis',
|
||||||
config_args.append('--with-parmetis-incdir={0}'
|
'--with-parmetis-libdir={0}'.format(parmetis_prefix.lib),
|
||||||
.format(spec['parmetis'].prefix.include))
|
'--with-parmetis-incdir={0}'.format(parmetis_prefix.include),
|
||||||
config_args.append('--with-incdirs=-I{0}'
|
'--with-incdirs=-I{0}'.format(spec['metis'].prefix.include),
|
||||||
.format(spec['metis'].prefix.include))
|
'--with-ldflags=-L{0}'.format(spec['metis'].prefix.lib)
|
||||||
config_args.append('--with-ldflags=-L{0}'
|
])
|
||||||
.format(spec['metis'].prefix.lib))
|
|
||||||
if '+int64' in spec['metis']:
|
if '+int64' in spec['metis']:
|
||||||
config_args.append('--with-id-type=ulong')
|
config_args.append('--with-id-type=ulong')
|
||||||
else:
|
else:
|
||||||
config_args.append('--with-id-type=uint')
|
config_args.append('--with-id-type=uint')
|
||||||
|
|
||||||
if '+mpi' in spec:
|
if '+mpi' in spec:
|
||||||
config_args.append('CC={0}'.format(spec['mpi'].mpicc))
|
config_args.extend([
|
||||||
config_args.append('CXX={0}'.format(spec['mpi'].mpicxx))
|
'CC={0}'.format(spec['mpi'].mpicc),
|
||||||
config_args.append('FC={0}'.format(spec['mpi'].mpifc))
|
'CXX={0}'.format(spec['mpi'].mpicxx),
|
||||||
|
'FC={0}'.format(spec['mpi'].mpifc),
|
||||||
config_args.append('--with-mpi={0}'.format(spec['mpi'].prefix))
|
'--with-mpi={0}'.format(spec['mpi'].prefix),
|
||||||
|
|
||||||
# NOTE: Zoltan assumes that it's linking against an MPI library
|
# NOTE: Zoltan assumes that it's linking against an MPI library
|
||||||
# that can be found with '-lmpi' which isn't the case for many
|
# that can be found with '-lmpi' which isn't the case for many
|
||||||
# MPI packages. We rely on the MPI-wrappers to automatically add
|
# MPI packages. We rely on the MPI-wrappers to automatically
|
||||||
# what is required for linking and thus pass an empty list of libs
|
# add what is required for linking and thus pass an empty
|
||||||
config_args.append('--with-mpi-libs= ')
|
# list of libs
|
||||||
|
'--with-mpi-libs= '
|
||||||
|
])
|
||||||
|
|
||||||
# NOTE: Early versions of Zoltan come packaged with a few embedded
|
# NOTE: Early versions of Zoltan come packaged with a few embedded
|
||||||
# library packages (e.g. ParMETIS, Scotch), which messes with Spack's
|
# library packages (e.g. ParMETIS, Scotch), which messes with Spack's
|
||||||
# ability to descend directly into the package's source directory.
|
# ability to descend directly into the package's source directory.
|
||||||
source_directory = self.stage.source_path
|
config_args.extend([
|
||||||
if spec.satisfies('@:3.6'):
|
|
||||||
zoltan_directory = 'Zoltan_v{0}'.format(self.version)
|
|
||||||
source_directory = join_path(source_directory, zoltan_directory)
|
|
||||||
|
|
||||||
build_directory = join_path(source_directory, 'build')
|
|
||||||
with working_dir(build_directory, create=True):
|
|
||||||
config = Executable(join_path(source_directory, 'configure'))
|
|
||||||
config(
|
|
||||||
'--prefix={0}'.format(prefix),
|
|
||||||
'--with-cflags={0}'.format(' '.join(config_cflags)),
|
'--with-cflags={0}'.format(' '.join(config_cflags)),
|
||||||
'--with-cxxflags={0}'.format(' '.join(config_cflags)),
|
'--with-cxxflags={0}'.format(' '.join(config_cflags)),
|
||||||
'--with-fcflags={0}'.format(' '.join(config_cflags)),
|
'--with-fcflags={0}'.format(' '.join(config_cflags))
|
||||||
*config_args
|
])
|
||||||
)
|
return config_args
|
||||||
|
|
||||||
# NOTE: Earlier versions of Zoltan cannot be built in parallel
|
|
||||||
# because they contain nested Makefile dependency bugs.
|
|
||||||
make(parallel=not spec.satisfies('@:3.6+fortran'))
|
|
||||||
make('install')
|
|
||||||
|
|
||||||
# NOTE: Unfortunately, Zoltan doesn't provide any configuration
|
# NOTE: Unfortunately, Zoltan doesn't provide any configuration
|
||||||
# options for the extension of the output library files, so this
|
# options for the extension of the output library files, so this
|
||||||
# script must change these extensions as a post-processing step.
|
# script must change these extensions as a post-processing step.
|
||||||
if '+shared' in spec:
|
@run_after('install')
|
||||||
for lib_path in glob.glob(join_path(prefix, 'lib', '*.a')):
|
def solib_install(self):
|
||||||
lib_static_name = os.path.basename(lib_path)
|
if '+shared' in self.spec:
|
||||||
|
for lib_path in find(self.spec.prefix.lib, 'lib*.a'):
|
||||||
lib_shared_name = re.sub(r'\.a$', '.{0}'.format(dso_suffix),
|
lib_shared_name = re.sub(r'\.a$', '.{0}'.format(dso_suffix),
|
||||||
lib_static_name)
|
lib_path)
|
||||||
move(lib_path, join_path(prefix, 'lib', lib_shared_name))
|
move(lib_path, lib_shared_name)
|
||||||
|
|
||||||
def get_config_flag(self, flag_name, flag_variant):
|
def get_config_flag(self, flag_name, flag_variant):
|
||||||
flag_pre = 'en' if '+{0}'.format(flag_variant) in self.spec else 'dis'
|
flag_pre = 'en' if '+{0}'.format(flag_variant) in self.spec else 'dis'
|
||||||
|
Loading…
Reference in New Issue
Block a user