Dear all,
I'm quite newbie to Viennacl and having trouble in my first try of
hello-world project. Here is the snippet of my code.
#define VIENNACL_WITH_OPENCL
#include "viennacl/vector.hpp"
#include "viennacl/compressed_matrix.hpp"
#include "viennacl/linalg/cg.hpp"
void test_viennacl(std::vector<std::string> &args)
{
const int ndim = 16;
// identity matrix
std::vector< std::map< unsigned int, float> > cpu_sparse_matrix(ndim);
for( auto i = 0; i < ndim; i++ ) {
cpu_sparse_matrix[i][i] = 1.0;
}
viennacl::compressed_matrix<float> A(ndim, ndim);
copy(cpu_sparse_matrix, A);
viennacl::vector<float> x(ndim);
viennacl::vector<float> b(ndim);
// b = [ 0, 1, ..., ndim-1 ]
std::vector<float> vec_init(ndim);
for( auto i = 0; i < vec_init.size(); i++ ) {
vec_init[i] = i;
}
viennacl::copy( vec_init, b );
// x = A*b
x = viennacl::linalg::prod(A, b);
// A*x = b
viennacl::linalg::cg_tag cg();
x = viennacl::linalg::solve(A, b, viennacl::linalg::cg_tag());
return;
}
As written in code, I wanted to do two things : matrix-vector
multiplication and solving linear equation. Multiplication(prod) is done
easily but solving equation(solve) is not, system went frozen. I built and
tried examples/tutorial/iterative.cpp and got same situation.
My working envirioment is :
Windows 8.1
Intel i5 6600 (a.k.a skylake)
Intel Opencl SDK (sdk version 6.1)
Visual studio 2015
Any comment would be appreciated. Thank you.
-Taehan.
------------------------------------------------------------------------------
Attend Shape: An AT&T Tech Expo July 15-16. Meet us at AT&T Park in San
Francisco, CA to explore cutting-edge tech and listen to tech luminaries
present their vision of the future. This family event has something for
everyone, including kids. Get more information and register today.
http://sdm.link/attshape
_______________________________________________
ViennaCL-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/viennacl-support