I'm currently trying to use OpenMP for parallel computing. I've written the following basic code. However it returns the following warning:
warning #2901: [omp] OpenMP is not active; all OpenMP directives will be ignored.
Changing the number of threads does not change the required running time since omp.h is ignored for some reason which is unclear to me.
Can someone help me out?
#include <stdio.h> #include <omp.h> #include <math.h> int main(void) { double ts; double something; clock_t begin = clock(); #pragma omp parallel num_threads(4) #pragma omp parallel for for (int i = 0; i<pow(10,7);i++) { something=sqrt(123456); } clock_t end = clock(); ts = (double)(end - begin) / CLOCKS_PER_SEC; printf("Time elpased is %f seconds", ts); } 