I'm just learning to work with ViennaCL. The first tries on the CPU worked fine, now I am trying to use OpenCL. However, I can't manage to get data onto the CPU - while the matrices seem to be created, they don't get any contents:
#define VIENNACL_WITH_OPENCL #define VIENNACL_WITH_UBLAS #include <boost/numeric/ublas/matrix.hpp> #include "viennacl/matrix.hpp" int main() { boost::numeric::ublas::matrix<float> data_cpu(1,1); data_cpu(0,0) = 1; viennacl::matrix<float> data_gpu(1,1); viennacl::copy(data_cpu, data_gpu); assert(data_cpu(0,0) == data_gpu(0,0)); }
After this,
data_gpu(0,0)
is 0 but I believe it should be 1. Also, if I copy
data_gpu
back to
data_cpu
,
data_cpu
is incorrect as well.
I'm compiling this with
g++ nocopy.cpp -framework OpenCL
. I am using OS X with the provided OpenCL driver.
What am I doing wrong here?
Edit: Removing
VIENNACL_WITH_OPENCL
fixes the problem, but is not what I want.