GithubHelp home page GithubHelp logo

syifan / cu Goto Github PK

View Code? Open in Web Editor NEW

This project forked from gorgonia/cu

0.0 2.0 0.0 86 KB

package cu provides an idiomatic interface to the CUDA Driver API.

License: MIT License

Go 96.38% C 3.62%

cu's Introduction

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 github.com/chewxy/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 8.0

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

go install github.com/chewxy/cu/cmd/cudatest
cudatest

You should see something like this if successful:

CUDA version: 8000
CUDA devices: 1
Device 0
========
Name      :	"GeForce GTX 960"
Clock Rate:	1177500 kHz
Memory    :	4233297920 bytes
Compute   : 5.2

#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##

  • All texture, surface and graphics related API have an equivalent Go prototype.
  • Batching of common operations (see for example Device.Attributes(...)
  • 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).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.