5 #ifndef FML_GPU_LINALG_ADD_H
6 #define FML_GPU_LINALG_ADD_H
12 #include "../../_internals/linalgutils.hh"
14 #include "../arch/arch.hh"
16 #include "../gpumat.hh"
18 #include "internals/err.hh"
41 template <
typename REAL>
42 void add(
const bool transx,
const bool transy,
const REAL alpha,
46 err::check_card(x, y, ret);
49 fml::linalgutils::matadd_params(transx, transy, x.
nrows(), x.
ncols(),
55 auto c = x.get_card();
56 gpublas_operation_t cbtransx = transx ? GPUBLAS_OP_T : GPUBLAS_OP_N;
57 gpublas_operation_t cbtransy = transy ? GPUBLAS_OP_T : GPUBLAS_OP_N;
59 gpublas_status_t check = gpublas::geam(c->blas_handle(), cbtransx, cbtransy,
62 gpublas::err::check_ret(check,
"geam");
68 template <
typename REAL>
72 err::check_card(x, y);
75 fml::linalgutils::matadd_params(transx, transy, x.
nrows(), x.
ncols(),
78 auto c = x.get_card();
80 add(transx, transy, alpha, beta, x, y, ret);