Replies: 3 comments
|
Yes, the default thrust allocators require the current device be the same during destruction. This is a limitation we should fix. If instead you use |
|
|
|
The key distinction is the owning container vs. the allocator / memory resource it delegates to. For {
cudaSetDevice(device);
thrust::device_vector<int> v(n);
// destroy v while `device` is still current, unless using a device-aware allocator/resource
}If you need RMM-style behavior with Thrust containers, using an allocator backed by RMM is a reasonable workaround. If my answer solved your problem, you can click answered the question. I'm really here to help, and along the way I'm also collecting Galaxy Brain badges haha 😆 |
Uh oh!
There was an error while loading. Please reload this page.
RMM's documentation (https://github.com/rapidsai/rmm#multiple-devices) mentions the requirements for deallocation in a multi-gpu settings. In particular, RMM tracks the current device at creation time and sets it automatically in the destructor to ensure the correct device is selected during deallocation.
I could not find such statements for CCCL classes, for example for thrust::device_vector or cuda::buffer.
All reactions