Title: RFC: Enable per-thread default stream in free-threading builds · Issue #133 · NVIDIA/cuda-python · GitHub
Open Graph Title: RFC: Enable per-thread default stream in free-threading builds · Issue #133 · NVIDIA/cuda-python
X Title: RFC: Enable per-thread default stream in free-threading builds · Issue #133 · NVIDIA/cuda-python
Description: tl;dr: For the Python 3.13 free-threading build (cp313t), the per-thread default stream is enabled and used by default. Users need to set CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0 to explicitly opt out and restore the old behavior. In...
Open Graph Description: tl;dr: For the Python 3.13 free-threading build (cp313t), the per-thread default stream is enabled and used by default. Users need to set CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0 to explicitly ...
X Description: tl;dr: For the Python 3.13 free-threading build (cp313t), the per-thread default stream is enabled and used by default. Users need to set CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0 to explicitly ...
Opengraph URL: https://github.com/NVIDIA/cuda-python/issues/133
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"RFC: Enable per-thread default stream in free-threading builds","articleBody":"tl;dr: For the Python 3.13 free-threading build (`cp313t`), the per-thread default stream is enabled and used by default. Users need to set `CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0` to explicitly opt out and restore the old behavior.\n\nIn CUDA, there are two kinds of default streams:\n- Legacy default stream (synchronizing all blocking streams)\n - Unless some action is done as per the CUDA Programming Guide, this is the default. Most of the time the null/0 stream is a synonym of the legacy default stream\n- Per-thread default stream (only synchronizing with the legacy default stream)\n\nToday, CUDA Python offers a way to switch between the legacy and per-thread default streams (at the time of loading driver symbols) via the environment variable `CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM`, and the default has been as if it is set to 0 (so using the legacy default stream). \n\nHowever, it is a very common pitfall for performance-seeking applications and users who find themselves needing to create nonblocking streams explicitly to avoid implicit synchronization. This change would lift the need of creating nonblocking streams. This change would also allow GPU workloads launched from different host threads -- without an explicit stream in use -- to have an opportunity of overlapping and executing in parallel, instead of being serialized on the same (legacy default) stream.\n\nThe free threading build offers a natural opportunity and perfect timing for us to change the default to as if the env var is set to 1 and using the per-thread default stream. This also gives NVIDIA a path forward to assess the feasibility of deprecating (and eventually removing!) the legacy default stream, which has been a long-time quest we seek to conquer.\n\nUsers who use the regular build will not be affected, only those testing the experimental `cp313t` free-threading build will.","author":{"url":"https://github.com/leofang","@type":"Person","name":"leofang"},"datePublished":"2024-09-26T14:11:45Z","url":"https://github.com/NVIDIA/cuda-python/issues/133"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:6de21cc5-35a0-7bfc-2aca-4468dfe46ff7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CD12:360310:1B2E56:25D451:6AF83AA5 |
| html-safe-nonce | 454f6eb839e85999bdc9afb50514ba11e0f10b5ce58177dafe2abbafa7146149 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDEyOjM2MDMxMDoxQjJFNTY6MjVENDUxOjZBRjgzQUE1IiwidmlzaXRvcl9pZCI6IjU4MjMxMDM5NDQzMTMyODkzODEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 7f25bb6d5c747b2a89de82918359e9077db70e462bfa59cace28478c16ef7ba0 |
| hovercard-subject-tag | issue:2550720193 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/NVIDIA/cuda-python/133/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6ae30f75aece437df385446a63f740d5a8b2ab1daef02d062f9f3128c9034883/NVIDIA/cuda-python/issues/133 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6ae30f75aece437df385446a63f740d5a8b2ab1daef02d062f9f3128c9034883/NVIDIA/cuda-python/issues/133 |
| og:image:alt | tl;dr: For the Python 3.13 free-threading build (cp313t), the per-thread default stream is enabled and used by default. Users need to set CUDA_PYTHON_CUDA_PER_THREAD_DEFAULT_STREAM=0 to explicitly ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | leofang |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5713ecd83001b2f55c3509fb7a292bf7d66d0f167c7ae87a9f7eaec5a52bf8db |
| turbo-cache-control | no-preview |
| go-import | github.com/NVIDIA/cuda-python git https://github.com/NVIDIA/cuda-python.git |
| octolytics-dimension-user_id | 1728152 |
| octolytics-dimension-user_login | NVIDIA |
| octolytics-dimension-repository_id | 381173759 |
| octolytics-dimension-repository_nwo | NVIDIA/cuda-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 381173759 |
| octolytics-dimension-repository_network_root_nwo | NVIDIA/cuda-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 653be32ff5c755082a4db662491bfbbcfc9112c1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width