Hi Jose,

 > I have been looking for documentation regarding how to handle a matrix
> (sparse) in an OpenCL kernel. My main objective is to can fill a sparse
> matrix using an OpenCL kernel.
>
> Would it be possible??
>
> P.S. I can eventually precompute the matrix and indexes arrays sizes.

Yes, that's possible. The typical procedure for doing so is:

1. Compute number of elements per row, store in a buffer
2. Run exclusive_scan() on the buffer to obtain the row-array for the 
three-array CSR format.
3. Allocate the column index and value array (CSR format)
4. Populate these two arrays with values
5. Pass the arrays to a viennacl::compressed_matrix<>.

Instead of 5. you may already start with a viennacl::compressed_matrix<> 
and operate on the OpenCL buffers directly.

There is no ready-to-go example, but the pattern shows up in e.g. the 
sparse matrix-matrix product 
(viennacl/linalg/opencl/sparse_matrix_operations.hpp).

Best regards,
Karli



------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785471&iu=/4140
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to