Increase functionality of try_toolchain#2539
Conversation
| toolchain['blas_family'] = None | ||
| try: | ||
| toolchain['lapack_family'] = tc.lapack_family() | ||
| except: |
| toolchain['mpi_family'] = None | ||
| try: | ||
| toolchain['blas_family'] = tc.blas_family() | ||
| except: |
| toolchain['compiler_family'] = None | ||
| try: | ||
| toolchain['mpi_family'] = tc.mpi_family() | ||
| except: |
| toolchain['blas_family'] = None | ||
| try: | ||
| toolchain['lapack_family'] = tc.lapack_family() | ||
| except: |
| toolchain['mpi_family'] = None | ||
| try: | ||
| toolchain['blas_family'] = tc.blas_family() | ||
| except: |
| toolchain['compiler_family'] = None | ||
| try: | ||
| toolchain['mpi_family'] = tc.mpi_family() | ||
| 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 No newline at end of file |
| source_tc_spec['compiler_family'], target_compiler_family) | ||
|
|
||
|
|
||
| return minimal_matching_toolchain |
| target_compiler_family = target_tc_spec['compiler_family'] | ||
|
|
||
|
|
||
| if not minimal_matching_toolchain: |
|
|
||
| return can_map | ||
|
|
||
| def match_minimum_tc_specs(source_tc_spec, target_tc_hierarchy): |
| """ | ||
| can_map = True | ||
| # Check they have same capabilities | ||
| for key in ['compiler_family', 'mpi_family','blas_family', 'lapack_family', 'cuda']: |
| 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): |
| 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.
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 No newline at end of file |
| source_tc_spec['compiler_family'], target_compiler_family) | ||
|
|
||
|
|
||
| return minimal_matching_toolchain |
| target_compiler_family = target_tc_spec['compiler_family'] | ||
|
|
||
|
|
||
| if not minimal_matching_toolchain: |
|
|
||
| return can_map | ||
|
|
||
| def match_minimum_tc_specs(source_tc_spec, target_tc_hierarchy): |
| """ | ||
| can_map = True | ||
| # Check they have same capabilities | ||
| for key in ['compiler_family', 'mpi_family','blas_family', 'lapack_family', 'cuda']: |
| 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): |
| 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.
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.
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 No newline at end of file |
|
|
||
| return resolve_dependencies(ec, modtool) | ||
|
|
||
| def map_toolchain_hierarchies(source_toolchain, target_toolchain, modtool): |
|
|
||
| return minimal_matching_toolchain | ||
|
|
||
| def get_dep_tree_of_toolchain(toolchain_spec, modtool): |
| }) | ||
| 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.
local variable 'iccifort_binutils_tc' is assigned to but never used
| '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.
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) No newline at end of file |
| # 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.
at least two spaces before inline comment
| }) | ||
| 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.
local variable 'iccifort_binutils_tc' is assigned to but never used
| '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.
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) No newline at end of file |
| # 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.
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 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 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.
clarify that this should be an instance of the ModulesTool class?
| 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.
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_hierarchybinutilsupdate in an easyconfig that depends onGCCcore