O'Reilly logo

UPC: DISTRIBUTED SHARED MEMORY PROGRAMMING by Katherine Yelick, Thomas Sterling, William Carlson, Tarek El-Ghazawi

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

APPENDIX D

How to Compile and Run UPC Programs

In this appendix we give a few examples of how to compile and run UPC programs on a sample of the compilers available. These examples are intended to give the reader an idea of how to do so in general. Readers are encouraged to examine the programming manual of their target machines to become familiar with how to optimize the compilation and execution of their code through compiler switches and shell variables. Many of these manuals also provide extensive coverage of the performance tuning and debugging tools available on their target platform.

COMPILING AND RUNNING ON THE CRAY X1 UPC COMPILER

To compile and run with a fixed number of threads (here, four THREADS):

cc -h upc -X 4 -o helloworld1 helloworld1.upc

aprun -n 4. /helloworld1

To compile and run without specifying the number of threads at compile time:

cc -h upc -o helloworld1 helloworld1.upc

aprun -n 4. /helloworld1

COMPILING AND RUNNING ON THE HP-UPC COMPILER

To compile and run with a fixed number of threads (here, four THREADS):

upc -O2 -fthreads 4 -o helloworld1 helloworld1.upc

prun -n 4. /helloworld1

To compile and run without specifying the number of threads at compile time:

upc -O2 -o helloworld1 helloworld1.upc
prun -n 4. /helloworld1

COMPILING AND RUNNING ON THE SGI-INTREPID GCC-UPC COMPILER

To compile and run with a fixed number of threads (here, four THREADS):

upc -x upc -fupc-threads-4 -O2 -o helloworld1 helloworld1.upc

./vect_add

To compile and run without ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required