Hi Sumit,

 > If I were to use an Eigen Matrix, I can potentially access its raw data
> using the Matrix.data() function. Is there anything similar in ViennaCL
> also?

yes, there is. The respective member function is called handle() and 
returns a multi-backend handle. It then depends where the actual data is 
residing, as the data may be sitting in either main RAM, a CUDA device, 
or an OpenCL context:

viennacl::vector<T> x(N);

char *ram_data = x.handle().ram_handle().get();
char *cuda_data = x.handle().cuda_handle().get();
cl_mem opencl_data = x.handle().opencl_handle().get();

In order to find out which handle type is currently valid, use
x.handle().get_active_handle_id()
which is either
  viennacl::MEMORY_NOT_INITIALIZED,
  viennacl::MAIN_MEMORY,
  viennacl::CUDA_MEMORY, or
  viennacl::OPENCL_MEMORY

Note that you usually want to reinterpret_cast<> the char* to the 
respective target type.

On the other hand, you should *not* use these low-level functionality 
directly, unless you really know what you're doing and how the source 
and target memory layouts look like. Better use viennacl::copy() and 
eventually viennacl::fast_copy() instead, which are backend-agnostic and 
take care of the details.


Best regards,
Karli


------------------------------------------------------------------------------
HPCC Systems Open Source Big Data Platform from LexisNexis Risk Solutions
Find What Matters Most in Your Big Data with HPCC Systems
Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
Leverages Graph Analysis for Fast Processing & Easy Data Exploration
http://p.sf.net/sfu/hpccsystems
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to