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
correctly configure R for BLAS/LAPACK & check configure output #1292
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,12 +26,15 @@ | |
EasyBuild support for building and installing R, implemented as an easyblock | ||
|
||
@author: Jens Timmerman (Ghent University) | ||
@author: Kenneth Hoste (Ghent University) | ||
""" | ||
import os | ||
import re | ||
from distutils.version import LooseVersion | ||
|
||
import easybuild.tools.environment as env | ||
from easybuild.easyblocks.generic.configuremake import ConfigureMake | ||
from easybuild.tools import environment | ||
from easybuild.tools.build_log import print_warning | ||
from easybuild.tools.modules import get_software_root | ||
from easybuild.tools.systemtools import get_shared_lib_ext | ||
|
||
|
@@ -55,19 +58,39 @@ def prepare_for_extensions(self): | |
self.cfg['exts_filter'] = EXTS_FILTER_R_PACKAGES | ||
|
||
def configure_step(self): | ||
"""Configuration step, we set FC, F77 is already set by EasyBuild to the right compiler, | ||
FC is used for Fortan90""" | ||
environment.setvar('FC', self.toolchain.get_variable('F90')) | ||
"""Custom configuration for R.""" | ||
|
||
# define $BLAS_LIBS to build R correctly against BLAS/LAPACK library | ||
# $LAPACK_LIBS should *not* be specified since that may lead to using generic LAPACK | ||
# see https://github.com/easybuilders/easybuild-easyconfigs/issues/1435 | ||
env.setvar('BLAS_LIBS', os.getenv('LIBBLAS_MT')) | ||
self.cfg.update('configopts', "--with-blas --with-lapack") | ||
|
||
# make sure correct config script is used for Tcl/Tk | ||
for dep in ['Tcl', 'Tk']: | ||
root = get_software_root(dep) | ||
if root: | ||
dep_config = os.path.join(root, 'lib', '%sConfig.sh' % dep.lower()) | ||
self.cfg.update('configopts', '-with-%s-config=%s' % (dep.lower(), dep_config)) | ||
self.cfg.update('configopts', '--with-%s-config=%s' % (dep.lower(), dep_config)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nasty typo here, this went undetected because the existing R easyconfigs already include |
||
|
||
out = ConfigureMake.configure_step(self) | ||
|
||
# check output of configure command to verify BLAS/LAPACK settings | ||
ext_libs_regex = re.compile("External libraries:.*BLAS\((?P<BLAS>.*)\).*LAPACK\((?P<LAPACK>.*)\)") | ||
res = ext_libs_regex.search(out) | ||
if res: | ||
for lib in ['BLAS', 'LAPACK']: | ||
if res.group(lib) == 'generic': | ||
warn_msg = "R will be built with generic %s, which will result in poor performance." % lib | ||
self.log.warning(warn_msg) | ||
print_warning(warn_msg) | ||
else: | ||
self.log.info("R is configured to use non-generic %s: %s", lib, res.group(lib)) | ||
else: | ||
warn_msg = "R is configured to be built without BLAS/LAPACK, which will result in (very) poor performance" | ||
self.log.warning(warn_msg) | ||
print_warning(warn_msg) | ||
|
||
ConfigureMake.configure_step(self) | ||
|
||
def make_module_req_guess(self): | ||
""" | ||
Add extra paths to modulefile | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am using
$LIBBLAS_MT
here, while existing R easyconfigs use$LIBBLAS
.This matter mainly when using Intel MKL, i.e. multithreaded vs sequential, see also the discussion in #202.
We could/should make this configurable, and stick to linking with the sequential BLAS library by default?