spack.compilers package

This module contains functions related to finding compilers on the system and configuring Spack to use multiple compilers.

class spack.compilers.CacheReference(val)[source]

Bases: object

This acts as a hashable reference to any object (regardless of whether the object itself is hashable) and also prevents the object from being garbage-collected (so if two CacheReference objects are equal, they will refer to the same object, since it will not have been gc’ed since the creation of the first CacheReference).

exception spack.compilers.CompilerDuplicateError(compiler_spec, arch_spec)[source]

Bases: SpackError

class spack.compilers.CompilerID(os, compiler_name, version)

Bases: tuple

Gathers the attribute values by which a detected compiler is considered unique in Spack.

  • os: the operating system

  • compiler_name: the name of the compiler (e.g. ‘gcc’, ‘clang’, etc.)

  • version: the version of the compiler

property compiler_name

Alias for field number 1

property os

Alias for field number 0

property version

Alias for field number 2

exception spack.compilers.CompilerSpecInsufficientlySpecificError(compiler_spec)[source]

Bases: SpackError

class spack.compilers.DetectVersionArgs(id, variation, language, path)

Bases: tuple

Groups together the arguments needed by detect_version. The four entries in the tuple are:

  • id: An instance of the CompilerID named tuple (version can be set to None

    as it will be detected later)

  • variation: a NameVariation for file being tested

  • language: compiler language being tested (one of ‘cc’, ‘cxx’, ‘fc’, ‘f77’)

  • path: full path to the executable being tested

property id

Alias for field number 0

property language

Alias for field number 2

property path

Alias for field number 3

property variation

Alias for field number 1

exception spack.compilers.InvalidCompilerConfigurationError(compiler_spec)[source]

Bases: SpackError

class spack.compilers.NameVariation(prefix, suffix)

Bases: tuple

Variations on a matched compiler name

property prefix

Alias for field number 0

property suffix

Alias for field number 1

exception spack.compilers.NoCompilerForSpecError(compiler_spec, target)[source]

Bases: SpackError

exception spack.compilers.NoCompilersError[source]

Bases: SpackError

exception spack.compilers.UnknownCompilerError(compiler_name)[source]

Bases: SpackError

spack.compilers.add_compilers_to_config(compilers, scope=None, init_config=True)[source]

Add compilers to the config for the specified architecture.

Parameters
  • compilers – a list of Compiler objects.

  • scope – configuration scope to modify.

spack.compilers.all_compiler_specs(scope=None, init_config=True)[source]
spack.compilers.all_compiler_types()[source]
spack.compilers.all_compilers(scope=None, init_config=True)[source]
spack.compilers.all_compilers_config(scope=None, init_config=True)[source]

Return a set of specs for all the compiler versions currently available to build with. These are instances of CompilerSpec.

spack.compilers.all_os_classes()[source]

Return the list of classes for all operating systems available on this platform

spack.compilers.arguments_to_detect_version_fn(operating_system, paths)[source]

Returns a list of DetectVersionArgs tuples to be used in a corresponding function to detect compiler versions.

The operating_system instance can customize the behavior of this function by providing a method called with the same name.

Parameters
Returns

List of DetectVersionArgs tuples. Each item in the list will be later mapped to the corresponding function call to detect the version of the compilers in this OS.

spack.compilers.class_for_compiler_name(compiler_name)[source]

Given a compiler module name, get the corresponding Compiler class.

spack.compilers.compiler_config_files()[source]
spack.compilers.compiler_for_spec(cspec_like, *args, **kwargs)[source]
spack.compilers.compiler_from_dict(items)[source]
spack.compilers.compiler_specs_for_arch(arch_spec, scope=None)[source]
spack.compilers.compilers_for_arch(arch_spec, scope=None)[source]
spack.compilers.compilers_for_spec(cspec_like, *args, **kwargs)[source]
spack.compilers.detect_version(detect_version_args)[source]

Computes the version of a compiler and adds it to the information passed as input.

As this function is meant to be executed by worker processes it won’t raise any exception but instead will return a (value, error) tuple that needs to be checked by the code dispatching the calls.

Parameters

detect_version_args (DetectVersionArgs) – information on the compiler for which we should detect the version.

Returns

A (DetectVersionArgs, error) tuple. If error is None the version of the compiler was computed correctly and the first argument of the tuple will contain it. Otherwise error is a string containing an explanation on why the version couldn’t be computed.

spack.compilers.find(cspec_like, *args, **kwargs)[source]
spack.compilers.find_compilers(path_hints=None)[source]

Return the list of compilers found in the paths given as arguments.

Parameters

path_hints (list or None) – list of path hints where to look for. A sensible default based on the PATH environment variable will be used if the value is None

spack.compilers.find_new_compilers(path_hints=None, scope=None)[source]

Same as find_compilers but return only the compilers that are not already in compilers.yaml.

Parameters
  • path_hints (list or None) – list of path hints where to look for. A sensible default based on the PATH environment variable will be used if the value is None

  • scope (str) – scope to look for a compiler. If None consider the merged configuration.

spack.compilers.find_specs_by_arch(cspec_like, *args, **kwargs)[source]
spack.compilers.get_compiler_config(scope=None, init_config=True)[source]

Return the compiler configuration for the specified architecture.

spack.compilers.get_compiler_duplicates(cspec_like, *args, **kwargs)[source]
spack.compilers.get_compilers(config, cspec=None, arch_spec=None)[source]
spack.compilers.is_mixed_toolchain(compiler)[source]

Returns True if the current compiler is a mixed toolchain, False otherwise.

Parameters

compiler (spack.compiler.Compiler) – a valid compiler object

spack.compilers.make_compiler_list(detected_versions)[source]

Process a list of detected versions and turn them into a list of compiler specs.

Parameters

detected_versions (list) – list of DetectVersionArgs containing a valid version

Returns

list of Compiler objects

Return type

list

spack.compilers.pkg_spec_for_compiler(cspec)[source]

Return the spec of the package that provides the compiler.

spack.compilers.remove_compiler_from_config(cspec_like, *args, **kwargs)[source]
spack.compilers.select_new_compilers(compilers, scope=None)[source]

Given a list of compilers, remove those that are already defined in the configuration.

spack.compilers.supported(cspec_like, *args, **kwargs)[source]
spack.compilers.supported_compilers()[source]

Return a set of names of compilers supported by Spack.

See available_compilers() to get a list of all the available versions of supported compilers.

Submodules

spack.compilers.aocc module

class spack.compilers.aocc.Aocc(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-aocc'
PrgEnv_compiler: Optional[str] = 'aocc'
property c11_flag
property c99_flag
cc_names: List[str] = ['clang']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cflags
property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['clang++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property cxxflags
property debug_flags
classmethod extract_version_from_output(output)[source]

Extracts the version from compiler’s output.

f77_names: List[str] = ['flang']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

classmethod f77_version(f77)[source]
fc_names: List[str] = ['flang']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

classmethod fc_version(fortran_compiler)[source]
property fflags
property openmp_flag
property opt_flags
required_libs = ['libclang']
property stdcxx_libs
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

spack.compilers.apple_clang module

class spack.compilers.apple_clang.AppleClang(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Clang

property c11_flag
property c17_flag
property c23_flag
property c99_flag
property cxx11_flag
property cxx14_flag
property cxx17_flag
property cxx20_flag
property cxx23_flag
classmethod extract_version_from_output(output)[source]

Extracts the version from compiler’s output.

openmp_flag = '-Xpreprocessor -fopenmp'
setup_custom_environment(pkg, env)[source]

Set the DEVELOPER_DIR environment for the Xcode toolchain.

On macOS, not all buildsystems support querying CC and CXX for the compilers to use and instead query the Xcode toolchain for what compiler to run. This side-steps the spack wrappers. In order to inject spack into this setup, we need to copy (a subset of) Xcode.app and replace the compiler executables with symlinks to the spack wrapper. Currently, the stage is used to store the Xcode.app copies. We then set the ‘DEVELOPER_DIR’ environment variables to cause the xcrun and related tools to use this Xcode.app.

spack.compilers.arm module

class spack.compilers.arm.Arm(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

property c11_flag
property c99_flag
cc_names: List[str] = ['armclang']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['armclang++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

f77_names: List[str] = ['armflang']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

classmethod f77_version(f77)[source]
fc_names: List[str] = ['armflang']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

classmethod fc_version(fc)[source]
property openmp_flag
property opt_flags
required_libs = ['libclang', 'libflang']
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = 'Arm C\\/C\\+\\+\\/Fortran Compiler version ([\\d\\.]+) '

Regex used to extract version from compiler’s output

spack.compilers.cce module

class spack.compilers.cce.Cce(*args, **kwargs)[source]

Bases: Compiler

Cray compiler environment compiler.

PrgEnv: Optional[str] = 'PrgEnv-cray'
PrgEnv_compiler: Optional[str] = 'cce'
property c11_flag
property c99_flag
cc_names: List[str] = ['craycc', 'cc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['crayCC', 'CC']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['crayftn', 'ftn']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['crayftn', 'ftn']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property is_clang_based
property openmp_flag
property stdcxx_libs
suffixes = ['-mp-\\d\\.\\d']
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = '[Cc]ray (?:clang|C :|C\\+\\+ :|Fortran :) [Vv]ersion.*?(\\d+(\\.\\d+)+)'

Regex used to extract version from compiler’s output

spack.compilers.clang module

class spack.compilers.clang.Clang(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

property c11_flag
property c17_flag
property c23_flag
property c99_flag
cc_names: List[str] = ['clang']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['clang++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
classmethod extract_version_from_output(output)[source]

Extracts the version from compiler’s output.

f77_names: List[str] = ['flang', 'gfortran', 'xlf_r']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

classmethod f77_version(f77)[source]
fc_names: List[str] = ['flang', 'gfortran', 'xlf90_r']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

classmethod fc_version(fc)[source]
openmp_flag = '-fopenmp'
property opt_flags
required_libs = ['libclang']
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

spack.compilers.clang.f77_mapping = [('gfortran', 'clang/gfortran'), ('xlf_r', 'xl_r/xlf_r'), ('xlf', 'xl/xlf'), ('pgfortran', 'pgi/pgfortran'), ('ifort', 'intel/ifort')]

compiler symlink mappings for mixed f77 compilers

spack.compilers.clang.fc_mapping = [('gfortran', 'clang/gfortran'), ('xlf90_r', 'xl_r/xlf90_r'), ('xlf90', 'xl/xlf90'), ('pgfortran', 'pgi/pgfortran'), ('ifort', 'intel/ifort')]

compiler symlink mappings for mixed f90/fc compilers

spack.compilers.dpcpp module

class spack.compilers.dpcpp.Dpcpp(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Oneapi

This is the same as the oneAPI compiler but uses dpcpp instead of icpx (for DPC++ source files). It explicitly refers to dpcpp, so that CMake test files which check the compiler name (e.g. CMAKE_CXX_COMPILER) detect it as dpcpp.

Ideally we could switch out icpx for dpcpp where needed in the oneAPI compiler definition, but two things are needed for that: (a) a way to tell the compiler that it should be using dpcpp and (b) a way to customize the link_paths

See also: https://www.intel.com/content/www/us/en/develop/documentation/oneapi-dpcpp-cpp-compiler-dev-guide-and-reference/top/compiler-setup/using-the-command-line/invoking-the-compiler.html

cxx_names: List[str] = ['dpcpp']

spack.compilers.fj module

class spack.compilers.fj.Fj(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

property c11_flag
property c99_flag
cc_names: List[str] = ['fcc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
property cxx98_flag
cxx_names: List[str] = ['FCC']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['frt']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['frt']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property openmp_flag
property opt_flags
required_libs = ['libfj90i', 'libfj90f', 'libfjsrcinfo']
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = '\\((?:FCC|FRT)\\) ([a-z\\d.]+)'

Regex used to extract version from compiler’s output

spack.compilers.gcc module

class spack.compilers.gcc.Gcc(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-gnu'
PrgEnv_compiler: Optional[str] = 'gcc'
property c11_flag
property c99_flag
cc_names: List[str] = ['gcc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
property cxx98_flag
cxx_names: List[str] = ['g++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
classmethod default_version(cc)[source]

Older versions of gcc use the -dumpversion option. Output looks like this:

4.4.7

In GCC 7, this option was changed to only return the major version of the compiler:

7

A new -dumpfullversion option was added that gives us what we want:

7.2.0
f77_names: List[str] = ['gfortran']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

classmethod f77_version(f77)[source]
fc_names: List[str] = ['gfortran']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

classmethod fc_version(fc)[source]

Older versions of gfortran use the -dumpversion option. Output looks like this:

GNU Fortran (GCC) 4.4.7 20120313 (Red Hat 4.4.7-18)
Copyright (C) 2010 Free Software Foundation, Inc.

or:

4.8.5

In GCC 7, this option was changed to only return the major version of the compiler:

7

A new -dumpfullversion option was added that gives us what we want:

7.2.0
property openmp_flag
property opt_flags
property prefix

Query the compiler for its install prefix. This is the install path as reported by the compiler. Note that paths for cc, cxx, etc are not enough to find the install prefix of the compiler, since the can be symlinks, wrappers, or filenames instead of absolute paths.

required_libs = ['libgcc', 'libgfortran']
property stdcxx_libs
suffixes = ['-mp-\\d+(?:\\.\\d+)?', '-\\d+(?:\\.\\d+)?', '\\d\\d']
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

spack.compilers.intel module

class spack.compilers.intel.Intel(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-intel'
PrgEnv_compiler: Optional[str] = 'intel'
property c11_flag
property c99_flag
cc_names: List[str] = ['icc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
cxx_names: List[str] = ['icpc']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['ifort']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['ifort']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property openmp_flag
property opt_flags
required_libs = ['libirc', 'libifcore', 'libifcoremt', 'libirng']
property stdcxx_libs
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = '\\((?:IFORT|ICC)\\) ([^ ]+)'

Regex used to extract version from compiler’s output

spack.compilers.msvc module

class spack.compilers.msvc.Msvc(*args, **kwargs)[source]

Bases: Compiler

cc_names: List[str] = ['cl']
property cl_version

Cl toolset version

cxx_names: List[str] = ['cl']
f77_names: List[str] = ['ifx']
classmethod f77_version(f77)[source]
fc_names: List[str] = ['ifx']
classmethod fc_version(fc)[source]
ignore_version_errors: Sequence[int] = [1]

Return values to ignore when invoking the compiler to get its version

property msvc_version

This is the VCToolset version NOT the actual version of the cl compiler For CL version, query Msvc.cl_version

property platform_toolset_ver

This is the platform toolset version of current MSVC compiler i.e. 142. This is different from the VC toolset version as established by short_msvc_version

setup_custom_environment(pkg, env)[source]

Set environment variables for MSVC using the Microsoft-provided script.

property short_msvc_version

This is the shorthand VCToolset version of form MSVC<short-ver> NOT the full version, for that see Msvc.msvc_version or MSVC.platform_toolset_ver for the raw platform toolset version

version_argument = ''

Compiler argument that produces version information

version_regex = '([1-9][0-9]*\\.[0-9]*\\.[0-9]*)'

Regex used to extract version from compiler’s output

property vs_root
spack.compilers.msvc.get_valid_fortran_pth(comp_ver)[source]

spack.compilers.nag module

class spack.compilers.nag.Nag(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

cc_names: List[str] = []
property cxx11_flag
cxx_names: List[str] = []
property debug_flags
property disable_new_dtags
property enable_new_dtags
f77_names: List[str] = ['nagfor']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

property f77_rpath_arg
fc_names: List[str] = ['nagfor']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property fc_rpath_arg
property linker_arg

Flag that need to be used to pass an argument to the linker.

property openmp_flag
property opt_flags
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '-V'

Compiler argument that produces version information

version_regex = 'NAG Fortran Compiler Release ([0-9.]+)'

Regex used to extract version from compiler’s output

spack.compilers.nvhpc module

class spack.compilers.nvhpc.Nvhpc(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-nvhpc'
PrgEnv_compiler: Optional[str] = 'nvhpc'
property c11_flag
property c99_flag
cc_names: List[str] = ['nvc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['nvc++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['nvfortran']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['nvfortran']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property openmp_flag
property opt_flags
required_libs = ['libnvc', 'libnvf']
property stdcxx_libs
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = 'nv[^ ]* (?:[^ ]+ Dev-r)?([0-9.]+)(?:-[0-9]+)?'

Regex used to extract version from compiler’s output

spack.compilers.oneapi module

class spack.compilers.oneapi.Oneapi(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-oneapi'
PrgEnv_compiler: Optional[str] = 'oneapi'
property c11_flag
property c99_flag
cc_names: List[str] = ['icx']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
property cxx17_flag
property cxx20_flag
cxx_names: List[str] = ['icpx']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['ifx']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['ifx']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

property openmp_flag
property opt_flags
required_libs = ['libirc', 'libifcore', 'libifcoremt', 'libirng', 'libsvml', 'libintlc', 'libimf', 'libsycl', 'libOpenCL']
setup_custom_environment(pkg, env)[source]

Set any environment variables necessary to use the compiler.

property stdcxx_libs
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '--version'

Compiler argument that produces version information

version_regex = '(?:(?:oneAPI DPC\\+\\+(?:\\/C\\+\\+)? Compiler)|(?:\\(IFORT\\))|(?:\\(IFX\\))) (\\S+)'

Regex used to extract version from compiler’s output

spack.compilers.pgi module

class spack.compilers.pgi.Pgi(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

PrgEnv: Optional[str] = 'PrgEnv-pgi'
PrgEnv_compiler: Optional[str] = 'pgi'
property c11_flag
property c99_flag
cc_names: List[str] = ['pgcc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
cxx_names: List[str] = ['pgc++', 'pgCC']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['pgfortran', 'pgf77']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

fc_names: List[str] = ['pgfortran', 'pgf95', 'pgf90']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

ignore_version_errors: Sequence[int] = [2]

Return values to ignore when invoking the compiler to get its version

property openmp_flag
property opt_flags
required_libs = ['libpgc', 'libpgf90']
property stdcxx_libs
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '-V'

Compiler argument that produces version information

version_regex = 'pg[^ ]* ([0-9.]+)-[0-9]+ (LLVM )?[^ ]+ target on '

Regex used to extract version from compiler’s output

spack.compilers.rocmcc module

class spack.compilers.rocmcc.Rocmcc(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Clang

PrgEnv: Optional[str] = 'PrgEnv-amd'
PrgEnv_compiler: Optional[str] = 'amd'
property c11_flag
property c99_flag
cc_names: List[str] = ['amdclang']
property cxx11_flag
property cxx14_flag
property cxx17_flag
cxx_names: List[str] = ['amdclang++']
classmethod extract_version_from_output(output)[source]

Extracts the version from compiler’s output.

f77_names: List[str] = ['amdflang']
classmethod f77_version(f77)[source]
fc_names: List[str] = ['amdflang']
classmethod fc_version(fortran_compiler)[source]
property stdcxx_libs

spack.compilers.xl module

class spack.compilers.xl.Xl(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Compiler

property c11_flag
property c99_flag
cc_names: List[str] = ['xlc']
property cc_pic_flag

Returns the flag used by the C compiler to produce Position Independent Code (PIC).

property cxx11_flag
property cxx14_flag
cxx_names: List[str] = ['xlC', 'xlc++']
property cxx_pic_flag

Returns the flag used by the C++ compiler to produce Position Independent Code (PIC).

property debug_flags
f77_names: List[str] = ['xlf']
property f77_pic_flag

Returns the flag used by the F77 compiler to produce Position Independent Code (PIC).

classmethod f77_version(f77)[source]
fc_names: List[str] = ['xlf90', 'xlf95', 'xlf2003', 'xlf2008']
property fc_pic_flag

Returns the flag used by the FC compiler to produce Position Independent Code (PIC).

classmethod fc_version(fc)[source]
property fflags
property openmp_flag
property opt_flags
property verbose_flag

This property should be overridden in the compiler subclass if a verbose flag is available.

If it is not overridden, it is assumed to not be supported.

version_argument = '-qversion'

Compiler argument that produces version information

version_regex = '([0-9]?[0-9]\\.[0-9])'

Regex used to extract version from compiler’s output

spack.compilers.xl_r module

class spack.compilers.xl_r.XlR(cspec, operating_system, target, paths, modules=None, alias=None, environment=None, extra_rpaths=None, enable_implicit_rpaths=None, **kwargs)[source]

Bases: Xl

cc_names: List[str] = ['xlc_r']
cxx_names: List[str] = ['xlC_r', 'xlc++_r']
f77_names: List[str] = ['xlf_r']
fc_names: List[str] = ['xlf90_r', 'xlf95_r', 'xlf2003_r', 'xlf2008_r']