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

Document the synchronisation behavious of alpaka buffers #2371

Open
fwyzard opened this issue Aug 22, 2024 · 2 comments
Open

Document the synchronisation behavious of alpaka buffers #2371

fwyzard opened this issue Aug 22, 2024 · 2 comments

Comments

@fwyzard
Copy link
Contributor

fwyzard commented Aug 22, 2024

As far as I know, we do not document any synchronisation behaviours for alpaka buffers.
However, different buffers and different back-ends effectively implement different behaviours.

  • A buffer allocated on a CUDA gpu with alpaka::allocBuf() internally used cudaMalloc() to allocate the memory, and cudaFree() to release it. While not mentioned explicitly in the CUDA documentation, the observed behaviour is that cudaMalloc() and cudaFree()¹ are blocking and synchronise across all kernels executing on the current GPU.

  • A buffer allocated on the host with alpaka::allocMappedBuf() for the CUDA platform internally uses cudaMallocHost() and cudaFreeHost(). I have no idea if these are blocking calls that synchronise with the current (or all) CUDA device(s).

  • A buffer allocated on the host with alpaka::allocBuf() internally uses aligned new and delete. These do not imply any synchronisations.

  • A buffer allocated on the host with alpaka::allocMappedBuf() for the CPU platform uses allocBuf(), and does not imply any synchronisations.

  • A buffer allocated with alpaka::allocAsyncBuf() should be queue-ordered and asynchronouse with respect to the host. But we should double check that it is indeed the current behaviour :-)

--
¹ except for memory allocated by cudaMallocAsync().

@fwyzard
Copy link
Contributor Author

fwyzard commented Aug 22, 2024

Should we add new functions that implement a common behaviour across all backends ?

@fwyzard
Copy link
Contributor Author

fwyzard commented Nov 5, 2024

See also #2417 .

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

No branches or pull requests

2 participants