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.
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
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
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 specifying the number of threads at compile time:
upc -x upc -O2 -o helloworld1 helloworld1.upc ./vect_add -fupc-threads-4
To compile and run with a fixed number of threads (here, four THREADS):
upcc -O -T 4 -o helloworld1 helloworld1.upc upcrun. /helloworld1
To compile and run without specifying the number of threads at compile time:
upcc -O -o helloworld1 helloworld1.upc upcrun -n 4. /helloworld1
UPC: Distributed Shared Memory Programming, by Tarek El-Ghazawi, William Carlson, Thomas Sterling, and Katherine Yelick
Copyright © 2005 John Wiley & Sons, Inc.
3.16.130.201