spack.compilers package

Submodules

spack.compilers.arm module

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

ベースクラス: spack.compiler.Compiler

cc_names = ['armclang']
cxx11_flag
cxx14_flag
cxx17_flag
cxx_names = ['armclang++']
f77_names = ['armflang']
classmethod f77_version(f77)
fc_names = ['armflang']
classmethod fc_version(fc)
openmp_flag
pic_flag
version_argument = '--version'
version_regex = 'Arm C\\/C\\+\\+\\/Fortran Compiler version ([^ )]+)'

spack.compilers.cce module

class spack.compilers.cce.Cce(cspec, operating_system, target, paths, modules=[], alias=None, environment=None, extra_rpaths=None, **kwargs)

ベースクラス: spack.compiler.Compiler

Cray compiler environment compiler.

PrgEnv = 'PrgEnv-cray'
PrgEnv_compiler = 'cce'
cc_names = ['cc']
cxx11_flag
cxx_names = ['CC']
f77_names = ['ftn']
fc_names = ['ftn']
openmp_flag
pic_flag
suffixes = ['-mp-\\d\\.\\d']
version_argument = '-V'
version_regex = '[Vv]ersion.*?(\\d+(\\.\\d+)+)'

spack.compilers.clang module

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

ベースクラス: spack.compiler.Compiler

cc_names = ['clang']
cxx11_flag
cxx14_flag
cxx17_flag
cxx_names = ['clang++']
classmethod default_version(comp)

The --version option works for clang compilers. On most platforms, output looks like this:

clang version 3.1 (trunk 149096)
Target: x86_64-unknown-linux-gnu
Thread model: posix

On macOS, it looks like this:

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
classmethod extract_version_from_output(output)

Extracts the version from compiler's output.

f77_names = ['flang', 'gfortran', 'xlf_r']
classmethod f77_version(f77)
fc_names = ['flang', 'gfortran', 'xlf90_r']
classmethod fc_version(fc)
is_apple
openmp_flag
pic_flag
setup_custom_environment(pkg, env)

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.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.fj module

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

ベースクラス: spack.compiler.Compiler

cc_names = ['fcc']
cxx11_flag
cxx14_flag
cxx98_flag
cxx_names = ['FCC']
f77_names = ['frt']
fc_names = ['frt']
openmp_flag
pic_flag
version_argument = '--version'
version_regex = '\\((?:FCC|FRT)\\) ([\\d.]+)'

spack.compilers.gcc module

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

ベースクラス: spack.compiler.Compiler

PrgEnv = 'PrgEnv-gnu'
PrgEnv_compiler = 'gcc'
cc_names = ['gcc']
cxx11_flag
cxx14_flag
cxx17_flag
cxx98_flag
cxx_names = ['g++']
classmethod default_version(cc)

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 = ['gfortran']
classmethod f77_version(f77)
fc_names = ['gfortran']
classmethod fc_version(fc)

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
openmp_flag
pic_flag
stdcxx_libs
suffixes = ['-mp-\\d\\.\\d', '-\\d\\.\\d', '-\\d', '\\d\\d']

spack.compilers.intel module

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

ベースクラス: spack.compiler.Compiler

PrgEnv = 'PrgEnv-intel'
PrgEnv_compiler = 'intel'
cc_names = ['icc']
cxx11_flag
cxx14_flag
cxx_names = ['icpc']
f77_names = ['ifort']
fc_names = ['ifort']
openmp_flag
pic_flag
stdcxx_libs
version_argument = '--version'
version_regex = '\\((?:IFORT|ICC)\\) ([^ ]+)'

spack.compilers.nag module

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

ベースクラス: spack.compiler.Compiler

cc_names = []
cxx11_flag
cxx_names = []
f77_names = ['nagfor']
f77_rpath_arg
fc_names = ['nagfor']
fc_rpath_arg
openmp_flag
pic_flag
version_argument = '-V'
version_regex = 'NAG Fortran Compiler Release ([0-9.]+)'

spack.compilers.pgi module

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

ベースクラス: spack.compiler.Compiler

PrgEnv = 'PrgEnv-pgi'
PrgEnv_compiler = 'pgi'
cc_names = ['pgcc']
cxx11_flag
cxx_names = ['pgc++', 'pgCC']
f77_names = ['pgfortran', 'pgf77']
fc_names = ['pgfortran', 'pgf95', 'pgf90']
openmp_flag
pic_flag
suffixes = ['-?llvm']
version_argument = '-V'
version_regex = 'pg[^ ]* ([0-9.]+)-[0-9]+ (LLVM )?[^ ]+ target on '

spack.compilers.xl module

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

ベースクラス: spack.compiler.Compiler

cc_names = ['xlc']
cxx11_flag
cxx_names = ['xlC', 'xlc++']
f77_names = ['xlf']
classmethod f77_version(f77)
fc_names = ['xlf90', 'xlf95', 'xlf2003', 'xlf2008']
classmethod fc_version(fc)
fflags
openmp_flag
pic_flag
version_argument = '-qversion'
version_regex = '([0-9]?[0-9]\\.[0-9])'

spack.compilers.xl_r module

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

ベースクラス: spack.compilers.xl.Xl

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

Module contents

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

exception spack.compilers.CompilerDuplicateError(compiler_spec, arch_spec)

ベースクラス: spack.error.SpackError

exception spack.compilers.CompilerSpecInsufficientlySpecificError(compiler_spec)

ベースクラス: spack.error.SpackError

exception spack.compilers.InvalidCompilerConfigurationError(compiler_spec)

ベースクラス: spack.error.SpackError

exception spack.compilers.NoCompilerForSpecError(compiler_spec, target)

ベースクラス: spack.error.SpackError

exception spack.compilers.NoCompilersError

ベースクラス: spack.error.SpackError

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

Add compilers to the config for the specified architecture.

パラメータ
  • compilers (-) -- a list of Compiler objects.

  • scope (-) -- configuration scope to modify.

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

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()

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

spack.compilers.class_for_compiler_name(compiler_name)

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

spack.compilers.compiler_config_files()
spack.compilers.compiler_for_spec(cspec_like, *args, **kwargs)
spack.compilers.compiler_from_config_entry(items)
spack.compilers.compilers_for_arch(arch_spec, scope=None)
spack.compilers.compilers_for_spec(cspec_like, *args, **kwargs)
spack.compilers.find(cspec_like, *args, **kwargs)
spack.compilers.find_compilers(*paths)

Return a list of compilers found in the supplied paths. This invokes the find_compilers() method for each operating system associated with the host platform, and appends the compilers detected to a list.

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

Return the compiler configuration for the specified architecture.

spack.compilers.get_compiler_duplicates(cspec_like, *args, **kwargs)
spack.compilers.get_compilers(config, cspec=None, arch_spec=None)
spack.compilers.pkg_spec_for_compiler(cspec)

Return the spec of the package that provides the compiler.

spack.compilers.remove_compiler_from_config(cspec_like, *args, **kwargs)
spack.compilers.supported(cspec_like, *args, **kwargs)
spack.compilers.supported_compilers()

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.