Hi Toby,

> For most of the PyViennaCL functions, where the prototypes are
> compatible, I pass vector_base objects to ViennaCL, because that way I
> don't have to have a large number of identical functions for vector,
> vector_proxy, etc. In this case, I was passing the vector as a
> vector_base object to the solver, and for some reason, it became 0 along
> the way.

It seems like you found a bug. In the iterative solvers we have the lines:
       VectorType result = rhs;
       viennacl::traits::clear(result);

If VectorType is viennacl::vector, everything is okay. However, if 
VectorType is viennacl::vector_base, then a missing copy-CTOR results in 
a compiler-generated, 'flat' copy. The subsequent clear() thus operates 
on the memory handle copied from 'rhs', clearing the data.
Ticket created: https://github.com/viennacl/viennacl-dev/issues/60


> Does anyone know why that might be? This doesn't seem to happen
> elsewhere.. (Notably, for instance, the direct solvers work, and those
> calls use matrix_base and vector_base prototypes).

Hmm, seems like this requires some temporary to fix things up. Could you 
please create a temporary object rhs_copy of type viennacl_vector<> and 
pass that to the iterative solvers? For example, replace

  result = viennacl::solve(A, b, cg_tag());

by
  viennacl::vector<T> b_copy(b);
  result = viennacl::solve(A, b_copy, cg_tag());

The additional temporary object won't matter for overall performance.

Best regards,
Karli


------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121054471&iu=/4140/ostg.clktrk
_______________________________________________
ViennaCL-devel mailing list
ViennaCL-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/viennacl-devel

Reply via email to