• Stars
    star
    27
  • Rank 905,827 (Top 18 %)
  • Language
    Ruby
  • License
    MIT License
  • Created about 6 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An OpenCL backend for TensorStream

Gem Version

TensorStream::Opencl

This gem provides an OpenCL backend for TensorStream (https://github.com/jedld/tensor_stream). OpenCL is an open standard that allows running compute applications on heterogenous platforms like CPUs and GPUs. For certain neural network implementations, like deep neural networks GPU acceleration can dramatically speedup computation.

Installation

Make sure OpenCL device drivers are installed in your system. You may refer to the following links:

Nvidia

https://developer.nvidia.com/opencl

AMD

https://support.amd.com/en-us/kb-articles/Pages/OpenCL2-Driver.aspx

Intel

https://software.intel.com/en-us/articles/opencl-drivers

Add this line to your application's Gemfile:

gem 'tensor_stream-opencl'

And then execute:

$ bundle

Or install it yourself as:

$ gem install tensor_stream-opencl

Usage

If using a Gemfile or a framework like rails, simply including this gem will allow tensor_stream to automatically select opencl devices for use in your computation. Otherwise you can do:

require 'tensor_stream/opencl'

You can check for available OpenCL devices via'

TensorStream::Evaluator::OpenclEvaluator.query_supported_devices

TensorStream::Evaluator::OpenclEvaluator.query_supported_devices.map(&:native_device)
# => [#<OpenCL::Device: Intel(R) Core(TM) i5-5575R CPU @ 2.80GHz (4294967295)>, #<OpenCL::Device: Intel(R) Iris(TM) Pro Graphics 6200 (16925952)>]

Device placement control

You can place operations on certain devices using ts.device:

require 'tensor_stream/opencl'

ts = TensorStream
# For the first GPU
ts.device('/device:GPU:0') do
  a = ts.placeholder(:float32, shape: [DIMEN, DIMEN])
  b = ts.placeholder(:float32, shape: [DIMEN, DIMEN])
  # Compute A^n and B^n and store results in c1
  c1 << matpow(a, n)
  c1 << matpow(b, n)
end

# For the second GPU
ts.device('/device:GPU:1') do
  a = ts.placeholder(:float32, shape: [DIMEN, DIMEN])
  b = ts.placeholder(:float32, shape: [DIMEN, DIMEN])
  # Compute A^n and B^n and store results in c1
  c1 << matpow(a, n)
  c1 << matpow(b, n)
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/jedld/tensor_stream-opencl. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

Code of Conduct

Everyone interacting in the TensorStream::Opencl project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.

More Repositories

1

tensor_stream

A ground-up and standalone reimplementation of TensorFlow for ruby. Comes with a pure ruby and OpenCL opcode evaluator
Ruby
505
star
2

pretentious

Tool for writing characterization tests - Generate RSpec or minitest specs based on existing behavior in a straightforward manner
Ruby
98
star
3

resugan

simple, powerful and unobstrusive event driven architecture framework for ruby
Ruby
81
star
4

natural_20

This is a text-based game engine that implements the D&D 5th edition ruleset. A sample adventure is included in this repository
Ruby
71
star
5

brains-jruby

A feedforward neural network implementation for JRuby
Ruby
60
star
6

multi_string_replace

A fast multiple string replace library for ruby. Uses a C implementation of the Aho–Corasick Algorithm based on https://github.com/morenice/ahocorasick while adding support for on the fly multiple string replacement. Faster alternative to String.gsub when dealing with non-regex (exact match) use cases
C
21
star
7

droiuby

App development platform for Android using Ruby. Develop android apps rapidly using the programming language that we all love, Ruby. Leveraging the JRuby runtime, Droiuby is designed as an open environment where you can use your own framework to develop apps.
Ruby
19
star
8

android_internals_handbook

An unofficial and crazy guide to hacking (in a good way) android on YOUR device. This includes rooting, custom roms and various other tweaks.
9
star
9

device_samsung_gtexslte

Device tree for the Samsung Galaxy Tab A 7.0 (2016) SM-T285
C
8
star
10

jetson-voice-assistant

A real time AI voice assistant for the Jetson Orin Nano. Fully self-contained, runs the Mistral 7B locally, setup a dedicated large language model home assistant using your Jetson Nano.
Python
8
star
11

GiNote

A Notetaking app for android
Java
7
star
12

ruby-rpg-engine

A ruby based text commandline RPG engine based on DnD 5e rules
Ruby
6
star
13

smt285_data_scripts

Various shell scripts for hacking the Samsung Galaxy Tab A 7.0 SM-T285
Shell
6
star
14

sinatra-proxy

A simple sinatra based forward and reverse proxy
Ruby
5
star
15

kernel_samsung_gtexslte

STOCK Kernel sources for the SM-T285 with SELinux patches for Android 6.0 support
C
4
star
16

ender3-skr1.3-hermera

Marlin 2.0 bugfix with skr 1.3 w/ e3d hermera and tmc2209/2208 mods
C++
4
star
17

kernel_7730

C
4
star
18

kernel_9832_7

C
3
star
19

droiuby-doo

Easy android development using ruby
Ruby
3
star
20

resque-fifo-queue

FIFO queue with consistent hashing on top of resque
Ruby
3
star
21

pinnaclesports

ruby client for the pinnaclesports api (unofficial)
Ruby
3
star
22

dex-os

The DEX Extensible Operating System. An educational operating system I developed during my college days.
C
3
star
23

vendor_sprd_9830

C
2
star
24

natural_20.py

A Dungeons and Dragons text based game engine for python
Python
1
star
25

atom-droiuby

Droiuby package for the github atom editor
CoffeeScript
1
star
26

oisems

Open Internetworked Secure Message Service (OISEMS) - An attempt to build a secure peer to peer robust message framework using off the shelf WIFI routers and/or bluetooth devices
Ruby
1
star
27

appstash

Appstash for android
Ruby
1
star
28

torii-globe

Globe OAuth2 provider for ember torii
JavaScript
1
star
29

ember-lenddo

ember add-on to add the lenddo button as a component to your Ember CLI app
JavaScript
1
star
30

hardware_sprd

C
1
star