Using libraries in parallel code with OpenMp

Dear friends,

I’m writing a parallel code using OpenMp. I have to assign a block of code to different threads, something like this:

program ABC
use omp_lib
!$omp parallel sections
!$omp section
.
.
!$omp section
.
.
!$end parallel section
end program ABC

Each section needs to use an external library XYZ. My doubt is that I’m not very sure in which part of the code I should incorporate the command “use XYZ.” Could you please help me with this doubt?

Many thanks in advance.

You must declare the use association of XYZ at the beginning of the program, before implicit none, as you’ve done with omp_lib.

@Rob777, many thanks for your help.

1 Like