You can use IRIS Power C (PCA) in two ways:
As a standalone analysis tool, pca(1). Passing options directly to PCA and using it as a standalone analyzer are explained in Chapter 3, “PCA Command-Line Options.” You can also refer to the pca(1) reference page for information.
As a phase of the C Compiler, cc(1). This chapter describes how to use Power C with the C compiler (cc) to produce code that runs in parallel. When you use Power C this way, you simply pass pca options to cc.
Table 1-1 lists the options you can pass to cc.
Table 1-1. Power C Options to cc
Option to cc | Function |
|---|---|
–pca | Run Power C Analyzer (pca) and the multiprocessing compiler (mpc) |
–pca list | All of the above plus generate a listing file |
–pca keep | All of the above plus keep the mp source file |
–WK,options | Pass options to pca |
–mp | Run the multiprocessing compiler only |
In many cases, you will invoke pca as an option to cc. You can also change the PCA default settings and pass options to pca as part of a cc compilation. To do this, just pass these options via the –WK mechanism. For more information on the cc compiler and the –WK options, refer to cc(1) in the IRIX User's Reference Manual.
The C compiler command-line syntax is:
cc [argument] -pca [list|keep] [–WK,–option[=value] [,–option[=value]]...] filename.c |
Each option and its description appears in Table 1-2.
Table 1-2. Power C Command-Line Options to cc
Option | Description |
|---|---|
cc | Invokes the C compiler that compiles, optimizes, assembles, and link edits the program. |
argument | Passes an argument to cc (see cc(1) for the arguments and their descriptions). |
–pca | Invokes the pca optimizer that concurrentizes C by restructuring certain parts of code and adding parallel programming directives where possible. |
list | Produces the annotated pca listing file, file.l. The content of this file varies depending on the value of the –lo command-line option (see “listoptions” in Chapter 3). The default is to produce no listing file. |
keep | Produces the file containing the concurrentized C source code, file.m, that is accepted by the compiler. |
–WK, | Allows you to pass pca options on the command line. Do not insert a space between –WK, and the option(s). If you specify multiple options, separate each with a comma (,). |
–option | Allows you to specify a pca command-line option listed in Table 1-3 and explained in Chapter 3, “PCA Command-Line Options.” |
value | Sets a value for a command-line option (see Chapter 3, “PCA Command-Line Options” for values). |
filename.c | Uses the specified file as the C source file. The file name must have a .c suffix. |
For example, to compile a C program with –pca and the option –lo=l, enter:
cc -pca -WK,-lo=l prog.c |
The –lo (listoptions) option is described in Chapter 3, “PCA Command-Line Options”.
You can generate several types of files when you compile your program. To generate a PCA listing file, use the list option. This option produces file.l, which contains the annotated pca listing of the parts of the program that can (and cannot) run in parallel on multiprocessors. Chapter 2, “How to Use IRIS Power C,” has an example of a listing file. The content of this file varies depending on the value of the –lo command-line option (see “listoptions” in Chapter 3). The default is to produce no listing file.
To generate a multiprocessing source file as well as a listing file, use the keep option. This option produces an intermediate file, file.M, that is accepted by the compiler. Chapter 2, “How to Use IRIS Power C” has an example of an intermediate multiprocessing source file.
You can find information about multiprocessing in the mpc(1) reference page. mpc is a source-to-source C translator that transforms code containing parallel directives, inserted by pca(1) or by hand, into parallel C code containing calls to the C multiprocessing library.
To pass options to PCA, send the –WK, option to cc. The options are listed in Table 1-3.
Table 1-3. PCA Command_line Options
Purpose | Long Name | Short Name | Default Value |
|---|---|---|---|
Run code in parallel | concurrentize noconcurrentize minconcurrent=n | conc nconc mc=n | concurrentize concurrentize minconcurrent=1000 |
Optimize code | arclimit=naddress_resolution_level=nlimit=nmachine=listnomachine optimize=nroundoff=nscalaropt=nsyntax=[a|k] unroll=nunroll2=n | arclm=narl=nlm=nma=listnma o=nr=nso=nsy=[a|k] ur=nur2=n | arclimit=2000 arl=1 limit=5000 machine=s machine=s optimize=5 roundoff=0 scalaropt=4 syntax=a unroll=4 unroll2=100 |
In-lining and Inter-procedure Analysis | inline[=names] ipa[=names] inline_create=fileipa_create=fileinline_from_files=listinline_from_libraries=listipa_from_files=listipa_from_libraries=listinline_depth[=n] inline_looplevel[=n] ipa_looplevel[=n] inline_manual ipa_manual | inl[=names] ipa[=names] incr=fileipacr=fileinff=listinfl=listipaff=listipafl=listind[=n] inll[=n] ipall[=n] inm ipam | (off) (off) (off) (off) current source file (off) current source file (off) ind=2 inll=2 ipall=2 (off) (off) |
Input/Output | cmp=filenocm p
input[=file] list=filenolist | cmp=filencmp i[=file] l=filenl | see text see text see text nolist nolist |
Listing | cmpoptions=listnocmpoptions lines=nlistoptions=listlistingwidth=<80|132> | cp=listncp ln=nlo=listlw=<80,132> | nocmpoptions nocmpoptions lines=55 (no listing) 80 |
Memory Management | cacheline=ncachesize=ndpregisters=nfpregisters=nsetassociativity=n | chl=nchs=ndpr=nfpr=nsasc=n | chl=64 chs=64 dpr=12 fpr=12 sasc=1 |
Invariant IF Floating | each_invariant_if_growth= nmax_invariant_if_growth=n | eiifg=nmiifg=n | eiifg=20 miifg=500 |
Command Line Options for Portability | DOLLAR FLOAT SIGNED VOLATILE PROCESSORS INLINE_AND_COPY STDIO |
P INLC STDIO | off off off off P=0 off off |
For more information on the command-line options, see Chapter 3, “PCA Command-Line Options.” For in-lining and interprocedural analysis (IPA), see Chapter 7, “In-lining and Interprocedural Analysis.”
This chapter described the pca options that you can pass to the cc compiler. You can also pass these options directly to PCA, and use it as a standalone analyzer. Chapter 3, “PCA Command-Line Options” explains each PCA option in detail and describes how to use the Analyzer.
Before turning to Chapter 3, “PCA Command-Line Options” however, continue with Chapter 2, “How to Use IRIS Power C,” which tells you how to interpret the .L and .M files, and explains how to use Power C to get more of a program to run in parallel.