06.01.2013 Views

Mixing Graphics and Compute with multiple GPUs, Alina Alt - Nvidia

Mixing Graphics and Compute with multiple GPUs, Alina Alt - Nvidia

Mixing Graphics and Compute with multiple GPUs, Alina Alt - Nvidia

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Simple OpenGL-CUDA interop sample<br />

unsigned char *memPtr;<br />

cudaArray *arrayPtr;<br />

while (!done) {<br />

}<br />

cuda<strong>Graphics</strong>MapResources(1, &cudaResourceBuf, cudaStream);<br />

cuda<strong>Graphics</strong>ResourceGetMappedPointer((void **)&memPtr, &size,<br />

doWorkInCUDA(cudaArray, memPtr, cudaStream);<br />

NVIDIA Confidential<br />

cudaResourceBuf);<br />

cuda<strong>Graphics</strong>UnmapResources(1, & cudaResourceBuf, cudaStream);<br />

doWorkInGL(imagePBO, imageTex);

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!