I'm trying to use clSPARSE pre-compiled. Tried creating a simple dense matrix and then converting it to sparse using clsparseDdense2csr. Code is more or less:
cl::Buffer ADenseBuffer = CL().CreateBuffer(A.total() * sizeof(float), A.data);
ADenseCl.values = ADenseBuffer();
ADenseCl.offValues = 0;
ADenseCl.num_rows = A.rows;
ADenseCl.num_cols = A.cols;
ADenseCl.lead_dim = A.rows; // Doc says it's number of rows
ADenseCl.major = rowMajor;
clsparseDdense2csr(&ADenseCl, &ACl, ImageProcessingCL::CL().ClsparseControl());
What I get is a crash in clsparseDdense2csr. The error I'm getting printed is "CLSPARSE_V( CL_INVALID_MEM_OBJECT ) - Error: Enqueue copy buffer values to offsets".
Looking at ACl in the debugger, its num rows / cols are set correctly, as well as num_nonzeroes, but looks like buffers haven't been created. Should I create them myself? Obviously I can't allocate the values and colIndices buffers efficiently, and I have no idea where rowBlockSize comes from so can't set rowBlocks.
Help would be appreciated.