nvlink error in openacc


I am new to OpenAcc and I am facing the “nvlink error” while trying to parallelisze a C code given to me, since the job is official in nature I am not able to share the exact code.
But the error line is shared as below:

nvlink error : Undefined reference to ‘open_Data’ in ‘open.o’
pgacclnk: child process exit status 2: /opt/pgi/linux86-64/15.7/bin/pgnvd

kindly help!

Hi Sankha,

Most likely it’s the order of objects on the link line. NVLink needs dependent objects to come before their parent on the link line, so the object that contains the “open_Data” symbol needs to come before “open.o”.

Hope this helps,

Hello Mat,

I am using " pgcc -acc -fast -Minfo=all open.c hash.c -o open.o " for compiling, here the “open_Data” function is described at “open.c”, which is already before “open.o”.
I believe I am missing something here…am I missing any flags here during my compilation?


If open_Data() is a function that is called within a parallel region, it needs to either be inlined for compiled for acceleration, and marked with a #pragma acc routine pragma. Is that the case?

Yes, that is the case. The open_Data() function is inside a parallel region and hence I have marked open_Data() with #pragma acc routine seq