在CUDA之后的可用内存cudaGraphicsGLRegisterImage而不破坏缓冲区 [英] Free Memory in CUDA after cudaGraphicsGLRegisterImage without destroying the buffer

查看:939
本文介绍了在CUDA之后的可用内存cudaGraphicsGLRegisterImage而不破坏缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个项目,使用OpenGL绘图技术和CUDA的组合来执行分析。我想使用CUDA生成一个renderbuffer,然后使用OpenGL对其进行分析。因为缓冲区的数量,我需要的内存在渲染缓冲区完成后,CUDA免费,但缓冲区仍然可用于OpenGL。

I am working on a project that uses a combination of OpenGL drawing techniques as well as CUDA to perform analysis. I would like to use CUDA to generate a renderbuffer and then perform analysis on it with OpenGL. Because of the number of buffers, I need for the memory to be free from CUDA after the renderbuffer is complete but for the buffer to be available for OpenGL still.

更多,我用


glGenRenderbuffersEXT
glBindRenderbufferEXT
glRenderbuferStorageEXT

然后我用CUDA中的

cudaGraphicsGLRegisterImage

注册它们,它使用CUDA的内存。但是,当我使用

, which uses memory from CUDA. However, when I go to unregister the renderbuffers with

cudaGraphicsUnregisterResource

取消注册renderbuffers时,内存不会释放。我不想用

the memory is not freed. I do not want to destroy the buffer with

glDeleteBuffers

破坏缓冲区,因为我仍然需要它们用于计算,但是还需要使用CUDA来处理其他缓冲区。是否有其他CUDA调用我可以执行释放这个内存而不破坏缓冲区?

because I still need them for computation but also need to use CUDA to work on other buffers. Is there some other CUDA call I can perform to free this memory without destroying the buffer?

推荐答案

你说,cudaGraphicsRegisterImage从CUDA,但你测量了多少?使用CUDA注册缓冲区只是 - 它只是通知OpenGL驱动程序CUDA也想要看到缓冲区。内存成本应该非常小。

You say, cudaGraphicsRegisterImage "uses memory from CUDA," but have you measured how much? Registering the buffer with CUDA does just that - it just notifies the OpenGL driver that CUDA also wants to see the buffer. The memory cost should be very modest.

这篇关于在CUDA之后的可用内存cudaGraphicsGLRegisterImage而不破坏缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆