I am trying to learn parallelization with openMP in cpp. I am using the following test example
#pragma parallel for num_threads( 4 )
for ( int i = 0 ; i < N ; i++ ){
for ( int j = 0 ; j < 100000 ; j++ ){
data[ i ] = data[ i ] + ( double ) i ;
}
}
I am using 4 threads; with top ( in unix ) I should see then in the col %CPU 400% or something similar. But I get 100% what would be the case for serial execution. And if I measure the time there is no velocity gain compared to serial execution. I can not figure out what I am doing wrong.
-fopenmp?