This is simple code don’t work
#include <stdio.h>
#include <stdlib.h>
#include <cuda.h>
#include <cutil.h>
int main() {
CUresult result;
CUdevice device;
CUcontext context;
cuInit(0);
cuDeviceGet(&device, 0);
cuCtxCreate(&context, 0, device);
unsigned int free, total;
result = cuMemGetInfo(&free, &total);
cuCtxDetach(context);
printf("GPU Memory status: %10d %10d\n", free, total);
}
1>MemoryTest.obj : error LNK2019: unresolved external symbol _cuCtxDetach@4 referenced in function _main
1>MemoryTest.obj : error LNK2019: unresolved external symbol _cuMemGetInfo@8 referenced in function _main
1>MemoryTest.obj : error LNK2019: unresolved external symbol _cuCtxCreate@12 referenced in function _main
1>MemoryTest.obj : error LNK2019: unresolved external symbol _cuDeviceGet@8 referenced in function _main
1>MemoryTest.obj : error LNK2019: unresolved external symbol _cuInit@4 referenced in function _main
May be before using driver API i need any to initialize this driver API or add any compile keys for nvcc?
P.S. Sample from SDK deviceQueryDrv is the absolutely like to my code but it work, why?