Skip to content

CUDA: Print format string and warn for > 32 print() args - #7479

Merged
sklam merged 2 commits into
numba:masterfrom
gmarkall:cuda-print-32-limit
Nov 2, 2021
Merged

sklam merged 2 commits into
numba:masterfrom
gmarkall:cuda-print-32-limit

Conversation

@gmarkall

Copy link
Copy Markdown
Member

CUDA vprintf prints garbage for arguments past the 32nd (a similar limitation on printf is outlined in the CUDA C++ Programming Guide at https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#limitations).

This commit matches the C/C++ behavior in Python by emitting the format string when more than 32 arguments are provided, instead of printing garbage results. A warning is also produced to explain the behavior that users will see.

CUDA vprintf prints garbage for arguments past the 32nd (a similar
limitation on `printf` is outlined in the CUDA C++ Programming Guide at
https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html#limitations).

This commit matches the C/C++ behavior in Python by emitting the format
string when more than 32 arguments are provided, instead of printing
garbage results. A warning is also produced to explain the behavior that
users will see.
@gmarkall gmarkall added 3 - Ready for Review CUDA CUDA related issue/PR Effort - short Short size effort needed labels Oct 11, 2021
@gmarkall gmarkall added this to the Numba 0.55 RC milestone Oct 11, 2021

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch. Couple of minor things to resolve else looks good.

Comment thread numba/cuda/tests/cudapy/test_print.py
Comment thread numba/cuda/tests/cudapy/test_print.py Outdated
@stuartarchibald stuartarchibald added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Oct 12, 2021
Co-authored-by: stuartarchibald <stuartarchibald@users.noreply.github.com>
@gmarkall

Copy link
Copy Markdown
Member Author

@stuartarchibald Many thanks for the review - suggestions applied.

@gmarkall gmarkall added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Oct 13, 2021

@stuartarchibald stuartarchibald left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch and fixes.

@stuartarchibald stuartarchibald added 4 - Waiting on CI Review etc done, waiting for CI to finish Pending BuildFarm For PRs that have been reviewed but pending a push through our buildfarm and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Oct 13, 2021
@gmarkall

gmarkall commented Nov 1, 2021

Copy link
Copy Markdown
Member Author

gpuci run tests

@sklam

sklam commented Nov 2, 2021

Copy link
Copy Markdown
Member

BFID numba_smoketest_cuda_yaml_101

@sklam

sklam commented Nov 2, 2021

Copy link
Copy Markdown
Member

build farm passed

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed Pending BuildFarm For PRs that have been reviewed but pending a push through our buildfarm 4 - Waiting on CI Review etc done, waiting for CI to finish labels Nov 2, 2021
@sklam
sklam merged commit 075cec2 into numba:master Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge CUDA CUDA related issue/PR Effort - short Short size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants