proxy.golang.org : github.com/unixpickle/cuda
Package cuda provides bindings to the CUDA library. To use this package, you must tell Go how to link with CUDA. On Mac OS X, this might look like: On Linux, this might look like: Virtually every cuda API must be run from within a Context, which can be created like so: To run code in a Context asynchronously, you can do the following: To run code synchronously, simply read from the resulting channel: You should never call ctx.Run() inside another call to ctx.Run(), for reasons that are documented on the Context.Run() method. There are two ways to deal with memory: using Buffers, or using an Allocator directly with unsafe.Pointers. The Buffer API provides a high-level buffer interface with garbage collection and bounds checking. Most APIs use Buffers, including the APIs provided by sub-packages. No matter what, you will need an Allocator if you want to allocate memory. You can create an Allocator directly on top of CUDA: Once you have an allocator, you can use it to allocate Buffer objects like so: There are various functions to help you deal with buffers. The WriteBuffer() and ReadBuffer() functions allow you to copy Go slices to and from buffers. The Slice() function allows you to get a Buffer which points to a sub-region of a parent Buffer. To run kernels, you will use a Module. You can pass various Go primitives, unsafe.Pointers, and Buffers as kernel arguments. The cublas and curand sub-packages provide basic linear algebra routines and random number generators, respectively.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/unixpickle/cuda
License: BSD-2-Clause
Latest release: almost 8 years ago
First release: almost 8 years ago
Namespace: github.com/unixpickle
Stars: 25 on GitHub
Forks: 9 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 3 months ago