All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
iterative_operations.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_OPENCL_ITERATIVE_OPERATIONS_HPP_
#define VIENNACL_LINALG_OPENCL_ITERATIVE_OPERATIONS_HPP_
/* =========================================================================
Copyright (c) 2010-2016, Institute for Microelectronics,
Institute for Analysis and Scientific Computing,
TU Wien.
Portions of this software are copyright by UChicago Argonne, LLC.
-----------------
ViennaCL - The Vienna Computing Library
-----------------
Project Head: Karl Rupp rupp@iue.tuwien.ac.at
(A list of authors and contributors can be found in the manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include <cmath>
#include "viennacl/forwards.h"
#include "viennacl/detail/vector_def.hpp"
#include "viennacl/ocl/device.hpp"
#include "viennacl/ocl/handle.hpp"
#include "viennacl/ocl/kernel.hpp"
#include "viennacl/scalar.hpp"
#include "viennacl/tools/tools.hpp"
#include "viennacl/linalg/opencl/common.hpp"
#include "viennacl/linalg/opencl/kernels/iterative.hpp"
#include "viennacl/meta/predicate.hpp"
#include "viennacl/meta/enable_if.hpp"
#include "viennacl/traits/size.hpp"
#include "viennacl/traits/start.hpp"
#include "viennacl/traits/handle.hpp"
#include "viennacl/traits/stride.hpp"
namespace viennacl
{
namespace linalg
{
namespace opencl
{
template<typename NumericT>
void pipelined_cg_vector_update(vector_base<NumericT> & result,
NumericT alpha,
vector_base<NumericT> & p,
vector_base<NumericT> & r,
vector_base<NumericT> const & Ap,
NumericT beta,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(result).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "cg_vector_update");
cl_uint vec_size = cl_uint(viennacl::traits::size(result));
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(result, alpha, p, r, Ap, beta, inner_prod_buffer, vec_size, viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))));
}
template<typename NumericT>
void pipelined_cg_prod(compressed_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
bool use_nvidia_blocked = (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id && (double(A.nnz()) / double(A.size1()) > 12.0));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), use_nvidia_blocked ? "cg_csr_blocked_prod" : "cg_csr_prod");
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
if (use_nvidia_blocked)
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle().opencl_handle(),
p,
Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
));
}
else
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle3().opencl_handle(), A.handle().opencl_handle(), cl_uint(A.blocks1()),
p,
Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(1024 * sizeof(NumericT))
));
}
}
template<typename NumericT>
void pipelined_cg_prod(coordinate_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
Ap.clear();
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "cg_coo_prod");
unsigned int thread_num = 256; //k.local_work_size(0);
k.local_work_size(0, thread_num);
k.global_work_size(0, 64 * thread_num); //64 work groups are hard-coded for now. Gives reasonable performance in most cases
viennacl::ocl::enqueue(k(A.handle12().opencl_handle(), A.handle().opencl_handle(), A.handle3().opencl_handle(),
p,
Ap,
vec_size,
viennacl::ocl::local_mem(sizeof(cl_uint)*thread_num),
viennacl::ocl::local_mem(sizeof(NumericT)*thread_num),
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
));
}
template<typename NumericT>
void pipelined_cg_prod(ell_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "cg_ell_prod");
unsigned int thread_num = 128;
unsigned int group_num = 256;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.maxnnz()),
cl_uint(A.internal_maxnnz()),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_cg_prod(sliced_ell_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "cg_sliced_ell_prod");
vcl_size_t thread_num = std::max(A.rows_per_block(), static_cast<vcl_size_t>(128));
unsigned int group_num = 256;
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
thread_num = 256;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(),
A.handle2().opencl_handle(),
A.handle3().opencl_handle(),
A.handle().opencl_handle(),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
vec_size,
cl_uint(A.rows_per_block()),
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_cg_prod(hyb_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "cg_hyb_prod");
unsigned int thread_num = 128;
unsigned int group_num = 128;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
A.handle3().opencl_handle(),
A.handle4().opencl_handle(),
A.handle5().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.ell_nnz()),
cl_uint(A.internal_ellnnz()),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_bicgstab_update_s(vector_base<NumericT> & s,
vector_base<NumericT> & r,
vector_base<NumericT> const & Ap,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(s).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_update_s");
cl_uint vec_size = cl_uint(viennacl::traits::size(s));
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
viennacl::ocl::enqueue(k(s, r, Ap,
inner_prod_buffer, chunk_size, chunk_offset, vec_size,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))));
}
template<typename NumericT>
void pipelined_bicgstab_vector_update(vector_base<NumericT> & result, NumericT alpha, vector_base<NumericT> & p, NumericT omega, vector_base<NumericT> const & s,
vector_base<NumericT> & residual, vector_base<NumericT> const & As,
NumericT beta, vector_base<NumericT> const & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer, vcl_size_t buffer_chunk_size)
{
(void)buffer_chunk_size;
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(s).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_vector_update");
cl_uint vec_size = cl_uint(viennacl::traits::size(result));
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(result, alpha, p, omega, s,
residual, As,
beta, Ap,
r0star,
inner_prod_buffer,
vec_size, viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_bicgstab_prod(compressed_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
bool use_nvidia_blocked = (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id && (double(A.nnz()) / double(A.size1()) > 12.0));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), use_nvidia_blocked ? "bicgstab_csr_blocked_prod" : "bicgstab_csr_prod");
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
if (use_nvidia_blocked)
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle().opencl_handle(),
p,
Ap,
r0star,
vec_size,
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
));
}
else
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle3().opencl_handle(), A.handle().opencl_handle(), cl_uint(A.blocks1()),
p,
Ap,
r0star,
vec_size,
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
));
}
}
template<typename NumericT>
void pipelined_bicgstab_prod(coordinate_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
Ap.clear();
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_coo_prod");
unsigned int thread_num = 256; //k.local_work_size(0);
k.local_work_size(0, thread_num);
k.global_work_size(0, 64 * thread_num); //64 work groups are hard-coded for now. Gives reasonable performance in most cases
viennacl::ocl::enqueue(k(A.handle12().opencl_handle(), A.handle().opencl_handle(), A.handle3().opencl_handle(),
p,
Ap,
r0star,
vec_size,
viennacl::ocl::local_mem(sizeof(cl_uint)*thread_num),
viennacl::ocl::local_mem(sizeof(NumericT)*thread_num),
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
));
}
template<typename NumericT>
void pipelined_bicgstab_prod(ell_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_ell_prod");
unsigned int thread_num = 128;
unsigned int group_num = 128;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.maxnnz()),
cl_uint(A.internal_maxnnz()),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
r0star,
vec_size,
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_bicgstab_prod(sliced_ell_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_sliced_ell_prod");
vcl_size_t thread_num = std::max(A.rows_per_block(), static_cast<vcl_size_t>(128));
unsigned int group_num = 256;
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
thread_num = 256;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(),
A.handle2().opencl_handle(),
A.handle3().opencl_handle(),
A.handle().opencl_handle(),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
r0star,
vec_size,
cl_uint(A.rows_per_block()),
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template<typename NumericT>
void pipelined_bicgstab_prod(hyb_matrix<NumericT> const & A,
vector_base<NumericT> const & p,
vector_base<NumericT> & Ap,
vector_base<NumericT> const & r0star,
vector_base<NumericT> & inner_prod_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<NumericT>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<NumericT>::program_name(), "bicgstab_hyb_prod");
unsigned int thread_num = 256;
unsigned int group_num = 128;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*256);
}
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
A.handle3().opencl_handle(),
A.handle4().opencl_handle(),
A.handle5().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.ell_nnz()),
cl_uint(A.internal_ellnnz()),
viennacl::traits::opencl_handle(p),
viennacl::traits::opencl_handle(Ap),
r0star,
vec_size,
inner_prod_buffer, chunk_size, chunk_offset,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(NumericT))
)
);
}
template <typename T>
void pipelined_gmres_normalize_vk(vector_base<T> & v_k,
vector_base<T> const & residual,
vector_base<T> & R_buffer,
vcl_size_t offset_in_R,
vector_base<T> const & inner_prod_buffer,
vector_base<T> & r_dot_vk_buffer,
vcl_size_t buffer_chunk_size,
vcl_size_t buffer_chunk_offset)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(v_k).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_normalize_vk");
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
cl_uint size_vk = cl_uint(v_k.size());
cl_uint vk_offset = cl_uint(viennacl::traits::start(v_k));
cl_uint R_offset = cl_uint(offset_in_R);
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint chunk_offset = cl_uint(buffer_chunk_offset);
viennacl::ocl::enqueue(k(v_k, vk_offset,
residual,
R_buffer, R_offset,
inner_prod_buffer, chunk_size,
r_dot_vk_buffer, chunk_offset,
size_vk,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
));
}
template <typename T>
void pipelined_gmres_gram_schmidt_stage1(vector_base<T> const & device_krylov_basis,
vcl_size_t v_k_size,
vcl_size_t v_k_internal_size,
vcl_size_t param_k,
vector_base<T> & vi_in_vk_buffer,
vcl_size_t buffer_chunk_size)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(device_krylov_basis).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_gram_schmidt_1");
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
cl_uint size_vk = cl_uint(v_k_size);
cl_uint internal_size_vk = cl_uint(v_k_internal_size);
cl_uint ocl_k = cl_uint(param_k);
cl_uint chunk_size = cl_uint(buffer_chunk_size);
viennacl::ocl::enqueue(k(device_krylov_basis, size_vk, internal_size_vk, ocl_k,
vi_in_vk_buffer, chunk_size
));
}
template <typename T>
void pipelined_gmres_gram_schmidt_stage2(vector_base<T> & device_krylov_basis,
vcl_size_t v_k_size,
vcl_size_t v_k_internal_size,
vcl_size_t param_k,
vector_base<T> const & vi_in_vk_buffer,
vector_base<T> & R_buffer,
vcl_size_t krylov_dim,
vector_base<T> & inner_prod_buffer,
vcl_size_t buffer_chunk_size)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(device_krylov_basis).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_gram_schmidt_2");
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
cl_uint size_vk = cl_uint(v_k_size);
cl_uint internal_size_vk = cl_uint(v_k_internal_size);
cl_uint ocl_k = cl_uint(param_k);
cl_uint chunk_size = cl_uint(buffer_chunk_size);
cl_uint ocl_krylov_dim = cl_uint(krylov_dim);
viennacl::ocl::enqueue(k(device_krylov_basis, size_vk, internal_size_vk, ocl_k,
vi_in_vk_buffer, chunk_size,
R_buffer, ocl_krylov_dim,
inner_prod_buffer,
viennacl::ocl::local_mem(7 * k.local_work_size() * sizeof(T))
));
}
template <typename T>
void pipelined_gmres_update_result(vector_base<T> & result,
vector_base<T> const & residual,
vector_base<T> const & krylov_basis,
vcl_size_t v_k_size,
vcl_size_t v_k_internal_size,
vector_base<T> const & coefficients,
vcl_size_t param_k)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(result).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_update_result");
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
cl_uint size_vk = cl_uint(v_k_size);
cl_uint internal_size_vk = cl_uint(v_k_internal_size);
cl_uint ocl_k = cl_uint(param_k);
viennacl::ocl::enqueue(k(result,
residual,
krylov_basis, size_vk, internal_size_vk,
coefficients, ocl_k
));
}
template <typename T>
void pipelined_gmres_prod(compressed_matrix<T> const & A,
vector_base<T> const & p,
vector_base<T> & Ap,
vector_base<T> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
bool use_nvidia_blocked = (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id && (double(A.nnz()) / double(A.size1()) > 12.0));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), use_nvidia_blocked ? "gmres_csr_blocked_prod" : "gmres_csr_prod");
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
cl_uint start_p = cl_uint(viennacl::traits::start(p));
cl_uint start_Ap = cl_uint(viennacl::traits::start(Ap));
k.local_work_size(0, 128);
k.global_work_size(0, 128*128);
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
{
k.local_work_size(0, 256);
k.global_work_size(0, 256*128);
}
if (use_nvidia_blocked)
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle().opencl_handle(),
p, start_p,
Ap, start_Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
));
}
else
{
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle3().opencl_handle(), A.handle().opencl_handle(), cl_uint(A.blocks1()),
p, start_p,
Ap, start_Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(1024 * sizeof(T))
));
}
}
template <typename T>
void pipelined_gmres_prod(coordinate_matrix<T> const & A,
vector_base<T> const & p,
vector_base<T> & Ap,
vector_base<T> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
cl_uint start_p = cl_uint(viennacl::traits::start(p));
cl_uint start_Ap = cl_uint(viennacl::traits::start(Ap));
Ap.clear();
inner_prod_buffer.clear();
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_coo_prod");
unsigned int thread_num = 128; //k.local_work_size(0);
k.local_work_size(0, thread_num);
k.global_work_size(0, 64 * thread_num); //64 work groups are hard-coded for now. Gives reasonable performance in most cases
viennacl::ocl::enqueue(k(A.handle12().opencl_handle(), A.handle().opencl_handle(), A.handle3().opencl_handle(),
p, start_p,
Ap, start_Ap,
vec_size,
viennacl::ocl::local_mem(sizeof(cl_uint)*thread_num),
viennacl::ocl::local_mem(sizeof(T)*thread_num),
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
));
}
template <typename T>
void pipelined_gmres_prod(ell_matrix<T> const & A,
vector_base<T> const & p,
vector_base<T> & Ap,
vector_base<T> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
cl_uint start_p = cl_uint(viennacl::traits::start(p));
cl_uint start_Ap = cl_uint(viennacl::traits::start(Ap));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_ell_prod");
unsigned int thread_num = (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id) ? 256 : 128;
unsigned int group_num = 128;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.maxnnz()),
cl_uint(A.internal_maxnnz()),
viennacl::traits::opencl_handle(p), start_p,
viennacl::traits::opencl_handle(Ap), start_Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
)
);
}
template <typename T>
void pipelined_gmres_prod(sliced_ell_matrix<T> const & A,
vector_base<T> const & p,
vector_base<T> & Ap,
vector_base<T> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
cl_uint start_p = cl_uint(viennacl::traits::start(p));
cl_uint start_Ap = cl_uint(viennacl::traits::start(Ap));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_sliced_ell_prod");
vcl_size_t thread_num = std::max(A.rows_per_block(), static_cast<vcl_size_t>(128));
unsigned int group_num = 128;
if (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id)
thread_num = 256;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(),
A.handle2().opencl_handle(),
A.handle3().opencl_handle(),
A.handle().opencl_handle(),
viennacl::traits::opencl_handle(p), start_p,
viennacl::traits::opencl_handle(Ap), start_Ap,
vec_size,
cl_uint(A.rows_per_block()),
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
)
);
}
template <typename T>
void pipelined_gmres_prod(hyb_matrix<T> const & A,
vector_base<T> const & p,
vector_base<T> & Ap,
vector_base<T> & inner_prod_buffer)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::iterative<T>::init(ctx);
cl_uint vec_size = cl_uint(viennacl::traits::size(p));
cl_uint buffer_size_per_vector = cl_uint(inner_prod_buffer.size()) / cl_uint(3);
cl_uint start_p = cl_uint(viennacl::traits::start(p));
cl_uint start_Ap = cl_uint(viennacl::traits::start(Ap));
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::iterative<T>::program_name(), "gmres_hyb_prod");
unsigned int thread_num = (ctx.current_device().vendor_id() == viennacl::ocl::nvidia_id) ? 256 : 128;
unsigned int group_num = 128;
k.local_work_size(0, thread_num);
k.global_work_size(0, thread_num * group_num);
viennacl::ocl::enqueue(k(A.handle2().opencl_handle(),
A.handle().opencl_handle(),
A.handle3().opencl_handle(),
A.handle4().opencl_handle(),
A.handle5().opencl_handle(),
cl_uint(A.internal_size1()),
cl_uint(A.ell_nnz()),
cl_uint(A.internal_ellnnz()),
viennacl::traits::opencl_handle(p), start_p,
viennacl::traits::opencl_handle(Ap), start_Ap,
vec_size,
inner_prod_buffer,
buffer_size_per_vector,
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T)),
viennacl::ocl::local_mem(k.local_work_size() * sizeof(T))
)
);
}
} //namespace opencl
} //namespace linalg
} //namespace viennacl
#endif
viennacl::hyb_matrix::internal_ellnnz
vcl_size_t internal_ellnnz() const
Definition: hyb_matrix.hpp:101
viennacl::hyb_matrix
Sparse matrix class using a hybrid format composed of the ELL and CSR format for storing the nonzeros...
Definition: forwards.h:406
viennacl::sliced_ell_matrix::handle2
handle_type & handle2()
Definition: sliced_ell_matrix.hpp:112
viennacl::ocl::context::current_device
viennacl::ocl::device const & current_device() const
Returns the current device.
Definition: context.hpp:112
viennacl::linalg::opencl::kernels::iterative
Main kernel class for generating specialized OpenCL kernels for fast iterative solvers.
Definition: iterative.hpp:1553
viennacl::ell_matrix::handle2
handle_type & handle2()
Definition: ell_matrix.hpp:103
device.hpp
Represents an OpenCL device within ViennaCL.
viennacl::linalg::opencl::pipelined_bicgstab_prod
void pipelined_bicgstab_prod(compressed_matrix< NumericT > const &A, vector_base< NumericT > const &p, vector_base< NumericT > &Ap, vector_base< NumericT > const &r0star, vector_base< NumericT > &inner_prod_buffer, vcl_size_t buffer_chunk_size, vcl_size_t buffer_chunk_offset)
Definition: iterative_operations.hpp:360
size.hpp
Generic size and resize functionality for different vector and matrix types.
viennacl::hyb_matrix::handle3
const handle_type & handle3() const
Definition: hyb_matrix.hpp:107
viennacl::compressed_matrix::size1
const vcl_size_t & size1() const
Returns the number of rows.
Definition: compressed_matrix.hpp:927
viennacl::ocl::kernel
Represents an OpenCL kernel within ViennaCL.
Definition: kernel.hpp:58
start.hpp
Extracts the underlying OpenCL start index handle from a vector, a matrix, an expression etc...
tools.hpp
Various little tools used here and there in ViennaCL.
viennacl::linalg::opencl::kernels::iterative::init
static void init(viennacl::ocl::context &ctx)
Definition: iterative.hpp:1560
viennacl::hyb_matrix::handle
const handle_type & handle() const
Definition: hyb_matrix.hpp:105
viennacl::ocl::kernel::local_work_size
size_type local_work_size(int index=0) const
Returns the local work size at the respective dimension.
Definition: kernel.hpp:742
viennacl::coordinate_matrix::handle12
const handle_type & handle12() const
Returns the OpenCL handle to the (row, column) index array.
Definition: coordinate_matrix.hpp:366
viennacl::ocl::nvidia_id
Definition: device_utils.hpp:49
viennacl::ocl::context
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:55
viennacl::hyb_matrix::internal_size1
vcl_size_t internal_size1() const
Definition: hyb_matrix.hpp:95
viennacl::linalg::opencl::pipelined_gmres_gram_schmidt_stage2
void pipelined_gmres_gram_schmidt_stage2(vector_base< T > &device_krylov_basis, vcl_size_t v_k_size, vcl_size_t v_k_internal_size, vcl_size_t param_k, vector_base< T > const &vi_in_vk_buffer, vector_base< T > &R_buffer, vcl_size_t krylov_dim, vector_base< T > &inner_prod_buffer, vcl_size_t buffer_chunk_size)
Definition: iterative_operations.hpp:667
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
stride.hpp
Determines row and column increments for matrices and matrix proxies.
viennacl::hyb_matrix::handle4
const handle_type & handle4() const
Definition: hyb_matrix.hpp:108
viennacl::ocl::device::vendor_id
cl_uint vendor_id() const
A unique device vendor identifier. An example of a unique device identifier could be the PCIe ID...
Definition: device.hpp:917
viennacl::linalg::detail::max
T max(const T &lhs, const T &rhs)
Maximum.
Definition: util.hpp:59
viennacl::sliced_ell_matrix::rows_per_block
vcl_size_t rows_per_block() const
Definition: sliced_ell_matrix.hpp:104
viennacl::linalg::opencl::pipelined_gmres_normalize_vk
void pipelined_gmres_normalize_vk(vector_base< T > &v_k, vector_base< T > const &residual, vector_base< T > &R_buffer, vcl_size_t offset_in_R, vector_base< T > const &inner_prod_buffer, vector_base< T > &r_dot_vk_buffer, vcl_size_t buffer_chunk_size, vcl_size_t buffer_chunk_offset)
Performs a vector normalization needed for an efficient pipelined GMRES algorithm.
Definition: iterative_operations.hpp:609
viennacl::compressed_matrix::handle
const handle_type & handle() const
Returns the OpenCL handle to the matrix entry array.
Definition: compressed_matrix.hpp:942
viennacl::compressed_matrix::handle1
const handle_type & handle1() const
Returns the OpenCL handle to the row index array.
Definition: compressed_matrix.hpp:936
viennacl::ell_matrix::internal_size1
vcl_size_t internal_size1() const
Definition: ell_matrix.hpp:88
common.hpp
Common implementations shared by OpenCL-based operations.
viennacl::compressed_matrix::nnz
const vcl_size_t & nnz() const
Returns the number of nonzero entries.
Definition: compressed_matrix.hpp:931
viennacl::sliced_ell_matrix::handle
handle_type & handle()
Definition: sliced_ell_matrix.hpp:118
NumericT
float NumericT
Definition: bisect.cpp:40
viennacl::hyb_matrix::handle2
const handle_type & handle2() const
Definition: hyb_matrix.hpp:106
viennacl::traits::size
vcl_size_t size(VectorType const &vec)
Generic routine for obtaining the size of a vector (ViennaCL, uBLAS, etc.)
Definition: size.hpp:239
viennacl::ocl::local_mem
A class representing local (shared) OpenCL memory. Typically used as kernel argument.
Definition: local_mem.hpp:33
iterative.hpp
OpenCL kernel file for specialized iterative solver kernels.
viennacl::ell_matrix
Sparse matrix class using the ELLPACK format for storing the nonzeros.
Definition: ell_matrix.hpp:53
viennacl::ocl::context::get_kernel
viennacl::ocl::kernel & get_kernel(std::string const &program_name, std::string const &kernel_name)
Convenience function for retrieving the kernel of a program directly from the context.
Definition: context.hpp:605
viennacl::sliced_ell_matrix
Sparse matrix class using the sliced ELLPACK with parameters C, .
Definition: forwards.h:403
handle.hpp
Implementation of a smart-pointer-like class for handling OpenCL handles.
viennacl::linalg::opencl::pipelined_cg_vector_update
void pipelined_cg_vector_update(vector_base< NumericT > &result, NumericT alpha, vector_base< NumericT > &p, vector_base< NumericT > &r, vector_base< NumericT > const &Ap, NumericT beta, vector_base< NumericT > &inner_prod_buffer)
Definition: iterative_operations.hpp:51
viennacl::traits::start
result_of::size_type< T >::type start(T const &obj)
Definition: start.hpp:44
viennacl::linalg::opencl::pipelined_bicgstab_vector_update
void pipelined_bicgstab_vector_update(vector_base< NumericT > &result, NumericT alpha, vector_base< NumericT > &p, NumericT omega, vector_base< NumericT > const &s, vector_base< NumericT > &residual, vector_base< NumericT > const &As, NumericT beta, vector_base< NumericT > const &Ap, vector_base< NumericT > const &r0star, vector_base< NumericT > &inner_prod_buffer, vcl_size_t buffer_chunk_size)
Definition: iterative_operations.hpp:326
viennacl::compressed_matrix::handle2
const handle_type & handle2() const
Returns the OpenCL handle to the column index array.
Definition: compressed_matrix.hpp:938
viennacl::vector_base< NumericT >
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::ell_matrix::maxnnz
vcl_size_t maxnnz() const
Definition: ell_matrix.hpp:95
viennacl::coordinate_matrix::handle3
const handle_type & handle3() const
Returns the OpenCL handle to the group start index array.
Definition: coordinate_matrix.hpp:370
viennacl::linalg::opencl::pipelined_gmres_gram_schmidt_stage1
void pipelined_gmres_gram_schmidt_stage1(vector_base< T > const &device_krylov_basis, vcl_size_t v_k_size, vcl_size_t v_k_internal_size, vcl_size_t param_k, vector_base< T > &vi_in_vk_buffer, vcl_size_t buffer_chunk_size)
Definition: iterative_operations.hpp:642
predicate.hpp
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
viennacl::ell_matrix::handle
handle_type & handle()
Definition: ell_matrix.hpp:100
viennacl::linalg::opencl::pipelined_bicgstab_update_s
void pipelined_bicgstab_update_s(vector_base< NumericT > &s, vector_base< NumericT > &r, vector_base< NumericT > const &Ap, vector_base< NumericT > &inner_prod_buffer, vcl_size_t buffer_chunk_size, vcl_size_t buffer_chunk_offset)
Definition: iterative_operations.hpp:295
viennacl::compressed_matrix::handle3
const handle_type & handle3() const
Returns the OpenCL handle to the row block array.
Definition: compressed_matrix.hpp:940
viennacl::vector_base::clear
void clear()
Resets all entries to zero. Does not change the size of the vector.
Definition: vector.hpp:875
viennacl::coordinate_matrix::handle
const handle_type & handle() const
Returns the OpenCL handle to the matrix entry array.
Definition: coordinate_matrix.hpp:368
viennacl::ocl::enqueue
void enqueue(KernelType &k, viennacl::ocl::command_queue const &queue)
Enqueues a kernel in the provided queue.
Definition: enqueue.hpp:50
kernel.hpp
Representation of an OpenCL kernel in ViennaCL.
viennacl::sliced_ell_matrix::handle3
handle_type & handle3()
Definition: sliced_ell_matrix.hpp:115
viennacl::vector_base::size
size_type size() const
Returns the length of the vector (cf. std::vector)
Definition: vector_def.hpp:118
viennacl::hyb_matrix::ell_nnz
vcl_size_t ell_nnz() const
Definition: hyb_matrix.hpp:102
viennacl::ocl::kernel::global_work_size
size_type global_work_size(int index=0) const
Returns the global work size at the respective dimension.
Definition: kernel.hpp:751
viennacl::linalg::opencl::pipelined_cg_prod
void pipelined_cg_prod(compressed_matrix< NumericT > const &A, vector_base< NumericT > const &p, vector_base< NumericT > &Ap, vector_base< NumericT > &inner_prod_buffer)
Definition: iterative_operations.hpp:78
viennacl::compressed_matrix< NumericT >
vector_def.hpp
Forward declarations of the implicit_vector_base, vector_base class.
handle.hpp
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
viennacl::hyb_matrix::handle5
const handle_type & handle5() const
Definition: hyb_matrix.hpp:109
viennacl::linalg::opencl::pipelined_gmres_update_result
void pipelined_gmres_update_result(vector_base< T > &result, vector_base< T > const &residual, vector_base< T > const &krylov_basis, vcl_size_t v_k_size, vcl_size_t v_k_internal_size, vector_base< T > const &coefficients, vcl_size_t param_k)
Definition: iterative_operations.hpp:699
viennacl::compressed_matrix::blocks1
const vcl_size_t & blocks1() const
Returns the internal number of row blocks for an adaptive SpMV.
Definition: compressed_matrix.hpp:933
viennacl::ell_matrix::internal_maxnnz
vcl_size_t internal_maxnnz() const
Definition: ell_matrix.hpp:94
viennacl::sliced_ell_matrix::handle1
handle_type & handle1()
Definition: sliced_ell_matrix.hpp:109
scalar.hpp
Implementation of the ViennaCL scalar class.
viennacl::linalg::opencl::pipelined_gmres_prod
void pipelined_gmres_prod(compressed_matrix< T > const &A, vector_base< T > const &p, vector_base< T > &Ap, vector_base< T > &inner_prod_buffer)
Definition: iterative_operations.hpp:727
enable_if.hpp
Simple enable-if variant that uses the SFINAE pattern.
viennacl::coordinate_matrix
A sparse square matrix, where entries are stored as triplets (i,j, val), where i and j are the row an...
Definition: coordinate_matrix.hpp:186