spack.compilers package¶
Submodules¶
spack.compilers.adaptor module¶
- class spack.compilers.adaptor.CompilerAdaptor(compiled_spec: Spec, compilers: Dict[Languages, Spec])[source]¶
Bases:
objectProvides access to compiler attributes via
Package.compiler. Useful for packages which do not yet access compiler properties viaself.spec[language].- property cc¶
- property cxx¶
- property f77¶
- property fc¶
- property name¶
- property stdcxx_libs¶
- property version¶
- class spack.compilers.adaptor.DeprecatedCompiler[source]¶
Bases:
DeprecatedProperty- factory(instance, owner) CompilerAdaptor[source]¶
- name¶
spack.compilers.config module¶
This module contains functions related to finding compilers on the system, and configuring Spack to use multiple compilers.
- spack.compilers.config.COMPILER_TAG¶
Tag used to identify packages providing a compiler
- class spack.compilers.config.CompilerFactory[source]¶
Bases:
objectClass aggregating all ways of constructing a list of compiler specs from config entries.
- static from_compilers_yaml(configuration: Configuration, *, scope: str | None = None) List[Spec][source]¶
Returns the compiler specs defined in the “compilers” section of the configuration
- class spack.compilers.config.CompilerRemover(configuration: Configuration)[source]¶
Bases:
objectRemoves compiler from configuration.
- flush()[source]¶
Removes from configuration the specs that have been marked by the previous call of
remove_compilers.
- mark_compilers(*, match: str, scope: str | None = None) List[Spec][source]¶
Marks compilers to be removed in configuration, and returns a corresponding list of specs.
- Parameters:
match – constraint that the compiler must match to be removed.
scope – scope where to remove the compiler. If None, all writeable scopes are checked.
- exception spack.compilers.config.NoAvailableCompilerError(message: str, long_message: str | None = None)[source]¶
Bases:
SpackError
- exception spack.compilers.config.UnknownCompilerError(compiler_name)[source]¶
Bases:
SpackError
- spack.compilers.config.add_compiler_to_config(new_compilers, *, scope=None) None[source]¶
Add a Compiler object to the configuration, at the required scope.
- spack.compilers.config.all_compilers(scope: str | None = None, init_config: bool = True) List[Spec][source]¶
Returns all the compilers from the current global configuration.
- Parameters:
scope – configuration scope from which to extract the compilers. If None, the merged configuration is used.
init_config – if True, search for compilers if none is found in configuration.
- spack.compilers.config.all_compilers_from(configuration: Configuration, scope: str | None = None) List[Spec][source]¶
Returns all the compilers from the current global configuration.
- Parameters:
configuration – configuration to be queried
scope – configuration scope from which to extract the compilers. If None, the merged configuration is used.
- spack.compilers.config.compilers_for_arch(arch_spec: ArchSpec, *, scope: str | None = None) List[Spec][source]¶
Returns the compilers that can be used on the input architecture
- spack.compilers.config.find_compilers(path_hints: List[str] | None = None, *, scope: str | None = None, max_workers: int | None = None) List[Spec][source]¶
Searches for compiler in the paths given as argument. If any new compiler is found, the configuration is updated, and the list of new compiler objects is returned.
- Parameters:
path_hints – list of path hints where to look for. A sensible default based on the
PATHenvironment variable will be used if the value is Nonescope – configuration scope to modify
max_workers – number of processes used to search for compilers
spack.compilers.error module¶
- exception spack.compilers.error.CompilerAccessError(compiler, paths)[source]¶
Bases:
SpackError
- exception spack.compilers.error.UnsupportedCompilerFlag(message, long_message=None)[source]¶
Bases:
SpackErrorRaised when a compiler does not support a flag type (e.g. a flag to enforce a language standard).
spack.compilers.flags module¶
- spack.compilers.flags.tokenize_flags(flags_values: str, propagate: bool = False) List[Tuple[str, bool]][source]¶
Given a compiler flag specification as a string, this returns a list where the entries are the flags. For compiler options which set values using the syntax
-flag value, this function groups flags and their values together. Any token not preceded by a-is considered the value of a prior flag.
spack.compilers.libraries module¶
- class spack.compilers.libraries.CompilerCache[source]¶
Bases:
objectBase class for compiler output cache. Default implementation does not cache anything.
- get(compiler: Spec) CompilerCacheEntry[source]¶
- class spack.compilers.libraries.CompilerCacheEntry(c_compiler_output: str | None)[source]¶
Bases:
objectDeserialized cache entry for a compiler
- c_compiler_output¶
- class spack.compilers.libraries.CompilerPropertyDetector(compiler_spec: Spec)[source]¶
Bases:
objectDetects compiler properties of a given compiler spec. Useful for compiler wrappers.
- compiler_verbose_output() str | None[source]¶
Get the compiler verbose output from the cache or by compiling a dummy C source.
- class spack.compilers.libraries.DefaultDynamicLinkerFilter(dynamic_linker: str | None)[source]¶
Bases:
objectRemove rpaths to directories that are default search paths of the dynamic linker.
- class spack.compilers.libraries.FileCompilerCache(cache: FileCache)[source]¶
Bases:
CompilerCacheCache for compiler output, which is used to determine implicit link paths, the default libc version, and the compiler version.
- get(compiler: Spec) CompilerCacheEntry[source]¶
- name¶
- spack.compilers.libraries.compiler_spec(node: Spec) Spec | None[source]¶
Returns a compiler
Specassociated with the node passed as argument.The function looks for a
c,cxx, andfortrancompiler in that order, and returns the first found. If the node does not depend on any of these languages, it returnsNone.Use of this function is discouraged, because a single spec can have multiple compilers associated with it, and this function only returns one of them. It can be better to refer to compilers on a per-language basis, through the language virtuals:
spec["c"],spec["cxx"], andspec["fortran"].
- spack.compilers.libraries.dynamic_linker_filter_for(node: Spec) DefaultDynamicLinkerFilter | None[source]¶