cusolver with openmp

greetings,
i am working on parallelizing a fortran code using both OpenMP and cusolver. Part of the code has been accelerated via OpenMP directives, and a matrix solution is performed using cusolverDN library thanks to C bindings of Fortran. The question is when i simply compile with:
pgfortran -mp -L/usr/local/cuda/lib64 -lcudart -lcusolver
the compilation aborts with the missing several GOMP functions error (like “/usr/local/cuda/lib64/libcusolver.so: undefined reference to `GOMP_critical_end’” and several others). However, when i compile with:
pgfortran -mp -lgomp -L/usr/local/cuda/lib64 -lcudart -lcusolver
the code works fine except that openMP libraries behave weird (kind of in confliction), such that the output of the following code:

!$OMP PARALLEL
!$ print*,omp_get_thread_num()
!$OMP END PARALLEL

turns out to be 0 for all the threads. Still, the solution is successful with good results. I guess cusolver was compiled with gnu compilers and gomp is the gnu openmp distribution, which seems to differ from the pgi’s openmp distribution. Is there a workaround other than compiling cusolver via pgi compiler (is it possible by the way. it is not open source, is it?) ?
thanks for the guidance

Hi CcengizZ,

turns out to be 0 for all the threads. Still, the solution is successful with good results. I guess cusolver was compiled with gnu compilers and gomp is the gnu openmp distribution, which seems to differ from the pgi’s openmp distribution. Is there a workaround other than compiling cusolver via pgi compiler (is it possible by the way. it is not open source, is it?)

Correct. The cuSolver that ships with the CUDA SDK was built using GNU and will only work under OpenMP when compiled with the GNU compilers.

To address this issue, we recently (as of PGI 17.7) began including a PGI built version of cuSolver on Linux x86 and Power that will work with PGI’s OpenMP. If you are using the PGI Community Edition, this support will be available in next month’s PGI 17.10 release.

You can use PGI convenience option, “-Mcudalib”, to link with the correct version. For example:

pgfortran -mp -Mcuda -Mcudalib=cusolver  ..files

Hope this helps,
Mat