kvikio-cu11


Namekvikio-cu11 JSON
Version 24.10.0 PyPI version JSON
download
home_pageNone
SummaryKvikIO - GPUDirect Storage
upload_time2024-10-10 17:26:09
maintainerNone
docs_urlNone
authorNVIDIA Corporation
requires_python>=3.10
licenseApache 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # KvikIO: High Performance File IO

## Summary

KvikIO (pronounced "kuh-VICK-eye-oh", see [here](https://ordnet.dk/ddo_en/dict?query=kvik) for pronunciation of kvik) is a Python and C++ library for high performance file IO. It provides C++ and Python
bindings to [cuFile](https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html),
which enables [GPUDirect Storage (GDS)](https://developer.nvidia.com/blog/gpudirect-storage/).
KvikIO also works efficiently when GDS isn't available and can read/write both host and device data seamlessly.
The C++ library is header-only making it easy to include in [existing projects](https://github.com/rapidsai/kvikio/blob/HEAD/cpp/examples/downstream/).


### Features

* Object oriented API of [cuFile](https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html) with C++/Python exception handling.
* A Python [Zarr](https://zarr.readthedocs.io/en/stable/) 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](https://github.com/NVIDIA/nvcomp).


### Documentation
 * Python: <https://docs.rapids.ai/api/kvikio/nightly/>
 * C++: <https://docs.rapids.ai/api/libkvikio/nightly/>


### Examples

#### Python
```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++
```c++
#include <cstddef>
#include <cuda_runtime.h>
#include <kvikio/file_handle.hpp>
using namespace std;

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");
  size_t written = fw.write(a, size);
  fw.close();

  // Read file into `b`
  kvikio::FileHandle fr("test-file", "r");
  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");
    future<size_t> future = f.pread(b_dev, sizeof(a), 0);  // Non-blocking
    size_t read = future.get(); // Blocking
    // Notice, `f` closes automatically on destruction.
  }
}
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kvikio-cu11",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "NVIDIA Corporation",
    "author_email": null,
    "download_url": "https://files.pythonhosted.org/packages/7a/5d/d272de853ef8485f8db7e1b4f1e36207235e4a6db4af200e83fd3638561e/kvikio_cu11-24.10.0.tar.gz",
    "platform": null,
    "description": "# KvikIO: High Performance File IO\n\n## Summary\n\nKvikIO (pronounced \"kuh-VICK-eye-oh\", see [here](https://ordnet.dk/ddo_en/dict?query=kvik) for pronunciation of kvik) is a Python and C++ library for high performance file IO. It provides C++ and Python\nbindings to [cuFile](https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html),\nwhich enables [GPUDirect Storage (GDS)](https://developer.nvidia.com/blog/gpudirect-storage/).\nKvikIO also works efficiently when GDS isn't available and can read/write both host and device data seamlessly.\nThe C++ library is header-only making it easy to include in [existing projects](https://github.com/rapidsai/kvikio/blob/HEAD/cpp/examples/downstream/).\n\n\n### Features\n\n* Object oriented API of [cuFile](https://docs.nvidia.com/gpudirect-storage/api-reference-guide/index.html) with C++/Python exception handling.\n* A Python [Zarr](https://zarr.readthedocs.io/en/stable/) backend for reading and writing GPU data to file seamlessly.\n* Concurrent reads and writes using an internal thread pool.\n* Non-blocking API.\n* Transparently handles reads and writes to/from memory on both host and device.\n* Provides Python bindings to [nvCOMP](https://github.com/NVIDIA/nvcomp).\n\n\n### Documentation\n * Python: <https://docs.rapids.ai/api/kvikio/nightly/>\n * C++: <https://docs.rapids.ai/api/libkvikio/nightly/>\n\n\n### Examples\n\n#### Python\n```python\nimport cupy\nimport kvikio\n\ndef main(path):\n    a = cupy.arange(100)\n    f = kvikio.CuFile(path, \"w\")\n    # Write whole array to file\n    f.write(a)\n    f.close()\n\n    b = cupy.empty_like(a)\n    f = kvikio.CuFile(path, \"r\")\n    # Read whole array from file\n    f.read(b)\n    assert all(a == b)\n    f.close()\n\n    # Use contexmanager\n    c = cupy.empty_like(a)\n    with kvikio.CuFile(path, \"r\") as f:\n        f.read(c)\n    assert all(a == c)\n\n    # Non-blocking read\n    d = cupy.empty_like(a)\n    with kvikio.CuFile(path, \"r\") as f:\n        future1 = f.pread(d[:50])\n        future2 = f.pread(d[50:], file_offset=d[:50].nbytes)\n        # Note: must wait for futures before exiting block\n        # at which point the file is closed.\n        future1.get()  # Wait for first read\n        future2.get()  # Wait for second read\n    assert all(a == d)\n\n\nif __name__ == \"__main__\":\n    main(\"/tmp/kvikio-hello-world-file\")\n```\n\n#### C++\n```c++\n#include <cstddef>\n#include <cuda_runtime.h>\n#include <kvikio/file_handle.hpp>\nusing namespace std;\n\nint main()\n{\n  // Create two arrays `a` and `b`\n  constexpr std::size_t size = 100;\n  void *a = nullptr;\n  void *b = nullptr;\n  cudaMalloc(&a, size);\n  cudaMalloc(&b, size);\n\n  // Write `a` to file\n  kvikio::FileHandle fw(\"test-file\", \"w\");\n  size_t written = fw.write(a, size);\n  fw.close();\n\n  // Read file into `b`\n  kvikio::FileHandle fr(\"test-file\", \"r\");\n  size_t read = fr.read(b, size);\n  fr.close();\n\n  // Read file into `b` in parallel using 16 threads\n  kvikio::default_thread_pool::reset(16);\n  {\n    // FileHandles have RAII semantics\n    kvikio::FileHandle f(\"test-file\", \"r\");\n    future<size_t> future = f.pread(b_dev, sizeof(a), 0);  // Non-blocking\n    size_t read = future.get(); // Blocking\n    // Notice, `f` closes automatically on destruction.\n  }\n}\n```\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "KvikIO - GPUDirect Storage",
    "version": "24.10.0",
    "project_urls": {
        "Homepage": "https://github.com/rapidsai/kvikio"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "7a5dd272de853ef8485f8db7e1b4f1e36207235e4a6db4af200e83fd3638561e",
                "md5": "299c87ba41de4bc5183864e7d633cc17",
                "sha256": "b3d02cf751616c56260ff04c1ec0b712b073a815cab4a9c71d7fe5e147f18ff1"
            },
            "downloads": -1,
            "filename": "kvikio_cu11-24.10.0.tar.gz",
            "has_sig": false,
            "md5_digest": "299c87ba41de4bc5183864e7d633cc17",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 2117,
            "upload_time": "2024-10-10T17:26:09",
            "upload_time_iso_8601": "2024-10-10T17:26:09.719142Z",
            "url": "https://files.pythonhosted.org/packages/7a/5d/d272de853ef8485f8db7e1b4f1e36207235e4a6db4af200e83fd3638561e/kvikio_cu11-24.10.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-10 17:26:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "rapidsai",
    "github_project": "kvikio",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "kvikio-cu11"
}
        
Elapsed time: 0.36799s