Replies: 1 comment
-
How would the library use these calls? i.e. what algorithm inside the library code would want to allocate a buffer on an accelerator device (like a GPU)? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
From PR #1500 - I'm moving this here for discussion so we can close the PR (@derobins)
With the introduction of VFD plugins, it is now possible to have virtual
file drivers that specialize on data transfer between storage and
hardware accelerators. The GDS (GPUDirect Storage) VFD is one such
example that enables I/O between NVMe storage and GPU memory.
GDS allocates device memory using vendor-specific APIs that are not meant
to be exposed elsewhere in the HDF5 core library. Yet, other components
such as I/O filters would benefit from having access to the memory
allocator used by the VFD, as that could save data copies across device
and host memory, for instance.
This commit introduces two high-level memory management interfaces that
enable memory allocation/deallocation through the VFD driver (falling
back to the existing
H5MM_malloc/xfree
functions when the VFD does notprovide a custom implementation). The functions are implemented on top
of the H5FD ctl interface and are described in details below.
H5FDalloc_mem()
: allocate memory via the file driver. If the driver doesnot support the
H5FD_CTL__MEM_ALLOC
opcode then the operation falls backto allocation via system memory (i.e.,
H5MM_malloc()
). The inputarguments to that CTL operation are given by the
H5FD_ctl_alloc_args_t
structure:
The
flags
andargs
members have been introduced to support fancymemory allocators such as
cudaMallocAsync()
(which takes a stream IDas argument), and Xilinx' platform extension to OpenCL which enables
clCreateBuffer()
to take a target memory bank ID argument.H5FDfree_mem()
: release memory previously allocated viaH5FDalloc_mem()
.If the driver does not support the
H5FD_CTL__MEM_FREE
opcode, memory isfreed via
H5MM_xfree()
. Input arguments are given by theH5FD_ctl_free_args_t
structure:The same observations regarding
flags
andargs
apply here.An application can query the supported flags by calling
H5FDctl
withthe new
H5FD_CTL__MEM_QUERY_SUPPORTED_FLAGS
opcode:This commit introduces a single
H5FD_MEM_ASYNC
flag. Other flags may beadded in the future depending on use-cases and demand.
Signed-off-by: Lucas C. Villa Real lucasvr@br.ibm.com
Beta Was this translation helpful? Give feedback.
All reactions