[compute] extending meta_kernel functionality
Hi, I am trying to use boost.compute to extend my linear algebra library to GPUs. so far it helped me a lot with vectors as i can directly use the iterator interface. Matrices are harder. for matrices i need to overload the operator matrix(i,j)-> return the element (i,j). For this i have to return an expression which then offers operator<< with meta_kernel, for example template<class T, class IndexExpr1, class IndexExpr2> inline meta_kernel& operator<<(boost::compute::detail::meta_kernel &kernel, const matrix_element_expr<T, IndexExpr1, IndexExpr2> &expr) { return kernel << kernel.get_buffer_identifier<T>(expr.m_buffer, expr.m_address_space) << '[' << expr.m_expr1 <<"*" <<expr.m_stride1<<"+"<<expr.m_expr2<< "*"<<expr.m_stride2 << ']'; } Unfortunately all of this is in namespace boost::compute::detail, making it a no-go area. Therefore two questions: 1. How stable is i?/can meta_kernel be moved into a normal namespace? 2. Is there a different way to achieve this? (Note that the code above is only an example. I could hack it in this case using the return type of buffer_iterator but not in all cases unfortunately...)
participants (1)
-
Oswin Krause