Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix printf() on device #81

Open
kevmo314 opened this issue Jan 11, 2025 · 0 comments
Open

Fix printf() on device #81

kevmo314 opened this issue Jan 11, 2025 · 0 comments
Assignees

Comments

@kevmo314
Copy link
Owner

kevmo314 commented Jan 11, 2025

If the cudaLaunchKernel()'d kernel includes a call to printf(), it will print on the server. This is correct behavior as far as CUDA is concerned but makes using SCUDA a bit surprising since the client won't get an output the user is expecting.

The way that CUDA handles printf() today amounts to a special vprintf() function that CUDA hooks into and then it prints to a buffer on device, which is then output to stdout by libcuda. To get this working with SCUDA, we should try hijacking the PTX sent to cudaLaunchKernel() and intercept vprintf() with our own handler that does the same thing. Then, once the kernel run is complete, ship this buffer from the server to the client for printing.

To observe the difference today, run https://github.com/NVIDIA/cuda-samples/tree/master/Samples/0_Introduction/simplePrintf with and without SCUDA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants