All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
amg_operations.hpp
Go to the documentation of this file.
#ifndef VIENNACL_LINALG_OPENCL_AMG_OPERATIONS_HPP
#define VIENNACL_LINALG_OPENCL_AMG_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 PDF manual)
License: MIT (X11), see file LICENSE in the base directory
============================================================================= */
#include <cstdlib>
#include <cmath>
#include <map>
#include "viennacl/linalg/detail/amg/amg_base.hpp"
#include "viennacl/linalg/opencl/common.hpp"
#include "viennacl/linalg/opencl/kernels/amg.hpp"
namespace viennacl
{
namespace linalg
{
namespace opencl
{
namespace amg
{
template<typename NumericT>
void amg_influence_trivial(compressed_matrix<NumericT> const & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
(void)tag;
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::amg<NumericT>::init(ctx);
viennacl::ocl::kernel & influence_kernel = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_influence_trivial");
viennacl::ocl::enqueue(influence_kernel(A.handle1().opencl_handle(), A.handle2().opencl_handle(),
cl_uint(A.size1()),
cl_uint(A.nnz()),
viennacl::traits::opencl_handle(amg_context.influence_jumper_),
viennacl::traits::opencl_handle(amg_context.influence_ids_),
viennacl::traits::opencl_handle(amg_context.influence_values_)
)
);
}
template<typename NumericT>
void amg_influence_advanced(compressed_matrix<NumericT> const & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
(void)A; (void)amg_context; (void)tag;
throw std::runtime_error("amg_influence_advanced() not implemented for OpenCL yet");
}
template<typename NumericT>
void amg_influence(compressed_matrix<NumericT> const & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
// TODO: dispatch based on influence tolerance provided
amg_influence_trivial(A, amg_context, tag);
}
inline void enumerate_coarse_points(viennacl::linalg::detail::amg::amg_level_context & amg_context)
{
viennacl::backend::typesafe_host_array<unsigned int> point_types(amg_context.point_types_.handle(), amg_context.point_types_.size());
viennacl::backend::typesafe_host_array<unsigned int> coarse_ids(amg_context.coarse_id_.handle(), amg_context.coarse_id_.size());
viennacl::backend::memory_read(amg_context.point_types_.handle(), 0, point_types.raw_size(), point_types.get());
viennacl::backend::memory_read(amg_context.coarse_id_.handle(), 0, coarse_ids.raw_size(), coarse_ids.get());
unsigned int coarse_id = 0;
for (std::size_t i=0; i<amg_context.point_types_.size(); ++i)
{
coarse_ids.set(i, coarse_id);
if (point_types[i] == viennacl::linalg::detail::amg::amg_level_context::POINT_TYPE_COARSE)
++coarse_id;
}
amg_context.num_coarse_ = coarse_id;
viennacl::backend::memory_write(amg_context.coarse_id_.handle(), 0, coarse_ids.raw_size(), coarse_ids.get());
}
template<typename NumericT>
void amg_coarse_ag_stage1_mis2(compressed_matrix<NumericT> const & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
(void)tag;
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::amg<NumericT>::init(ctx);
viennacl::vector<unsigned int> random_weights(A.size1(), viennacl::context(viennacl::MAIN_MEMORY));
unsigned int *random_weights_ptr = viennacl::linalg::host_based::detail::extract_raw_pointer<unsigned int>(random_weights.handle());
for (std::size_t i=0; i<random_weights.size(); ++i)
random_weights_ptr[i] = static_cast<unsigned int>(rand()) % static_cast<unsigned int>(A.size1());
random_weights.switch_memory_context(viennacl::traits::context(A));
// work vectors:
viennacl::vector<unsigned int> work_state(A.size1(), viennacl::traits::context(A));
viennacl::vector<unsigned int> work_random(A.size1(), viennacl::traits::context(A));
viennacl::vector<unsigned int> work_index(A.size1(), viennacl::traits::context(A));
viennacl::vector<unsigned int> work_state2(A.size1(), viennacl::traits::context(A));
viennacl::vector<unsigned int> work_random2(A.size1(), viennacl::traits::context(A));
viennacl::vector<unsigned int> work_index2(A.size1(), viennacl::traits::context(A));
unsigned int num_undecided = static_cast<unsigned int>(A.size1());
viennacl::vector<unsigned int> undecided_buffer(256, viennacl::traits::context(A));
viennacl::backend::typesafe_host_array<unsigned int> undecided_buffer_host(undecided_buffer.handle(), undecided_buffer.size());
viennacl::ocl::kernel & init_workdata_kernel = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_pmis2_init_workdata");
viennacl::ocl::kernel & max_neighborhood_kernel = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_pmis2_max_neighborhood");
viennacl::ocl::kernel & mark_mis_nodes_kernel = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_pmis2_mark_mis_nodes");
viennacl::ocl::kernel & reset_state_kernel = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_pmis2_reset_state");
unsigned int pmis_iters = 0;
while (num_undecided > 0)
{
++pmis_iters;
//
// init temporary work data:
//
viennacl::ocl::enqueue(init_workdata_kernel(work_state, work_random, work_index,
amg_context.point_types_,
random_weights,
cl_uint(A.size1())
)
);
//
// Propagate maximum tuple twice
//
for (unsigned int r = 0; r < 2; ++r)
{
// max operation
viennacl::ocl::enqueue(max_neighborhood_kernel(work_state, work_random, work_index,
work_state2, work_random2, work_index2,
amg_context.influence_jumper_, amg_context.influence_ids_,
cl_uint(A.size1())
)
);
// copy work array (can be fused into a single kernel if needed. Previous kernel is in most cases sufficiently heavy)
work_state = work_state2;
work_random = work_random2;
work_index = work_index2;
}
//
// mark MIS and non-MIS nodes:
//
viennacl::ocl::enqueue(mark_mis_nodes_kernel(work_state, work_index,
amg_context.point_types_,
undecided_buffer,
cl_uint(A.size1())
)
);
// get number of undecided points on host:
viennacl::backend::memory_read(undecided_buffer.handle(), 0, undecided_buffer_host.raw_size(), undecided_buffer_host.get());
num_undecided = 0;
for (std::size_t i=0; i<undecided_buffer.size(); ++i)
num_undecided += undecided_buffer_host[i];
} //while
viennacl::ocl::enqueue(reset_state_kernel(amg_context.point_types_, cl_uint(amg_context.point_types_.size()) ) );
}
template<typename NumericT>
void amg_coarse_ag(compressed_matrix<NumericT> const & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::amg<NumericT>::init(ctx);
amg_influence_trivial(A, amg_context, tag);
//
// Stage 1: Build aggregates:
//
if (tag.get_coarsening_method() == viennacl::linalg::AMG_COARSENING_METHOD_MIS2_AGGREGATION)
amg_coarse_ag_stage1_mis2(A, amg_context, tag);
else
throw std::runtime_error("Only MIS2 coarsening implemented. Selected coarsening not available with OpenCL backend!");
viennacl::linalg::opencl::amg::enumerate_coarse_points(amg_context);
//
// Stage 2: Propagate coarse aggregate indices to neighbors:
//
viennacl::ocl::kernel & propagate_coarse_indices = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_agg_propagate_coarse_indices");
viennacl::ocl::enqueue(propagate_coarse_indices(amg_context.point_types_,
amg_context.coarse_id_,
amg_context.influence_jumper_,
amg_context.influence_ids_,
cl_uint(A.size1())
)
);
//
// Stage 3: Merge remaining undecided points (merging to first aggregate found when cycling over the hierarchy
//
viennacl::ocl::kernel & merge_undecided = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_agg_merge_undecided");
viennacl::ocl::enqueue(merge_undecided(amg_context.point_types_,
amg_context.coarse_id_,
amg_context.influence_jumper_,
amg_context.influence_ids_,
cl_uint(A.size1())
)
);
//
// Stage 4: Set undecided points to fine points (coarse ID already set in Stage 3)
// Note: Stage 3 and Stage 4 were initially fused, but are now split in order to avoid race conditions (or a fallback to sequential execution).
//
viennacl::ocl::kernel & merge_undecided_2 = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_agg_merge_undecided_2");
viennacl::ocl::enqueue(merge_undecided_2(amg_context.point_types_, cl_uint(A.size1()) ) );
}
template<typename InternalT1>
void amg_coarse(InternalT1 & A,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
switch (tag.get_coarsening_method())
{
case viennacl::linalg::AMG_COARSENING_METHOD_MIS2_AGGREGATION: amg_coarse_ag(A, amg_context, tag); break;
default: throw std::runtime_error("not implemented yet");
}
}
template<typename NumericT>
void amg_interpol_ag(compressed_matrix<NumericT> const & A,
compressed_matrix<NumericT> & P,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::amg<NumericT>::init(ctx);
(void)tag;
P = compressed_matrix<NumericT>(A.size1(), amg_context.num_coarse_, A.size1(), viennacl::traits::context(A));
// build matrix here
viennacl::ocl::kernel & interpolate_ag = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_interpol_ag");
viennacl::ocl::enqueue(interpolate_ag(P.handle1().opencl_handle(),
P.handle2().opencl_handle(),
P.handle().opencl_handle(),
amg_context.coarse_id_,
cl_uint(A.size1())
)
);
P.generate_row_block_information();
}
template<typename NumericT>
void amg_interpol_sa(compressed_matrix<NumericT> const & A,
compressed_matrix<NumericT> & P,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::amg<NumericT>::init(ctx);
(void)tag;
viennacl::compressed_matrix<NumericT> P_tentative(A.size1(), amg_context.num_coarse_, A.size1(), viennacl::traits::context(A));
// form tentative operator:
amg_interpol_ag(A, P_tentative, amg_context, tag);
viennacl::compressed_matrix<NumericT> Jacobi(A.size1(), A.size1(), A.nnz(), viennacl::traits::context(A));
viennacl::ocl::kernel & interpol_sa = ctx.get_kernel(viennacl::linalg::opencl::kernels::amg<NumericT>::program_name(), "amg_interpol_sa");
viennacl::ocl::enqueue(interpol_sa(A.handle1().opencl_handle(),
A.handle2().opencl_handle(),
A.handle().opencl_handle(),
cl_uint(A.size1()),
cl_uint(A.nnz()),
Jacobi.handle1().opencl_handle(),
Jacobi.handle2().opencl_handle(),
Jacobi.handle().opencl_handle(),
NumericT(tag.get_jacobi_weight())
)
);
P = viennacl::linalg::prod(Jacobi, P_tentative);
P.generate_row_block_information();
}
template<typename MatrixT>
void amg_interpol(MatrixT const & A,
MatrixT & P,
viennacl::linalg::detail::amg::amg_level_context & amg_context,
viennacl::linalg::amg_tag & tag)
{
switch (tag.get_interpolation_method())
{
case viennacl::linalg::AMG_INTERPOLATION_METHOD_AGGREGATION: amg_interpol_ag (A, P, amg_context, tag); break;
case viennacl::linalg::AMG_INTERPOLATION_METHOD_SMOOTHED_AGGREGATION: amg_interpol_sa (A, P, amg_context, tag); break;
default: throw std::runtime_error("Not implemented yet!");
}
}
template<typename NumericT, unsigned int AlignmentV>
void assign_to_dense(viennacl::compressed_matrix<NumericT, AlignmentV> const & A,
viennacl::matrix_base<NumericT> & B)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(A).context());
viennacl::linalg::opencl::kernels::compressed_matrix<NumericT>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::compressed_matrix<NumericT>::program_name(),
"assign_to_dense");
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle().opencl_handle(),
viennacl::traits::opencl_handle(B),
cl_uint(viennacl::traits::start1(B)), cl_uint(viennacl::traits::start2(B)),
cl_uint(viennacl::traits::stride1(B)), cl_uint(viennacl::traits::stride2(B)),
cl_uint(viennacl::traits::size1(B)), cl_uint(viennacl::traits::size2(B)),
cl_uint(viennacl::traits::internal_size1(B)), cl_uint(viennacl::traits::internal_size2(B)) ));
}
template<typename NumericT>
void smooth_jacobi(unsigned int iterations,
compressed_matrix<NumericT> const & A,
vector<NumericT> & x,
vector<NumericT> & x_backup,
vector<NumericT> const & rhs_smooth,
NumericT weight)
{
viennacl::ocl::context & ctx = const_cast<viennacl::ocl::context &>(viennacl::traits::opencl_handle(x).context());
viennacl::linalg::opencl::kernels::compressed_matrix<NumericT>::init(ctx);
viennacl::ocl::kernel & k = ctx.get_kernel(viennacl::linalg::opencl::kernels::compressed_matrix<NumericT>::program_name(), "jacobi");
for (unsigned int i=0; i<iterations; ++i)
{
x_backup = x;
viennacl::ocl::enqueue(k(A.handle1().opencl_handle(), A.handle2().opencl_handle(), A.handle().opencl_handle(),
static_cast<NumericT>(weight),
viennacl::traits::opencl_handle(x_backup),
viennacl::traits::opencl_handle(x),
viennacl::traits::opencl_handle(rhs_smooth),
static_cast<cl_uint>(rhs_smooth.size())));
}
}
} //namespace amg
} //namespace host_based
} //namespace linalg
} //namespace viennacl
#endif
viennacl::linalg::opencl::kernels::amg
Main kernel class for generating OpenCL kernels for compressed_matrix.
Definition: amg.hpp:346
viennacl::backend::typesafe_host_array
Helper class implementing an array on the host. Default case: No conversion necessary.
Definition: util.hpp:92
viennacl::linalg::opencl::amg::amg_influence
void amg_influence(compressed_matrix< NumericT > const &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Dispatcher for influence processing.
Definition: amg_operations.hpp:82
viennacl::linalg::amg_tag::get_coarsening_method
amg_coarsening_method get_coarsening_method() const
Returns the current coarsening strategy.
Definition: amg_base.hpp:88
viennacl::linalg::opencl::amg::amg_influence_trivial
void amg_influence_trivial(compressed_matrix< NumericT > const &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Routine for taking all connections in the matrix as strong.
Definition: amg_operations.hpp:48
viennacl::backend::memory_write
void memory_write(mem_handle &dst_buffer, vcl_size_t dst_offset, vcl_size_t bytes_to_write, const void *ptr, bool async=false)
Writes data from main RAM identified by 'ptr' to the buffer identified by 'dst_buffer'.
Definition: memory.hpp:220
viennacl::traits::stride1
result_of::size_type< matrix_base< NumericT > >::type stride1(matrix_base< NumericT > const &s)
Definition: stride.hpp:55
viennacl::linalg::detail::amg::amg_level_context
Definition: amg_base.hpp:167
viennacl::linalg::opencl::amg::amg_coarse_ag
void amg_coarse_ag(compressed_matrix< NumericT > const &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
AG (aggregation based) coarsening. Partially single-threaded version (VIENNACL_AMG_COARSE_AG) ...
Definition: amg_operations.hpp:224
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
viennacl::traits::internal_size1
vcl_size_t internal_size1(matrix_base< NumericT > const &mat)
Helper routine for obtaining the internal number of entries per row of a ViennaCL matrix...
Definition: size.hpp:386
viennacl::traits::size1
vcl_size_t size1(MatrixType const &mat)
Generic routine for obtaining the number of rows of a matrix (ViennaCL, uBLAS, etc.)
Definition: size.hpp:163
viennacl::ocl::context
Manages an OpenCL context and provides the respective convenience functions for creating buffers...
Definition: context.hpp:55
viennacl::linalg::amg_tag::get_jacobi_weight
double get_jacobi_weight() const
Returns the Jacobi smoother weight (damping).
Definition: amg_base.hpp:113
viennacl::traits::internal_size2
vcl_size_t internal_size2(matrix_base< NumericT > const &mat)
Helper routine for obtaining the internal number of entries per column of a ViennaCL matrix...
Definition: size.hpp:394
viennacl::matrix_base< NumericT >
amg.hpp
OpenCL kernel file for operations related to algebraic multigrid.
viennacl::traits::start1
result_of::size_type< T >::type start1(T const &obj)
Definition: start.hpp:65
viennacl::backend::memory_read
void memory_read(mem_handle const &src_buffer, vcl_size_t src_offset, vcl_size_t bytes_to_read, void *ptr, bool async=false)
Reads data from a buffer back to main RAM.
Definition: memory.hpp:261
viennacl::linalg::AMG_INTERPOLATION_METHOD_AGGREGATION
Definition: amg_base.hpp:57
viennacl::linalg::opencl::amg::amg_interpol_ag
void amg_interpol_ag(compressed_matrix< NumericT > const &A, compressed_matrix< NumericT > &P, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
AG (aggregation based) interpolation. Multi-Threaded! (VIENNACL_INTERPOL_SA)
Definition: amg_operations.hpp:311
viennacl::traits::size2
result_of::size_type< MatrixType >::type size2(MatrixType const &mat)
Generic routine for obtaining the number of columns of a matrix (ViennaCL, uBLAS, etc...
Definition: size.hpp:201
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::linalg::AMG_COARSENING_METHOD_MIS2_AGGREGATION
Definition: amg_base.hpp:50
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
NumericT
float NumericT
Definition: bisect.cpp:40
viennacl::linalg::opencl::amg::assign_to_dense
void assign_to_dense(viennacl::compressed_matrix< NumericT, AlignmentV > const &A, viennacl::matrix_base< NumericT > &B)
Definition: amg_operations.hpp:400
viennacl::linalg::prod
VectorT prod(std::vector< std::vector< T, A1 >, A2 > const &matrix, VectorT const &vector)
Definition: prod.hpp:102
viennacl::compressed_matrix::generate_row_block_information
void generate_row_block_information()
Builds the row block information needed for fast sparse matrix-vector multiplications.
Definition: compressed_matrix.hpp:999
viennacl::linalg::opencl::amg::enumerate_coarse_points
void enumerate_coarse_points(viennacl::linalg::detail::amg::amg_level_context &amg_context)
Assign IDs to coarse points.
Definition: amg_operations.hpp:96
viennacl::traits::start2
result_of::size_type< T >::type start2(T const &obj)
Definition: start.hpp:84
viennacl::linalg::AMG_INTERPOLATION_METHOD_SMOOTHED_AGGREGATION
Definition: amg_base.hpp:58
viennacl::linalg::opencl::kernels::compressed_matrix
Main kernel class for generating OpenCL kernels for compressed_matrix (except solvers).
Definition: compressed_matrix.hpp:1599
viennacl::linalg::opencl::amg::amg_interpol
void amg_interpol(MatrixT const &A, MatrixT &P, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Dispatcher for building the interpolation matrix.
Definition: amg_operations.hpp:385
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::linalg::detail::amg::amg_level_context::num_coarse_
unsigned int num_coarse_
Definition: amg_base.hpp:199
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< unsigned int >
viennacl::linalg::opencl::amg::amg_influence_advanced
void amg_influence_advanced(compressed_matrix< NumericT > const &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Routine for extracting strongly connected points considering a user-provided threshold value...
Definition: amg_operations.hpp:71
viennacl::traits::stride2
result_of::size_type< matrix_base< NumericT > >::type stride2(matrix_base< NumericT > const &s)
Definition: stride.hpp:65
viennacl::MAIN_MEMORY
Definition: forwards.h:348
viennacl::linalg::opencl::kernels::amg::init
static void init(viennacl::ocl::context &ctx)
Definition: amg.hpp:353
viennacl::linalg::amg_tag
A tag for algebraic multigrid (AMG). Used to transport information from the user to the implementatio...
Definition: amg_base.hpp:64
viennacl::linalg::opencl::amg::smooth_jacobi
void smooth_jacobi(unsigned int iterations, compressed_matrix< NumericT > const &A, vector< NumericT > &x, vector< NumericT > &x_backup, vector< NumericT > const &rhs_smooth, NumericT weight)
Jacobi Smoother (OpenCL version)
Definition: amg_operations.hpp:427
viennacl::traits::context
viennacl::context context(T const &t)
Returns an ID for the currently active memory domain of an object.
Definition: context.hpp:40
viennacl::ocl::enqueue
void enqueue(KernelType &k, viennacl::ocl::command_queue const &queue)
Enqueues a kernel in the provided queue.
Definition: enqueue.hpp:50
viennacl::linalg::opencl::kernels::compressed_matrix::init
static void init(viennacl::ocl::context &ctx)
Definition: compressed_matrix.hpp:1606
viennacl::vector_base::size
size_type size() const
Returns the length of the vector (cf. std::vector)
Definition: vector_def.hpp:118
viennacl::linalg::detail::amg::amg_level_context::point_types_
viennacl::vector< unsigned int > point_types_
Definition: amg_base.hpp:197
viennacl::linalg::amg_tag::get_interpolation_method
amg_interpolation_method get_interpolation_method() const
Returns the current interpolation method.
Definition: amg_base.hpp:93
viennacl::backend::mem_handle::raw_size
vcl_size_t raw_size() const
Returns the number of bytes of the currently active buffer.
Definition: mem_handle.hpp:230
viennacl::compressed_matrix< NumericT >
viennacl::linalg::opencl::amg::amg_coarse
void amg_coarse(InternalT1 &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Calls the right coarsening procedure.
Definition: amg_operations.hpp:286
amg_base.hpp
Helper classes and functions for the AMG preconditioner. Experimental.
viennacl::linalg::detail::amg::amg_level_context::POINT_TYPE_COARSE
Definition: amg_base.hpp:190
viennacl::linalg::detail::amg::amg_level_context::coarse_id_
viennacl::vector< unsigned int > coarse_id_
Definition: amg_base.hpp:198
viennacl::vector_base::handle
const handle_type & handle() const
Returns the memory handle.
Definition: vector_def.hpp:128
viennacl::linalg::detail::amg::amg_level_context::influence_values_
viennacl::vector< unsigned int > influence_values_
Definition: amg_base.hpp:196
viennacl::linalg::opencl::amg::amg_coarse_ag_stage1_mis2
void amg_coarse_ag_stage1_mis2(compressed_matrix< NumericT > const &A, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
AG (aggregation based) coarsening, single-threaded version of stage 1.
Definition: amg_operations.hpp:128
viennacl::linalg::opencl::amg::amg_interpol_sa
void amg_interpol_sa(compressed_matrix< NumericT > const &A, compressed_matrix< NumericT > &P, viennacl::linalg::detail::amg::amg_level_context &amg_context, viennacl::linalg::amg_tag &tag)
Smoothed aggregation interpolation. (VIENNACL_INTERPOL_SA)
Definition: amg_operations.hpp:343
viennacl::linalg::detail::amg::amg_level_context::influence_ids_
viennacl::vector< unsigned int > influence_ids_
Definition: amg_base.hpp:195
viennacl::vector::switch_memory_context
void switch_memory_context(viennacl::context new_ctx)
Definition: vector.hpp:1064
viennacl::linalg::detail::amg::amg_level_context::influence_jumper_
viennacl::vector< unsigned int > influence_jumper_
Definition: amg_base.hpp:194