Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…asyblocks into update_r_config_guess
  • Loading branch information
boegel committed Mar 11, 2020
2 parents ba26246 + 1d1c00e commit 8ce05a6
Show file tree
Hide file tree
Showing 7 changed files with 122 additions and 19 deletions.
42 changes: 32 additions & 10 deletions easybuild/easyblocks/f/ferret.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
@author: Pieter De Baets (Ghent University)
@author: Jens Timmerman (Ghent University)
@author: George Fanourgakis (The Cyprus Institute)
@author: Samuel Moors (Vrije Universiteit Brussel (VUB))
"""


Expand All @@ -53,7 +54,10 @@ def configure_step(self):
if LooseVersion(self.version) < LooseVersion("7.3"):
change_dir('FERRET')

deps = ['HDF5', 'netCDF', 'Java']
if LooseVersion(self.version) >= LooseVersion("7.5"):
deps = ['HDF5', 'netCDF-Fortran']
else:
deps = ['HDF5', 'netCDF', 'Java']

for name in deps:
if not get_software_root(name):
Expand All @@ -75,15 +79,32 @@ def configure_step(self):
(r"^INSTALL_FER_DIR =.*", "INSTALL_FER_DIR = %s" % self.installdir),
]

for name in deps:
regex_subs.append((r"^(%s.*DIR\s*)=.*" % name.upper(), r"\1 = %s" % get_software_root(name)))
if LooseVersion(self.version) >= LooseVersion("7.5"):
regex_subs.append((r"^(HDF5_LIBDIR\s*)=.*", r"\1 = %s/lib" % get_software_root('HDF5')))
regex_subs.append((r"^(NETCDF_LIBDIR\s*)=.*", r"\1 = %s/lib" % get_software_root('netCDF-Fortran')))
else:
for name in deps:
regex_subs.append((r"^(%s.*DIR\s*)=.*" % name.upper(), r"\1 = %s" % get_software_root(name)))


if LooseVersion(self.version) >= LooseVersion("7.3"):
regex_subs.extend([
(r"^DIR_PREFIX =.*", "DIR_PREFIX = %s" % self.cfg['start_dir']),
(r"^FER_LOCAL_EXTFCNS = $(FER_DIR)", "FER_LOCAL_EXTFCNS = $(INSTALL_FER_DIR)/libs"),
])

if LooseVersion(self.version) >= LooseVersion("7.5"):
comp_vars = {
'CC': 'CC',
'FC': 'FC',
}

for key, value in comp_vars.items():
regex_subs.append((r"^(%s\s*)=.*" % key, r"\1= %s " % os.getenv(value)))

if self.toolchain.comp_family() == toolchain.INTELCOMP:
regex_subs.append((r"^(\s*LD\s*)=.*", r"\1 = %s -nofor-main " % os.getenv("FC")))

for fn in fns:
apply_regex_substitutions(fn, regex_subs)

Expand Down Expand Up @@ -114,8 +135,8 @@ def configure_step(self):
fn = 'xgks/CUSTOMIZE.%s' % buildtype

regex_subs = [(r"^(FFLAGS\s*=').*-m64 (.*)", r"\1%s \2" % os.getenv('FFLAGS'))]
for x, y in comp_vars.items():
regex_subs.append((r"^(%s\s*)=.*" % x, r"\1='%s'" % os.getenv(y)))
for key, value in comp_vars.items():
regex_subs.append((r"^(%s\s*)=.*" % key, r"\1='%s'" % os.getenv(value)))

x11_root = get_software_root('X11')
if x11_root:
Expand Down Expand Up @@ -148,8 +169,8 @@ def configure_step(self):
]

regex_subs = []
for x, y in comp_vars.items():
regex_subs.append((r"^(\s*%s\s*)=.*" % x, r"\1 = %s" % os.getenv(y)))
for key, value in comp_vars.items():
regex_subs.append((r"^(\s*%s\s*)=.*" % key, r"\1 = %s" % os.getenv(value)))

if LooseVersion(self.version) >= LooseVersion("7.3"):
regex_subs.extend([
Expand Down Expand Up @@ -179,16 +200,17 @@ def configure_step(self):
fn = 'gksm2ps/Makefile'

regex_subs = [(r"^(\s*CFLAGS=\")-m64 (.*)", r"\1%s \2" % os.getenv('CFLAGS'))]
for x, y in comp_vars.items():
regex_subs.append((r"^(\s*%s)=.*" % x, r"\1='%s' \\" % os.getenv(y)))
for key, value in comp_vars.items():
regex_subs.append((r"^(\s*%s)=.*" % key, r"\1='%s' \\" % os.getenv(value)))

apply_regex_substitutions(fn, regex_subs)

def sanity_check_step(self):
"""Custom sanity check for Ferret."""

major_minor_version = '.'.join(self.version.split('.')[:2])
custom_paths = {
'files': ["bin/ferret_v%s" % self.version],
'files': ["bin/ferret_v%s" % major_minor_version],
'dirs': [],
}

Expand Down
10 changes: 9 additions & 1 deletion easybuild/easyblocks/generic/pythonpackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ def extra_options(extra_vars=None):
'use_easy_install': [False, "Install using '%s' (deprecated)" % EASY_INSTALL_INSTALL_CMD, CUSTOM],
'use_pip': [None, "Install using '%s'" % PIP_INSTALL_CMD, CUSTOM],
'use_pip_editable': [False, "Install using 'pip install --editable'", CUSTOM],
# see https://packaging.python.org/tutorials/installing-packages/#installing-setuptools-extras
'use_pip_extras': [None, "String with comma-separated list of 'extras' to install via pip", CUSTOM],
'use_pip_for_deps': [False, "Install dependencies using '%s'" % PIP_INSTALL_CMD, CUSTOM],
'use_setup_py_develop': [False, "Install using '%s' (deprecated)" % SETUP_PY_DEVELOP_CMD, CUSTOM],
'zipped_egg': [False, "Install as a zipped eggs (requires use_easy_install)", CUSTOM],
Expand Down Expand Up @@ -392,7 +394,8 @@ def compose_install_command(self, prefix, extrapath=None, installopts=None):
if self.install_cmd.startswith(EASY_INSTALL_INSTALL_CMD):
run_cmd("%s setup.py easy_install --version" % self.python_cmd, verbose=False, trace=False)

if self.install_cmd.startswith(PIP_INSTALL_CMD):
using_pip = self.install_cmd.startswith(PIP_INSTALL_CMD)
if using_pip:

pip_version = det_pip_version()
if pip_version:
Expand Down Expand Up @@ -428,6 +431,11 @@ def compose_install_command(self, prefix, extrapath=None, installopts=None):
else:
loc = self.src[0]['path']

if using_pip:
extras = self.cfg.get('use_pip_extras')
if extras:
loc += '[%s]' % extras

if installopts is None:
installopts = self.cfg['installopts']

Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/i/impi.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def post_install_step(self):
regex_subs = [(r"^setenv I_MPI_ROOT.*", r"setenv I_MPI_ROOT %s" % self.installdir)]
for script in [os.path.join(script_path, 'mpivars.csh') for script_path in script_paths]:
apply_regex_substitutions(os.path.join(self.installdir, script), regex_subs)
regex_subs = [(r"^I_MPI_ROOT=.*", r"I_MPI_ROOT=%s; export I_MPI_ROOT" % self.installdir)]
regex_subs = [(r"^(\s*)I_MPI_ROOT=[^;\n]*", r"\1I_MPI_ROOT=%s" % self.installdir)]
for script in [os.path.join(script_path, 'mpivars.sh') for script_path in script_paths]:
apply_regex_substitutions(os.path.join(self.installdir, script), regex_subs)

Expand Down Expand Up @@ -230,7 +230,7 @@ def make_module_req_guess(self):
else:
guesses = {}
if LooseVersion(self.version) >= LooseVersion('2019'):
# Keep release_mt and release in front, to give priority to the possible symlinks in intel64/lib.
# Keep release_mt and release in front, to give them priority over the possible symlinks in intel64/lib.
# IntelMPI 2019 changed the default library to be the non-mt version.
lib_dirs = ['intel64/%s' % x for x in ['lib/release_mt', 'lib/release', 'lib']]
include_dirs = ['intel64/include']
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/l/lammps.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def make_module_extra(self):
def get_cuda_gpu_arch(cuda_cc):
"""Return CUDA gpu ARCH in LAMMPS required format. Example: 'sm_32' """
# Get largest cuda supported
return 'sm_%s' % str(cuda_cc.sorted(reverse=True)[0]).replace(".", "")
return 'sm_%s' % str(sorted(cuda_cc, reverse=True)[0]).replace(".", "")


def get_kokkos_arch(cuda_cc, kokkos_arch):
Expand Down Expand Up @@ -317,7 +317,7 @@ def get_kokkos_arch(cuda_cc, kokkos_arch):
if cuda:
# CUDA below
gpu_arch = None
for cc in cuda_cc.sorted(reverse=True):
for cc in sorted(cuda_cc, reverse=True):
gpu_arch = KOKKOS_GPU_ARCH_TABLE.get(str(cc))
if gpu_arch:
break
Expand Down
53 changes: 53 additions & 0 deletions easybuild/easyblocks/l/libdrm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
##
# Copyright 2013-2020 Ghent University
#
# This file is part of EasyBuild,
# originally created by the HPC team of Ghent University (http://ugent.be/hpc/en),
# with support of Ghent University (http://ugent.be/hpc),
# the Flemish Supercomputer Centre (VSC) (https://www.vscentrum.be),
# Flemish Research Foundation (FWO) (http://www.fwo.be/en)
# and the Department of Economy, Science and Innovation (EWI) (http://www.ewi-vlaanderen.be/en).
#
# https://github.com/easybuilders/easybuild
#
# EasyBuild is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation v2.
#
# EasyBuild 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
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with EasyBuild. If not, see <http://www.gnu.org/licenses/>.
##
"""
EasyBuild support for building and installing libdrm, implemented as an easyblock
@author: Andrew Edmondson (University of Birmingham)
"""

from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.tools.systemtools import X86_64, get_cpu_architecture, get_shared_lib_ext


class EB_libdrm(ConfigureMake):
"""
Support for building libdrm on different architectures
"""

def sanity_check_step(self):
"""Custom sanity check for libdrm"""
shlib_ext = get_shared_lib_ext()
custom_paths = {
'files': ['include/xf86drm.h', 'include/xf86drmMode.h',
'lib/libdrm_radeon.%s' % shlib_ext, 'lib/libdrm.%s' % shlib_ext, 'lib/libkms.%s' % shlib_ext],
'dirs': ['include/libdrm', 'include/libkms', 'lib/pkgconfig'],
}

arch = get_cpu_architecture()
if arch == X86_64:
custom_paths['files'].append('lib/libdrm_intel.%s' % shlib_ext)

super(EB_libdrm, self).sanity_check_step(custom_paths=custom_paths)
8 changes: 7 additions & 1 deletion easybuild/easyblocks/o/openfoam.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,13 @@ def sanity_check_step(self):
shlib_ext = get_shared_lib_ext()

# OpenFOAM >= 3.0.0 can use 64 bit integers
if 'extend' not in self.name.lower() and self.looseversion >= LooseVersion('3.0'):
# same goes for OpenFOAM-Extend >= 4.1
if 'extend' in self.name.lower():
set_int_size = self.looseversion >= LooseVersion('4.1')
else:
set_int_size = self.looseversion >= LooseVersion('3.0')

if set_int_size:
if self.toolchain.options['i8']:
int_size = 'Int64'
else:
Expand Down
20 changes: 17 additions & 3 deletions easybuild/easyblocks/p/petsc.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,13 @@
from easybuild.easyblocks.generic.configuremake import ConfigureMake
from easybuild.framework.easyconfig import BUILD, CUSTOM
from easybuild.tools.build_log import EasyBuildError
from easybuild.tools.filetools import symlink
from easybuild.tools.filetools import symlink, apply_regex_substitutions
from easybuild.tools.modules import get_software_root
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import get_shared_lib_ext

NO_MPI_CXX_EXT_FLAGS = '-DOMPI_SKIP_MPICXX -DMPICH_SKIP_MPICXX'


class EB_PETSc(ConfigureMake):
"""Support for building and installing PETSc"""
Expand Down Expand Up @@ -112,13 +114,16 @@ def configure_step(self):
self.cfg.update('configopts', '--with-fc="%s"' % os.getenv('F90'))

# compiler flags
# Don't build with MPI c++ bindings as this leads to a hard dependency
# on libmpi and libmpi_cxx even for C code and non-MPI code
cxxflags = os.getenv('CXXFLAGS') + ' ' + NO_MPI_CXX_EXT_FLAGS
if LooseVersion(self.version) >= LooseVersion("3.5"):
self.cfg.update('configopts', '--CFLAGS="%s"' % os.getenv('CFLAGS'))
self.cfg.update('configopts', '--CXXFLAGS="%s"' % os.getenv('CXXFLAGS'))
self.cfg.update('configopts', '--CXXFLAGS="%s"' % cxxflags)
self.cfg.update('configopts', '--FFLAGS="%s"' % os.getenv('F90FLAGS'))
else:
self.cfg.update('configopts', '--with-cflags="%s"' % os.getenv('CFLAGS'))
self.cfg.update('configopts', '--with-cxxflags="%s"' % os.getenv('CXXFLAGS'))
self.cfg.update('configopts', '--with-cxxflags="%s"' % cxxflags)
self.cfg.update('configopts', '--with-fcflags="%s"' % os.getenv('F90FLAGS'))

if not self.toolchain.comp_family() == toolchain.GCC: #@UndefinedVariable
Expand Down Expand Up @@ -280,6 +285,15 @@ def install_step(self):
if LooseVersion(self.version) >= LooseVersion("3"):
if not self.cfg['sourceinstall']:
super(EB_PETSc, self).install_step()
petsc_root = self.installdir
else:
petsc_root = os.path.join(self.installdir, self.petsc_subdir)
# Remove MPI-CXX flags added during configure to prevent them from being passed to consumers of PETsc
petsc_variables_path = os.path.join(petsc_root, 'lib', 'petsc', 'conf', 'petscvariables')
if os.path.isfile(petsc_variables_path):
fix = (r'^(CXX_FLAGS|CXX_LINKER_FLAGS|CONFIGURE_OPTIONS)( = .*)%s(.*)$' % NO_MPI_CXX_EXT_FLAGS,
r'\1\2\3')
apply_regex_substitutions(petsc_variables_path, [fix])

else: # old versions (< 3.x)

Expand Down

0 comments on commit 8ce05a6

Please sign in to comment.