#gpgpu #cuda #ffi

sys cuda-driver-sys

Rust binding to CUDA Driver APIs

3 releases

0.3.0 May 3, 2020
0.3.0-alpha.2 May 1, 2020
0.3.0-alpha.1 Dec 30, 2019

#236 in Hardware support

Download history 214/week @ 2021-08-08 140/week @ 2021-08-15 253/week @ 2021-08-22 221/week @ 2021-08-29 213/week @ 2021-09-05 186/week @ 2021-09-12 241/week @ 2021-09-19 308/week @ 2021-09-26 525/week @ 2021-10-03 742/week @ 2021-10-10 1941/week @ 2021-10-17 1493/week @ 2021-10-24 745/week @ 2021-10-31 735/week @ 2021-11-07 1053/week @ 2021-11-14 961/week @ 2021-11-21

96 downloads per month
Used in 7 crates (3 directly)

MIT/Apache

215KB
7K SLoC

cuda-sys

name crate.io docs.rs CUDA
cuda-driver-sys Crate docs.rs 10.2
cuda-runtime-sys Crate docs.rs 10.2

Rust binding to CUDA Driver (libcuda.so) and Runtime (libcudart.so) APIs

This crate does NOT include CUDA itself. You need to install on your own.

CUDA Installation

  • You should install CUDA from the official installer.
  • or use nvidia/cuda container
    • This container does not add libcuda.so to dynamic link path. You need to add it to your ld path LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs or using ldconfig.

CUDA_LIBRARY_PATH environment variable

  • If you use system installer (e.g. apt, yum, pacman, and so on), the install path may be different.
  • $CUDA_LIBRARY_PATH (e.g. /opt/cuda/lib64) environment value adds paths to the list of library searching.
  • To verify that cuda-sys can find your CUDA installation, you can check that the CUDA_PATH environment variable has been set.

Q & A

Q. Program does not start (can be compiled) with following error message:

error while loading shared libraries: libcuda.so.1: cannot open shared object file: No such file or directory

A. Driver API (libcuda.so) is sometimes installed in a separate directory. You need to find it, and add to LD_LIBRARY_PATH:

LD_LIBRARY_PATH=/usr/local/cuda/lib64/stubs

License

Dual-licensed to be compatible with the Rust project. Licensed under the Apache License, Version 2.0 or the MIT license, at your option. This file may not be copied, modified, or distributed except according to those terms.

You should check the End User License Agreement, which describes NVIDIA Software License Agreement and CUDA Supplement to Software License Agreement.

Dependencies

^