GCC UPC

... Unified Parallel C

  • Increase font size
  • Default font size
  • Decrease font size

GCC UPC Sample Code

E-mail Print PDF

Once the compiler has been built and installed, try running the following simple test program:

mkdir ~/upctest
cd ~/upctest cat > hello.upc << EOF
#include <upc.h>
#include <stdio.h>
int main (int argc, char *argv[])
{
int i;
for (i = 0; i < THREADS; ++i)
{
upc_barrier;
if (i == MYTHREAD)
printf ("Hello world from thread: %d\n", MYTHREAD);
}
return 0;
}
EOF
$ upc -fupc-threads-4 hello.upc -o hello
$ ./hello

The output should appear as follows:

Hello world from thread: 0
Hello world from thread: 1
Hello world from thread: 2
Hello world from thread: 3

Last Updated on Sunday, 18 October 2009 02:12  

Downloads

download
latest version

4.3.2.5

search gccupc