ViennaCL - The Vienna Computing Library: viennacl/linalg/detail/bisect/bisect_kernel_calls.hpp Source File

ViennaCL - The Vienna Computing Library 1.7.1 Free open-source GPU-accelerated linear algebra and solver library. |

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
bisect_kernel_calls.hpp
Go to the documentation of this file.
1 #ifndef VIENNACL_LINALG_DETAIL_BISECT_KERNEL_CALLS_HPP_
2 #define VIENNACL_LINALG_DETAIL_BISECT_KERNEL_CALLS_HPP_
3
4 /* =========================================================================
5 Copyright (c) 2010-2016, Institute for Microelectronics,
6 Institute for Analysis and Scientific Computing,
7 TU Wien.
8 Portions of this software are copyright by UChicago Argonne, LLC.
9
10 -----------------
11 ViennaCL - The Vienna Computing Library
12 -----------------
13
14 Project Head: Karl Rupp rupp@iue.tuwien.ac.at
15
16 (A list of authors and contributors can be found in the manual)
17
18 License: MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20
30 #include "viennacl/forwards.h"
31 #include "viennacl/scalar.hpp"
32 #include "viennacl/vector.hpp"
33 #include "viennacl/vector_proxy.hpp"
34 #include "viennacl/tools/tools.hpp"
35 #include "viennacl/meta/enable_if.hpp"
36 #include "viennacl/meta/predicate.hpp"
37 #include "viennacl/meta/result_of.hpp"
38 #include "viennacl/traits/size.hpp"
39 #include "viennacl/traits/start.hpp"
40 #include "viennacl/traits/handle.hpp"
41 #include "viennacl/traits/stride.hpp"
42
43 #include "viennacl/linalg/detail/bisect/structs.hpp"
44 #ifdef VIENNACL_WITH_OPENCL
45 #include "viennacl/linalg/opencl/bisect_kernel_calls.hpp"
46 #endif
47
48 #ifdef VIENNACL_WITH_CUDA
49 #include "viennacl/linalg/cuda/bisect_kernel_calls.hpp"
50 #endif
51
52 namespace viennacl
53 {
54 namespace linalg
55 {
56 namespace detail
57 {
58 template<typename NumericT>
59 void bisectSmall(const InputData<NumericT> &input, ResultDataSmall<NumericT> &result,
60 const unsigned int mat_size,
61 const NumericT lg, const NumericT ug,
62 const NumericT precision)
63 {
64 switch (viennacl::traits::handle(input.g_a).get_active_handle_id())
65 {
66 #ifdef VIENNACL_WITH_OPENCL
67 case viennacl::OPENCL_MEMORY:
68 viennacl::linalg::opencl::bisectSmall(input, result,
69 mat_size,
70 lg,ug,
71 precision);
72 break;
73 #endif
74 #ifdef VIENNACL_WITH_CUDA
75 case viennacl::CUDA_MEMORY:
76 viennacl::linalg::cuda::bisectSmall(input, result,
77 mat_size,
78 lg,ug,
79 precision);
80 break;
81 #endif
82 case viennacl::MEMORY_NOT_INITIALIZED:
83 throw memory_exception("not initialised!");
84 default:
85 throw memory_exception("not implemented");
86 }
87 }
88
89
90
91
92 template<typename NumericT>
93 void bisectLarge(const InputData<NumericT> &input, ResultDataLarge<NumericT> &result,
94 const unsigned int mat_size,
95 const NumericT lg, const NumericT ug,
96 const NumericT precision)
97 {
98 switch (viennacl::traits::handle(input.g_a).get_active_handle_id())
99 {
100 #ifdef VIENNACL_WITH_OPENCL
101 case viennacl::OPENCL_MEMORY:
102 viennacl::linalg::opencl::bisectLarge(input, result,
103 mat_size,
104 lg,ug,
105 precision);
106 break;
107 #endif
108 #ifdef VIENNACL_WITH_CUDA
109 case viennacl::CUDA_MEMORY:
110 viennacl::linalg::cuda::bisectLarge(input, result,
111 mat_size,
112 lg,ug,
113 precision);
114 break;
115 #endif
116 case viennacl::MEMORY_NOT_INITIALIZED:
117 throw memory_exception("not initialised!");
118 default:
119 throw memory_exception("not implemented");
120 }
121 }
122
123
124
125
126
127 template<typename NumericT>
128 void bisectLarge_OneIntervals(const InputData<NumericT> &input, ResultDataLarge<NumericT> &result,
129 const unsigned int mat_size,
130 const NumericT precision)
131 {
132 switch (viennacl::traits::handle(input.g_a).get_active_handle_id())
133 {
134 #ifdef VIENNACL_WITH_OPENCL
135 case viennacl::OPENCL_MEMORY:
136 viennacl::linalg::opencl::bisectLargeOneIntervals(input, result,
137 mat_size,
138 precision);
139 break;
140 #endif
141 #ifdef VIENNACL_WITH_CUDA
142 case viennacl::CUDA_MEMORY:
143 viennacl::linalg::cuda::bisectLarge_OneIntervals(input, result,
144 mat_size,
145 precision);
146
147 break;
148 #endif
149 case viennacl::MEMORY_NOT_INITIALIZED:
150 throw memory_exception("not initialised!");
151 default:
152 throw memory_exception("not implemented");
153 }
154 }
155
156
157
158
159 template<typename NumericT>
160 void bisectLarge_MultIntervals(const InputData<NumericT> &input, ResultDataLarge<NumericT> &result,
161 const unsigned int mat_size,
162 const NumericT precision)
163 {
164 switch (viennacl::traits::handle(input.g_a).get_active_handle_id())
165 {
166 #ifdef VIENNACL_WITH_OPENCL
167 case viennacl::OPENCL_MEMORY:
168 viennacl::linalg::opencl::bisectLargeMultIntervals(input, result,
169 mat_size,
170 precision);
171 break;
172 #endif
173 #ifdef VIENNACL_WITH_CUDA
174 case viennacl::CUDA_MEMORY:
175 viennacl::linalg::cuda::bisectLarge_MultIntervals(input, result,
176 mat_size,
177 precision);
178 break;
179 #endif
180 case viennacl::MEMORY_NOT_INITIALIZED:
181 throw memory_exception("not initialised!");
182 default:
183 throw memory_exception("not implemented");
184 }
185 }
186 } // namespace detail
187 } // namespace linalg
188 } //namespace viennacl
189
190
191 #endif
viennacl::linalg::cuda::bisectLarge
void bisectLarge(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:71
viennacl::linalg::detail::bisectLarge_MultIntervals
void bisectLarge_MultIntervals(const InputData< NumericT > &input, ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:160
viennacl::linalg::opencl::bisectLargeMultIntervals
void bisectLargeMultIntervals(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:145
viennacl::linalg::detail::bisectLarge
void bisectLarge(const InputData< NumericT > &input, ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:93
viennacl::linalg::opencl::bisectSmall
void bisectSmall(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:49
structs.hpp
Helper structures to simplify variable handling.
viennacl::memory_exception
Exception class in case of memory errors.
Definition: forwards.h:572
size.hpp
Generic size and resize functionality for different vector and matrix types.
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::OPENCL_MEMORY
Definition: forwards.h:349
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.
NumericT
float NumericT
Definition: bisect.cpp:40
bisect_kernel_calls.hpp
CUDA kernel calls for the bisection algorithm.
viennacl::linalg::detail::InputData
In this class the input matrix is stored.
Definition: structs.hpp:53
viennacl::linalg::opencl::bisectLargeOneIntervals
void bisectLargeOneIntervals(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:116
viennacl::MEMORY_NOT_INITIALIZED
Definition: forwards.h:347
viennacl::CUDA_MEMORY
Definition: forwards.h:350
vector_proxy.hpp
Proxy classes for vectors.
viennacl::linalg::detail::bisectLarge_OneIntervals
void bisectLarge_OneIntervals(const InputData< NumericT > &input, ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:128
predicate.hpp
All the predicates used within ViennaCL. Checks for expressions to be vectors, etc.
vector.hpp
The vector type with operator-overloads and proxy classes is defined here. Linear algebra operations ...
viennacl::linalg::cuda::bisectLarge_OneIntervals
void bisectLarge_OneIntervals(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:103
viennacl::linalg::detail::bisectSmall
void bisectSmall(const InputData< NumericT > &input, ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:59
viennacl::linalg::detail::ResultDataLarge
In this class the data of the result for large matrices is stored.
Definition: structs.hpp:125
viennacl::linalg::cuda::bisectSmall
void bisectSmall(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataSmall< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:45
handle.hpp
Extracts the underlying OpenCL handle from a vector, a matrix, an expression etc. ...
viennacl::traits::handle
viennacl::backend::mem_handle & handle(T &obj)
Returns the generic memory handle of an object. Non-const version.
Definition: handle.hpp:41
viennacl::linalg::cuda::bisectLarge_MultIntervals
void bisectLarge_MultIntervals(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT precision)
Definition: bisect_kernel_calls.hpp:133
scalar.hpp
Implementation of the ViennaCL scalar class.
viennacl::linalg::detail::ResultDataSmall
In this class the data of the result for small matrices is stored.
Definition: structs.hpp:96
result_of.hpp
A collection of compile time type deductions.
bisect_kernel_calls.hpp
OpenCL kernel calls for the bisection algorithm.
enable_if.hpp
Simple enable-if variant that uses the SFINAE pattern.
viennacl::linalg::opencl::bisectLarge
void bisectLarge(const viennacl::linalg::detail::InputData< NumericT > &input, viennacl::linalg::detail::ResultDataLarge< NumericT > &result, const unsigned int mat_size, const NumericT lg, const NumericT ug, const NumericT precision)
Definition: bisect_kernel_calls.hpp:79
viennacl::backend::mem_handle::get_active_handle_id
memory_types get_active_handle_id() const
Returns an ID for the currently active memory buffer. Other memory buffers might contain old or no da...
Definition: mem_handle.hpp:118
viennacl::linalg::detail::InputData::g_a
viennacl::vector< NumericT > g_a
device side representation of diagonal
Definition: structs.hpp:60