Meditation, The Art of Exploitation

Thinking? At last I have discovered it--thought; this alone is inseparable from me. I am, I exist--that is certain. But for how long? For as long as I am thinking. For it could be, that were I totally to cease from thinking, I should totally cease to exist....I am, then, in the strict sense only a thing that thinks.

Wednesday, April 04, 2007

openmp with gcc on fedora core 5

There are many code examples using openmp, but it is less obvious exactly how you can actually compile and experiment with openmp. On fedora core 5, gcc 4.1 already has openmp support through compiler modification and openmp library. Make sure you have libgomp installed. Using an openmp example from, you can compile the source code with the following command line:
g++ -fopenmp -fstrict-aliasing -fomit-frame-pointer -Wall -pedantic -ansi -g -O2 openmp_taylor.cpp -o openmp_taylor -lgomp

The important things to note here are -fopenmp (tells gcc to enable openmpp support by parsing openmpp #pragma directives) and -lgomp (the openmp library APIs).