C/C++

Cray C/C++

The C compiler on Phoenix is Cray C. It supports the C99 American National Standards Institute (ANSI) standard. The C++ compiler on Phoenix is Cray C++. It supports ANSI C++.

As on other Cray systems, the cc command will automatically link against the message passing interface (MPI) (-lmpi ) and SciLib (-lsci ), so you don’t have to.

C/C++ Options

General

Option Description
-h SSP Creates an executable that runs in single-streaming mode.
-h MSP Creates an executable that runs in multistreaming mode . This is the default.
-h command Creates an executable to run serially on a support node (login node).

 

 

 

 

 

Debugging

The following options control the amount of debugging information generated by the compiler. They can adversely affect optimization.

Option Description
-g Generates symbolic debug information. Turns off optimization.
-Gp Controls block-level debugging. Limits optimization.
-Gf Controls function-level debugging. Allows full optimization.

 

 

 

 

Optimization

For most cases, the usual levels of optimization are appropriate (-O0,
-O1,-O2
[default], -O3). Here are a few exceptions.

Option Description
-h list=m Generates a loopmark listing. The listing appears in a file with the suffix .lst. Loopmarks illustrate where optimization did and did not occur and why.
-h gen_private_callee Generates the code necessary to call each procedure from within a stream. With this option, the procedures may be called as usual or from within a multistreamed region.
-h upc Compiles Unified Parallel C (UPC).

 

 

 

 

 

 

 

Profiling

On many systems you must specify compiler options to create an executable that provides profiling data. On Phoenix you instead instrument an existing executable using the

pat_build

tool as follows:

pat_build <original_executable> <instrumented_executable>

You then run the instrumented executable, which produces a .xf file. Use pat_report to generate a profile.

pat_report <file>.xf

See

man pat_build

and

man pat_report

for more information on the types of profiles you can produce.

C/C++ Documentation

See

man cc

or

man CC

for use of the Cray wrappers. PDF and HTML documentation is also available online from Cray at the following URL.

http://docs.cray.com/

In particular, see the following documents:

  • Optimizing Applications on Cray X1 Series Systems
  • Cray C and C++ Reference Manual