Posts

Showing posts from June, 2011

Multi-Core programming with OpenMP with GOMP

Compilation: Within the source, type the following. #pragma omp parallel for Before a for loop doing number crunching. Example from Wiki  http://en.wikipedia.org/wiki/OpenMP : int main ( int argc , char * argv [ ] ) { const int N = 100000 ; int i , a [ N ] ; #pragma omp parallel for for ( i = 0 ; i < N ; i ++ ) a [ i ] = 2 * i ; return 0 ; } Compile with -fopenmp i.e. gcc -fopenmp Link with gomp i.e. gcc -lgomp