-
Notifications
You must be signed in to change notification settings - Fork 204
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
Increase functionality of try_toolchain #2539
Changes from 8 commits
d5ba7d6
cb4904d
b0c5406
5259b4a
c7ddafe
21b3a53
d3aba89
46714a9
4a86c2b
a5f1d36
69080d3
7867ba9
444aea5
f256a32
619c9ff
9b20491
ee1eb88
1d07e4a
9abfe53
97e7d82
9d25494
46a7f7f
eddc050
e685231
f003b17
a40c2d6
cc2168c
53646aa
b060dfa
2073e38
b46b093
746471d
6c26f79
133b4c7
bb3bcde
a137e27
dd0a7dd
ae4d50e
059a621
1cf9d36
db1400a
583f047
6c13972
1f1b03d
0965f9a
5377ff8
61a0bcb
14d80b7
4d8b503
21a638c
07384d5
5569c50
b6942cc
6c49a39
67b816e
6b627a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,7 @@ | |
|
||
from easybuild.framework.easyconfig.default import get_easyconfig_parameter_default | ||
from easybuild.framework.easyconfig.easyconfig import EasyConfig, create_paths, process_easyconfig | ||
from easybuild.framework.easyconfig.easyconfig import get_toolchain_hierarchy | ||
from easybuild.tools.build_log import EasyBuildError, print_warning | ||
from easybuild.tools.config import build_option | ||
from easybuild.tools.filetools import read_file, write_file | ||
|
@@ -183,7 +184,7 @@ def __repr__(self): | |
tweaks['checksums'] = [] | ||
_log.warning("Tweaking version: checksums cleared, verification disabled.") | ||
|
||
# we need to treat list values seperately, i.e. we prepend to the current value (if any) | ||
# we need to treat list values separately, i.e. we prepend to the current value (if any) | ||
for (key, val) in tweaks.items(): | ||
|
||
if isinstance(val, list): | ||
|
@@ -615,3 +616,67 @@ def obtain_ec_for(specs, paths, fp=None): | |
return res | ||
else: | ||
raise EasyBuildError("No easyconfig found for requested software, and also failed to generate one.") | ||
|
||
|
||
def compare_toolchain_specs(source_tc_spec, target_tc_spec): | ||
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. expected 2 blank lines, found 1 |
||
""" | ||
Compare whether a source and target toolchain have compatible characteristics | ||
|
||
:param source_tc_spec: specs of source toolchain | ||
:param target_tc_spec: specs of target toolchain | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
can_map = True | ||
# Check they have same capabilities | ||
for key in ['compiler_family', 'mpi_family', 'blas_family', 'lapack_family', 'cuda']: | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if target_tc_spec[key] is None and source_tc_spec[key] is not None: | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
can_map = False | ||
break | ||
|
||
return can_map | ||
|
||
|
||
def match_minimum_tc_specs(source_tc_spec, target_tc_hierarchy): | ||
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. expected 2 blank lines, found 1 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. expected 2 blank lines, found 1 |
||
""" | ||
Match a source toolchain spec to the minimal corresponding toolchain in a target hierarchy | ||
|
||
:param source_tc_spec: specs of source toolchain | ||
:param target_tc_hierarchy: hierarchy of specs for target toolchain | ||
""" | ||
minimal_matching_toolchain = {} | ||
target_compiler_family = '' | ||
# Do a complete loop so we always end up with the minimal value in the hierarchy | ||
# hierarchy is given from lowest to highest, so need to reverse the order in the list | ||
for target_tc_spec in reversed(target_tc_hierarchy): | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if compare_toolchain_specs(source_tc_spec, target_tc_spec): | ||
# GCCcore has compiler capabilities but should only be used if the original toolchain was also GCCcore | ||
if (source_tc_spec['name'] != 'GCCcore' and target_tc_spec['name'] != 'GCCcore')\ | ||
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. I don't like the hardcoded |
||
or (source_tc_spec['name'] == 'GCCcore' and target_tc_spec['name'] == 'GCCcore'): | ||
minimal_matching_toolchain = {'name': target_tc_spec['name'], 'version': target_tc_spec['version']} | ||
target_compiler_family = target_tc_spec['compiler_family'] | ||
|
||
if not minimal_matching_toolchain: | ||
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. too many blank lines (2) 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. too many blank lines (2) |
||
raise EasyBuildError("No possible mapping from source toolchain spec %s to target toolchain hierarchy specs %s", | ||
source_tc_spec, target_tc_hierarchy) | ||
|
||
# Warn if we are changing compiler families, this is very likely to cause problems | ||
if target_compiler_family != source_tc_spec['compiler_family']: | ||
print_warning("Your request will results in a compiler family switch (%s to %s). Here be dragons!" % | ||
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.
Is this case covered by the tests? 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. The warning is triggered a number of times in the tests, there are plenty of 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. OK, but we should check for it in the tests at least once? You can capture messages that are printed via |
||
(source_tc_spec['compiler_family'], target_compiler_family)) | ||
|
||
return minimal_matching_toolchain | ||
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. too many blank lines (2) 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. too many blank lines (2) |
||
|
||
|
||
def map_toolchain_hierarchies(source_toolchain, target_toolchain): | ||
""" | ||
Create a map between toolchain hierarchy of the initial toolchain and that of the target toolchain | ||
|
||
:param source_toolchain: initial toolchain of the easyconfig(s) | ||
:param target_toolchain: target toolchain for tweaked easyconfig(s) | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
""" | ||
tc_mapping = {} | ||
initial_tc_hierarchy = get_toolchain_hierarchy(source_toolchain, require_capabilities=True) | ||
ocaisa marked this conversation as resolved.
Show resolved
Hide resolved
|
||
target_tc_hierarchy = get_toolchain_hierarchy(target_toolchain, require_capabilities=True) | ||
for toolchain_spec in initial_tc_hierarchy: | ||
tc_mapping[toolchain_spec['name']] = match_minimum_tc_specs(toolchain_spec, target_tc_hierarchy) | ||
|
||
return tc_mapping |
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.
expected 2 blank lines, found 1