You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sameer Deshmukh edited this page Nov 6, 2017
·
1 revision
SciRuby Wishlist
This page lists a wishlist of projects that should be implemented for Ruby scientific computing in the future.
GPU computing
Native CUDA kernels with Rubex and RbCUDA
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'includeRbCUDA::Drivercudadefkernel_vadd(a,b,c)i=threadIdx().xc[i]=a[i] + b[i]returnend# generate some datalen=512a=rand(len).to_ib=rand(len).to_i# allocate & upload to the GPUd_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)withcuda(1,len)c=d_c.to_cpu_array