All Projects → gorgonia → Cu

gorgonia / Cu

Licence: apache-2.0
package cu provides an idiomatic interface to the CUDA Driver API.

Programming Languages

go
31211 projects - #10 most used programming language
golang
3204 projects

Labels

Projects that are alternatives of or similar to Cu

Amgx
Distributed multigrid linear solver library on GPU
Stars: ✭ 207 (-11.54%)
Mutual labels:  cuda
Softmax Splatting
an implementation of softmax splatting for differentiable forward warping using PyTorch
Stars: ✭ 218 (-6.84%)
Mutual labels:  cuda
Tengine
Tengine is a lite, high performance, modular inference engine for embedded device
Stars: ✭ 4,012 (+1614.53%)
Mutual labels:  cuda
Bohrium
Automatic parallelization of Python/NumPy, C, and C++ codes on Linux and MacOSX
Stars: ✭ 209 (-10.68%)
Mutual labels:  cuda
Nicehashquickminer
Super simple & easy Windows 10 cryptocurrency miner made by NiceHash.
Stars: ✭ 211 (-9.83%)
Mutual labels:  cuda
Deepspeech
DeepSpeech neon implementation
Stars: ✭ 223 (-4.7%)
Mutual labels:  cuda
Oneflow
OneFlow is a performance-centered and open-source deep learning framework.
Stars: ✭ 2,868 (+1125.64%)
Mutual labels:  cuda
Cudnn Training
A CUDNN minimal deep learning training code sample using LeNet.
Stars: ✭ 231 (-1.28%)
Mutual labels:  cuda
Relion
Image-processing software for cryo-electron microscopy
Stars: ✭ 219 (-6.41%)
Mutual labels:  cuda
Pytorch Hed
a reimplementation of Holistically-Nested Edge Detection in PyTorch
Stars: ✭ 228 (-2.56%)
Mutual labels:  cuda
Haste
Haste: a fast, simple, and open RNN library
Stars: ✭ 214 (-8.55%)
Mutual labels:  cuda
Tigre
TIGRE: Tomographic Iterative GPU-based Reconstruction Toolbox
Stars: ✭ 215 (-8.12%)
Mutual labels:  cuda
Nvidia Modded Inf
Modified nVidia .inf files to run drivers on all video cards, research & telemetry free drivers
Stars: ✭ 227 (-2.99%)
Mutual labels:  cuda
Hip
HIP: C++ Heterogeneous-Compute Interface for Portability
Stars: ✭ 2,609 (+1014.96%)
Mutual labels:  cuda
Cuspatial
CUDA-accelerated GIS and spatiotemporal algorithms
Stars: ✭ 229 (-2.14%)
Mutual labels:  cuda
Cunn
Stars: ✭ 205 (-12.39%)
Mutual labels:  cuda
Pedestrian alignment
TCSVT2018 Pedestrian Alignment Network for Large-scale Person Re-identification
Stars: ✭ 223 (-4.7%)
Mutual labels:  cuda
Occa
JIT Compilation for Multiple Architectures: C++, OpenMP, CUDA, HIP, OpenCL, Metal
Stars: ✭ 230 (-1.71%)
Mutual labels:  cuda
Optix Pathtracer
Simple physically based path tracer based on Nvidia's Optix Ray Tracing Engine
Stars: ✭ 231 (-1.28%)
Mutual labels:  cuda
Cupoch
Robotics with GPU computing
Stars: ✭ 225 (-3.85%)
Mutual labels:  cuda

cu GoDoc

Package cu is a package that interfaces with the CUDA Driver API. This package was directly inspired by Arne Vansteenkiste's cu package.

Why Write This Package?

The main reason why this package was written (as opposed to just using the already-excellent cu package) was because of errors. Specifically, the main difference between this package and Arne's package is that this package returns errors instead of panicking.

Additionally another goal for this package is to have an idiomatic interface for CUDA. For example, instead of exposing cuCtxCreate to be CtxCreate, a nicer, more idiomatic name MakeContext is used. The primary goal is to make calling the CUDA API as comfortable as calling Go functions or methods. Additional convenience functions and methods are also created in this package in the pursuit of that goal.

Lastly, this package uses the latest CUDA toolkit whereas the original package cu uses a number of deprecated APIs.

Installation

This package is go-gettable: go get -u gorgonia.org/cu

This package mostly depends on built-in packages. There are two external dependencies:

  • errors, which is licenced under a MIT-like licence. This package is used for wrapping errors and providing a debug trail.
  • assert, which is licenced under a MIT-like licence. This package is used for quick and easy testing.

However, package cu DOES depend on one major external dependency: CUDA. Specifically, it requires the CUDA driver. Thankfully nvidia has made this rather simple - everything that is required can be installed with one click: CUDA Toolkit.

To verify that this library works, install and run the cudatest program, which accompanies this package:

go install gorgonia.org/cu/cmd/cudatest
cudatest

You should see something like this if successful:

CUDA version: 10020
CUDA devices: 1

Device 0
========
Name      :	"TITAN RTX"
Clock Rate:	1770000 kHz
Memory    :	25393561600 bytes
Compute   : 	7.5

Windows

To setup CUDA in Windows:

  1. Install CUDA Toolkit
  2. Add %CUDA_PATH%/bin to your %PATH% environment variable (running nvcc from console should work)
  3. Make a symlink mklink /D C:\cuda "c:\Program Files\NVIDIA GPU Computing Toolkit\CUDA" (alternatively, install CUDA toolkit to C:\cuda\)

To setup the compiler:

  1. Install MSYS2 (see https://www.msys2.org/)
  2. In c:\msys64\msys2_shell.cmd uncomment the line with set MSYS2_PATH_TYPE=inherit (this makes Windows PATH variable visible)
  3. Install go in MSYS2 (64 bit) with pacman -S go

FAQ

Here is a common list of problems that you may encounter.

ld: cannot find -lcuda (Linux)

Checklist:

  • [ ] Installed CUDA and applied the relevant post-installation steps?
  • [ ] Checked that the sample programs in the CUDA install all works?
  • [ ] Checked the output of ld -lcuda --verbose?
  • [ ] Checked that there is a libcuda.so in the given search paths?
  • [ ] Checked that the permissions on libcuda.so is correct?

Note, depending on how you install CUDA on Linux, sometimes the .so file is not properly linked. For example: in CUDA 10.2 on Ubuntu, the default .deb installation installs the shared object file to /usr/lib/x86_64-linux-gnu/libcuda.so.1. However ld searches only for libcuda.so. So the solution is to symlink libcuda.so.1 to libcuda.so, like so:

sudo ln -s /PATH/TO/libcuda.so.1 /PATH/TO/libcuda.so

Be careful when using ln. This author spent several hours being tripped up by permissions issues.

Progress

The work to fully represent the CUDA Driver API is a work in progress. At the moment, it is not complete. However, most of the API that are required for GPGPU purposes are complete. None of the texture, surface and graphics related APIs are handled yet. Please feel free to send a pull request.

Roadmap

  • [ ] Remaining API to be ported over
  • [x] All texture, surface and graphics related API have an equivalent Go prototype.
  • [x] Batching of common operations (see for example Device.Attributes(...)
  • [x] Generic queueing/batching of API calls (by some definition of generic)

Contributing

This author loves pull requests from everyone. Here's how to contribute to this package:

  1. Fork then clone this repo: git clone [email protected]:YOUR_USERNAME/cu.git
  2. Work on your edits.
  3. Commit with a good commit message.
  4. Push to your fork then submit a pull request.

We understand that this package is an interfacing package with a third party API. As such, tests may not always be viable. However, please do try to include as much tests as possible.

Licence

The package is licenced with a MIT-like licence. Ther is one file (cgoflags.go) where code is directly copied and two files (execution.go and memory.go) where code was partially copied from Arne Vansteenkiste's package, which is unlicenced (but to be safe, just assume a GPL-like licence, as mumax/3 is licenced under GPL).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].