3. Application Suitability#
This section provides information about application sustainability in GDS.
This section provides information about the conditions in which applications are suitable for acceleration with and would enjoy the benefits provided by GDS, summarized as follows:
Data transfers or IO transfers are directly to and from the GPU, not through the CPU.
IO must be a significant performance bottleneck.
Data transfers or IO transfers must be explicit.
Buffers must be pinned in the GPU memory.
CUDA and the cuFile APIs must be used along with GPUDirect capable NVIDIA GPUs (Quadro® or Data Center GPUs only).
Applications that need a common set of IO APIs to work with device and host memory and leverage optimal paths based on system topology and that work seamlessly with CUDA semantics such as CUDA contexts, streams and graphs.
3.1. Transfers To and From the GPU#
GPUDirect Storage enables direct data transfers between GPU memory and storage. If an application uses the CPU to parse or process the data before or after GPU computation, GPUDirect Storage doesn’t help. To benefit, the GPU must be the first and/or last agent that touches data transferred to or from storage.
3.2. Understanding IO Bottlenecks#
For IO to be a bottleneck, it must be on the critical path. If computation time is far greater than the IO time, then GPUDirect Storage provides little benefit. If IO time can be fully overlapped with computation, for example, with asynchronous IO, then it need not be a bottleneck. Workloads that stream large quantities of data and perform small amounts of computing on each data element tend to be IO bound.
3.3. Explicit GDS APIs#
Any application currently using mmap causes data to be moved implicitly rather than explicitly. This indirect and reactive approach is slower because data is loaded from storage to CPU memory and then from CPU memory to GPU memory and because faults introduce signficiant overhead that could be avoided with explicit transfers.
For applications that use explicit APIs, GPU memory must be allocated with cudaMalloc, so that it is pinned,
rather than with cudaMallocManaged, which can migrate. Use of explicitly APIs is applicable when applications
know exactly what data to transfer and where.
The APIs provided by GDS are explicit, similar to Linux pread and pwrite, rather than being implicit and
using a memory faulting model. This may require changing some application code, for example, switching from a model
that mmaps memory before accessing it directly as needed on
the GPU. The explicit model delivers higher performance because it avoids faulting and copying overheads, which
also have the potential downside of inducing jitter.
3.4. Pinned Memory for DMA Transfers#
The memory on the GPU must be pinned to enable DMA transfers. This requires that memory be allocated with cudaMalloc
rather than cudaMallocManaged or malloc. This restriction might be relaxed in the future, with more OS enabling. The
size of each data transfer must fit into the allocated buffer. The transfer does not need to be aligned to anything
other than a byte boundary.
3.5. cuFile APIs#
Application and framework developers enable GPUDirect Storage capabilities by incorporating the cuFile APIs. Applications
can use cuFile APIs directly or they can leverage frameworks like RAPIDS or DALI and higher-level APIs like C++ or Python
using vikio. cuFile provides synchronous and asynchronous APIs. Synchronous APIs such as cuFileRead and
cuFileWrite enable read and write similar to POSIX pread and pwrite with O_DIRECT. cuFile Batch APIs provide
asynchronous execution of IO similar to linux AIO. cuFile stream APIs starting in CUDA 12.2 release support asynchronous
submission in a CUDA stream and asynchronous execution similar to Linux AIO. In addition there are cuFile APIs for
driver initialization, finalization, buffer registration, and more. The cuFile based IO transfers are explicit and
direct, thereby enabling maximum performance.