monolish  0.14.0
MONOlithic LIner equation Solvers for Highly-parallel architecture
vml/vector/arithmetic/vecadd.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 namespace monolish {
4 
5 namespace {
6 template <typename F1, typename F2, typename F3>
7 void svadd_core(const F1 &a, const F2 alpha, F3 &y) {
8  Logger &logger = Logger::get_instance();
9  logger.func_in(monolish_func);
10 
11  // err
12  assert(util::is_same_size(a, y));
13  assert(util::is_same_device_mem_stat(a, y));
14 
15  internal::vadd(y.size(), a.data() + a.get_offset(), alpha,
16  y.data() + y.get_offset(), y.get_device_mem_stat());
17 
18  logger.func_out();
19 }
20 
21 template <typename F1, typename F2, typename F3>
22 void vvadd_core(const F1 &a, const F2 &b, F3 &y) {
23  Logger &logger = Logger::get_instance();
24  logger.func_in(monolish_func);
25 
26  // err
27  assert(util::is_same_size(a, b, y));
28  assert(util::is_same_device_mem_stat(a, b, y));
29 
30  internal::vadd(y.size(), a.data() + a.get_offset(), b.data() + b.get_offset(),
31  y.data() + y.get_offset(), y.get_device_mem_stat());
32 
33  logger.func_out();
34 }
35 } // namespace
36 
37 } // namespace monolish
monolish::util::is_same_size
bool is_same_size(const T &x, const U &y)
compare size of vector or 1Dview (same as is_same_structure())
Definition: monolish_common.hpp:358
monolish_func
#define monolish_func
Definition: monolish_logger.hpp:9
monolish::util::is_same_device_mem_stat
bool is_same_device_mem_stat(const T &arg1, const U &arg2)
compare same device memory status
Definition: monolish_common.hpp:431
monolish
Definition: monolish_matrix_blas.hpp:9
monolish::Logger::get_instance
static Logger & get_instance()
Definition: monolish_logger.hpp:42