Search code examples
c++copenmp

Is openmp included in stdio.h in c/c++?


I searched about openmp, and realised that some people includes omp.h and others do not. They just include stdio.h.

So my question is: Is openmp included in stdio.h so that we can use opemp if we only include it?

I think old openmp such as openmp2.0 need to be used with omp.h but openmp3.0 does not need to be so. but I'm not sure...


Solution

  • stdio.h does not contain omp.h.

    Your confusion may be because to use #pragma omp ... directives you do not have to include omp.h, so it means that you can write an OpenMP program without including omp.h.

    On the other hand, if you use any OpenMP runtime library function (e.g. omp_get_num_threads()) you have to include omp.h regardless of the version of OpenMP.