-
Notifications
You must be signed in to change notification settings - Fork 203
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
Conversation
toolchain['blas_family'] = None | ||
try: | ||
toolchain['lapack_family'] = tc.lapack_family() | ||
except: |
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.
do not use bare except'
toolchain['mpi_family'] = None | ||
try: | ||
toolchain['blas_family'] = tc.blas_family() | ||
except: |
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.
do not use bare except'
toolchain['compiler_family'] = None | ||
try: | ||
toolchain['mpi_family'] = tc.mpi_family() | ||
except: |
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.
do not use bare except'
toolchain['blas_family'] = None | ||
try: | ||
toolchain['lapack_family'] = tc.lapack_family() | ||
except: |
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.
do not use bare except'
toolchain['mpi_family'] = None | ||
try: | ||
toolchain['blas_family'] = tc.blas_family() | ||
except: |
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.
do not use bare except'
toolchain['compiler_family'] = None | ||
try: | ||
toolchain['mpi_family'] = tc.mpi_family() | ||
except: |
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.
do not use bare except'
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.
no newline at end of file
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 comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
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 comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
""" | ||
can_map = True | ||
# Check they have same capabilities | ||
for key in ['compiler_family', 'mpi_family','blas_family', 'lapack_family', 'cuda']: |
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.
missing whitespace after ','
@@ -615,3 +616,64 @@ 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 comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
if 'CUDA_CC' in tc.variables: | ||
toolchain['cuda'] = True | ||
else: | ||
toolchain['cuda'] = None # Useful to have it consistent with the rest |
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.
at least two spaces before inline comment
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.
no newline at end of file
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 comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
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 comment
The reason will be displayed to describe this comment to others. Learn more.
too many blank lines (2)
|
||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
""" | ||
can_map = True | ||
# Check they have same capabilities | ||
for key in ['compiler_family', 'mpi_family','blas_family', 'lapack_family', 'cuda']: |
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.
missing whitespace after ','
@@ -615,3 +616,64 @@ 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 comment
The reason will be displayed to describe this comment to others. Learn more.
expected 2 blank lines, found 1
if 'CUDA_CC' in tc.variables: | ||
toolchain['cuda'] = True | ||
else: | ||
toolchain['cuda'] = None # Useful to have it consistent with the rest |
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.
at least two spaces before inline comment
@boegel The last three points will require a major change in how --try-* works, I need to actually parse the easyconfigs so there are no templates and go in and replace values, i.e, we would need to replace the regex. |
for target_tc_spec in reversed(target_tc_hierarchy): | ||
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 comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like the hardcoded 'GCCcore'
but I also don't know where I can inherit that from
…re GCCcore does not appear in the target)
…re GCCcore does not appear in the target)
|
||
# TODO Replace the binutils version (if necessary) | ||
|
||
# TODO Determine the name of the modified easyconfig and dump it target_dir |
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.
no newline at end of file
|
||
return resolve_dependencies(ec, modtool) | ||
|
||
def map_toolchain_hierarchies(source_toolchain, target_toolchain, modtool): |
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
|
||
return minimal_matching_toolchain | ||
|
||
def get_dep_tree_of_toolchain(toolchain_spec, modtool): |
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
test/framework/tweak.py
Outdated
}) | ||
get_toolchain_hierarchy.clear() | ||
gcc_binutils_tc = {'name': 'GCC', 'version': '4.9.3-2.25'} | ||
iccifort_binutils_tc = {'name': 'iccifort', 'version': '2016.1.150-GCC-4.9.3-2.25'} |
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.
local variable 'iccifort_binutils_tc' is assigned to but never used
test/framework/tweak.py
Outdated
'robot_path': test_easyconfigs, | ||
}) | ||
get_toolchain_hierarchy.clear() | ||
gcc_binutils_tc = {'name': 'GCC', 'version': '4.9.3-2.25'} |
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.
local variable 'gcc_binutils_tc' is assigned to but never used
targetdir = tempfile.gettempdir() | ||
tweaked_spec = os.path.join(target_dir, ec_filename) | ||
parsed_ec.dump(tweaked_spec) | ||
_log.debug("Dumped easyconfig tweaked via --try-toolchain* to %s", tweaked_spec) |
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.
no newline at end of file
@@ -114,13 +136,23 @@ def tweak(easyconfigs, build_specs, modtool, targetdirs=None): | |||
# prepended path so that they are found first). | |||
# easyconfig files for dependencies are also generated but not included, they will be resolved via --robot | |||
# either from existing easyconfigs or, if that fails, from easyconfigs in the appended path | |||
|
|||
modifying_toolchain = False # TODO Remove this to enable all tests |
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.
at least two spaces before inline comment
test/framework/tweak.py
Outdated
}) | ||
get_toolchain_hierarchy.clear() | ||
gcc_binutils_tc = {'name': 'GCC', 'version': '4.9.3-2.25'} | ||
iccifort_binutils_tc = {'name': 'iccifort', 'version': '2016.1.150-GCC-4.9.3-2.25'} |
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.
local variable 'iccifort_binutils_tc' is assigned to but never used
test/framework/tweak.py
Outdated
'robot_path': test_easyconfigs, | ||
}) | ||
get_toolchain_hierarchy.clear() | ||
gcc_binutils_tc = {'name': 'GCC', 'version': '4.9.3-2.25'} |
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.
local variable 'gcc_binutils_tc' is assigned to but never used
targetdir = tempfile.gettempdir() | ||
tweaked_spec = os.path.join(target_dir, ec_filename) | ||
parsed_ec.dump(tweaked_spec) | ||
_log.debug("Dumped easyconfig tweaked via --try-toolchain* to %s", tweaked_spec) |
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.
no newline at end of file
@@ -114,13 +136,23 @@ def tweak(easyconfigs, build_specs, modtool, targetdirs=None): | |||
# prepended path so that they are found first). | |||
# easyconfig files for dependencies are also generated but not included, they will be resolved via --robot | |||
# either from existing easyconfigs or, if that fails, from easyconfigs in the appended path | |||
|
|||
modifying_toolchain = False # TODO Remove this to enable all tests |
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.
at least two spaces before inline comment
parsed_ec['ec'].dump(tweaked_spec) | ||
_log.debug("Dumped easyconfig tweaked via --try-toolchain* to %s", tweaked_spec) | ||
|
||
return tweaked_spec |
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.
no newline at end of file
parsed_ec['ec'].dump(tweaked_spec) | ||
_log.debug("Dumped easyconfig tweaked via --try-toolchain* to %s", tweaked_spec) | ||
|
||
return tweaked_spec |
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.
no newline at end of file
Get the dependency tree of a toolchain | ||
|
||
:param toolchain_spec: toolchain spec to get the dependencies of | ||
:param modtool: module tool used |
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.
clarify that this should be an instance of the ModulesTool
class?
test/framework/toy_build.py
Outdated
for modname in ['FFTW', 'OpenBLAS', 'ScaLAPACK']: | ||
regex = re.compile('load.*' + modname, re.M) | ||
self.assertTrue(regex.search(toy_modtxt), "Pattern '%s' found in: %s" % (regex.pattern, toy_modtxt)) | ||
self.assertFalse(regex.search(toy_modtxt), "Pattern '%s' not found in: %s" % (regex.pattern, toy_modtxt)) |
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.
line too long (121 > 120 characters)
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
@boegel Ready for re-review. The one item left is that there is no way to force mapping a toolchain only to the top-level of the target, e.g., for an easyconfig with an |
@boegel Would really like to see this included in 3.7.0 |
minor code cleanup
@boegel still does what it says on the tin |
Going in, thanks a lot for your work on this @ocaisa! |
The goal here is to increase the scope of
--try-toolchain-*
so that it can handle mapping the entire hierarchy of toolchains from the initial to the target toolchain.get_toolchain_hierarchy
binutils
update in an easyconfig that depends onGCCcore