This guide is intended to help Intel® C++ Compiler customers build the Berkeley* Unified Parallel C* (UPC*) compiler and configure it for use with symmetric multiprocessing (SMP) machines. UPC is a programming language that adds parallelization extensions to the C language.
This guide applies to version 2.4.0 of the Berkeley UPC runtime/front-end and UPC-to-C translator and the Intel® C++ Compiler version 10.0 for Linux*.
UPC adds extensions to C that follow the Partitioned Global Address Space* (PGAS*) programming model. UPC can be used in both shared memory and distributed memory environments. In either case, the physical memory configuration is abstracted and appears as shared memory to the programmer. Though the memory appears to be shared by all threads, each shared variable has a thread affinity that is controlled by the programmer and will help UPC determine where to store the variable physically.
More information about the UPC language and the Berkeley UPC compiler can be found at: http://upc.lbl.gov/
The source code can be found at: http://upc.lbl.gov/download/source.shtml
You will need both the Runtime/front-end package and the UPC-to-C translator. Please read and follow all licensing.
Note: Downloading the translator is not necessary if you use the remote translator provided by the Berkeley UPC website, but accessing the remote translator can be problematic for some users. For simplicity, this guide assumes that a local translator will be used.
After you download the source code, use the following commands to extract the archives:
Licensed users of the Intel compilers may download the most recent versions of the compiler from the Intel® Download Center which is accessed by logging into your account at the Intel® Registration Center.
Evaluation versions of the Intel compilers may be found at the Intel® Evaluation Software Center.
Hardware: This note has been tested on Intel® Pentium® D processors.
Software: This note applies to use of version 10.0 of the Intel C++ Compiler for Linux.
In order to use this guide, you will need to have the Intel C++ Compiler installed. After installing the compiler, you will need to execute one of the following commands, depending on your architecture, to set the environment variables.
Some minor source code changes are required to build the UPC translator with the Intel® compiler. You will need to edit the following file:
Comment out line number five:
/* detect unsupported C++ compilers */
You will also need to edit the following file:
Add an include directive after line 45 pointing to the limits.h file in your system's include directory, specifying the absolute path:
Now you should be ready to build UPC.
First, build the UPC-to-C translator. Execute the following commands in the directory where you downloaded the source code:
Replace <translator directory> in the above command with the directory where you would like to install the translator. If you omit the PREFIX, it will be installed to /usr/local/bupc_translator by default, assuming you have permission to write to that directory.
Next, build the runtime/front-end:
Replace <runtime directory> in the above command with the directory where you would like to install the UPC front-end. If the prefix option is omitted, the runtime/front-end will be installed to /usr/local/berkeley_upc by default. Wherever you choose to install it, make sure the directory <runtime directory>/bin is in your PATH environment variable.
You will need to edit some settings in the upcc.conf file. Change the default_network to setting to smp:
default_network = smp
Change the translator setting to point to the translator that you built, replacing <translator directory> with the directory in which you chose to install the translator:
Now you are ready to install the runtime/front-end:
The executable you will need for compiling UPC programs will be: <runtime directory>/bin/upcc
Running UPC is similar to running other command line compilers such as the Intel or GNU compilers. For example, a single UPC source file named source.c can be compiled with the following command:
upcc --pthreads source.c
The --pthreads switch tells UPC to use multiple threads on an SMP machine. The compiled executable file will be called a.out. This default filename can be changed with the -o <filename> option. For a list of available options, use the following command:
For a basic test that UPC is working, you can compile and run a simple UPC program like the one below:
printf("Thread %i of %i printing. ", MYTHREAD + 1, THREADS);
You can compile this program using the following command:
upcc --pthreads=2 -o upctest upctest.c
Specifying the -pthreads=2 option states explicitly that UPC should use two threads. This will allow you to verify that multithreading is working even if you are testing UPC on a single-core machine. However, normally it would be better to allow UPC to choose the appropriate number of threads at run-time by omitting the =2 part of the command. You can run the compiled executable like this:
The output you see should look something like:
UPCR: UPC threads 0..1 of 2 on computer1 (process 0 of 1, pid=15229)
This note demonstrates the use of UPC with the latest version 10.0 Intel C++ Compiler technology. Following this method will produce object files and libraries that are compatible with the latest Intel compilers. The UPC translator translates UPC code into C code. The C code is then compiled into an executable. By following this method, you will not only be compiling t he UPC front-end and translator with the Intel compiler, but the UPC front-end itself will also use the Intel compiler to compile the C code produced by the UPC-to-C translator. Therefore, you may see performance benefits in your UPC applications by using the Intel compiler, depending on the particular application.
There are no known issues or limitations with building UPC with the Intel C++ Compiler 10.0.
Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.
Notice revision #20110804