Skip to main content

KvikIO - GPUDirect Storage

Project description

KvikIO: High Performance File IO

Summary

KvikIO (pronounced "kuh-VICK-eye-oh", see here for pronunciation of kvik) is a Python and C++ library for high performance file IO. It provides C++ and Python bindings to cuFile, which enables GPUDirect Storage (GDS). KvikIO also works efficiently when GDS isn't available and can read/write both host and device data seamlessly.

Features

  • Object oriented API of cuFile with C++/Python exception handling.
  • A Python Zarr backend for reading and writing GPU data to file seamlessly.
  • Concurrent reads and writes using an internal thread pool.
  • Non-blocking API.
  • Transparently handles reads and writes to/from memory on both host and device.
  • Provides Python bindings to nvCOMP.

Documentation

Examples

Python

import cupy
import kvikio

def main(path):
    a = cupy.arange(100)
    f = kvikio.CuFile(path, "w")
    # Write whole array to file
    f.write(a)
    f.close()

    b = cupy.empty_like(a)
    f = kvikio.CuFile(path, "r")
    # Read whole array from file
    f.read(b)
    assert all(a == b)
    f.close()

    # Use contexmanager
    c = cupy.empty_like(a)
    with kvikio.CuFile(path, "r") as f:
        f.read(c)
    assert all(a == c)

    # Non-blocking read
    d = cupy.empty_like(a)
    with kvikio.CuFile(path, "r") as f:
        future1 = f.pread(d[:50])
        future2 = f.pread(d[50:], file_offset=d[:50].nbytes)
        # Note: must wait for futures before exiting block
        # at which point the file is closed.
        future1.get()  # Wait for first read
        future2.get()  # Wait for second read
    assert all(a == d)


if __name__ == "__main__":
    main("/tmp/kvikio-hello-world-file")

C++

#include <cstddef>
#include <future>
#include <cuda_runtime.h>
#include <kvikio/file_handle.hpp>

int main()
{
  // Create two arrays `a` and `b`
  constexpr std::size_t size = 100;
  void *a = nullptr;
  void *b = nullptr;
  cudaMalloc(&a, size);
  cudaMalloc(&b, size);

  // Write `a` to file
  kvikio::FileHandle fw("test-file", "w");
  std::size_t written = fw.write(a, size);
  fw.close();

  // Read file into `b`
  kvikio::FileHandle fr("test-file", "r");
  std::size_t read = fr.read(b, size);
  fr.close();

  // Read file into `b` in parallel using 16 threads
  kvikio::default_thread_pool::reset(16);
  {
    // FileHandles have RAII semantics
    kvikio::FileHandle f("test-file", "r");
    std::future<std::size_t> future = f.pread(b_dev, sizeof(a), 0);  // Non-blocking
    std::size_t read = future.get(); // Blocking
    // Notice, `f` closes automatically on destruction.
  }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (736.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (682.7 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (755.4 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (702.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (753.8 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (702.0 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ ARM64manylinux: glibc 2.28+ ARM64

File details

Details for the file kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9e3fc1054a897c11b7bb390a374e470d6bfc5aef8b2e63fb63ed2f70b5bd76d9
MD5 a74972f0db43212219b747c90079f61a
BLAKE2b-256 87b8d37fb2e9228e6447128fa95c504601d66e9cbf8d4d04c3630671eca1e9d5

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 523f6ff07a54a3f55979457feebc58b90774110d97461bd2f800d94ba51f946d
MD5 eff1ab05995f8ed6b66d5e8a0feef48a
BLAKE2b-256 6171e745b70bd51e709fb18b01744a0ed9c8987de9d94950c96524456fc4628e

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2e7799bddd762fd66f65d7aed3a27a707bfb73917d011b66e2458b49cb655420
MD5 906a96ca6cfbed594a8be39ede0c17ac
BLAKE2b-256 a8955461a1d7b77bdd4952427e9f5abc33c44eb83fcaa712b0c46aeab07810c9

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 53f7e486cd4c00df902968661eee31761358f315693ce7ac43adc49ff905d8fc
MD5 c74225109f96aeac23f100af7c88f89b
BLAKE2b-256 5ad4f0e21193dea7005bd2c3161adfedd847ad6a94eeddc0a92a1af591eed3f4

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d6942ff65867655bf1e8c3f24350601a8c0b32cac3b182151f89fe2435a721b2
MD5 5d4a5979f75708261e2db3d095937238
BLAKE2b-256 7f021b14fa612532678a255b749e112ee0e7b41c27007ba388a2b2d27235601b

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 afca88f0cb3085d89f67bcf5dfcfff48ae0752e6df29af478f5cdd48a4d82299
MD5 93786d765faa7ca609d36de7f8c5ac96
BLAKE2b-256 5de57d749756af6c6ca9c5955c7c362855adf9cfdf5f6afb2c160d0611853826

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page