C/C++
Portland Group C/C++
As on other Cray systems, the cc command will automatically link against MPI (-lmpi) and SciLib
(-lsci), so you don’t have to.
To build C/C++code for the Linux service nodes, you can call the PGI compilers directly. We strongly suggest that you don’t call the PGI compilers directly if you are building code to run on the compute nodes.
The PGI C compilers have two commands:
-
pgcc: C compiler, ANSI (89) and K&R C
-
pgCC: C++ compiler, ANSI C++ with
cfrontfeatures
pgcc does not currently support the ANSI 99 standard for C. For complex numbers, use pgCC.
C/C++ Options
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. |
| -Mbounds | Adds array bound checking. |
Optimization
For most cases, the usual levels of optimization are appropriate (-O0, -O1, -O2 [default], -O3). Here are a few exceptions.
| Option | Description |
|---|---|
| -fast | Chooses generally optimal flags for the target platform. Use pgcc -fast -help to see the equivalent switches.Note this sets the optimization level to a minimum of 2; see -O. |
| -fastsse | Chooses generally optimal flags for a processor that supports the streaming SIMD extensions (SSE) (Pentium 3/4, AthlonXP/MP, Opteron) and SSE2 (Pentium 4, Opteron) instructions. Use pgcc -fastsse -help to see the equivalent switches. |
| -tp k8-64 | Targets optimization to the 64-bit Opteron processor. |
| -Mflushz | Sets SSE to flush-to-zero mode. |
| -pg -ql -Mprof |
Instrument program for profiling. These flags imply different types of profiling. Please check the pgcc or pgCC man page for more information. |
| -Minfo | Generates an optimization report to standard error. This has several suboptions, so check the man page. |
| -mp | Enables the compiler to generate multithreaded code based on the OpenMP directives. |
C/C++ Documentation
See man cc or man CC for use of the Cray wrappers. See man pgcc or man pgCC for a full list of compiler options. PDF and HTML documentation is also available online from PGI at http://www.pgroup.com/resources/docs.htm. Documentation is also available from http://docs.cray.com.