21 #define SELECT_BLAS1_KERNEL(kernels,commonlocation,compute_at,storage,ret,...) \
22 if (commonlocation == (GHOST_LOCATION_HOST | GHOST_LOCATION_DEVICE)) {\
23 if (compute_at == GHOST_LOCATION_HOST) {\
24 if (storage == GHOST_DENSEMAT_COLMAJOR) {\
25 ret = kernels[GHOST_HOST_IDX][GHOST_CM_IDX](__VA_ARGS__);\
27 ret = kernels[GHOST_HOST_IDX][GHOST_RM_IDX](__VA_ARGS__);\
30 if (storage == GHOST_DENSEMAT_COLMAJOR) {\
31 ret = kernels[GHOST_DEVICE_IDX][GHOST_CM_IDX](__VA_ARGS__);\
33 ret = kernels[GHOST_DEVICE_IDX][GHOST_RM_IDX](__VA_ARGS__);\
37 if (!kernels[ghost_idx_of_location(commonlocation)][ghost_idx_of_densemat_storage(storage)]) {\
38 GHOST_ERROR_LOG("No kernel found!");\
39 ret = GHOST_ERR_INVALID_ARG;\
41 ret = kernels[ghost_idx_of_location(commonlocation)][ghost_idx_of_densemat_storage(storage)](__VA_ARGS__);\
57 a =
static_cast<ghost_gemm_flags>(
static_cast<int>(a) & static_cast<int>(b));
82 #define GHOST_GEMM_ALL_REDUCE GHOST_ALLREDUCE
83 #define GHOST_GEMM_NO_REDUCE -2
92 #define GHOST_KACZ_PERF_UNIT "GF/s"
93 #define GHOST_KACZ_PERF_TAG "kacz"
103 #define GHOST_SPMV_PERF_UNIT "GF/s"
104 #define GHOST_SPMV_PERF_TAG "spmv"
112 #define GHOST_AXPY_PERF_UNIT "GB/s"
113 #define GHOST_AXPY_PERF_TAG "axpy"
121 #define GHOST_AXPBY_PERF_UNIT "GB/s"
122 #define GHOST_AXPBY_PERF_TAG "axpby"
130 #define GHOST_AXPBYPCZ_PERF_UNIT "GB/s"
131 #define GHOST_AXPBYPCZ_PERF_TAG "axpbypcz"
140 #define GHOST_DOT_PERF_UNIT "GB/s"
141 #define GHOST_DOT_PERF_TAG "dot"
149 #define GHOST_SCALE_PERF_UNIT "GB/s"
150 #define GHOST_SCALE_PERF_TAG "scale"
ghost_error ghost_nrm2(void *norm, ghost_densemat *vec)
Compute the norm of a densemat: sum_i [conj(vec_i) * vec_i]^2.
Definition: math.c:791
ghost_error ghost_vaxpby(ghost_densemat *y, ghost_densemat *x, void *a, void *b)
Computes column-wise y := a_i*x + b_i*y with separate scalar a_i and b_i.
Definition: math.c:633
Header file for type definitions.
ghost_error ghost_mult(ghost_densemat *y, ghost_densemat *x, void *a)
Computes y(i,j) := a*x(i,j)*y(i,j) or y(i,j) := a*x(i) (if x has 1 column), with scalar a...
Definition: math.c:811
ghost_datatype dt
Definition: math.h:118
bool aisc
True if A is equal to C.
Definition: math.h:77
Types and functions related to GHOST contexts.
bool samevec
Definition: math.h:137
ghost_error ghost_vaxpy(ghost_densemat *y, ghost_densemat *x, void *a)
Computes column-wise y := a_i*x + y with separate scalar a_i.
Definition: math.c:587
int32_t ghost_gidx
Type for global indices.
Definition: types.h:443
int ghost_gemm_perf_GBs(double *perf, double time, void *arg)
Definition: gemm.c:592
ghost_gemm_flags
Definition: math.h:45
ghost_lidx globalrows
Definition: math.h:97
bool ghost_iszero(void *number, ghost_datatype dt)
Definition: math.c:509
ghost_lidx ncols
Definition: math.h:125
ghost_error ghost_gemm_valid(ghost_densemat *x, ghost_densemat *v, const char *transv, ghost_densemat *w, const char *transw, void *alpha, void *beta, int reduce, ghost_gemm_flags flags, int printerror)
Definition: gemm.c:17
ghost_datatype dt
Definition: math.h:146
int32_t ghost_lidx
Definition: types.h:503
ghost_gidx globnrows
Definition: math.h:135
ghost_datatype dt
Definition: math.h:78
ghost_error ghost_vscale(ghost_densemat *x, void *s)
Computes column-wise x := s_i*x with separate scalars s_i.
Definition: math.c:722
ghost_lidx vecncols
Definition: math.h:86
bool ghost_isone(void *vnumber, ghost_datatype dt)
Definition: math.c:536
ghost_gidx globalnnz
Definition: math.h:98
ghost_gidx globnrows
Definition: math.h:117
ghost_datatype dt
Definition: math.h:109
ghost_lidx vecncols
Definition: math.h:96
Types, functions and macros for error handling.
int ghost_axpby_perf(double *perf, double time, void *arg)
Definition: math.c:437
The specialized GEMM function tsmm.
ghost_spmv_flags flags
Definition: math.h:100
ghost_error ghost_normalize(ghost_densemat *x)
Normalizes a densemat (interpreted as a block vector).
Definition: math.c:740
ghost_error
Error return type.
Definition: error.h:23
ghost_error ghost_scale(ghost_densemat *x, void *s)
Computes x := s*x with scalar s.
Definition: math.c:704
The (block vector) dot product.
ghost_lidx ncols
Definition: math.h:107
ghost_gidx globnrows
Definition: math.h:108
int ghost_axpy_perf(double *perf, double time, void *arg)
Definition: math.c:454
ghost_spmv_flags
Flags to be passed to sparse matrix-vector multiplication.
Definition: spmv.h:15
int ghost_kacz_perf(double *perf, double time, void *arg)
Definition: math.c:347
static T norm(const T &a)
Definition: cpp11_fixes.h:29
ghost_gidx globnrows
Definition: math.h:145
ghost_lidx ncols
Definition: math.h:144
ghost_datatype
Available primitive data types.
Definition: types.h:248
ghost_error ghost_mpi_op_sum(ghost_mpi_op *op, ghost_datatype datatype)
Definition: math.c:214
bool alphaisone
Definition: math.h:72
int ghost_scale_perf(double *perf, double time, void *arg)
Definition: math.c:492
ghost_lidx ncols
Definition: math.h:134
ghost_error ghost_spmv(ghost_densemat *res, ghost_sparsemat *mat, ghost_densemat *invec, ghost_spmv_opts opts)
Multiply a sparse matrix with a dense vector.
Definition: spmv.c:9
int ghost_axpbypcz_perf(double *perf, double time, void *arg)
Definition: math.c:420
int ghost_spmv_perf(double *perf, double time, void *arg)
Definition: math.c:361
ghost_error ghost_mpi_op_densemat_sum(ghost_mpi_op *op, ghost_datatype datatype)
Definition: math.c:245
The specialized GEMM function tsmm (in-place).
int ghost_mpi_op
Definition: types.h:20
ghost_error ghost_gemm(ghost_densemat *x, ghost_densemat *v, const char *transv, ghost_densemat *w, const char *transw, void *alpha, void *beta, int reduce, ghost_gemm_flags flags)
Compute the general (dense) matrix-matrix product x = v*w.
Definition: gemm.c:431
ghost_error ghost_vaxpbypcz(ghost_densemat *y, ghost_densemat *x, void *a, void *b, ghost_densemat *z, void *c)
Computes column-wise y := a_i*x + b_i*y + c_i*z with separate scalars a_i, b_i, and c_i...
Definition: math.c:680
A sparse matrix.
Definition: sparsemat.h:476
ghost_error ghost_conj(ghost_densemat *x)
Conjugates a densemat.
Definition: math.c:758
ghost_datatype dt
Definition: math.h:99
int ghost_gemm_perf_GFs(double *perf, double time, void *arg)
Definition: gemm.c:564
int ghost_dot_perf(double *perf, double time, void *arg)
Definition: math.c:471
ghost_gidx globalnnz
Definition: math.h:88
ghost_lidx globalrows
Definition: math.h:87
ghost_gidx n
Definition: math.h:71
ghost_error ghost_axpbypcz(ghost_densemat *y, ghost_densemat *x, void *a, void *b, ghost_densemat *z, void *c)
Computes y := a*x + b*y + c*z with scalar a, b, and c.
Definition: math.c:656
ghost_datatype dt
Definition: math.h:89
ghost_error ghost_axpby(ghost_densemat *y, ghost_densemat *x, void *a, void *b)
Computes y := a*x + b*y with scalar a and b.
Definition: math.c:610
ghost_error ghost_axpy(ghost_densemat *y, ghost_densemat *x, void *a)
Computes y := a*x + y with scalar a.
Definition: math.c:564
Definition: sparsemat.h:71
ghost_error ghost_norm(void *norm, ghost_densemat *vec, void *pow)
Compute the norm of a densemat: sum_i [conj(vec_i) * vec_i]^pow.
Definition: math.c:776
Types and functions related to sparse matrices.
ghost_error ghost_mpi_operations_create()
Definition: math.c:276
ghost_error ghost_mpi_operations_destroy()
Definition: math.c:299
ghost_error ghost_spmv_nflops(int *nFlops, ghost_datatype m_t, ghost_datatype v_t)
Definition: math.c:315
ghost_datatype dt
Definition: math.h:127
ghost_lidx ncols
Definition: math.h:116
Do not look for special implementations!
Definition: math.h:50
bool betaiszero
Definition: math.h:73
A dense vector/matrix.
Definition: densemat.h:226
ghost_datatype dt
Definition: math.h:136
ghost_gidx globnrows
Definition: math.h:126
ghost_error ghost_spmv_nocomm(ghost_densemat *res, ghost_sparsemat *mat, ghost_densemat *invec, ghost_spmv_opts opts)
Definition: spmv.c:138