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_cu13-26.2.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (641.0 kB view details)

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

kvikio_cu13-26.2.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (601.8 kB view details)

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

kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (642.9 kB view details)

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

kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (603.9 kB view details)

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

kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (652.7 kB view details)

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

kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (616.5 kB view details)

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

kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (651.1 kB view details)

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

kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl (613.9 kB view details)

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

File details

Details for the file kvikio_cu13-26.2.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6b668dc006d888e9d8c629cf051ed407076c199222934cef7ff40d84da63b1af
MD5 9ccd00b4ed47d11d31817e9248aa1666
BLAKE2b-256 c6c7eec495b709c57d0ebca4e998e1747dc29d7230932725df19a9bbf2dd3239

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp313-cp313-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 4609e5d8b5a9a3263d6cbfe469007c2bf6811d468cd51315da714737ee24c6ba
MD5 ba905c09023d138a63eef8212a10c2e4
BLAKE2b-256 ab83a92e50514bc94f223cdb6c7cfbdadc2abcb3c2b867fec9184ff7155ddd92

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 75aa7778f8f206c4738dae63d00d7f0b1ea8108f8b1442038d7b4ff13cf0e455
MD5 87073381121d24acaca36ee4574135e1
BLAKE2b-256 fa7a0f87cbeb1a4fd4138e0a5c888fc6254fb73d8303038743dd215789ae75a5

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp312-cp312-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 93efa8e771584c590c52769930d60c29de7f91386f343ae448f962d7a975e536
MD5 94cb3cbebd35576bd85a245456dfec16
BLAKE2b-256 872dcedaf5fef8f972994669f1f66067c626bd57751cef69661196fbc4d2a50f

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ffc6b3bdf9f40c040ed0542c1f694f85653d2b98a679e90e4129198eee01362a
MD5 291b39a165a5272d1360247223c125be
BLAKE2b-256 fa164a593b4e74bc2e00387be59ee12743659c0d5339afb9abe8647dcf35c9eb

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp311-cp311-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 8c3c1310009a34fe4679a5e20d090b72382fc3ed58df19ce0627d17bc31bcd57
MD5 e1883ae7fd2d2067afddd26f41f28a05
BLAKE2b-256 5793ded8900f11d4fd89fe7fbfd1f9fb6f4dafae3658b7959c8a09ead2d8a2c8

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c982b23e130b4fde17a483225181ea439be03571c8868481c53189cfb58b07ba
MD5 950965ec562f1921bda366d92306a2ad
BLAKE2b-256 ad5558db7a89fa40eddd1e421f256e43b1c740cd7c7802555f6449cd93dd137d

See more details on using hashes here.

File details

Details for the file kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for kvikio_cu13-26.2.0-cp310-cp310-manylinux_2_24_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 c901ba7fc076788cf759a3ad6acd022d413db0dc198fa035d86466b17c259073
MD5 8e230c82b1d9d0915c3961bd8cce9b6f
BLAKE2b-256 2deca6d5137048f6aa767bc3211b0a492747ac3aece9f9472f765b0c2b4ea5a9

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