Welcome to SGC-Ruby-CUDA¶ ↑
SGC-Ruby-CUDA implements Ruby bindings to Nvidia CUDA SDK. It provides easy access to CUDA-enabled GPU from a Ruby program.
SGC-Ruby-CUDA is incomplete in many ways. Currently, it supports only some crucial CUDA Driver and Runtime API functions. We hope to expand the coverage as much as possible.
SGC-Ruby-CUDA is tested on 64bit Fedora 14. We are looking forward to support Mac OSX. We have not tested it against 32bit Linux OS and Windows. We certainly wish to improve the code base to support multiple platforms in the future. We also welcome CUDA users to test it against their working environments.
Current development will focus on supporting CUDA Toolkit 4.0.
Check out {file:doc/features.rdoc} for the supported CUDA features. Also see {file:doc/devel.rdoc} for the latest development plan.
Fedora and the Infinity design logo are trademarks of Red Hat, Inc.
Linux is a registered trademark of Linus Torvalds.
NVIDIA, the NVIDIA logo, CUDA, GeForce, Quadro, and Tesla are trademarks or registered trademarks of NVIDIA Corporation in the U.S. and other countries.
Windows is a registered trademark of Microsoft Corporation in the United States and other countries.
Design philosophy¶ ↑
The Ruby bindings, Ruby CUDA API, which deal directly with Nvidia CUDA SDK C/C++ bindings retain the CUDA Driver and Runtime API in a systematic way whenever possible. This facilitates developers familiar with CUDA C who should be able to use SGC-Ruby-CUDA with minimum effort. At times, we may design the API to be more Ruby-like and let go unnecessary API structure in modern programming language.
We use Ruby-FFI as a bridge to call the CUDA C API. Ruby classes and methods to are built on top. The use of Ruby-FFI would ease the support of multiple Ruby interpretors.
Prerequisites¶ ↑
-
Ruby (Tested with Ruby 1.9.2)
-
Ruby-FFI (Tested with Ruby-FFI 1.0.7)
-
CUDA Toolkit (Tested with CUDA Toolkit 4.0)
-
C++ compiler (Tested with GCC 4.6.0 but requires simple patch to CUDA Toolkit)
-
Yard (Tested with Yard 0.6.7, required for generating documentations)
How to get SGC-Ruby-CUDA¶ ↑
The SGC-Ruby-CUDA Ruby gem is available at rubygems.org and rubyforge.org:
# Install the gem with the following command. $ gem install sgc-ruby-cuda or # Download the gem from the following URL and install. http://rubyforge.org/frs/?group_id=9719
The online documentations are available at the following:
http://rubydoc.info/github/xman/sgc-ruby-cuda/master/frames
The SGC-Ruby-CUDA git repository can be found in the following:
http://github.com/xman/sgc-ruby-cuda git://rubyforge.org/rubycuda.git
The master branch can be checked out with the following command:
git clone git://github.com/xman/sgc-ruby-cuda.git sgc-ruby-cuda git clone git://rubyforge.org/rubycuda.git sgc-ruby-cuda
The devel* branches may be checked out for a peep on the latest development. However, they are highly volatile and rebase may be applied for cleaner commits. The devel* branches serve as grace period before commits move into mainstream or master branches which are considered stable commits. This would minimize unnecessary fixing commits.
Getting started¶ ↑
# Setup the environment. Assuming the CUDA Toolkit is installed in # the default path /usr/local/cuda. # For 64bit Linux only: export CPATH="/usr/local/cuda/include" export LIBRARY_PATH="/usr/local/cuda/lib64" export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$LD_LIBRARY_PATH" export PATH="/usr/local/cuda/bin:$PATH" # For Mac OSX only: export CPATH="/usr/local/cuda/include" export LIBRARY_PATH="/usr/local/cuda/lib" export DYLD_LIBRARY_PATH="/usr/local/cuda/lib:$DYLD_LIBRARY_PATH" export PATH="/usr/local/cuda/bin:$PATH" gem install ffi cd sgc-ruby-cuda rake test # Check out the test cases in test/ on how to use Ruby CUDA API. gem install yard cd sgc-ruby-cuda rake yard # Check out the generated documentations in html/index.html with a browser.
How to contribute¶ ↑
-
Create an account in github github.com
-
Fork this project SGC-Ruby-CUDA at github.com/xman/sgc-ruby-cuda
-
Make changes and submit commits to your local repository.
-
At your local repository, setup and send a pull request.
Ideally, a commit should do only one task. We like clean commits. Commits should be applied to the master branch.
How to file a bug report¶ ↑
Submit new issues at github.com/xman/sgc-ruby-cuda/issues
Please provide information on the SGC-Ruby-CUDA version or the commit hash, OS platform, Ruby version, FFI version, how to reproduce the issue, the error messages.
Mailing list¶ ↑
groups.google.com/group/sgc-ruby-cuda
License¶ ↑
SGC-Ruby-CUDA is released under the GNU GPLv3. See the file COPYING.
The Author¶ ↑
All kinds of feedbacks and bug reports are welcomed. Here is the author’s email address:
shinyee@speedgocomputing.com