CC
Synopsis
CC [-[no-]add-rpath
] [-[no-]add-rpath-shared
] [-[no-]add-runpath
] [--[no-]as-needed
] [--[no-]custom-ld-script
] [--cray-bypass-pkgconfig
] [--cray-print-opts
[=option]
] [--craype-append-opt
[=flag]
] [--craype-prepend-opt
[=flag]
] [-default64
] [-craympich-mt
] [-craype-verbose
] [-dynamic
] [-help
] [-shared
] [-static
] [-target-cpu
=cpu
] [-target-network
=network
] [-target-accel
=accelerator
] [Cray_options
|AMD_options
|GCC_options
|Intel_options
|Nvidia_options
]files
IMPLEMENTATION
Cray Linux Environment (CLE)
DESCRIPTION
The CC
command invokes the C++ compiler in the Cray Programming
Environment. The command links in the fundamental header files and
libraries provided for applications that run on a Cray system.
To see which Programming Environment (PrgEnv) is currently loaded, enter:
> module list
To see which Programming Environments are available on your system, enter:
> module avail PrgEnv
Cray recommends against calling the AMD, GCC, Intel, or Nvidia C compiler directly to build code intended for compute nodes, login nodes, or service nodes. If you choose to do this, you are responsible for properly constructing the link options.
The CC
command provides these options:
- -[no-]add-rpath
Controls whether or not
-Wl,-rpath
options are added for all pkg-config-generated-L
options and disables new dtags. This can be useful to lock in specific versions of libraries at runtime for dynamically linked applications. The -add-rpath option is ignored with the -shared option. In order to build a shared object (dynamic library), see the -add-rpath-shared option.Default: off
Controls whether or not
-Wl,-rpath
options are added for all pkg-config-generated-L
options and disables new dtags. This can be useful to lock in specific versions of libraries at runtime for dynamically linked applications. The -add-rpath-shared also affects builds targeting -shared object creation. This will create dynamic libraries that include RPATHs. This option is separate because some environments discourage or prohibit adding RPATHs to dynamic libraries.Default: off
- -[no-]add-runpath
Controls whether or not
-Wl,-rpath
options are added for all pkg-config-generated-L
options and enables new dtags. This can be useful to lock in specific versions of libraries at runtime for dynamically linked applications, while still allowing users to use alternate versions by settingLD_LIBRARY_PATH
.Default: off
- --[no-]as-needed
Controls whether or not
-l
options provided by the driver will be wrapped withWl,as-needed
and-Wl,-no-as-needed
when possible to minimize unnecessary dependencies when linking dynamically.Default: on
- --[no-]custom-ld-script[=script]
Controls whether or not CrayPE attempts to pass
ld
a custom linker script. If a script is provided, it will be used. Otherwise, a custom script will be used if beneficial.Default: on
- --cray-bypass-pkgconfig
Disable linking PE libraries via pkg-config.
- --cray-print-opts [=option]
Print the results generated by pkg-config, where option can be:
all
Print all include and library information.
cflags
Print include information.
cray_ld_library_path
Print a dynamically generated
CRAY_LD_LIBRARY_PATH
libs
Print library information
pcfiles
Print the pcfiles that pkg-config will be called with.
pkg_config_path
Print the
PKG_CONFIG_PATH
used.variables
Print the variable definitions that pkg-config will be called with.
- --craype-append-opt[=flag]
Add flag after all CrayPE-generated flags. This can effectively be used to override flags set by CrayPE.
- --craype-prepend-opt[=flag]
Add flag before all CrayPE-generated flags.
- Cray_options
Specify one or more options of the Cray C++ compiler command (CC). For a description of options, see the crayCC(1) man page and the Cray C and C++ Reference Manual.
- AMD_options
Specify one or more options of the AMD clang C++ compiler command (amdclang++). For a description of options, see
amdclang++ --help
.
- GCC_options
Specify one or more options of the GCC C++ compiler command (g++). For a description of available options, see the g++(1) man page and the Using the GNU Compiler Collection.
- Intel_options
Specify one or more options of the Intel C++ compiler command (icc). For a description of available options, see the icc(1) man page and the Intel® Parallel Studio user guide.
- Nvidia_options
Specify one or more options of the Nvidia C++ compiler command (nvc++). For a description of available options, see the nvc++(1) man page.
- files
Specifies the files to be compiled and/or linked.
- -craympich-mt
Directs the driver to link in an alternate version of the Cray-MPICH library which provides fine-grained multi-threading support to applications that perform MPI operations within threaded regions. See the intro_mpi(3) man page.
- -craype-verbose
Print the command which is forwarded to compiler invocation.
- -dynamic
Directs the compiler driver to link dynamic libraries at runtime, rather than linking static libraries in at compile time. The linker stores the internal name of the dynamic library in the executable file. The actual library that is loaded at runtime must have the same internal name, but may differ from the filename of the library found at link time. This option is used to create dynamically linked executable files and may not be used with the
-static
or-shared
options.
- -help
Display programming environment specific options.
Creates a library which may be dynamically linked at runtime.
- -static
Directs the linker to use the static version of the libraries, not the dynamic version of the libraries, to create an executable file.
- -target-cpu=cpu
Set CPU target. This setting overrides the default setting defined by the users’ module environment. To see which CPU targets are available on your system, enter this command:
>
module avail craype-
- -target-network=network
Set network target to either Aries, Gemini, Infiniband, or none. This setting overrides the default setting defined by the users’ module environment. To see which network targets are available on your system, enter this command:
>
module avail craype-network
- -target-accel=accelerator
Set accelerator target to either a specific GPU or host. This setting overrides the default setting defined by the users’ module environment. To see which accelerator targets are available on your system, enter this command:
>
module avail craype-accel
In addition, the following predefined macros are supported. These macro
values are set when the associated craype
module is loaded for
example, if craype-ivybridge
is loaded, -D__CRAY_cpu
is set to
-D__CRAY_IVYBRIDGE
but can be overridden by using the
-target
command line arguments listed above.
-D__CRAYsystem
Provided based on the network target used. For example, if the
craype-network-aries
module is loaded, this is set to-D__CRAYXC
.-D__CRAY_cpu
Provided based on the cpu target used. For example, if the
craype-sandybridge
module is loaded, this is set to-D__CRAY_SANDYBRIDGE
.-D__CRAY_accelerator
Provided based on the accelerator target used. For example if the
craype-accel-nvidia35
module is loaded, this is set to-D__CRAY_NVIDIA35
.
NOTES
The C++ compiler is part of the Cray, AMD, GCC, Intel, and Nvidia
compiler suites. Verify that the desired module (PrgEnv-cray
,
PrgEnv-amd
, PrgEnv-gnu
, PrgEnv-intel
, or PrgEnv-nvhpc
)
is loaded before attempting to compile.
CrayPE supports link line generation for the multi-threaded versions of the LibSci library based on the OpenMP option the user specifies with each compiler.
CCE 8.7.x or earlier by default links to the OpenMP LibSci library. CrayPE will link-in the serial version of LibSci when the CCE flag
-h noomp
is used.CCE 8.7.x or earlier by default uses
static
linking.CCE 9.0.x or later by default links to the serial version of the LibSci library. CrayPE will link-in the OpenMP version of LibSci when the CCE flag
-h omp
(Fortran) or-fopenmp
(C, C++) is used.CCE 9.0.x or later by default uses
dynamic
linking.CCE-SVE by default links to the serial version of the LibSci library. CrayPE will link-in the OpenMP version of LibSci when the CCE flag
-h omp
is used.GNU by default links to the serial LibSci library. CrayPE will link-in the OpenMP version of LibSci when the gcc flag
-f openmp
is used.INTEL by default links to the serial LibSci library. CrayPE will link-in the OpenMP version of LibSci when the Intel flag
-qopenmp
is used.
EXAMPLES
Example 1: Compiling a C++ CNL program
The first command compiles files proga.CC
and progb.CC
, creating
object files proga.o
and progb.o
. The second command links the
*.o
files and any required library files, producing executable
progab
.
% CC -c proga.CC progb.CC
% CC -o progab proga.o progb.o
ENVIRONMENT VARIABLES
- CRAY_LD_LIBRARY_PATH
The environment variable containing paths to be combined with
LD_LIBRARY_PATH
. It is designed for overriding the default path as provided by ld.so.cache (for systems that make use of CPE ld.so.cache), or to add search paths for the run-time linker for systems that do not make use of the CPE ld.so.cache.
- CRAYPE_LINK_TYPE
Specifies the default linking behavior. The valid values are:
dynamic
,shared
, orstatic
. The default value isdynamic
. This environment variable takes priority over the command line options
- CRAY_ADD_RPATH
Instruct the driver to add RPATHs for library dependencies resolved via PE pkg-config, excluding shared objects. This environment variable takes priority over the command line options
- CRAY_ADD_RUNPATH
Instruct the driver to add RUNPATHs for library dependencies resolved via PE pkg-config. This environment variable takes priority over the command line options
- CRAY_ADD_RPATH_SHARED
Instruct the driver to add RPATHs for library dependencies resolved via PE pkg-config, including for shared objects. This environment variable takes priority over the command line options
EXAMPLES
SEE ALSO
cc(1), ftn(1), aprun(1), intro_hugepages(1)