OpenMP+MKL problem by using Pgfortran

hi all,
I need to use the Intel MKL PARDISIO in my program, and I also use the OpenMP to accelerate. So I compile and run my code by using Intel Fortran compiler and PGI Fortran compiler as follows:
ifort -extend-source -O3 -I/opt/intel/mkl/include -L/opt/intel/mkl/lib/intel64 -L/opt/intel/lib -lmkl_intel_lp64 -lmkl_core -liomp5 -lmkl_intel_thread -lpthread -openmp *.f *.F -o hello

Luckly, there is no problem, and I got the result.

pgfortran -L/opt/intel/mkl/lib/intel64 -L/opt/intel/lib/intel64 -lmkl_intel_lp64 -lmkl_core -liomp5 -lmkl_intel_thread -lpthread -O3 -mp=allcores -Mextend *.f *F -o hello

When I use the “-mp=allcores”, there always is error:“Segmentation fault”. Although I delete the “!omp” clause, that means I have no code need to accelerate, “Segmentation fault” error still exists!
If I delete the “-mp=allcores”, there is no problem.

Anyone’s help will be appreciated!

Hi Willkong,

There’s not enough information here to tell exactly what’s wrong, but we can try a few guesses.

  1. Often when I see this type of error, i.e. the program seg faults with -mp, it’s a stack overflow and you should try setting your shell’s stack size to unlimited. Using “-mp” has the side effect (even without !$OMP directives) of having automatics allocated on the stack rather than the heap. This can increase the amount of stack needed.

  2. I Have seen a few programs where it was writing off the end of a local automatic array. Without -mp, it didn’t cause an issue since in heap, there was some padding. But with -mp and now that automatics are on the stack, the error did cause issues since it started to overwrite other variables on the stack.

  3. Does MKL PARDISIO us OpenMP? The older PGI non-LLVM OpenMP runtime is not compatible Intel’s OpenOMP runtime. However, our new LLVM based compilers are compatible. What PGI version are you using? In PGI 19.1, LLVM became our default. If you are using PGI 18.1, try adding the flag “-Mllvm” or set your PATH to use “$PGI/linux86-64-llvm/”.