easybuild.tools.toolchain.toolchain module¶
The toolchain module with the abstract Toolchain class.
Creating a new toolchain should be as simple as possible.
Toolchain terminology¶
- Toolchain: group of development related utilities (eg compiler) and libraries (eg MPI, linear algebra)
- -> eg tc=Toolchain()
- Toolchain options : options passed to the toolchain through the easyconfig file
- -> eg tc.options
- Options : all options passed to an executable
- Flags: specific subset of options, typically involved with compilation
- -> eg tc.variables.CFLAGS
- LinkOptions: specific subset of options, typically involved with linking
- -> eg tc.variables.LIBBLAS
- TooclchainVariables: list of environment variables that are set when the toolchain is initialised
- and the toolchain options have been parsed.
-> eg tc.variables[‘X’] will be available as os.environ[‘X’]
Authors:
- Stijn De Weirdt (Ghent University)
- Kenneth Hoste (Ghent University)
-
class
easybuild.tools.toolchain.toolchain.Toolchain(name=None, version=None, mns=None, class_constants=None, tcdeps=None, modtool=None, hidden=False)¶ Bases:
objectGeneral toolchain class
-
CLASS_CONSTANTS_TO_RESTORE= None¶
-
CLASS_CONSTANT_COPIES= {}¶
-
NAME= None¶
-
OPTIONS_CLASS¶
-
SUBTOOLCHAIN= None¶
-
TOOLCHAIN_FAMILY= None¶
-
VARIABLES_CLASS¶ alias of
easybuild.tools.toolchain.toolchainvariables.ToolchainVariables
-
VERSION= None¶
-
add_dependencies(dependencies)¶ [DEPRECATED] Verify if the given dependencies exist, and return them.
This method is deprecated. You should pass the dependencies to the ‘prepare’ method instead, via the ‘deps’ named argument.
-
as_dict(name=None, version=None)¶ Return toolchain specification as a dictionary.
List of shared libraries (names, file names, paths) which are not allowed to be linked in any installed binary/library.
-
base_init()¶ Initialise missing class attributes (log, options, variables).
-
blas_family()¶ Return type of BLAS library used in this toolchain, or ‘None’ if BLAS is not supported.
-
cleanup()¶ Clean up after using this toolchain
-
comp_cache_compilers(cache_tool)¶ Determine list of relevant compilers for specified compiler caching tool. :param cache_tool: name of compiler caching tool :return: list of names of relevant compilers
-
comp_family()¶ Return compiler family used in this toolchain (abstract method).
-
compilers()¶ Return list of relevant compilers for this toolchain
-
definition()¶ Determine toolchain elements for given Toolchain instance.
-
det_short_module_name()¶ Determine module name for this toolchain.
-
generate_vars()¶ Convert the variables in simple vars
-
get_dependency_version(dependency)¶ Generate a version string for a dependency on a module using this toolchain
-
get_flag(name)¶ Get compiler flag for a certain option.
-
get_software_root(names)¶ Try to get the software root for all names
-
get_software_version(names, required=True)¶ Try to get the software version for all names
-
get_variable(name, typ=<class 'str'>)¶ Get value for specified variable. typ: indicates what type of return value is expected
-
handle_sysroot()¶ Extra stuff to be done when alternate system root is specified via –sysroot EasyBuild configuration option.
- Update $PKG_CONFIG_PATH to include sysroot location to pkg-config files (*.pc).
-
is_dep_in_toolchain_module(name)¶ Check whether a specific software name is listed as a dependency in the module for this toolchain.
-
is_deprecated()¶ Return whether or not this toolchain is deprecated.
-
is_required(name)¶ Determine whether this is a required toolchain element.
-
static
is_rpath_wrapper(path)¶ Check whether command at specified location already is an RPATH wrapper script rather than the actual command
-
is_system_toolchain()¶ Return boolean to indicate whether this toolchain is a system(/dummy) toolchain.
-
lapack_family()¶ Return type of LAPACK library used in this toolchain, or ‘None’ if LAPACK is not supported.
-
mpi_family()¶ Return type of MPI library used in this toolchain, or ‘None’ if MPI is not supported.
-
prepare(onlymod=None, deps=None, silent=False, loadmod=True, rpath_filter_dirs=None, rpath_include_dirs=None)¶ Prepare a set of environment parameters based on name/version of toolchain - load modules for toolchain and dependencies - generate extra variables and set them in the environment
Parameters: - deps – list of dependencies
- onlymod – boolean/string to indicate if the toolchain should only load the environment with module (True) or also set all other variables (False) like compiler CC etc (If string: comma separated list of variables that will be ignored).
- silent – keep quiet, or not (mostly relates to extended dry run output)
- loadmod – whether or not to (re)load the toolchain module, and the modules for the dependencies
- rpath_filter_dirs – extra directories to include in RPATH filter (e.g. build dir, tmpdir, …)
- rpath_include_dirs – extra directories to include in RPATH
-
prepare_compiler_cache(cache_tool)¶ Prepare for using specified compiler caching tool (e.g., ccache, f90cache)
Parameters: cache_tool – name of compiler caching tool to prepare for
-
prepare_rpath_wrappers(rpath_filter_dirs=None, rpath_include_dirs=None)¶ Put RPATH wrapper script in place for compiler and linker commands
Parameters: rpath_filter_dirs – extra directories to include in RPATH filter (e.g. build dir, tmpdir, …)
List of shared libraries (names, file names, paths) which must be linked in all installed binaries/libraries.
-
reset()¶ Reset this toolchain instance.
-
set_minimal_build_env()¶ Set up a minimal build environment, by setting (only) the $CC and $CXX environment variables.
-
set_options(options)¶ Process toolchain options
-
set_variables()¶ Do nothing? Everything should have been set by others Needs to be defined for super() relations
-
show_variables(offset='', sep='\n', verbose=False)¶ Pretty print the variables
-
symlink_commands(paths)¶ Create a symlink for each command to binary/script at specified path.
Parameters: paths – dictionary containing one or mappings, each one specified as a tuple: (<path/to/script>, <list of commands to symlink to the script>)
-
toolchain_family()¶ Return toolchain family for this toolchain.
-
variables_init()¶ Initialise toolchain variables.
-
-
easybuild.tools.toolchain.toolchain.env_vars_external_module(name, version, metadata)¶ Determine $EBROOT* and/or $EBVERSION* environment variables that can be set for external module, based on the provided name, version and metadata.
-
easybuild.tools.toolchain.toolchain.is_system_toolchain(tc_name)¶ Return whether toolchain with specified name is a system toolchain or not.