---
title: "How to Read Data into GPU Memory in Python with NVIDIA GPUDirect Storage"
description: "GPU applications face growing datasets that demand efficient data movement to keep accelerators supplied. NVIDIA GPUDirect Storage (GDS) enables a direct path between storage and GPU memory through the nvidia-fs kernel module, bypassing CPU staging. KvikIO provides Python interfaces over cuFile with defaults of a 16 KiB GDS threshold and 4 MiB task size, and its compat_mode setting determines whether cuFile is invoked. This tutorial demonstrates reading a 1 GiB file into a CuPy buffer on an H100 system with NVMe and verifying the path by setting CUFILE_STATS_LEVEL=3 and inspecting gds_stats output. With four cuFile worker threads and max_request_parallelism set to four, the default task size divides the read into 256 cuFile requests, while a 1 GiB task size results in four 256 MiB pieces processed through bounce buffers with slab caching."
---

# How to Read Data into GPU Memory in Python with NVIDIA GPUDirect Storage

[NVIDIA](https://yomu.fyi/company/nvidia-developer-blog) · Tanya Lenz · Oct 22, 2026

**Type:** Tutorial

## Summary

GPU applications face growing datasets that demand efficient data movement to keep accelerators supplied. NVIDIA GPUDirect Storage (GDS) enables a direct path between storage and GPU memory through the nvidia-fs kernel module, bypassing CPU staging. KvikIO provides Python interfaces over cuFile with defaults of a 16 KiB GDS threshold and 4 MiB task size, and its compat\_mode setting determines whether cuFile is invoked. This tutorial demonstrates reading a 1 GiB file into a CuPy buffer on an H100 system with NVMe and verifying the path by setting CUFILE\_STATS\_LEVEL=3 and inspecting gds\_stats output. With four cuFile worker threads and max\_request\_parallelism set to four, the default task size divides the read into 256 cuFile requests, while a 1 GiB task size results in four 256 MiB pieces processed through bounce buffers with slab caching.

## Context

GPU applications are processing ever-growing datasets, and moving data efficiently from storage is a necessity for keeping accelerators supplied. NVIDIA Magnum IO GPUDirect Storage (GDS) addresses this by enabling a direct data path between supported storage and GPU memory, avoiding staging through CPU memory.

## Approach / What changed

The tutorial guides users through installing NVIDIA KvikIO, inspecting KvikIO and cuFile settings, reading a file into a CuPy GPU buffer using direct I/O, and verifying the data path by enabling level-three cuFile statistics and using gds\_stats. It also covers cuFile execution settings that affect request decomposition, such as worker threads, max\_request\_parallelism, and min\_io\_threshold\_size\_kb.

## Takeaways

- KvikIO uses a compatibility mode (AUTO, ON, OFF) and a GDS threshold to decide whether to send I/O requests to cuFile or use its POSIX path that stages through host memory.
- cuFile independently determines the final transfer path based on system support; reaching cuFile does not guarantee the accelerated GDS path was used, which is indicated by nvfs counters in gds\_stats output.
- Default KvikIO settings (4 MiB task size, 16 KiB GDS threshold) divide a 1 GiB read into 256 cuFile requests, and cuFile execution settings like worker threads and min\_io\_threshold\_size\_kb affect how requests are split and scheduled.

## FAQ

### How does KvikIO decide whether to use cuFile?

KvikIO uses the compat\_mode setting (AUTO, ON, OFF) and gds\_threshold. In AUTO mode, it tries cuFile and falls back to POSIX if unavailable. Reads smaller than the GDS threshold go through the POSIX path directly.

### How can I verify that the accelerated GDS path was used for a read?

Set CUFILE\_STATS\_LEVEL=3 and run the program. While the process remains active, use gds\_stats to inspect per-GPU statistics; operations labeled nvfs indicate the accelerated path, while posix indicates CPU-staged transfers.

### What happens when a GPU buffer is not registered for storage DMA?

cuFile reads into a registered GPU bounce buffer and copies the data to the destination. Since GDS 1.17, these bounce buffers can be configured as slabs, and the nvidia-fs path uses slabs no larger than 16 MiB.

**Tags:** [GPU](https://yomu.fyi/topic/gpu), [GPUDirect Storage](https://yomu.fyi/topic/gpudirect-storage), [NVIDIA](https://yomu.fyi/topic/nvidia), [Python](https://yomu.fyi/topic/python)

- Source: [NVIDIA](https://developer.nvidia.com/blog/how-to-read-data-into-gpu-memory-in-python-with-nvidia-gpudirect-storage)
- Source URL: https://developer.nvidia.com/blog/how-to-read-data-into-gpu-memory-in-python-with-nvidia-gpudirect-storage
- Ingested by Yomu: 2026-10-22T18:00:16.841Z

[Read original post](https://developer.nvidia.com/blog/how-to-read-data-into-gpu-memory-in-python-with-nvidia-gpudirect-storage)
