Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…asyblocks into 20231017084015_new_pr_palm
  • Loading branch information
akesandgren committed Oct 30, 2023
2 parents f037c2a + afab7cd commit aeb061e
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 19 deletions.
16 changes: 14 additions & 2 deletions easybuild/easyblocks/generic/modulerc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import os

from easybuild.framework.easyblock import EasyBlock
from easybuild.framework.easyconfig import CUSTOM
from easybuild.framework.easyconfig.easyconfig import ActiveMNS
from easybuild.tools.build_log import EasyBuildError, print_msg
from easybuild.tools.config import install_path
Expand All @@ -41,6 +42,16 @@ class ModuleRC(EasyBlock):
Generic easyblock to create a software-specific .modulerc file
"""

@staticmethod
def extra_options(extra_vars=None):
"""Define extra easyconfig parameters specific to ModuleRC"""
if extra_vars is None:
extra_vars = {}
extra_vars.update({
'check_version': [True, "Check version is prefix of dependency", CUSTOM],
})
return EasyBlock.extra_options(extra_vars)

def configure_step(self):
"""Do nothing."""
pass
Expand All @@ -67,7 +78,8 @@ def make_module_step(self, fake=False):
raise EasyBuildError("Name does not match dependency name: %s vs %s", self.name, deps[0]['name'])

# ensure version to alias to is a prefix of the version of the dependency
if not deps[0]['version'].startswith(self.version) and not self.version == "default":
if self.cfg['check_version'] and \
not deps[0]['version'].startswith(self.version) and not self.version == "default":
raise EasyBuildError("Version is not 'default' and not a prefix of dependency version: %s vs %s",
self.version, deps[0]['version'])

Expand All @@ -85,7 +97,7 @@ def make_module_step(self, fake=False):

module_version_specs = {
'modname': alias_modname,
'sym_version': self.version,
'sym_version': self.version + self.cfg['versionsuffix'],
'version': deps[0]['version'],
}
self.module_generator.modulerc(module_version=module_version_specs, filepath=modulerc)
Expand Down
2 changes: 2 additions & 0 deletions easybuild/easyblocks/i/imkl.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,11 +546,13 @@ def make_module_req_guess(self):
os.path.join(self.mkl_basedir, 'include'),
os.path.join(self.mkl_basedir, 'include', 'fftw'),
]
cmake_prefix_path = [self.mkl_basedir]
guesses.update({
'PATH': [],
'LD_LIBRARY_PATH': library_path,
'LIBRARY_PATH': library_path,
'CPATH': cpath,
'CMAKE_PREFIX_PATH': cmake_prefix_path,
'PKG_CONFIG_PATH': pkg_config_path,
})
if self.cfg['flexiblas']:
Expand Down
4 changes: 2 additions & 2 deletions easybuild/easyblocks/p/perl.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def configure_step(self):
configopts = [
self.cfg['configopts'],
'-Dcc="{0}"'.format(os.getenv('CC')),
'-Dccflags="{0}"'.format(os.getenv('CFLAGS')),
'-Dccflags="{0}"'.format(os.getenv('CFLAGS')) if '-Dccflags' not in self.cfg['configopts'] else '',
'-Dinc_version_list=none',
'-Dprefix=%(installdir)s',
# guarantee that scripts are installed in /bin in the installation directory (and not in a guessed path)
Expand Down Expand Up @@ -116,7 +116,7 @@ def configure_step(self):
if os.getenv('COLUMNS', None) == '0':
unset_env_vars(['COLUMNS'])

cmd = './Configure -de %s' % configopts
cmd = '%s ./Configure -de %s' % (self.cfg['preconfigopts'], configopts)
run_cmd(cmd, log_all=True, simple=True)

def test_step(self):
Expand Down
2 changes: 1 addition & 1 deletion easybuild/easyblocks/s/scipy.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def configure_step(self):
if lapack_lib == toolchain.FLEXIBLAS:
blas_lapack = 'flexiblas'
elif lapack_lib == toolchain.INTELMKL:
blas_lapack = 'mkl'
blas_lapack = 'mkl-dynamic-lp64-seq'
elif lapack_lib == toolchain.OPENBLAS:
blas_lapack = 'openblas'
else:
Expand Down
15 changes: 14 additions & 1 deletion easybuild/easyblocks/t/tensorflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
from easybuild.tools.filetools import is_readable, read_file, which, write_file, remove_file
from easybuild.tools.modules import get_software_root, get_software_version, get_software_libdir
from easybuild.tools.run import run_cmd
from easybuild.tools.systemtools import X86_64, get_cpu_architecture, get_os_name, get_os_version
from easybuild.tools.systemtools import AARCH64, X86_64, get_cpu_architecture, get_os_name, get_os_version


CPU_DEVICE = 'cpu'
Expand Down Expand Up @@ -687,6 +687,19 @@ def configure_step(self):
cmd = self.cfg['preconfigopts'] + './configure ' + self.cfg['configopts']
run_cmd(cmd, log_all=True, simple=True)

# when building on Arm 64-bit we can't just use --copt=-mcpu=native (or likewise for any -mcpu=...),
# because it breaks the build of XNNPACK;
# see also https://github.com/easybuilders/easybuild-easyconfigs/issues/18899
if get_cpu_architecture() == AARCH64:
tf_conf_bazelrc = os.path.join(self.start_dir, '.tf_configure.bazelrc')
regex_subs = [
# use --per_file_copt instead of --copt to selectively use -mcpu=native (not for XNNPACK),
# the leading '-' ensures that -mcpu=native is *not* used when building XNNPACK;
# see https://github.com/google/XNNPACK/issues/5566 + https://bazel.build/docs/user-manual#per-file-copt
('--copt=-mcpu=', '--per_file_copt=-.*XNNPACK/.*@-mcpu='),
]
apply_regex_substitutions(tf_conf_bazelrc, regex_subs)

def patch_crosstool_files(self):
"""Patches the CROSSTOOL files to include EasyBuild provided compiler paths"""
inc_paths, lib_paths = [], []
Expand Down
39 changes: 26 additions & 13 deletions easybuild/easyblocks/u/ucx_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
@author: Mikael Öhman (Chalmers University of Techonology)
"""
from collections import defaultdict
from itertools import chain
import os

from easybuild.easyblocks.generic.configuremake import ConfigureMake
Expand All @@ -43,16 +44,37 @@ class EB_UCX_Plugins(ConfigureMake):
"""Support for building additional plugins for a existing UCX module"""

def __init__(self, *args, **kwargs):
"""Custom initialization for UCX: set correct module name."""
"""Custom initialization for UCX-Plugins."""
super(EB_UCX_Plugins, self).__init__(*args, **kwargs)
self.plugins = {}
self._plugins = None
self.makefile_dirs = []

@property
def plugins(self):
"""Property to determine list of plugins based on loaded dependencies, or return cached list of plugins."""
if self._plugins is None:
plugins = defaultdict(list)
dep_names = self.cfg.dependency_names()

if 'CUDAcore' in dep_names or 'CUDA' in dep_names:
for key in ('ucm', 'uct', 'ucx_perftest'):
plugins[key].append('cuda')

if 'GDRCopy' in dep_names:
plugins['uct_cuda'].append('gdrcopy')

if 'ROCm' in dep_names:
for key in ('ucm', 'uct', 'ucx_perftest'):
plugins[key].append('rocm')

self._plugins = dict(plugins)
self.log.info("Creating plugins for %s", ", ".join(sorted(set(chain(*plugins.values())))))
return self._plugins

def configure_step(self):
"""Customize configuration for building requested plugins."""
# make sure that required dependencies are loaded
ucxroot = get_software_root('UCX')
if not ucxroot:
if not get_software_root('UCX'):
raise EasyBuildError("UCX is a required dependency")

self.cfg['configure_cmd'] = 'contrib/configure-release'
Expand All @@ -62,30 +84,21 @@ def configure_step(self):
# omit the lib subdirectory since we are just installing plugins
configopts += '--libdir=%(installdir)s '

plugins = defaultdict(list)
cudaroot = get_software_root('CUDAcore') or get_software_root('CUDA')
if cudaroot:
configopts += '--with-cuda=%s ' % cudaroot
for key in ('ucm', 'uct', 'ucx_perftest'):
plugins[key].append('cuda')

gdrcopyroot = get_software_root('GDRCopy')
if gdrcopyroot:
plugins['uct_cuda'].append('gdrcopy')
configopts += '--with-gdrcopy=%s ' % gdrcopyroot

self.makefile_dirs.extend(os.path.join(x, 'cuda') for x in ('uct', 'ucm', 'tools/perf'))

# To be supported in the future:
rocmroot = get_software_root('ROCm')
if rocmroot:
for key in ('ucm', 'uct', 'ucx_perftest'):
plugins[key].append('rocm')
configopts += '--with-rocm=%s ' % rocmroot
self.makefile_dirs.extend(os.path.join(x, 'rocm') for x in ('uct', 'ucm', 'tools/perf'))

self.plugins = dict(plugins)

self.cfg.update('configopts', configopts)

super(EB_UCX_Plugins, self).configure_step()
Expand Down
2 changes: 2 additions & 0 deletions easybuild/easyblocks/w/wrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def det_wrf_subdir(wrf_version):

if LooseVersion(wrf_version) < LooseVersion('4.0'):
wrf_subdir = 'WRFV%s' % wrf_version.split('.')[0]
elif LooseVersion(wrf_version) >= LooseVersion('4.5.1'):
wrf_subdir = 'WRFV%s' % wrf_version
else:
wrf_subdir = 'WRF-%s' % wrf_version

Expand Down
3 changes: 3 additions & 0 deletions easybuild/easyblocks/w/wxpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ def sanity_check_step(self):
files.extend([os.path.join('bin', 'wxrc')])
dirs.extend(['include', 'share'])
py_bins.extend(['alacarte', 'alamode', 'wrap'])
elif LooseVersion(self.version) >= LooseVersion("4.2"):
majver = '3.2' # this is 3.2 in ver 4.2.x
py_bins.extend(['slices', 'slicesshell'])
elif LooseVersion(self.version) >= LooseVersion("4.1"):
majver = '3.1' # this is 3.1 in ver 4.1.x
py_bins.extend(['slices', 'slicesshell'])
Expand Down

0 comments on commit aeb061e

Please sign in to comment.