Sha256: 0942b3887ac3c7413c78e8619b4fb412286961836f5d9b85bf0f89b073cfee47

Contents?: true

Size: 799 Bytes

Versions: 13

Compression:

Stored size: 799 Bytes

Contents

% ctype = dtype_to_c_type(data_type)
% mul_str = mul.each_with_index.collect { |mul, index| "#{mul} * index_map_#{index}" }
__kernel void split(const int offset, __global const <%= ctype %> *A, __global <%= ctype %> *C) {
    // Get the index of the current element to be processed
    const int globalCol = get_global_id(0); // Col ID of C (0..N)

    // compute effective coordinates
    int ptr = globalCol;
<% div.each_with_index do |div, index| %>
    <% if index == axis %>
    int index_map_<%= index %> = (int)floor(ptr / (float)<%= div %>) + <%= step %>;
    <% else %>
    int index_map_<%= index %> = (int)floor(ptr / (float)<%= div %>);
    <% end %>
    <% if index < div.size - 1%>ptr = ptr % <%= div %>;<% end %><% end %>
    C[offset + globalCol] =  A[<%= mul_str.join(" + ") %>];

}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
tensor_stream-opencl-0.3.2 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.3.1 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.3.0 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.10 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.9 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.8 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.6 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.5 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.4 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.3 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.2 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.1 lib/tensor_stream/opencl/kernels/split_n.cl
tensor_stream-opencl-0.2.0 lib/tensor_stream/opencl/kernels/split_n.cl