[SOLVED] OpenMP doesn't work

Hello,

We built Abinit 9.4.1 with GNU compiler and mkl library on HPE Cray EX machine (128 CPUs per node) . we compiled it with following:

–enable-openmp=“yes”
–enable-mpi-io=“yes”
–with-linalg-flavor=mkl

We could run a job with MPI without problems. But when we run it with OpenMP threads by setting env variable:

“setenv OMP_NUM_THREADS 32”

the job completes OK but it always uses on 1 thread. We have following in an output file:

=== Multicore ===
Parallel build :
Parallel I/O : yes
openMP support : yes
GPU support :

==== OpenMP parallelism is OFF ====

mpi_procs: 4
omp_threads: 1

Can someone tell us:

  1. how to turn on “OpenMP parallelism” when running a job?
    or
  2. if we need recompile the program with more options?

Thanks,

Frank

Hi Frank,

Just to be sure, do you have the following configs :

  • for compilation ( GNU ) add : -fopenmp
  • enable OMP in LINALG_LIBS :

LINALG_LIBS="-L${MKLROOT}/lib/intel64 -lmkl_intel_lp64 -lmkl_intel_thread -lmkl_core -liomp5 -lpthread -lm -ldl"

jmb

Hi jmb,

I tried your suggestions above with GNU compiler, but could not compile the executables. However, when I switched to Intel compiler, with the LINALG_LIBS setting as you suggested and “-qopenmp” flag, I could make the executables which now turns on “OpenMP parallelism” as expected.

Thank you!

Frank

I didn’t realize you were using the GNU compiler

so there are 2 changes in LINALG_LIBS with GNU :

LINALG_LIBS="-L${MKLROOT}/lib/intel64 -lmkl_gf_lp64 -lmkl_gnu_thread -lmkl_core -liomp5 -lpthread -lm -ldl"

See also:

1 Like

Again, thanks for your suggestion. I could also compiled GNU version with the settings. Only thing I needed to change was to use “-lgomp” instead of “-liomp5”.

Frank