Hi,
I’m having some linker issues with the CUDA OpenGL interop functions. I’m using CUDA 6.5. In the cudaGL.h header file, there are the following definitions:
CUresult CUDAAPI cuGraphicsGLRegisterBuffer(CUgraphicsResource *pCudaResource, GLuint buffer, unsigned int Flags);
CUresult CUDAAPI cuGLUnmapBufferObject(GLuint buffer);
These are wrapped in an extern “C”, so I’d expect one of the supplied CUDA libs to contain the symbols _cuGraphicsGLRegisterBuffer and _cuGLUnmapBufferObject. However, this is not the case. All you find is:
0000000000029380 T _cudaGLGetDevices
0000000000029c40 T _cudaGLMapBufferObject
0000000000029690 T _cudaGLMapBufferObjectAsync
0000000000029db0 T _cudaGLRegisterBufferObject
0000000000029830 T _cudaGLSetBufferObjectMapFlags
0000000000029f00 T _cudaGLSetGLDevice
0000000000029af0 T _cudaGLUnmapBufferObject
0000000000029510 T _cudaGLUnmapBufferObjectAsync
00000000000299a0 T _cudaGLUnregisterBufferObject
When I grep for the cuGL functions, I see:
000000000003dc50 S __ZN6cudart14__fun_cuGLInitE
000000000003dc58 S __ZN6cudart20__fun_cuGLGetDevicesE
000000000003dc48 S __ZN6cudart22__fun_cuGLCtxCreate_v2E
000000000003dc78 S __ZN6cudart27__fun_cuGLUnmapBufferObjectE
000000000003dc68 S __ZN6cudart28__fun_cuGLMapBufferObject_v2E
000000000003dc60 S __ZN6cudart30__fun_cuGLRegisterBufferObjectE
000000000003dc80 S __ZN6cudart32__fun_cuGLUnmapBufferObjectAsyncE
000000000003dc88 S __ZN6cudart32__fun_cuGLUnregisterBufferObjectE
000000000003dc70 S __ZN6cudart33__fun_cuGLMapBufferObjectAsync_v2E
000000000003dc90 S __ZN6cudart33__fun_cuGLSetBufferObjectMapFlagsE
000000000003d6d0 b __ZN6cudartL17__funtmp_cuGLInitE
0000000000008c60 t __ZN6cudartL17__unimpl_cuGLInitEv
000000000003d6d8 b __ZN6cudartL23__funtmp_cuGLGetDevicesE
0000000000008c70 t __ZN6cudartL23__unimpl_cuGLGetDevicesEPjPij19CUGLDeviceList_enum
000000000003d6c8 b __ZN6cudartL25__funtmp_cuGLCtxCreate_v2E
0000000000008c50 t __ZN6cudartL25__unimpl_cuGLCtxCreate_v2EPP8CUctx_stji
000000000003d6f8 b __ZN6cudartL30__funtmp_cuGLUnmapBufferObjectE
0000000000008cb0 t __ZN6cudartL30__unimpl_cuGLUnmapBufferObjectEj
000000000003d6e8 b __ZN6cudartL31__funtmp_cuGLMapBufferObject_v2E
0000000000008c90 t __ZN6cudartL31__unimpl_cuGLMapBufferObject_v2EPyPmj
000000000003d6e0 b __ZN6cudartL33__funtmp_cuGLRegisterBufferObjectE
0000000000008c80 t __ZN6cudartL33__unimpl_cuGLRegisterBufferObjectEj
000000000003d700 b __ZN6cudartL35__funtmp_cuGLUnmapBufferObjectAsyncE
000000000003d708 b __ZN6cudartL35__funtmp_cuGLUnregisterBufferObjectE
0000000000008cc0 t __ZN6cudartL35__unimpl_cuGLUnmapBufferObjectAsyncEjP11CUstream_st
0000000000008cd0 t __ZN6cudartL35__unimpl_cuGLUnregisterBufferObjectEj
000000000003d6f0 b __ZN6cudartL36__funtmp_cuGLMapBufferObjectAsync_v2E
000000000003d710 b __ZN6cudartL36__funtmp_cuGLSetBufferObjectMapFlagsE
0000000000008ca0 t __ZN6cudartL36__unimpl_cuGLMapBufferObjectAsync_v2EPyPmjP11CUstream_st
0000000000008ce0 t __ZN6cudartL36__unimpl_cuGLSetBufferObjectMapFlagsEjj
What gives? These are even documented http://developer.download.nvidia.com/compute/cuda/4_1/rel/toolkit/docs/online/group__CUDA__GL_gd530f66cc9ab43a31a98527e75f343a0.html.
Here was my test code:
CUgraphicsResource testBufferCuda;
CUresult err = cuGraphicsGLRegisterBuffer(&testBufferCuda, buffer, CU_GRAPHICS_REGISTER_FLAGS_NONE);
err = cuGraphicsMapResources(1, &testBufferCuda, 0);
CUdeviceptr devPtr;
size_t devPtrSize;
err = cuGraphicsResourceGetMappedPointer(&devPtr, &devPtrSize, testBufferCuda);
err = cuGraphicsUnmapResources(1, &testBufferCuda, 0);
How am I supposed to map a buffer properly? All of these functions are marked deprecated and the examples I’m finding online to very different things depending on how old they are.
thanks!