-
Notifications
You must be signed in to change notification settings - Fork 915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
benchmark fixture - static object pointer fix #10145
Conversation
benchmark fixture - fix static object pointer, replace with static shared pointer.
static rmm::mr::pool_memory_resource pool_mr{&cuda_mr}; | ||
return std::shared_ptr<rmm::mr::device_memory_resource>(&pool_mr); | ||
static auto pool_mr = | ||
std::make_shared<rmm::mr::pool_memory_resource<rmm::mr::cuda_memory_resource>>(&cuda_mr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is the difference, was the returned type incorrect?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In old code, address of the static object pool_mr
goes into shared_pointer. (pointer of a local variable should not be held in shared_pointer). when that shared pointer is destroyed, it tries to delete the pointer but it's a static object, we are getting the error.
In this new code, I created an pool_memory_resource
object (in heap) and made the shared_pointer as static. So, this shared pointer object will live until program termination. When that shared pointer object is deleted at program end, the pool_memory_resource
object will be deleted.
Codecov Report
@@ Coverage Diff @@
## branch-22.04 #10145 +/- ##
=============================================
Coverage 10.37% 10.38%
=============================================
Files 119 119
Lines 20149 20207 +58
=============================================
+ Hits 2091 2099 +8
- Misses 18058 18108 +50
Continue to review full report at Codecov.
|
@gpucibot merge |
benchmark fixture - fix sharing static object pointer, replace with static shared pointer.