cpp extension tutorial: not device agnostic?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 9.3k
- Forks
- 4.4k
- Avg merge
- 1d 21h
- Merged PRs (30d)
- 4
Description
Would the kerne calll in lltm_cuda_forward in the tutorial tutorials/advanced_source/cpp_extension.rst fail on multi gpu systems if the inputs are not on the default device, i.e., device:0?
To my understanding, some "magic" takes care of setting the right context if we add functionality do pytorch via custom kernels, see here.
However, it seems like in the tutorial this machinery is not used.
Explicit usage of at::OptionalDeviceGuard should resolve the issue (?) in the tutorial.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in tutorials/advanced_source/cpp_extension.rst at the lltm_cuda_forward kernel call and review how the tutorial handles device selection. Reproduce or inspect the behavior with inputs on a non-default GPU, then confirm whether the tutorial needs a device-context change and update its documented example accordingly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 40/100