fab.tools.tool_repository#

This file contains the ToolRepository class.

Classes

ToolRepository()

This class implements the tool repository.

class fab.tools.tool_repository.ToolRepository#

This class implements the tool repository. It stores a list of tools for various categories. For each compiler, it will automatically create a tool called “linker-{compiler-name}” which can be used for linking with the specified compiler.

Singleton access. Changes the value of _singleton so that the constructor can verify that it is indeed called from here.

add_tool(cls)#

Creates an instance of the specified class and adds it to the tool repository.

Parameters:

cls (Type[Any]) – the tool to instantiate.

get_tool(category, name)#
Return type:

Tool

Returns:

the tool with a given name in the specified category.

Parameters:
  • category (Category) – the name of the category in which to look for the tool.

  • name (str) – the name of the tool to find.

Raises:
  • KeyError – if there is no tool in this category.

  • KeyError – if no tool in the given category has the requested name.

set_default_compiler_suite(suite)#

Sets the default for linker and compilers to be of the given compiler suite.

Parameters:

suite (str) – the name of the compiler suite to make the default.

get_default(category, mpi=None, openmp=None)#

Returns the default tool for a given category. For most tools that will be the first entry in the list of tools. The exception are compilers and linker: in this case it must be specified if MPI support is required or not. And the default return will be the first tool that either supports MPI or not.

Parameters:
  • category (Category) – the category for which to return the default tool.

  • mpi (Optional[bool]) – if a compiler or linker is required that supports MPI. (default: None)

  • open – if a compiler or linker is required that supports OpenMP.

Raises:
  • KeyError – if the category does not exist.

  • RuntimeError – if no compiler/linker is found with the requested level of MPI support (yes or no).