spack.compilers package

Submodules

spack.compilers.cce module

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

Bases: spack.compiler.Compiler

Cray compiler environment compiler.

PrgEnv = 'PrgEnv-cray'
PrgEnv_compiler = 'cce'
cc_names = ['cc']
cxx_names = ['CC']
classmethod default_version(comp)
f77_names = ['ftn']
fc_names = ['ftn']
suffixes = ['-mp-\\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)

Bases: 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 Mac OS X, it looks like this:

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix
f77_names = ['gfortran']
classmethod f77_version(f77)
fc_names = ['gfortran']
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.gcc module

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

Bases: spack.compiler.Compiler

PrgEnv = 'PrgEnv-gnu'
PrgEnv_compiler = 'gcc'
cc_names = ['gcc']
cxx11_flag
cxx14_flag
cxx17_flag
cxx_names = ['g++']
f77_names = ['gfortran']
classmethod f77_version(f77)
fc_names = ['gfortran']
classmethod fc_version(fc)
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)

Bases: spack.compiler.Compiler

PrgEnv = 'PrgEnv-intel'
PrgEnv_compiler = 'intel'
cc_names = ['icc']
cxx11_flag
cxx14_flag
cxx_names = ['icpc']
classmethod default_version(comp)

The ‘–version’ option seems to be the most consistent one for intel compilers. Output looks like this:

icpc (ICC) 12.1.5 20120612
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.

or:

ifort (IFORT) 12.1.5 20120612
Copyright (C) 1985-2012 Intel Corporation.  All rights reserved.
f77_names = ['ifort']
fc_names = ['ifort']
openmp_flag
pic_flag
stdcxx_libs

spack.compilers.nag module

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

Bases: spack.compiler.Compiler

cc_names = []
cxx11_flag
cxx_names = []
classmethod default_version(comp)

The ‘-V’ option works for nag compilers. Output looks like this:

NAG Fortran Compiler Release 6.0(Hibiya) Build 1037
Product NPL6A60NA for x86-64 Linux
f77_names = ['nagfor']
f77_rpath_arg
fc_names = ['nagfor']
fc_rpath_arg
openmp_flag
pic_flag

spack.compilers.pgi module

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

Bases: spack.compiler.Compiler

PrgEnv = 'PrgEnv-pgi'
PrgEnv_compiler = 'pgi'
cc_names = ['pgcc']
cxx11_flag
cxx_names = ['pgc++', 'pgCC']
classmethod default_version(comp)

The ‘-V’ option works for all the PGI compilers. Output looks like this:

pgcc 15.10-0 64-bit target on x86-64 Linux -tp sandybridge
The Portland Group - PGI Compilers and Tools
Copyright (c) 2015, NVIDIA CORPORATION.  All rights reserved.
f77_names = ['pgfortran', 'pgf77']
fc_names = ['pgfortran', 'pgf95', 'pgf90']
openmp_flag
pic_flag

spack.compilers.xl module

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

Bases: spack.compiler.Compiler

cc_names = ['xlc']
cxx11_flag
cxx_names = ['xlC', 'xlc++']
classmethod default_version(comp)

The ‘-qversion’ is the standard option fo XL compilers. Output looks like this:

IBM XL C/C++ for Linux, V11.1 (5724-X14)
Version: 11.01.0000.0000

or:

IBM XL Fortran for Linux, V13.1 (5724-X16)
Version: 13.01.0000.0000

or:

IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0009

or:

IBM XL C/C++ Advanced Edition for Blue Gene/P, V9.0
Version: 09.00.0000.0017
f77_names = ['xlf']
classmethod f77_version(f77)
fc_names = ['xlf90', 'xlf95', 'xlf2003', 'xlf2008']
classmethod fc_version(fc)

The fortran and C/C++ versions of the XL compiler are always two units apart. By this we mean that the fortran release that goes with XL C/C++ 11.1 is 13.1. Having such a difference in version number is confusing spack quite a lot. Most notably if you keep the versions as is the default xl compiler will only have fortran and no C/C++. So we associate the Fortran compiler with the version associated to the C/C++ compiler. One last stumble. Version numbers over 10 have at least a .1 those under 10 a .0. There is no xlf 9.x or under currently available. BG/P and BG/L can such a compiler mix and possibly older version of AIX and linux on power.

fflags
openmp_flag
pic_flag

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)

Bases: spack.compiler.Compiler

cc_names = ['xlc_r']
cxx11_flag
cxx_names = ['xlC_r', 'xlc++_r']
classmethod default_version(comp)

The ‘-qversion’ is the standard option fo XL compilers. Output looks like this:

IBM XL C/C++ for Linux, V11.1 (5724-X14)
Version: 11.01.0000.0000

or:

IBM XL Fortran for Linux, V13.1 (5724-X16)
Version: 13.01.0000.0000

or:

IBM XL C/C++ for AIX, V11.1 (5724-X13)
Version: 11.01.0000.0009

or:

IBM XL C/C++ Advanced Edition for Blue Gene/P, V9.0
Version: 09.00.0000.0017
f77_names = ['xlf_r']
classmethod f77_version(f77)
fc_names = ['xlf90_r', 'xlf95_r', 'xlf2003_r', 'xlf2008_r']
classmethod fc_version(fc)

The fortran and C/C++ versions of the XL compiler are always two units apart. By this we mean that the fortran release that goes with XL C/C++ 11.1 is 13.1. Having such a difference in version number is confusing spack quite a lot. Most notably if you keep the versions as is the default xl compiler will only have fortran and no C/C++. So we associate the Fortran compiler with the version associated to the C/C++ compiler. One last stumble. Version numbers over 10 have at least a .1 those under 10 a .0. There is no xlf 9.x or under currently available. BG/P and BG/L can such a compiler mix and possibly older version of AIX and linux on power.

fflags
openmp_flag
pic_flag

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)

Bases: spack.error.SpackError

exception spack.compilers.CompilerSpecInsufficientlySpecificError(compiler_spec)

Bases: spack.error.SpackError

exception spack.compilers.InvalidCompilerConfigurationError(compiler_spec)

Bases: spack.error.SpackError

exception spack.compilers.NoCompilerForSpecError(compiler_spec, target)

Bases: spack.error.SpackError

exception spack.compilers.NoCompilersError

Bases: spack.error.SpackError

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

Add compilers to the config for the specified architecture.

Arguments:
  • 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 suppied 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.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.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.