Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When freeing memory, use the high-level device getter. (#2029)
`current_device()` can throw an error when the current thread does not have a context bound, and at the point we free memory there's no guarantee that a context is bound: The preceding call to `context()` only primes the *task* local state, and doesn't set CUDA's *thread* local state. The latter is only set before any API call that needs it, and `cuCtxGetDevice` is explicitly exempt from that so that we can check whether a device is bound.
- Loading branch information