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

CUBLAS: Improve concurrency using device pointer mode #2571

Open
maleadt opened this issue Nov 29, 2024 · 0 comments
Open

CUBLAS: Improve concurrency using device pointer mode #2571

maleadt opened this issue Nov 29, 2024 · 0 comments
Labels
cuda libraries Stuff about CUDA library wrappers. good first issue Good for newcomers

Comments

@maleadt
Copy link
Member

maleadt commented Nov 29, 2024

By default, CUBLAS uses the "host" pointer mode for scalar reference arguments: https://docs.nvidia.com/cuda/cublas/#scalar-parameters

julia> mode = Ref{CUBLAS.cublasPointerMode_t}();

julia> CUBLAS.cublasGetPointerMode_v2(CUBLAS.handle(), mode)

julia> mode[]
CUBLAS_POINTER_MODE_HOST::cublasPointerMode_t = 0x00000000

This allows us to use simple Ref boxes for scalar inputs, but results in calls like cublasDot blocking in libcublas until the GPU is synchronized. We should instead set the pointer mode to device, and synchronize in Julia, so that other tasks get the opportunity to execute while waiting for the GPU to finish.

Going beyond this, we could add async flags to these APIs to optionally return a lazy scalar, or a 0d array.

cc @Jutho

@maleadt maleadt added cuda libraries Stuff about CUDA library wrappers. good first issue Good for newcomers labels Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cuda libraries Stuff about CUDA library wrappers. good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant