spack.platforms package

class spack.platforms.Darwin[source]

Bases: Platform

binary_formats = ['macho']

binary formats used on this platform; used by relocation logic

classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 89
setup_platform_environment(pkg, env)[source]

Specify deployment target based on target OS version.

The MACOSX_DEPLOYMENT_TARGET environment variable provides a default -mmacosx-version-min argument for GCC and Clang compilers, as well as the default value of CMAKE_OSX_DEPLOYMENT_TARGET for CMake-based build systems. The default value for the deployment target is usually the major version (11, 10.16, …) for CMake and Clang, but some versions of GCC specify a minor component as well (11.3), leading to numerous link warnings about inconsistent or incompatible target versions. Setting the environment variable ensures consistent versions for an install toolchain target, even when the host macOS version changes.

TODO: it may be necessary to add SYSTEM_VERSION_COMPAT for older versions of the macosx developer tools; see https://github.com/spack/spack/pull/26290 for discussion.

class spack.platforms.FreeBSD[source]

Bases: Platform

classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 102
class spack.platforms.Linux[source]

Bases: Platform

classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 90
class spack.platforms.Platform(name)[source]

Bases: object

Platform is an abstract class extended by subclasses.

Platform also contain a priority class attribute. A lower number signifies higher priority. These numbers are arbitrarily set and can be changed though often there isn’t much need unless a new platform is added and the user wants that to be detected first.

add_operating_system(name, os_class)[source]
add_target(name: str, target: Microarchitecture) None[source]
binary_formats = ['elf']

binary formats used on this platform; used by relocation logic

default: str
default_operating_system()[source]
default_os: str
default_target()[source]
deprecated_names = ['frontend', 'fe', 'backend', 'be']
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

operating_system(name)[source]
priority: int | None = None
reserved_oss = ['default_os', 'frontend', 'fe', 'backend', 'be']
reserved_targets = ['default_target', 'frontend', 'fe', 'backend', 'be']
setup_platform_environment(pkg, env)[source]

Platform-specific build environment modifications.

This method is meant toi be overridden by subclasses, when needed.

target(name)[source]
class spack.platforms.Test(name=None)[source]

Bases: Platform

default: str = 'core2'
default_os: str = 'debian6'
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 1000000
class spack.platforms.Windows[source]

Bases: Platform

classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 101
spack.platforms.by_name(name)[source]

Return a platform object that corresponds to the given name or None if there is no match.

Parameters:

name (str) – name of the platform

spack.platforms.host()

The current platform used by Spack. May be swapped by the use_platform context manager.

spack.platforms.reset()[source]

The result of the host search is memoized. In case it needs to be recomputed we must clear the cache, which is what this function does.

Submodules

spack.platforms.cray module

spack.platforms.cray.slingshot_network()[source]

spack.platforms.darwin module

class spack.platforms.darwin.Darwin[source]

Bases: Platform

binary_formats = ['macho']

binary formats used on this platform; used by relocation logic

default: str
default_os: str
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 89
setup_platform_environment(pkg, env)[source]

Specify deployment target based on target OS version.

The MACOSX_DEPLOYMENT_TARGET environment variable provides a default -mmacosx-version-min argument for GCC and Clang compilers, as well as the default value of CMAKE_OSX_DEPLOYMENT_TARGET for CMake-based build systems. The default value for the deployment target is usually the major version (11, 10.16, …) for CMake and Clang, but some versions of GCC specify a minor component as well (11.3), leading to numerous link warnings about inconsistent or incompatible target versions. Setting the environment variable ensures consistent versions for an install toolchain target, even when the host macOS version changes.

TODO: it may be necessary to add SYSTEM_VERSION_COMPAT for older versions of the macosx developer tools; see https://github.com/spack/spack/pull/26290 for discussion.

spack.platforms.freebsd module

class spack.platforms.freebsd.FreeBSD[source]

Bases: Platform

default: str
default_os: str
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 102

spack.platforms.linux module

class spack.platforms.linux.Linux[source]

Bases: Platform

default: str
default_os: str
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 90

spack.platforms.test module

class spack.platforms.test.Test(name=None)[source]

Bases: Platform

default: str = 'core2'
default_os: str = 'debian6'
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 1000000

spack.platforms.windows module

class spack.platforms.windows.Windows[source]

Bases: Platform

default: str
default_os: str
classmethod detect()[source]

Returns True if the host platform is detected to be the current Platform class, False otherwise.

Derived classes are responsible for implementing this method.

priority: int | None = 101