开发者

Is there a "right" way to release all resources once you are done doing openCL processing?

开发者 https://www.devze.com 2023-02-08 09:50 出处:网络
I guess the simple way is to restart the program, but is there a w开发者_JAVA百科ay to get the same effect without closing the program? I call the proper release statements for my allocated memory, my

I guess the simple way is to restart the program, but is there a w开发者_JAVA百科ay to get the same effect without closing the program? I call the proper release statements for my allocated memory, my context, and command queue, but I never trust that any openCL call actually does what I want when I call it.

For example, the call for creating a buffer doesn't actually create the buffer until I read from it.

I am curious if there is a way to force cleanup or something similar. Let me know, thanks.


No, the OpenCL spec only defines clRelease* functions to do that. Besides, there is no extra cleanup you need to do, just that OpenCL objects are reference counted, so they are only deleted when they reference count reaches 0.

I don't know Why you don't trust OpenCL to do what it says it will do. Some implementations are a bit buggy, but that should be fixed as OpenCL implementations mature.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号