Skip to content

Fix cuda_bindings conjugate_gradient_multi_block_cg.py example#1922

Draft
rwgk wants to merge 2 commits intoNVIDIA:mainfrom
rwgk:fix_conjugate_gradient_multi_block_cg
Draft

Fix cuda_bindings conjugate_gradient_multi_block_cg.py example#1922
rwgk wants to merge 2 commits intoNVIDIA:mainfrom
rwgk:fix_conjugate_gradient_multi_block_cg

Conversation

@rwgk
Copy link
Copy Markdown
Collaborator

@rwgk rwgk commented Apr 16, 2026

This PR started out as a humble attempt to eliminate the only remaining pytest.skip in our examples (similar to #1861), but then turned into a bigger-than-anticipated bug-fix project.

See commit messages for full details.

rwgk added 2 commits April 15, 2026 16:54
Remove the unconditional NVRTC waiver from the renamed example so CI can exercise its real execution path again. While re-enabling it, replace the standalone pytest.skip() checks with requirement_not_met() and simplify the platform gating.

The waived code path had been hiding several Python-side runtime bugs that required these fixes:
- replaced the invalid C-style %d f-string formatting
- fixed gen_tridiag() variable shadowing so the CSR row-offset array is actually populated
- passed the computed dynamic shared-memory size into cuLaunchCooperativeKernel() and made that size integer-valued
- stopped overwriting managed-memory pointer variables with loop indices before kernel launch and cleanup
- cached the residual before freeing dot_result, which removed the teardown segfault

Made-with: Cursor
QNX is an operating system rather than a machine architecture, so checking platform.machine() can miss the requirement_not_met() path on QNX hosts. Use platform.system() so the example is waived consistently on that platform.

Made-with: Cursor
@rwgk rwgk added this to the cuda.bindings next milestone Apr 16, 2026
@rwgk rwgk self-assigned this Apr 16, 2026
@rwgk rwgk added bug Something isn't working P1 Medium priority - Should do cuda.bindings Everything related to the cuda.bindings module labels Apr 16, 2026
@copy-pr-bot
Copy link
Copy Markdown
Contributor

copy-pr-bot bot commented Apr 16, 2026

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@rwgk
Copy link
Copy Markdown
Collaborator Author

rwgk commented Apr 16, 2026

/ok to test

@github-actions
Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working cuda.bindings Everything related to the cuda.bindings module P1 Medium priority - Should do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant