The GUPC compiler is an extension to the GNU Compiler Collection distributed by the Free Software Foundation. In addition to the compile options specified here, all of the normal options listed in the man pages for the GNU GCC are available.
The GUPC compiler is integrated with the GCC compiler. The compiler processes input files through one or more of four stages: pre-processing, compilation, assembly, and linking.
Suffixes of source file names indicate the language and kind of processing to be done:
- UPC source; pre-process, compile, assemble
- Pre-processed UPC source; compile, assemble
- Pre-processor header file; not usually named on command line
- Files will be compiled as UPC source, unless preceded by -x c
- Pre-processed source code; compile, assemble
- Assembler source files; assemble
Files with other suffixes are passed to the linker. Common cases include:
- Object file
- Archive file
Linking is always the last stage unless you use one of the -c, -S, or -E options to avoid linking. Compilation errors also stop the process, and the linker is not invoked. For the link stage, all .o files correspond to source files, and all -l options correspond to libraries. Named .o object files, .a archives, and any file names unrecognized by gupc are passed to the linker in command-line order.
Number of Threads
Within a UPC program, the special identifier THREADS refers to the number of parallel execution threads. On each thread, the special identifier MYTHREAD refers to the thread number. The number of threads in a UPC application can be specified statically at compile-time or dynamically at execution time. Generally, the number of threads should not exceed the number of available physical central processing units or cores.
If the number of threads is specified statically at compile-time, then THREADS is a constant and can be used freely in any context where a constant is required by the C language specification (for example, in array dimensions in an array declaration). See the -fupc-threads-N compilation option.
If the number of threads is specified dynamically at execution time, the special symbol THREADS is assigned at runtime, and THREADS can be used in array declarations only if the array is qualified as shared and only if one and only one of the shared array’s dimensions is specified as an integral multiple of THREADS. See the -fupc-threads-N execution option.
Invoking GNU UPC
gupc [options] file ...
GNU UPC (GUPC) Options
GUPC accepts the following UPC-specific options.
- Print the commands executed to run the stages of compilation. Also print the version number of the compiler driver program.
- Print the GUPC version number.
- -x upc
- All source files ending in .upc, .c, or .upci will be compiled by the GUPC compiler. The -x upc option tells the compiler to process all of the following file names as UPC source code, ignoring the default language typically associated with filename extensions.
- Specify the number of threads at compile-time as N.
- Compile for the POSIX threads (pthreads) environment. Each UPC thread is implemented as a pthread.
- Inline UPC runtime library calls. This option is turned on by default when compiled with optimization and the -fno-upc-inline-lib option must be specified to turn it off. In general, inlining of the runtime library is more efficient but the generated code is more complex. Disabling this capability can sometimes be helpful when debugging the application, or when a compilation code generation error is suspected.
- Pre-include UPC runtime header files. This option is turned on by default. Use -fno-upc-pre-include to disable this pre-include facility.
- Produce symbolic debugging information.
- Generate UPC-specific symbolic DWARF-2 debugging information. This debugging information is processed by UPC-aware debuggers including GDB-UPC, a variant of the GDB debugger, and the commercially available TotalView debugger.
- Generate calls to the UPC runtime library that include source filename and line number information that is used to print more informative error messages when errors are detected at runtime.
- Instrument UPC shared accesses and library calls using GASP tool support. This option implies -fno-upc-inline-lib.
- Instrument functions calls using GASP tool support. This option implies -fupc-instrument and -fno-upc-inline-lib.
- -O0, -O1, -O2, -O3
- Specify the optimization level.
- Published: 10 November 2013