|
Boost Users : |
Subject: [Boost-users] [compute] extending meta_kernel functionality
From: Oswin Krause (Oswin.Krause_at_[hidden])
Date: 2016-09-20 05:43:53
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...)
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net