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.

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.10.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (644.5 kB view details)

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

kvikio_cu12-25.10.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (594.3 kB view details)

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

kvikio_cu12-25.10.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (643.8 kB view details)

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

kvikio_cu12-25.10.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (593.5 kB view details)

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

kvikio_cu12-25.10.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (664.3 kB view details)

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

kvikio_cu12-25.10.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (620.0 kB view details)

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

kvikio_cu12-25.10.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (662.6 kB view details)

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

kvikio_cu12-25.10.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (615.7 kB view details)

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

File details

Details for the file kvikio_cu12-25.10.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 91050d796e7190544faa6e8ebc036dfc496610693f24b97c0dfec3e8d188fa19
MD5 f1094559f2ea56f247d71e4b4378c346
BLAKE2b-256 8bd7e7e53c40b5fd9398b6bd44859ca16475c37e4b9df65ede074c3cf83d81a0

See more details on using hashes here.

File details

Details for the file kvikio_cu12-25.10.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 5068e1101fc476b0d12bdc37d2cf8bcf724f8138f77104e1da3c5d96a1f6e4fc
MD5 a6dc61260c0bcbcd615971b82c08c1f4
BLAKE2b-256 254b6314fb1385274aa83f298072e82fe07c940338d3f4d5792c3d896c3ed8e7

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b5c4006bfe80c0482a42e3da69556ad928488ebd92f2aa9c319df7140af9f6d
MD5 991afe1246f39b189c6fd2f11eb9788e
BLAKE2b-256 d1dce58aa44a8153b5c9251761979bb11515ad575bc105c02c3f2bca7d6a7e35

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 af8c26a32d313e67f95802a8281245866482a5d6fb602d511d33cfdb3fdab27c
MD5 c97bdd87b99bd6f62c9eb2dbab20272b
BLAKE2b-256 479b63965d83ff0c3d3e4821873bde05fb6c0ea40857536bd0a114e40f4aa47a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 611037782170160285a2d7aafca34dea53f5ee1b4616d542603707bf47dd0c7a
MD5 2a27e14a8d04dc5f8488bc4d690982d7
BLAKE2b-256 855e21d546d7fe72d250536b2329f47d758ac6f709554b307371fbf46745d051

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3157104b0c1d92acfcfa2785d7ad2bb1c687b68b25bc1b7f4d6b107686e58c71
MD5 9364b032be78de3f6c99997a6e4e02c7
BLAKE2b-256 c8a03170c7ef410e2f690ae8c5ef1da7ba4c96a2be1a75a23569f52497ecd34c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8b2ece0215e218c5116ad8a12f9bc5c873c9b40a975878c73747fa61c836abce
MD5 401d2ef4b9e9b9d8e518930bac1085ad
BLAKE2b-256 db943bd71f3568c0fbdaa49604d422a1d9484f4463c75c0f2729d216ac8bea05

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for kvikio_cu12-25.10.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 3e4a33cf25068cd3e7fa05cebb26d123e659fa1948efe4a30158b68d5eea9dc7
MD5 406e31f91d4b3f3b19332945c7b1aff0
BLAKE2b-256 d7f306541155b8c186155eed4e721d4ef06b8898cbc1a558f45722e2cc1bfb86

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