All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
execute_generic_dispatcher.hpp
Go to the documentation of this file.
#ifndef VIENNACL_SCHEDULER_EXECUTE_GENERIC_DISPATCHER_HPP
#define VIENNACL_SCHEDULER_EXECUTE_GENERIC_DISPATCHER_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 <assert.h>
#include "viennacl/forwards.h"
#include "viennacl/scheduler/forwards.h"
#include "viennacl/scheduler/execute_util.hpp"
#include "viennacl/scheduler/execute_scalar_dispatcher.hpp"
#include "viennacl/scheduler/execute_vector_dispatcher.hpp"
#include "viennacl/scheduler/execute_matrix_dispatcher.hpp"
namespace viennacl
{
namespace scheduler
{
namespace detail
{
template<typename ScalarType1>
void ax(lhs_rhs_element & x1,
lhs_rhs_element const & x2, ScalarType1 const & alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
{
assert(x1.type_family == x2.type_family && bool("Arguments are not of the same type family!"));
switch (x1.type_family)
{
case SCALAR_TYPE_FAMILY:
detail::as(x1, x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha);
break;
case VECTOR_TYPE_FAMILY:
detail::av(x1, x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha);
break;
case MATRIX_TYPE_FAMILY:
detail::am(x1, x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha);
break;
default:
throw statement_not_supported_exception("Invalid argument in scheduler ax() while dispatching.");
}
}
template<typename ScalarType1, typename ScalarType2>
void axbx(lhs_rhs_element & x1,
lhs_rhs_element const & x2, ScalarType1 const & alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha,
lhs_rhs_element const & x3, ScalarType2 const & beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
{
assert( x1.type_family == x2.type_family
&& x2.type_family == x3.type_family
&& bool("Arguments are not of the same type family!"));
switch (x1.type_family)
{
case SCALAR_TYPE_FAMILY:
detail::asbs(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
case VECTOR_TYPE_FAMILY:
detail::avbv(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
case MATRIX_TYPE_FAMILY:
detail::ambm(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
default:
throw statement_not_supported_exception("Invalid argument in scheduler ax() while dispatching.");
}
}
template<typename ScalarType1, typename ScalarType2>
void axbx_x(lhs_rhs_element & x1,
lhs_rhs_element const & x2, ScalarType1 const & alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha,
lhs_rhs_element const & x3, ScalarType2 const & beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
{
assert( x1.type_family == x2.type_family
&& x2.type_family == x3.type_family
&& bool("Arguments are not of the same type family!"));
switch (x1.type_family)
{
case SCALAR_TYPE_FAMILY:
detail::asbs_s(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
case VECTOR_TYPE_FAMILY:
detail::avbv_v(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
case MATRIX_TYPE_FAMILY:
detail::ambm_m(x1,
x2, alpha, len_alpha, reciprocal_alpha, flip_sign_alpha,
x3, beta, len_beta, reciprocal_beta, flip_sign_beta);
break;
default:
throw statement_not_supported_exception("Invalid argument in scheduler ax() while dispatching.");
}
}
} // namespace detail
} // namespace scheduler
} // namespace viennacl
#endif
execute_vector_dispatcher.hpp
Provides wrappers for av(), avbv(), avbv_v(), etc. in viennacl/linalg/vector_operations.hpp such that scheduler logic is not cluttered with numeric type decutions.
viennacl::scheduler::detail::asbs
void asbs(lhs_rhs_element &s1, lhs_rhs_element const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &s3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv(), taking care of the argument unwrapping.
Definition: execute_scalar_dispatcher.hpp:68
viennacl::scheduler::detail::ambm
void ambm(lhs_rhs_element &mat1, lhs_rhs_element const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv(), taking care of the argument unwrapping.
Definition: execute_matrix_dispatcher.hpp:73
execute_matrix_dispatcher.hpp
Provides wrappers for am(), ambm(), ambm_m(), etc. in viennacl/linalg/matrix_operations.hpp such that scheduler logic is not cluttered with numeric type decutions.
viennacl::scheduler::detail::as
void as(lhs_rhs_element &s1, lhs_rhs_element const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Wrapper for viennacl::linalg::av(), taking care of the argument unwrapping.
Definition: execute_scalar_dispatcher.hpp:42
viennacl::scheduler::MATRIX_TYPE_FAMILY
Definition: forwards.h:260
viennacl::scheduler::SCALAR_TYPE_FAMILY
Definition: forwards.h:254
forwards.h
This file provides the forward declarations for the main types used within ViennaCL.
viennacl::scheduler::lhs_rhs_element::type_family
statement_node_type_family type_family
Definition: forwards.h:339
viennacl::scheduler::lhs_rhs_element
A class representing the 'data' for the LHS or RHS operand of the respective node.
Definition: forwards.h:337
viennacl::scheduler::detail::asbs_s
void asbs_s(lhs_rhs_element &s1, lhs_rhs_element const &s2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &s3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv_v(), taking care of the argument unwrapping.
Definition: execute_scalar_dispatcher.hpp:98
viennacl::scheduler::detail::am
void am(lhs_rhs_element &mat1, lhs_rhs_element const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Wrapper for viennacl::linalg::av(), taking care of the argument unwrapping.
Definition: execute_matrix_dispatcher.hpp:42
viennacl::scheduler::detail::avbv
void avbv(lhs_rhs_element &vec1, lhs_rhs_element const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &vec3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv(), taking care of the argument unwrapping.
Definition: execute_vector_dispatcher.hpp:68
viennacl::scheduler::detail::axbx
void axbx(lhs_rhs_element &x1, lhs_rhs_element const &x2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &x3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv(), taking care of the argument unwrapping.
Definition: execute_generic_dispatcher.hpp:67
viennacl::scheduler::detail::ambm_m
void ambm_m(lhs_rhs_element &mat1, lhs_rhs_element const &mat2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &mat3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv_v(), taking care of the argument unwrapping.
Definition: execute_matrix_dispatcher.hpp:114
viennacl::vcl_size_t
std::size_t vcl_size_t
Definition: forwards.h:75
viennacl::scheduler::detail::avbv_v
void avbv_v(lhs_rhs_element &vec1, lhs_rhs_element const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &vec3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv_v(), taking care of the argument unwrapping.
Definition: execute_vector_dispatcher.hpp:98
forwards.h
Provides the datastructures for dealing with a single statement such as 'x = y + z;'.
viennacl::scheduler::detail::ax
void ax(lhs_rhs_element &x1, lhs_rhs_element const &x2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Wrapper for viennacl::linalg::av(), taking care of the argument unwrapping.
Definition: execute_generic_dispatcher.hpp:44
viennacl::scheduler::detail::av
void av(lhs_rhs_element &vec1, lhs_rhs_element const &vec2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha)
Wrapper for viennacl::linalg::av(), taking care of the argument unwrapping.
Definition: execute_vector_dispatcher.hpp:42
execute_scalar_dispatcher.hpp
Provides wrappers for as(), asbs(), asbs_s(), etc. in viennacl/linalg/scalar_operations.hpp such that scheduler logic is not cluttered with numeric type decutions.
viennacl::scheduler::VECTOR_TYPE_FAMILY
Definition: forwards.h:257
execute_util.hpp
Provides various utilities for implementing the execution of statements.
viennacl::scheduler::detail::axbx_x
void axbx_x(lhs_rhs_element &x1, lhs_rhs_element const &x2, ScalarType1 const &alpha, vcl_size_t len_alpha, bool reciprocal_alpha, bool flip_sign_alpha, lhs_rhs_element const &x3, ScalarType2 const &beta, vcl_size_t len_beta, bool reciprocal_beta, bool flip_sign_beta)
Wrapper for viennacl::linalg::avbv_v(), taking care of the argument unwrapping.
Definition: execute_generic_dispatcher.hpp:99
viennacl::scheduler::statement_not_supported_exception
Exception for the case the scheduler is unable to deal with the operation.
Definition: forwards.h:38