Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes for CMakeMake and CMakeMake-based easyblocks (ELSI, SuperLU, Clang, DOLFIN, LAMMPS) #2

Merged
merged 9 commits into from
Mar 30, 2020
1 change: 0 additions & 1 deletion easybuild/easyblocks/c/clang.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ def extra_options():
# The sanitizer tests often fail on HPC systems due to the 'weird' environment.
'skip_sanitizer_tests': [True, "Do not run the sanitizer tests", CUSTOM],
})
extra_vars['build_type'][0] = 'Release'
# disable regular out-of-source build, too simplistic for Clang to work
extra_vars['separate_build_dir'][0] = False
return extra_vars
Expand Down
7 changes: 3 additions & 4 deletions easybuild/easyblocks/d/dolfin.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,10 +273,9 @@ def test_step(self):

# subdomains-poisson has no C++ get_version, only Python
# Python tests excluded, see above
if False:
name = 'subdomains-poisson'
path = os.path.join('demo', 'pde', name, 'python')
cmds += [cmd_template_python % {'dir': path, 'name': name}]
# name = 'subdomains-poisson'
# path = os.path.join('demo', 'pde', name, 'python')
# cmds += [cmd_template_python % {'dir': path, 'name': name}]

# supply empty argument to each command
for cmd in cmds:
Expand Down
7 changes: 5 additions & 2 deletions easybuild/easyblocks/e/elsi.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ def extra_options():
extra_vars.update({
'build_internal_pexsi': [None, "Build internal PEXSI solver", CUSTOM],
})
extra_vars['build_shared_libs'][0] = True
extra_vars['separate_build_dir'][0] = True
extra_vars['build_shared_libs'][0] = True
return extra_vars

def configure_step(self):
Expand Down Expand Up @@ -145,8 +145,11 @@ def sanity_check_step(self):
modules.append('elsi_sips')
libs.append('sips')

# follow self.lib_ext set by CMakeMake (based on build_shared_libs), fall back to .a (static libs by default)
lib_ext = self.lib_ext or 'a'

module_paths = [os.path.join('include', '%s.mod' % mod) for mod in modules]
lib_paths = [os.path.join('lib', 'lib%s.%s' % (lib, self.lib_ext)) for lib in libs]
lib_paths = [os.path.join('lib', 'lib%s.%s' % (lib, lib_ext)) for lib in libs]

custom_paths = {
'files': module_paths + lib_paths,
Expand Down
29 changes: 22 additions & 7 deletions easybuild/easyblocks/generic/cmakemake.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ def extra_options(extra_vars=None):
})
return extra_vars

def __init__(self, *args, **kwargs):
"""
Constructor for CMakeMake easyblock:
set self.lib_ext based on whether shared libraries are built or not
"""

super(CMakeMake, self).__init__(*args, **kwargs)

# set self.lib_ext according to 'build_shared_libs' easyconfig parameter (if it's set)
build_shared_libs = self.cfg['build_shared_libs']
if build_shared_libs:
self.lib_ext = get_shared_lib_ext()
elif build_shared_libs is not None:
self.lib_ext = 'a'
else:
self.lib_ext = None

def configure_step(self, srcdir=None, builddir=None):
"""Configure build using cmake"""

Expand All @@ -108,25 +125,23 @@ def configure_step(self, srcdir=None, builddir=None):

options = ['-DCMAKE_INSTALL_PREFIX=%s' % self.installdir]

build_type = self.cfg['build_type']
if build_type is None:
build_type = 'Debug' if self.toolchain.options.get('debug', None) else 'Release'
options.append("-DCMAKE_BUILD_TYPE=%s" % build_type)
if '-DCMAKE_BUILD_TYPE=' not in self.cfg['configopts']:
build_type = self.cfg['build_type']
if build_type is None:
build_type = 'Debug' if self.toolchain.options.get('debug', None) else 'Release'
options.append('-DCMAKE_BUILD_TYPE=%s' % build_type)

# Add -fPIC flag if necessary
if self.toolchain.options['pic']:
options.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')

# Set flag for shared libs if requested
# Not adding one allows the project to choose a default
# If build_shared_libs is set, then self.lib_ext will be set accordingly for use in e.g. sanity checks
build_shared_libs = self.cfg['build_shared_libs']
if build_shared_libs:
self.cfg.update('configopts', '-DBUILD_SHARED_LIBS=ON')
self.lib_ext = get_shared_lib_ext()
elif build_shared_libs is not None:
self.cfg.update('configopts', '-DBUILD_SHARED_LIBS=OFF')
self.lib_ext = 'a'

env_to_options = {
'CC': 'CMAKE_C_COMPILER',
Expand Down
7 changes: 5 additions & 2 deletions easybuild/easyblocks/l/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,6 @@ def extra_options(**kwargs):
'user_packages': [None, "List user packages without `PKG_USER-` prefix.", MANDATORY],
})
extra_vars['separate_build_dir'][0] = False
extra_vars['build_shared_libs'][0] = True
return extra_vars

def prepare_step(self, *args, **kwargs):
Expand All @@ -128,12 +127,16 @@ def configure_step(self, **kwargs):
# cmake has its own folder
self.cfg['srcdir'] = os.path.join(self.start_dir, 'cmake')

# Enable following packages, if not configured in easycofig
# Enable following packages, if not configured in easyconfig
default_options = ['BUILD_DOC', 'BUILD_EXE', 'BUILD_LIB', 'BUILD_TOOLS']
for option in default_options:
if "-D%s=" % option not in self.cfg['configopts']:
self.cfg.update('configopts', '-D%s=on' % option)

# enable building of shared libraries, if not specified already via configopts
if self.cfg['build_shared_libs'] is None and '-DBUILD_SHARED_LIBS=' not in self.cfg['configopts']:
self.cfg['build_shared_libs'] = True

# Enable gzip, libpng and libjpeg-turbo support when its included as dependency
deps = [
('gzip', 'GZIP'),
Expand Down
24 changes: 16 additions & 8 deletions easybuild/easyblocks/s/superlu.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,14 @@ def extra_options():
extra_vars['separate_build_dir'][0] = True
return extra_vars

def __init__(self, *args, **kwargs):
"""Constructor for SuperLU easyblock."""

super(EB_SuperLU, self).__init__(*args, **kwargs)

# if self.lib_ext is not set by CMakeMake, fall back to .a (static libraries by default)
self.lib_ext = self.lib_ext or 'a'

def configure_step(self):
"""
Set the CMake options for SuperLU
Expand Down Expand Up @@ -105,16 +113,16 @@ def install_step(self):
"""
super(EB_SuperLU, self).install_step()

self.libbits = 'lib'
if not os.path.exists(os.path.join(self.installdir, self.libbits)):
self.libbits = 'lib64'
libbits = 'lib'
Flamefire marked this conversation as resolved.
Show resolved Hide resolved
if not os.path.exists(os.path.join(self.installdir, libbits)):
libbits = 'lib64'

if not os.path.exists(os.path.join(self.installdir, self.libbits)):
if not os.path.exists(os.path.join(self.installdir, libbits)):
raise EasyBuildError("No lib or lib64 subdirectory exist in %s", self.installdir)

expected_libpath = os.path.join(self.installdir, self.libbits, "libsuperlu.%s" % self.lib_ext)
actual_libpath = os.path.join(self.installdir, self.libbits, "libsuperlu_%s.%s" %
(self.cfg['version'], self.lib_ext))
libbits_path = os.path.join(self.installdir, libbits)
expected_libpath = os.path.join(libbits_path, 'libsuperlu.%s' % self.lib_ext)
actual_libpath = os.path.join(libbits_path, 'libsuperlu_%s.%s' % (self.cfg['version'], self.lib_ext))

if not os.path.exists(expected_libpath):
try:
Expand All @@ -127,7 +135,7 @@ def sanity_check_step(self):
Check for main library files for SuperLU
"""
custom_paths = {
'files': ["include/supermatrix.h", os.path.join(self.libbits, "libsuperlu.%s" % self.lib_ext)],
'files': ["include/supermatrix.h", os.path.join('lib', 'libsuperlu.%s' % self.lib_ext)],
'dirs': [],
}
super(EB_SuperLU, self).sanity_check_step(custom_paths=custom_paths)