tags:

views:

327

answers:

4

Is it necessary to include omp.h in my C/C++ sources? Why? Or why not? Does the gcc compiler include it by default when used with the -fopenmp flag? It doesn't seem te make a differance.

+3  A: 

You only need it to call OMP APIs. If all you need are pragmas you don't need to include it.

bmargulies
+2  A: 

If you're using OpenMP functions in a given file, it is necessary for that file to include it. Otherwise it is not necessary.

Chuck
+1  A: 

If you want to perform open multi processing (open multi processing is an application programming interface) This supports multi platform shared memory multi processing. If we want to do this then only it is necessary to include that header file in your code

+3  A: 

The compiler flags (-openmp for Intel, -fopenmp for GCC) will not add it for you. If you need to use functions or types defined in this header, you will need to include it.

Neptune