I am trying to interface with clMAGMA using existing OpenCL objects (via the ViennaCL library - https://github.com/viennacl/viennacl-dev). I have confirmed I can accomplish this with clBLAS and assumed I could do the same with clMAGMA. I can extract the relevant arguments from existing viennacl::matrix objects (One trival example with elements [5,1][1,3] and the other to be filled [0,0][0,0]):
Code: Select all
// declare OpenCL objects
int info;
// Order of matrix (assuming square here)
const int N = vcl_A.size2();
// Get command queue
cl_command_queue queue = vcl_A.handle().opencl_handle().context().get_queue().handle().get();
/* Get OpenCL memory objects */
const cl_mem *bufA = &vcl_A.handle().opencl_handle().get();
const cl_mem *bufB = &vcl_B.handle().opencl_handle().get();
Code: Select all
/* Call clmagma. Perform cholesky decomp */
magma_spotrs_gpu(MagmaUpper, N, N,
*bufA, 0, vcl_A.internal_size2(),
*bufB, 0, vcl_B.internal_size2(),
queue, &info);
if (info < 0) {
stop("magma_spotrs_gpu failed");
}
Code: Select all
std::cout << "vcl_B" << std::endl;
std::cout << vcl_B << std::endl;
Regards,
Charles