Here comes the sample codes:
#include <cuda.h>
#include <cuda_runtime.h>
#include <stdio.h>
int main() {
unsigned char* cu_test;
cudaMalloc((void**)&cu_test, 3200);
CUdeviceptr pbase;
size_t psize;
CUresult res = cuMemGetAddressRange(&pbase, &psize, (CUdeviceptr)cu_test);
printf("cu_img_yuv size: %ld", psize);
return 0;
}
While it throws error when compiling whatever the cuda version is(tested from 11.3 to 11.5):
$ nvcc main.cu -o main
/tmp/tmpxft_0000e288_00000000-11_main.o: In function `main':
tmpxft_0000e288_00000000-6_main.cudafe1.cpp:(.text+0x54): undefined reference to `cuMemGetAddressRange_v2'
collect2: error: ld returned 1 exit status
Can someone help pointing out what the problem is plz?