-
Notifications
You must be signed in to change notification settings - Fork 80
Wishlist
Sameer Deshmukh edited this page Nov 6, 2017
·
1 revision
This page lists a wishlist of projects that should be implemented for Ruby scientific computing in the future.
Similar to native CUDA kernel support in Julia, we should have support in Ruby.
Since it is tough to augment the Ruby VM to support this, it can be done in an easier way using Rubex and RbCUDA. For example, a sample Rubex method that would compile to a native CUDA kernel can be defined with cudadef
and written like this:
require 'rbcuda_native'
require 'rbcuda'
include RbCUDA::Driver
cudadef kernel_vadd(a, b, c)
i = threadIdx().x
c[i] = a[i] + b[i]
return
end
# generate some data
len = 512
a = rand(len).to_i
b = rand(len).to_i
# allocate & upload to the GPU
d_a = GPU_Array.new(a)
d_b = GPU_Array.new(b)
d_c = GPU_Array.new(d_a)
# execute and fetch results.
kernel_vadd(d_a, d_b, d_c) with cuda(1,len)
c = d_c.to_cpu_array