About compiling the OpenMP code

Hi, all
I have a main program (main.f90) calling subroutine AA within OpenMP parallel do directive. And the subroutine AA using ACML’s dgetri was coded in another file sub.f90. May I compile this way?

pgf90 -c sub.f90
pgf90 -o a.x main.f90 sub.o -mp -lacml_mp

Or should I do like the following ?

pgf90 -c sub.f90 -mp -lacml_mp
pgf90 -o a.x main.f90 sub.o -mp -lacml_mp

What’s the difference, moreover, between flags -lacml_mp and -lacml ?
Thanks in advance.

Feng

Hi Feng,

If you are calling the ACML routines from an OpenMP region, use “-lacml”. If you are calling the routine from a serial region but want the routine itself to run in parallel use “-lacml_mp”.

Hope this helps,
Mat

Hi Mat,

I did call the ACML routines from a serial region and run it in parallel. Thank you for the clear advice. I can finally get the same results every time.

Feng