Hi Jose, > (Is it Karl or Karli?)
feel free to pick your favorite (just like Jose/Pepe) :-) > Thanks for your quick answer! I should further investigate. However, I > could not find how to execute an exclusive_scan() without downloading > the number of elements per row from the GPU to the host. exclusive_scan() is also available for vectors (more precisely: the base class vector_base<>): https://github.com/viennacl/viennacl-dev/blob/master/viennacl/linalg/vector_operations.hpp#L1272 Here is an example of how to wrap a host buffer in a vector_base object in order to call exclusive_scan: https://github.com/viennacl/viennacl-dev/blob/master/viennacl/linalg/host_based/amg_operations.hpp#L1444 (the OpenCL version works similarly - either provide your own OpenCL cl_mem buffer, or use the memory handle from the compressed_matrix). Best regards, Karli > 2016-03-29 22:24 GMT+02:00 Karl Rupp <r...@iue.tuwien.ac.at > <mailto:r...@iue.tuwien.ac.at>>: > > 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