Error Generating copyout(srcImg) [if not already present]', and 2)


When I use nvc++ to compile code file with openACC, I got the error information:

#include <opencv2/opencv.hpp>
#include <opencv2/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>

using namespace std;
using namespace cv;

int main(){

 cv::Mat srcImg=cv::imread("/home/testSpace/images/blue-mountains.jpg");

 cout<<"The file is not loaded or does not exist"<<endl;
 return -1;


 cout<<"Matrix"<<srcImg.rows<<" "<<srcImg.cols<<endl;

Mat duplicate(srcImg.rows,srcImg.cols, CV_8UC1,Scalar::all(255) );

int i,j=0;

#pragma acc enter data create(srcImg[0:srcImg.rows][0:srcImg.cols])

 #pragma acc update device(srcImg[:srcImg.rows][:srcImg.cols])
 #pragma acc parallel loop 
   #pragma acc loop



#pragma acc data copyout(srcImg[:srcImg.rows][:srcImg.cols])



// return 0;


40, Generating enter data create(srcImg)
45, Generating update device(srcImg)
Generating NVIDIA GPU code
45, #pragma acc loop gang /* blockIdx.x /
47, #pragma acc loop vector(128) /
threadIdx.x */
45, Generating implicit copyin(srcImg.step.p[:1],srcImg) [if not already present]
47, Loop is parallelizable
59, Generating copyout(srcImg) [if not already present]
T1 & cv::Mat::at(int, int):
1, include “opencv.hpp”
52, include “core.hpp”
59, include “mat.hpp”
3724, include “mat.inl.hpp”
1140, Generating implicit acc routine seq
Generating acc routine seq
Generating NVIDIA GPU code
cvflann::anyimpl::big_any_policy<std::__cxx11::basic_string<char, std::char_traits, std::allocator>>::print(std::basic_ostream<char, std::char_traits>&, void *const *):
1, include “opencv.hpp”
std::basic_ostream<T1, T2> & std::endl<char, std::char_traits>(std::basic_ostream<T1, T2> &):
1, include “opencv.hpp”
52, include “core.hpp”

My question is 1)why I got error information ’ Generating copyout(srcImg) [if not already present]', and 2) the result is Matrix810 1440 libgomp: TODO.

Hi glaciya2018,

2) the result is Matrix810 1440 libgomp: TODO.

I’m assuming you’re the same person who posted this question on stack overflow:

Same answer that I gave there in that you’ve most likely linked against the GNU OpenACC runtime (libgomp). Best guess is that it’s being brought in when you use ‘pgk-config’ to list the opencv2 libraries. I’d recommend you avoid doing this and only link with the libraries you need.

I also noticed that you added the “-nomp” flag. Presumably since we implicitly include our OpenMP runtime library, you were getting multiple defined references to the OpenMP runtime. If correct, then this is another sign that you’ve linked with libgomp. (GNU uses libgomp for both OpenMP and OpenACC).

1)why I got error information ’ Generating copyout(srcImg) [if not already present]’

Since you’re using unstructured data regions, the compiler needs to add the implicit copy clauses. Given OpenACC’s “present_or” semantics, at runtime the variable will be present and no data movement will occur.

However, you can remove the implicit copies by adding a “present” clause on the parallel loop, which tells the compiler to expect it to be present on the device. For example:

#pragma acc parallel loop present(srcImg)

Now this message may indicate another issue that you’ll encounter once you get your linking correct:

45, Generating implicit copyin(srcImg.step.p[:1],srcImg) [if not already present]

I don’t know the underlying structure of the “cv::Mat” type, but the compiler is seeing it as a class or struct. Hence my guess is that "srcImg[ ][ ]" may actually be an operator, and srcImg isn’t a 2D array. Hence how you’re using “create” and “update” may be problematic. Instead, you’d need to do a manual deep copy of the class in order to get the device copy to have the correct data layout.

Now given you probably don’t know the underlying data layout of a “cv:Mat”, it would be challenging to perform a deep copy to the device. I’d recommend you use CUDA Unified Memory by adding the “-gpu=managed” flag to you’re compilation and link flags. UM will have the CUDA driver implicitly manage data movement for all dynamically allocated data. Static objects still need to be managed via data directives, so you may still need to include “srcImg” in a data directive (without the brackets), but you wont need to manage the class’ underlying dynamic data.


Hello Mat,

Many thanks for your help. 1)With your suggestion, I reviewed the code and found the image should be transformed into 2d matrix instead of 3d matrix.
2)And when I removed -nomp the error still comes out. I just have one doubt whether there is any problem on the openacc directive. I will make more tests .

Hello Mat,

After several tests, there is no luck in the result. with or without -nomp it doesn’t change the final output. And I made a test which is about adding pkg-config opencv4 --cflags --libs or without adding pkg-config opencv4 --cflags --libs. It turns out that without pkg-config opencv4 --cflags --libs the result can show the value of variables.

Based on test above,could I think whether I should use nvc++ or pgc++ to compile the opencv during installation? Because I took a look at the reference library of opencv, all of the library files point to gnu, I guess that the opencv is built by GCC or g++ by using GNU software.

I wish you could provide any suggestions.

This is the test I use with and without opencv lib

#define N 5

using namespace std;

int main(){

int a[N];
int i,j=0;

#pragma acc data copyin(a[:N],i,j) //present(i,j)


    #pragma kernels present(a[:N],j,i)
for(int i=0;i<N;i++){
      // #pragma acc loop //present(i,j)
	for(int j=0;j<N;j++){


#pragma acc data copyout(a[:N],j,i)



Thanks in advance.

You can, but it shouldn’t be necessary. We’re object compatible with GNU, so you should be able to just link in the OpenCV libraries.

Again, what I’m guess is happening is that when you run the pkg-config command, it’s returning more than just the OpenCV libraries, but also libgomp. Since this is put before our OpenACC runtime on the link line, the linker is resolving the OpenACC symbols from the GNU OpenACC runtime.

What I suggest you try is running the “pkg-config opencv4 --cflags --libs” by itself, then explicitly add just the needed libraries to your link line.

Can you please post the output from “pkg-config opencv4 --cflags --libs”? Again, I just guessing here, but if I can see what the output is, it would help to confirm my theory.


Hello Mat,

Thanks for your reply.

Please take a look at the result by using “pkg-config opencv4 --cflags --libs” :

$ pkg-config opencv4 --cflags --libs


Thanks. I’m not seeing that the GOMP library is being added directly, but there may be a dependency in there someplace.

Does the output from the command “ldd <binary_name>” so any references to

I’m not sure what it would entail, but you can try building OpenCV with nvc++.

Hello Mat,

Please take a look at the information below :

From the information: => /lib/x86_64-linux-gnu/ (0x00007fba7d91e000

$ ldd testi_opencv (0x00007ffded20f000) => /lib/x86_64-linux-gnu/ (0x00007fba88cca000) => /lib/x86_64-linux-gnu/ (0x00007fba88c5c000) => /lib/x86_64-linux-gnu/ (0x00007fba88c37000) => /lib/x86_64-linux-gnu/ (0x00007fba88bf5000) => /lib/x86_64-linux-gnu/ (0x00007fba88b8a000) => /lib/x86_64-linux-gnu/ (0x00007fba88b7d000) => /lib/x86_64-linux-gnu/ (0x00007fba88b6c000) => /lib/x86_64-linux-gnu/ (0x00007fba88b4f000) => /lib/x86_64-linux-gnu/ (0x00007fba88b35000) => /lib/x86_64-linux-gnu/ (0x00007fba88a96000) => /lib/x86_64-linux-gnu/ (0x00007fba88a8b000) => /lib/x86_64-linux-gnu/ (0x00007fba88a6a000) => /lib/x86_64-linux-gnu/ (0x00007fba88a5c000) => /lib/x86_64-linux-gnu/ (0x00007fba88a48000) => /lib/x86_64-linux-gnu/ (0x00007fba88a2b000) => /lib/x86_64-linux-gnu/ (0x00007fba889fc000) => /lib/x86_64-linux-gnu/ (0x00007fba889e2000) => /lib/x86_64-linux-gnu/ (0x00007fba889b5000) => /lib/x86_64-linux-gnu/ (0x00007fba888fb000) => /lib/x86_64-linux-gnu/ (0x00007fba888cb000) => /lib/x86_64-linux-gnu/ (0x00007fba8889a000) => /lib/x86_64-linux-gnu/ (0x00007fba8886d000) => /lib/x86_64-linux-gnu/ (0x00007fba88852000) => /lib/x86_64-linux-gnu/ (0x00007fba88845000) => /lib/x86_64-linux-gnu/ (0x00007fba88818000) => /lib/x86_64-linux-gnu/ (0x00007fba88795000) => /lib/x86_64-linux-gnu/ (0x00007fba88743000) => /lib/x86_64-linux-gnu/ (0x00007fba884f4000) => /lib/x86_64-linux-gnu/ (0x00007fba8847b000) => /lib/x86_64-linux-gnu/ (0x00007fba8840c000) => /lib/x86_64-linux-gnu/ (0x00007fba880e5000) => /lib/x86_64-linux-gnu/ (0x00007fba880d6000) => /lib/x86_64-linux-gnu/ (0x00007fba88018000) => /lib/x86_64-linux-gnu/ (0x00007fba87fbc000) => /lib/x86_64-linux-gnu/ (0x00007fba87f3b000) => /lib/x86_64-linux-gnu/ (0x00007fba87ece000) => /lib/x86_64-linux-gnu/ (0x00007fba87c5e000) => /lib/x86_64-linux-gnu/ (0x00007fba87be4000) => /lib/x86_64-linux-gnu/ (0x00007fba87bca000) => /lib/x86_64-linux-gnu/ (0x00007fba87b64000) => /lib/x86_64-linux-gnu/ (0x00007fba87991000) => /lib/x86_64-linux-gnu/ (0x00007fba87936000) => /lib/x86_64-linux-gnu/ (0x00007fba87862000) => /lib/x86_64-linux-gnu/ (0x00007fba87803000) => /lib/x86_64-linux-gnu/ (0x00007fba877b8000) => /lib/x86_64-linux-gnu/ (0x00007fba876e5000) => /lib/x86_64-linux-gnu/ (0x00007fba8713e000) => /lib/x86_64-linux-gnu/ (0x00007fba86d8c000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba86b1b000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba86905000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba865d5000) => /lib/x86_64-linux-gnu/ (0x00007fba865cf000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba863b8000) => /lib/x86_64-linux-gnu/ (0x00007fba863ac000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba861a1000) => /lib/x86_64-linux-gnu/ (0x00007fba85fbf000) => /lib/x86_64-linux-gnu/ (0x00007fba85f9c000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba85b95000) => /opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ (0x00007fba85932000) => /lib/x86_64-linux-gnu/ (0x00007fba8573e000) => /lib/x86_64-linux-gnu/ (0x00007fba85723000) => /lib/x86_64-linux-gnu/ (0x00007fba855d4000) => /lib/x86_64-linux-gnu/ (0x00007fba84e23000) => /lib/x86_64-linux-gnu/ (0x00007fba84d1e000) => /lib/x86_64-linux-gnu/ (0x00007fba84bf9000) => /lib/x86_64-linux-gnu/ (0x00007fba84bd1000) => /lib/x86_64-linux-gnu/ (0x00007fba84b71000) => /lib/x86_64-linux-gnu/ (0x00007fba84a48000) => /lib/x86_64-linux-gnu/ (0x00007fba84989000) => /lib/x86_64-linux-gnu/ (0x00007fba84885000) => /lib/x86_64-linux-gnu/ (0x00007fba84506000) => /lib/x86_64-linux-gnu/ (0x00007fba841d8000) => /lib/x86_64-linux-gnu/ (0x00007fba83ee0000)
	/lib64/ (0x00007fba88dc5000) => /lib/x86_64-linux-gnu/ (0x00007fba83e66000) => /lib/x86_64-linux-gnu/ (0x00007fba83d1f000) => /lib/x86_64-linux-gnu/ (0x00007fba83d0d000) => /lib/x86_64-linux-gnu/ (0x00007fba83cfc000) => /lib/x86_64-linux-gnu/ (0x00007fba83cbe000) => /lib/x86_64-linux-gnu/ (0x00007fba826fd000) => /lib/x86_64-linux-gnu/ (0x00007fba82481000) => /lib/x86_64-linux-gnu/ (0x00007fba82358000) => /lib/x86_64-linux-gnu/ (0x00007fba822c1000) => /lib/x86_64-linux-gnu/ (0x00007fba82231000) => /lib/x86_64-linux-gnu/ (0x00007fba82215000) => /lib/x86_64-linux-gnu/ (0x00007fba821f5000) => /lib/x86_64-linux-gnu/ (0x00007fba820c3000) => /lib/x86_64-linux-gnu/ (0x00007fba8209b000) => /lib/x86_64-linux-gnu/ (0x00007fba82009000) => /lib/x86_64-linux-gnu/ (0x00007fba81fd1000) => /lib/x86_64-linux-gnu/ (0x00007fba81d0a000) => /lib/x86_64-linux-gnu/ (0x00007fba81b56000) => /lib/x86_64-linux-gnu/ (0x00007fba81ad9000) => /lib/x86_64-linux-gnu/ (0x00007fba81a0c000) => /lib/x86_64-linux-gnu/ (0x00007fba8175b000) => /lib/x86_64-linux-gnu/ (0x00007fba8162a000) => /lib/x86_64-linux-gnu/ (0x00007fba81436000) => /lib/x86_64-linux-gnu/ (0x00007fba8136a000) => /lib/x86_64-linux-gnu/ (0x00007fba81002000) => /lib/x86_64-linux-gnu/ (0x00007fba80ad4000) => /lib/x86_64-linux-gnu/ (0x00007fba80a22000) => /lib/x86_64-linux-gnu/ (0x00007fba806a0000) => /lib/x86_64-linux-gnu/ (0x00007fba8066e000) => /lib/x86_64-linux-gnu/ (0x00007fba8064b000) => /lib/x86_64-linux-gnu/ (0x00007fba80305000) => /lib/x86_64-linux-gnu/ (0x00007fba80280000) => /lib/x86_64-linux-gnu/ (0x00007fba80216000) => /lib/x86_64-linux-gnu/ (0x00007fba801de000) => /lib/x86_64-linux-gnu/ (0x00007fba7ff38000) => /lib/x86_64-linux-gnu/ (0x00007fba7feb5000) => /lib/x86_64-linux-gnu/ (0x00007fba7fbd6000) => /lib/ (0x00007fba7e84f000) => /lib/x86_64-linux-gnu/ (0x00007fba7e71d000) => /lib/x86_64-linux-gnu/ (0x00007fba7e701000) => /lib/x86_64-linux-gnu/ (0x00007fba7e6b9000) => /lib/x86_64-linux-gnu/ (0x00007fba7e6b3000) => /lib/x86_64-linux-gnu/ (0x00007fba7e6a1000) => /lib/x86_64-linux-gnu/ (0x00007fba7e564000) => /lib/x86_64-linux-gnu/ (0x00007fba7e552000) => /lib/x86_64-linux-gnu/ (0x00007fba7e548000) => /lib/x86_64-linux-gnu/ (0x00007fba7e53c000) => /lib/x86_64-linux-gnu/ (0x00007fba7e512000) => /lib/x86_64-linux-gnu/ (0x00007fba7e4db000) => /lib/x86_64-linux-gnu/ (0x00007fba7e3a8000) => /lib/x86_64-linux-gnu/ (0x00007fba7e38b000) => /lib/x86_64-linux-gnu/ (0x00007fba7e1a8000) => /lib/x86_64-linux-gnu/ (0x00007fba7e18f000) => /lib/x86_64-linux-gnu/ (0x00007fba7e140000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0f9000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0f4000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0e5000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0d8000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0d3000) => /lib/x86_64-linux-gnu/ (0x00007fba7e0ce000) => /lib/x86_64-linux-gnu/ (0x00007fba7e08c000) => /lib/x86_64-linux-gnu/ (0x00007fba7e081000) => /lib/x86_64-linux-gnu/ (0x00007fba7e07c000) => /lib/x86_64-linux-gnu/ (0x00007fba7e069000) => /lib/x86_64-linux-gnu/ (0x00007fba7e054000) => /lib/x86_64-linux-gnu/ (0x00007fba7e04a000) => /lib/x86_64-linux-gnu/ (0x00007fba7dfa3000) => /lib/x86_64-linux-gnu/ (0x00007fba7df9e000) => /lib/x86_64-linux-gnu/ (0x00007fba7df72000) => /lib/x86_64-linux-gnu/ (0x00007fba7df63000) => /lib/x86_64-linux-gnu/ (0x00007fba7dd59000) => /lib/x86_64-linux-gnu/ (0x00007fba7dd4d000) => /lib/x86_64-linux-gnu/ (0x00007fba7dcda000) => /lib/x86_64-linux-gnu/ (0x00007fba7dcad000) => /lib/x86_64-linux-gnu/ (0x00007fba7dca6000) => /lib/x86_64-linux-gnu/ (0x00007fba7dbe3000) => /lib/x86_64-linux-gnu/ (0x00007fba7d960000) => /lib/x86_64-linux-gnu/ (0x00007fba7d91e000) => /lib/x86_64-linux-gnu/ (0x00007fba7d70f000) => /lib/x86_64-linux-gnu/ (0x00007fba7d6f3000) => /lib/x86_64-linux-gnu/ (0x00007fba7d673000) => /lib/x86_64-linux-gnu/ (0x00007fba7d5f6000) => /lib/x86_64-linux-gnu/ (0x00007fba7d5b8000) => /lib/x86_64-linux-gnu/ (0x00007fba7d507000) => /lib/x86_64-linux-gnu/ (0x00007fba7d4e5000) => /lib/x86_64-linux-gnu/ (0x00007fba7d2ab000) => /lib/x86_64-linux-gnu/ (0x00007fba7d29f000) => /lib/x86_64-linux-gnu/ (0x00007fba7d276000) => /lib/x86_64-linux-gnu/ (0x00007fba7c94b000) => /lib/x86_64-linux-gnu/ (0x00007fba7c8bc000) => /lib/x86_64-linux-gnu/ (0x00007fba7c8b1000) => /lib/x86_64-linux-gnu/ (0x00007fba7c411000) => /lib/x86_64-linux-gnu/ (0x00007fba7b62d000) => /lib/x86_64-linux-gnu/ (0x00007fba7b61e000) => /lib/x86_64-linux-gnu/ (0x00007fba7b5a6000) => /lib/x86_64-linux-gnu/ (0x00007fba7b550000) => /lib/x86_64-linux-gnu/ (0x00007fba7b4f1000) => /lib/x86_64-linux-gnu/ (0x00007fba7b2e4000) => /lib/x86_64-linux-gnu/ (0x00007fba7b2c6000) => /lib/x86_64-linux-gnu/ (0x00007fba7b289000) => /lib/x86_64-linux-gnu/ (0x00007fba7b269000) => /lib/x86_64-linux-gnu/ (0x00007fba7b243000) => /lib/x86_64-linux-gnu/ (0x00007fba7b215000) => /lib/x86_64-linux-gnu/ (0x00007fba7b168000) => /lib/x86_64-linux-gnu/ (0x00007fba7b13c000) => /lib/x86_64-linux-gnu/ (0x00007fba7ae7e000) => /lib/x86_64-linux-gnu/ (0x00007fba79f10000) => /lib/x86_64-linux-gnu/ (0x00007fba79dfd000) => /lib/x86_64-linux-gnu/ (0x00007fba79dd4000) => /lib/x86_64-linux-gnu/ (0x00007fba79c18000) => /lib/x86_64-linux-gnu/ (0x00007fba79c05000) => /lib/x86_64-linux-gnu/ (0x00007fba79bb8000) => /lib/x86_64-linux-gnu/ (0x00007fba799cb000) => /lib/x86_64-linux-gnu/ (0x00007fba799b5000) => /lib/x86_64-linux-gnu/ (0x00007fba79962000) => /lib/x86_64-linux-gnu/ (0x00007fba7978c000) => /lib/x86_64-linux-gnu/ (0x00007fba79700000) => /lib/x86_64-linux-gnu/ (0x00007fba796fb000) => /lib/x86_64-linux-gnu/ (0x00007fba796f3000) => /lib/x86_64-linux-gnu/ (0x00007fba796ed000) => /lib/x86_64-linux-gnu/ (0x00007fba796d5000) => /usr/local/cuda/targets/x86_64-linux/lib/ (0x00007fba794cd000) => /lib/x86_64-linux-gnu/ (0x00007fba7944f000) => /lib/x86_64-linux-gnu/ (0x00007fba79436000) => /lib/x86_64-linux-gnu/ (0x00007fba7941e000) => /lib/x86_64-linux-gnu/ (0x00007fba793d0000) => /lib/x86_64-linux-gnu/ (0x00007fba793b2000) => /lib/x86_64-linux-gnu/ (0x00007fba792f9000) => /lib/x86_64-linux-gnu/ (0x00007fba790e4000) => /lib/x86_64-linux-gnu/ (0x00007fba790a0000) => /lib/x86_64-linux-gnu/ (0x00007fba7900b000) => /lib/x86_64-linux-gnu/ (0x00007fba78f83000) => /lib/x86_64-linux-gnu/ (0x00007fba78efb000) => /lib/x86_64-linux-gnu/ (0x00007fba78c92000) => /lib/x86_64-linux-gnu/ (0x00007fba78bf3000) => /lib/x86_64-linux-gnu/ (0x00007fba78bd6000) => /lib/x86_64-linux-gnu/ (0x00007fba78bc9000) => /lib/x86_64-linux-gnu/ (0x00007fba78bac000) => /lib/x86_64-linux-gnu/ (0x00007fba78b6d000) => /lib/x86_64-linux-gnu/ (0x00007fba78ada000) => /lib/x86_64-linux-gnu/ (0x00007fba78828000) => /lib/x86_64-linux-gnu/ (0x00007fba787fe000) => /lib/x86_64-linux-gnu/ (0x00007fba787d4000) => /lib/x86_64-linux-gnu/ (0x00007fba787aa000) => /lib/x86_64-linux-gnu/ (0x00007fba7875b000) => /lib/x86_64-linux-gnu/ (0x00007fba78750000) => /lib/x86_64-linux-gnu/ (0x00007fba7873e000) => /lib/x86_64-linux-gnu/ (0x00007fba78726000) => /lib/x86_64-linux-gnu/ (0x00007fba786fc000) => /lib/x86_64-linux-gnu/ (0x00007fba78653000) => /lib/x86_64-linux-gnu/ (0x00007fba78445000) => /lib/x86_64-linux-gnu/ (0x00007fba783fe000) => /lib/x86_64-linux-gnu/ (0x00007fba783dd000) => /lib/x86_64-linux-gnu/ (0x00007fba783d3000) => /lib/ (0x00007fba783c0000) => /lib/x86_64-linux-gnu/ (0x00007fba7807b000) => /lib/x86_64-linux-gnu/ (0x00007fba78070000) => /lib/x86_64-linux-gnu/ (0x00007fba77e14000) => /lib/x86_64-linux-gnu/ (0x00007fba77dd1000) => /lib/x86_64-linux-gnu/ (0x00007fba77db7000) => /lib/x86_64-linux-gnu/ (0x00007fba77d45000) => /lib/x86_64-linux-gnu/ (0x00007fba77d2d000) => /lib/x86_64-linux-gnu/ (0x00007fba77d10000) => /lib/x86_64-linux-gnu/ (0x00007fba77c6d000) => /lib/x86_64-linux-gnu/ (0x00007fba77c33000) => /lib/x86_64-linux-gnu/ (0x00007fba77c05000) => /lib/x86_64-linux-gnu/ (0x00007fba77872000) => /lib/x86_64-linux-gnu/ (0x00007fba7774d000) => /lib/ (0x00007fba77723000) => /lib/ (0x00007fba7767c000) => /lib/ (0x00007fba77660000) => /lib/x86_64-linux-gnu/ (0x00007fba77655000) => /lib/x86_64-linux-gnu/ (0x00007fba77620000) => /lib/x86_64-linux-gnu/ (0x00007fba77321000) => /lib/x86_64-linux-gnu/ (0x00007fba772d1000) => /lib/x86_64-linux-gnu/ (0x00007fba76fe0000) => /lib/x86_64-linux-gnu/ (0x00007fba76f98000) => /lib/x86_64-linux-gnu/ (0x00007fba76dfa000) => /lib/x86_64-linux-gnu/ (0x00007fba7686b000) => /lib/x86_64-linux-gnu/ (0x00007fba767dc000) => /lib/x86_64-linux-gnu/ (0x00007fba76784000) => /lib/x86_64-linux-gnu/ (0x00007fba7603b000) => /lib/x86_64-linux-gnu/ (0x00007fba75d65000) => /lib/x86_64-linux-gnu/ (0x00007fba75d14000) => /lib/x86_64-linux-gnu/ (0x00007fba75cdd000) => /lib/x86_64-linux-gnu/ (0x00007fba75c7b000) => /lib/x86_64-linux-gnu/ (0x00007fba75c50000) => /lib/x86_64-linux-gnu/ (0x00007fba75c34000) => /lib/x86_64-linux-gnu/ (0x00007fba75c29000) => /lib/x86_64-linux-gnu/ (0x00007fba75c23000) => /lib/x86_64-linux-gnu/ (0x00007fba75c19000) => /lib/x86_64-linux-gnu/ (0x00007fba75c10000) => /lib/x86_64-linux-gnu/ (0x00007fba75bd6000) => /lib/x86_64-linux-gnu/ (0x00007fba75bcb000) => /lib/x86_64-linux-gnu/ (0x00007fba75baa000) => /lib/x86_64-linux-gnu/ (0x00007fba75b7b000) => /lib/x86_64-linux-gnu/ (0x00007fba75af8000) => /lib/x86_64-linux-gnu/ (0x00007fba75a8d000) => /lib/x86_64-linux-gnu/ (0x00007fba75a80000) => /lib/x86_64-linux-gnu/ (0x00007fba75a71000) => /lib/x86_64-linux-gnu/ (0x00007fba7588b000) => /lib/x86_64-linux-gnu/ (0x00007fba7582b000) => /lib/x86_64-linux-gnu/ (0x00007fba75820000) => /lib/x86_64-linux-gnu/ (0x00007fba756ea000) => /lib/x86_64-linux-gnu/ (0x00007fba756c7000) => /lib/x86_64-linux-gnu/ (0x00007fba75545000) => /lib/x86_64-linux-gnu/ (0x00007fba7552f000) => /lib/x86_64-linux-gnu/ (0x00007fba754f8000) => /lib/x86_64-linux-gnu/ (0x00007fba75474000) => /lib/x86_64-linux-gnu/ (0x00007fba75356000) => /lib/x86_64-linux-gnu/ (0x00007fba75331000) => /lib/x86_64-linux-gnu/ (0x00007fba752e4000) => /lib/x86_64-linux-gnu/ (0x00007fba7522c000) => /lib/x86_64-linux-gnu/ (0x00007fba751f8000) => /lib/x86_64-linux-gnu/ (0x00007fba751eb000) => /lib/x86_64-linux-gnu/ (0x00007fba751cd000) => /lib/x86_64-linux-gnu/ (0x00007fba7519a000) => /lib/x86_64-linux-gnu/ (0x00007fba75175000) => /lib/x86_64-linux-gnu/ (0x00007fba73774000) => /lib/x86_64-linux-gnu/ (0x00007fba71760000) => /lib/x86_64-linux-gnu/ (0x00007fba71718000) => /lib/x86_64-linux-gnu/ (0x00007fba716a8000) => /lib/x86_64-linux-gnu/ (0x00007fba7164d000) => /lib/x86_64-linux-gnu/ (0x00007fba714fe000) => /lib/x86_64-linux-gnu/ (0x00007fba714cc000) => /lib/x86_64-linux-gnu/ (0x00007fba7148c000) => /lib/x86_64-linux-gnu/ (0x00007fba712c3000) => /lib/x86_64-linux-gnu/ (0x00007fba712b8000) => /lib/x86_64-linux-gnu/ (0x00007fba710ad000) => /lib/x86_64-linux-gnu/ (0x00007fba7108c000) => /lib/x86_64-linux-gnu/ (0x00007fba71065000) => /lib/x86_64-linux-gnu/ (0x00007fba70fd2000) => /lib/x86_64-linux-gnu/ (0x00007fba70f7c000) => /lib/x86_64-linux-gnu/ (0x00007fba70e53000) => /lib/x86_64-linux-gnu/ (0x00007fba70e28000) => /lib/x86_64-linux-gnu/ (0x00007fba70e08000) => /lib/x86_64-linux-gnu/ (0x00007fba70d9a000) => /lib/x86_64-linux-gnu/ (0x00007fba70d87000) => /lib/x86_64-linux-gnu/ (0x00007fba70d76000) => /lib/x86_64-linux-gnu/ (0x00007fba70d68000) => /lib/x86_64-linux-gnu/ (0x00007fba70d5a000) => /lib/x86_64-linux-gnu/ (0x00007fba70d51000) => /lib/x86_64-linux-gnu/ (0x00007fba70ca2000) => /lib/x86_64-linux-gnu/ (0x00007fba70c4b000) => /lib/x86_64-linux-gnu/ (0x00007fba70bbb000) => /lib/x86_64-linux-gnu/ (0x00007fba70baf000) => /lib/x86_64-linux-gnu/ (0x00007fba70b95000) => /lib/x86_64-linux-gnu/ (0x00007fba6f0d4000) => /lib/x86_64-linux-gnu/ (0x00007fba6eff7000) => /lib/x86_64-linux-gnu/ (0x00007fba6efc6000) => /lib/x86_64-linux-gnu/ (0x00007fba6efbd000) => /lib/x86_64-linux-gnu/ (0x00007fba6efae000) => /lib/x86_64-linux-gnu/ (0x00007fba6ece6000) => /lib/x86_64-linux-gnu/ (0x00007fba6ecb3000) => /lib/x86_64-linux-gnu/ (0x00007fba6ecac000) => /lib/x86_64-linux-gnu/ (0x00007fba6eca5000) => /lib/x86_64-linux-gnu/ (0x00007fba6ec88000) => /lib/x86_64-linux-gnu/ (0x00007fba6ec43000) => /lib/x86_64-linux-gnu/ (0x00007fba6ec20000) => /lib/x86_64-linux-gnu/ (0x00007fba6ec17000) => /lib/x86_64-linux-gnu/ (0x00007fba6ebcd000) => /lib/x86_64-linux-gnu/ (0x00007fba6ebc1000) => /lib/x86_64-linux-gnu/ (0x00007fba6eb2e000) => /lib/x86_64-linux-gnu/ (0x00007fba6ea87000) => /lib/x86_64-linux-gnu/ (0x00007fba6ea4d000) => /lib/x86_64-linux-gnu/ (0x00007fba6ea34000) => /lib/x86_64-linux-gnu/ (0x00007fba6ea0a000) => /lib/x86_64-linux-gnu/ (0x00007fba6e9f8000) => /lib/x86_64-linux-gnu/ (0x00007fba6e9aa000) => /lib/x86_64-linux-gnu/ (0x00007fba6e96f000)

Lots of dependent libraries there. Not a big deal, but libgomp is definitely there. I have no idea as to why it’s getting in there, but presume there’s some dependency with one or more of the OpenCV libs.

This is long shot, but I’m wondering if you can use LD_PRELOAD to force the loader to load our runtime before libgomp. Something like:

LD_PRELOAD=/opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ <your_exe_name> <args>

Otherwise, you may need to rebuild OpenCV with the NVHPC compilers, or possibly still with GNU if you can disable OpenMP. Though, I’ve not built OpenCV myself, so wont be much help here.

Hello Mat,

Thanks for your reply.

I tried to add LD_PRELOAD before exe file,but unfortunately, the issue still exists.

 $ LD_PRELOAD=/opt/nvidia/hpc_sdk/Linux_x86_64/22.7/compilers/lib/ ./testi_opencv

libgomp: TODO

Then I tried to load the environment of nvhpc by following your hints.
I used module loading to solve the issue:

export MODULEPATH=$MODULEPATH:/opt/nvidia/hpc_sdk/modulefiles
module load nvhpc

$ export MODULEPATH=$MODULEPATH:/opt/nvidia/hpc_sdk/modulefiles
$ module load nvhpc
$ sh
     16, Generating copyin(a[:][:],temp) [if not already present]
     20, Generating present(a[:][:],temp)
     23, Loop is parallelizable
     25, Loop is parallelizable
         Generating NVIDIA GPU code
         23, #pragma acc loop gang, vector(128) collapse(2) /* blockIdx.x threadIdx.x */
         25,   /* blockIdx.x threadIdx.x auto-collapsed */
     43, Generating update self(temp,a[:])
$ ./testi_opencv

It works in the end.