检查给定资源的上下文
让我们想象一下这种情况,我有很多初始化的资源,例如:流、主机和设备内存结束事件,其中一部分在一个 GPU 的上下文中初始化,其余的属于另一个 GPU 上下文。
有没有办法检查给定资源(事件、流或内存)是否属于某个 GPU 上下文?
在某些情况下,在命令内存复制或内核执行之前断言此类事情是值得的,然后获取cudaErrorInvalidArgument。
Lets imagine the situation, that I have a lot of initialized resources for example: streams, host and device memory end events, part of them are initialized in context of one GPU and the rest of them belong to the other GPU context.
Is there a way to check if given resource (event, stream or memory) belongs to certain GPU context?
In some case it would worthy to assert such things, before order memory copy or kernel execution and then get cudaErrorInvalidArgument
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不太清楚 CUDA API 本身有这样的选项。它只是您可以向 GPU 发出的一组低级命令。
我要做的是将 CUDA API 函数包装到一些不错的类中,该类将跟踪什么在哪里以及什么被初始化。代表 GPU 的类也可能很有用。
I am not really aware of such option in CUDA API itself. It is just a low-level sets of orders that you can issue to your GPU.
What I would do is to wrap the CUDA API functions into some nice class which would track what is where and what is initialised. A class representing a GPU might be useful as well.