23

I am getting this warning during compilation of a C code with OpenMP directives on Linux:

warning: ignoring #pragma omp parallel

Gcc version is 4.4.

Is it only a warning I should not care about? Will the execution be in parallel?. I would like a solution with a some explanation.

I have provide -fopenmp with the make command, but gcc doesn't accept that, otherwise for single compilation of file, i.e. gcc -fopenmp works alright.

the swine
  • 10,713
  • 7
  • 58
  • 100

3 Answers3

39

IIRC you have to pass -fopenmp to the g++ call to actually enable OpenMP. This will also link against the OpenMP runtime system.

Manuel
  • 6,461
  • 7
  • 40
  • 54
0

Make sure that lib-gomp and lib-gomp-dev is installed. In some strange distributions it is removed. It is the essential runtime and development library.

Brandon Pelfrey
  • 2,449
  • 6
  • 22
  • 22
0

This is probably a resolved/closed issue, because indeed the most common reason for this warning is the omission of the -fopenmp flag.

However, when I came across this problem the root cause for this was that the module openmp was not loaded, meaning: load module openmp.

Elina_syr
  • 76
  • 5