Title: [FEA]: Faster initialization time for `cuda.core` abstractions · Issue #658 · NVIDIA/cuda-python · GitHub
Open Graph Title: [FEA]: Faster initialization time for `cuda.core` abstractions · Issue #658 · NVIDIA/cuda-python
X Title: [FEA]: Faster initialization time for `cuda.core` abstractions · Issue #658 · NVIDIA/cuda-python
Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct Area cuda.core Is your feature request related to a problem? Please describe. As mentioned in a previous iss...
Open Graph Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct Area cuda.core Is your feature request related to a problem? Please ...
X Description: Is this a duplicate? I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct Area cuda.core Is your feature request related to a problem? Please ...
Opengraph URL: https://github.com/NVIDIA/cuda-python/issues/658
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[FEA]: Faster initialization time for `cuda.core` abstractions","articleBody":"### Is this a duplicate?\n\n- [x] I confirmed there appear to be no [duplicate issues](https://github.com/NVIDIA/cuda-python/issues) for this request and that I agree to the [Code of Conduct](CODE_OF_CONDUCT.md)\n\n### Area\n\ncuda.core\n\n### Is your feature request related to a problem? Please describe.\n\nAs mentioned [in a previous issue](https://github.com/NVIDIA/cuda-python/issues/439), equivalent operations using CuPy can be significantly faster. In this issue, I am requesting that the initialization of `cuda.core` abstractions have less overhead. Specifically, when compared to their CuPy counterparts, the initialization of Device, Stream, and Event abstractions are slower.\n\n```\n>>> timeit.timeit('cp.cuda.Device()', setup='import cupy as cp')\n0.06881106700166129\n>>> timeit.timeit('device = ccx.Device()', setup='import cuda.core.experimental as ccx')\n0.5686513699911302\n```\n\n```\n>>> timeit.timeit('cp.cuda.Stream()', setup='import cupy as cp')\n1.0035127629962517\n>>> timeit.timeit('device.create_stream()', setup='import cuda.core.experimental as ccx; device = ccx.Device(); device.set_current()')\n5.299269804003416\n```\n\n```\n>>> timeit.timeit('cp.cuda.Event()', setup='import cupy as cp')\n0.393913417996373\n>>> timeit.timeit('device.create_event()', setup='import cuda.core.experimental as ccx; device = ccx.Device(); device.set_current()')\n3.1525100879953243\n```\n\nThis has caused noticeable performance regressions in `nvmath-python` when transitioning from `cupy.cuda` to `cuda.core` for our benchmarks for smaller/medium size arrays or on faster devices where python overhead is more significant.\n\nSpecifically, we currently use event recording frequently in order to autoselect algorithms/plans and to wait for computation to complete before returning to the user (for host APIs), and we frequently use the Device constructor to check the current device.\n\n### Describe the solution you'd like\n\nThese init functions should just as fast as or faster than CuPy's abstractions.\n\n### Describe alternatives you've considered\n\n- Refactoring our internal implementation to call `Device()` less often by passing around one `Device` and being careful about context switching.\n- Using less event recording? Trying to reuse the same two `Event`s. I don't think this is feasible.\n\n### Additional context\n\nI doesn't seem like the best long term solution for `nvmath-python` to try to work around these issues. ","author":{"url":"https://github.com/carterbox","@type":"Person","name":"carterbox"},"datePublished":"2025-05-23T23:34:17Z","url":"https://github.com/NVIDIA/cuda-python/issues/658"}
| 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:7fa034c6-ea2e-f83d-1f4a-b1fb2a11a1cf |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | E8F8:B96CC:F0A127:14F54E5:6AF88E6A |
| html-safe-nonce | a8ad92e0ba2b71774db2f1eb759bfb6eec870e95a10054755fd5cca786d99a9a |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFOEY4OkI5NkNDOkYwQTEyNzoxNEY1NEU1OjZBRjg4RTZBIiwidmlzaXRvcl9pZCI6IjI4NDE3MjY0MzcwMTI1NzM4MDMiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 0a99b38146578045273492fb6b15b055a36f1eede6e52eaf66576123a46eb2b2 |
| hovercard-subject-tag | issue:3087719657 |
| 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/658/issue_layout |
| twitter:image | https://opengraph.githubassets.com/361d07604d659dd77b316f17f4101b8b65571cdf301820f6f2460bfd94d02d4d/NVIDIA/cuda-python/issues/658 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/361d07604d659dd77b316f17f4101b8b65571cdf301820f6f2460bfd94d02d4d/NVIDIA/cuda-python/issues/658 |
| og:image:alt | Is this a duplicate? I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct Area cuda.core Is your feature request related to a problem? Please ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | carterbox |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| 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 | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width