16 #ifndef dealii_cuda_kernels_h 17 #define dealii_cuda_kernels_h 19 #include <deal.II/base/config.h> 21 #ifdef DEAL_II_COMPILER_CUDA_AWARE 24 # include <deal.II/base/cuda_size.h> 25 # include <deal.II/base/types.h> 27 # include <deal.II/lac/cuda_atomic.h> 31 DEAL_II_NAMESPACE_OPEN
42 using ::CUDAWrappers::block_size;
43 using ::CUDAWrappers::chunk_size;
51 template <
typename Number>
53 vec_scale(Number *val,
const Number a,
const size_type N);
62 template <
typename Number>
65 __device__
static inline Number
66 operation(
const Number a,
const Number b)
72 template <
typename Number>
75 __device__
static inline std::complex<Number>
76 operation(
const std::complex<Number> a,
const std::complex<Number>)
78 printf(
"This function is not implemented for std::complex<Number>!");
91 template <
typename Number>
94 __device__
static inline Number
95 operation(
const Number a,
const Number b)
101 template <
typename Number>
104 __device__
static inline std::complex<Number>
105 operation(
const std::complex<Number> a,
const std::complex<Number> b)
107 printf(
"This function is not implemented for std::complex<Number>!");
120 template <
typename Number>
123 __device__
static inline Number
124 operation(
const Number a,
const Number b)
126 return a > b ? a : b;
130 template <
typename Number>
133 __device__
static inline std::complex<Number>
134 operation(
const std::complex<Number> a,
const std::complex<Number>)
136 printf(
"This function is not implemented for std::complex<Number>!");
149 template <
typename Number>
152 __device__
static inline Number
153 operation(
const Number a,
const Number b)
155 return a > b ? b : a;
159 template <
typename Number>
162 __device__
static inline std::complex<Number>
163 operation(
const std::complex<Number> a,
const std::complex<Number>)
165 printf(
"This function is not implemented for std::complex<Number>!");
178 template <
typename Number,
template <
typename>
class Binop>
180 vector_bin_op(Number *v1,
const Number *v2,
const size_type N);
192 template <
typename Number,
template <
typename>
class Binop>
207 template <
typename Number>
210 __device__
static Number
211 reduction_op(
const Number a,
const Number b);
213 __device__
static Number
214 atomic_op(Number *dst,
const Number a);
216 __device__
static Number
217 element_wise_op(
const Number a);
219 __device__
static Number
231 template <
typename Number>
234 __device__
static Number
235 reduction_op(
const Number a,
const Number b);
237 __device__
static Number
238 atomic_op(Number *dst,
const Number a);
240 __device__
static Number
241 element_wise_op(
const Number a);
243 __device__
static Number
255 template <
typename Number>
258 __device__
static Number
259 reduction_op(
const Number a,
const Number b);
261 __device__
static Number
262 atomic_op(Number *dst,
const Number a);
264 __device__
static Number
265 element_wise_op(
const Number a);
267 __device__
static Number
278 template <
typename Number,
typename Operation>
280 reduction(Number *result,
const Number *v,
const size_type N);
290 template <
typename Number>
293 __device__
static Number
294 binary_op(
const Number a,
const Number b);
296 __device__
static Number
297 reduction_op(
const Number a,
const Number b);
299 __device__
static Number
300 atomic_op(Number *dst,
const Number a);
302 __device__
static Number
314 template <
typename Number,
typename Operation>
328 template <
typename Number>
330 vec_add(Number *val,
const Number a,
const size_type N);
339 template <
typename Number>
343 const Number * V_val,
354 template <
typename Number>
358 const Number * V_val,
360 const Number * W_val,
371 template <
typename Number>
376 const Number * V_val,
387 template <
typename Number>
392 const Number * V_val,
394 const Number * W_val,
405 template <
typename Number>
407 scale(Number *val,
const Number *V_val,
const size_type N);
416 template <
typename Number>
418 equ(Number *val,
const Number a,
const Number *V_val,
const size_type N);
427 template <
typename Number>
431 const Number * V_val,
433 const Number * W_val,
444 template <
typename Number>
460 template <
typename Number>
462 set(Number *val,
const Number s,
const size_type N);
471 template <
typename Number,
typename IndexType>
486 template <
typename Number,
typename IndexType>
489 const IndexType *indices,
501 template <
typename Number>
511 DEAL_II_NAMESPACE_CLOSE
__global__ void reduction(Number *result, const Number *v, const size_type N)
__global__ void double_vector_reduction(Number *result, const Number *v1, const Number *v2, const size_type N)
__global__ void add_and_dot(Number *res, Number *v1, const Number *v2, const Number *v3, const Number a, const size_type N)
__global__ void vec_add(Number *val, const Number a, const size_type N)
__global__ void gather(Number *val, const IndexType *indices, const Number *v, const IndexType N)
__global__ void add_aVbW(Number *val, const Number a, const Number *V_val, const Number b, const Number *W_val, const size_type N)
__global__ void scale(Number *val, const Number *V_val, const size_type N)
__global__ void add_aV(Number *val, const Number a, const Number *V_val, const size_type N)
__global__ void masked_vector_bin_op(const unsigned int *mask, Number *v1, const Number *v2, const size_type N)
__global__ void vec_scale(Number *val, const Number a, const size_type N)
__global__ void set_permutated(const IndexType *indices, Number *val, const Number *v, const IndexType N)
__global__ void equ(Number *val, const Number a, const Number *V_val, const size_type N)
__global__ void sadd(const Number s, Number *val, const Number a, const Number *V_val, const size_type N)
unsigned int global_dof_index
__global__ void add_permutated(const size_type *indices, Number *val, const Number *v, const size_type N)
__global__ void vector_bin_op(Number *v1, const Number *v2, const size_type N)