Device buffer for asynchronous data transfer.
More...
#include <cuda_buffer.hpp>
|
|
| CUDABuffer (bool use_pinned_buffer=true) |
| |
| void | resize (size_t size, CUstream_st *stream) |
| | Resize the buffer size. This method only expands the device/host buffers and doesn't shrink them when buffer_size < size.
|
| |
| void | upload (CUstream_st *stream) |
| | Upload data from the host pinned buffer to the device buffer.
|
| |
| void | upload (size_t size, CUstream_st *stream) |
| | Upload data from the host pinned buffer to the device buffer.
|
| |
| void | upload (const void *buffer, size_t size, CUstream_st *stream) |
| | Upload data to the device buffer. If size > buffer_size, the buffers will be resized before uploading.
|
| |
| void | download (CUstream_st *stream) |
| | Download data from the device buffer to the pinned host buffer.
|
| |
| void | download (void *buffer, size_t size, CUstream_st *stream) |
| | Download data from the device buffer.
|
| |
|
size_t | size () const |
| | Buffer size.
|
| |
| void * | host_buffer () |
| | Pinned host buffer.
|
| |
|
void * | device_buffer () |
| | Pinned device buffer.
|
| |
|
template<typename T > |
| void | upload (const T *buffer, size_t size, CUstream_st *stream) |
| |
|
template<typename T > |
| void | download (T *buffer, size_t size, CUstream_st *stream) |
| |
|
template<typename T > |
| T * | host_buffer () |
| |
|
template<typename T > |
| T * | device_buffer () |
| |
Device buffer for asynchronous data transfer.
- Note
- To enable asynchronous upload/download, use_pinned_buffer needs to be true.
◆ download() [1/2]
| void gtsam_points::CUDABuffer::download |
( |
CUstream_st * |
stream | ) |
|
Download data from the device buffer to the pinned host buffer.
- Parameters
-
◆ download() [2/2]
| void gtsam_points::CUDABuffer::download |
( |
void * |
buffer, |
|
|
size_t |
size, |
|
|
CUstream_st * |
stream |
|
) |
| |
Download data from the device buffer.
- Parameters
-
| buffer | Buffer to write the downloaded data |
| size | Buffer size |
| stream | CUDA stream |
◆ host_buffer()
| void * gtsam_points::CUDABuffer::host_buffer |
( |
| ) |
|
Pinned host buffer.
- Note
- If use_pinned_buffer is false, the pinned host buffer will not be allocated, and this method returns nullptr.
◆ resize()
| void gtsam_points::CUDABuffer::resize |
( |
size_t |
size, |
|
|
CUstream_st * |
stream |
|
) |
| |
Resize the buffer size. This method only expands the device/host buffers and doesn't shrink them when buffer_size < size.
- Parameters
-
| size | Buffer size |
| stream | CUDA stream |
◆ upload() [1/3]
| void gtsam_points::CUDABuffer::upload |
( |
const void * |
buffer, |
|
|
size_t |
size, |
|
|
CUstream_st * |
stream |
|
) |
| |
Upload data to the device buffer. If size > buffer_size, the buffers will be resized before uploading.
- Parameters
-
| buffer | Input data |
| size | Buffer size |
| stream | CUDA stream |
◆ upload() [2/3]
| void gtsam_points::CUDABuffer::upload |
( |
CUstream_st * |
stream | ) |
|
Upload data from the host pinned buffer to the device buffer.
- Parameters
-
◆ upload() [3/3]
| void gtsam_points::CUDABuffer::upload |
( |
size_t |
size, |
|
|
CUstream_st * |
stream |
|
) |
| |
Upload data from the host pinned buffer to the device buffer.
- Parameters
-
| size | Data size (must be smaller than buffer_size) |
| stream | CUDA stream |
The documentation for this class was generated from the following file:
- /home/runner/work/gtsam_points/gtsam_points/include/gtsam_points/cuda/cuda_buffer.hpp