Hi Charles, > I am working on writing some additional opencl kernels (potentially to > incorporate in to viennacl) which involve column-wise reductions. A > simple case would simply be the sum of each column of a matrix. > However, I am having an extremely difficult time getting my kernel > correct (reductions are tricky to me). That said, after searching for > some resources I came across an old post on sourceforge referring to > column-wise kernels > (http://sourceforge.net/p/viennacl/mailman/message/27542552/) with > viennacl. This leads me to my primary question. > > Are there such kernels already in ViennaCL that I have overlooked?
Yes ;-) Have a look here at how row-wise sums reduce to a standard matrix-vector product: https://sourceforge.net/p/viennacl/discussion/1143678/thread/38e942a0/ That is, in order to compute a row-sum and a column-sum you can use row_sum = prod(A, ones); col_sum = prod(trans(A), ones); In an hour or two I will push convenience functions for summation fixing the only remaining issue for the 1.7.0 release: https://github.com/viennacl/viennacl-dev/issues/127 > If not, are there any examples or resources you would recommend to help > learn this topic? I have tried searching further but the only thing I > can really find is a reduction of an entire matrix (which is relatively > simple) as opposed to by column or row. At this point I can only recommend to think about how such operations can be recast in terms of (standard) linear algebra. For example, row- and column-wise updates to a matrix are special cases of the more general A += outer_prod(u, v); operation (rank-1 updates). I'll improve the documentation in that direction. Best regards, Karli ------------------------------------------------------------------------------ _______________________________________________ ViennaCL-devel mailing list ViennaCL-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/viennacl-devel