GHOST  1.1.2
General, Hybrid, and Optimized Sparse Toolkit
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Classes | Macros | Enumerations | Functions
math.h File Reference

Functions for global mathematical operations. More...

#include "config.h"
#include "types.h"
#include "context.h"
#include "sparsemat.h"
#include "densemat.h"
#include "error.h"
#include "tsmm.h"
#include "tsmm_inplace.h"
#include "dot.h"
#include <stdarg.h>
Include dependency graph for math.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ghost_gemm_perf_args
 
struct  ghost_kacz_perf_args
 
struct  ghost_spmv_perf_args
 
struct  ghost_axpy_perf_args
 
struct  ghost_axpby_perf_args
 
struct  ghost_axpbypcz_perf_args
 
struct  ghost_dot_perf_args
 
struct  ghost_scale_perf_args
 

Macros

#define SELECT_BLAS1_KERNEL(kernels, commonlocation, compute_at, storage, ret,...)
 
#define GHOST_GEMM_ALL_REDUCE   GHOST_ALLREDUCE
 
#define GHOST_GEMM_NO_REDUCE   -2
 
#define GHOST_KACZ_PERF_UNIT   "GF/s"
 
#define GHOST_KACZ_PERF_TAG   "kacz"
 
#define GHOST_SPMV_PERF_UNIT   "GF/s"
 
#define GHOST_SPMV_PERF_TAG   "spmv"
 
#define GHOST_AXPY_PERF_UNIT   "GB/s"
 
#define GHOST_AXPY_PERF_TAG   "axpy"
 
#define GHOST_AXPBY_PERF_UNIT   "GB/s"
 
#define GHOST_AXPBY_PERF_TAG   "axpby"
 
#define GHOST_AXPBYPCZ_PERF_UNIT   "GB/s"
 
#define GHOST_AXPBYPCZ_PERF_TAG   "axpbypcz"
 
#define GHOST_DOT_PERF_UNIT   "GB/s"
 
#define GHOST_DOT_PERF_TAG   "dot"
 
#define GHOST_SCALE_PERF_UNIT   "GB/s"
 
#define GHOST_SCALE_PERF_TAG   "scale"
 

Enumerations

enum  ghost_gemm_flags { GHOST_GEMM_DEFAULT = 0, GHOST_GEMM_NOT_SPECIAL = 1, GHOST_GEMM_NOT_CLONE_ALIASED = 2, GHOST_GEMM_KAHAN = 4 }
 

Functions

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. More...
 
ghost_error ghost_spmv_nocomm (ghost_densemat *res, ghost_sparsemat *mat, ghost_densemat *invec, ghost_spmv_opts opts)
 
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)
 
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. More...
 
ghost_error ghost_mpi_operations_create ()
 
ghost_error ghost_mpi_operations_destroy ()
 
ghost_error ghost_mpi_op_densemat_sum (ghost_mpi_op *op, ghost_datatype datatype)
 
ghost_error ghost_mpi_op_sum (ghost_mpi_op *op, ghost_datatype datatype)
 
ghost_error ghost_spmv_nflops (int *nFlops, ghost_datatype m_t, ghost_datatype v_t)
 
ghost_error ghost_axpy (ghost_densemat *y, ghost_densemat *x, void *a)
 Computes y := a*x + y with scalar a. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
ghost_error ghost_scale (ghost_densemat *x, void *s)
 Computes x := s*x with scalar s. More...
 
ghost_error ghost_vscale (ghost_densemat *x, void *s)
 Computes column-wise x := s_i*x with separate scalars s_i. More...
 
ghost_error ghost_normalize (ghost_densemat *x)
 Normalizes a densemat (interpreted as a block vector). More...
 
ghost_error ghost_conj (ghost_densemat *x)
 Conjugates a densemat. More...
 
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. More...
 
ghost_error ghost_nrm2 (void *norm, ghost_densemat *vec)
 Compute the norm of a densemat: sum_i [conj(vec_i) * vec_i]^2. More...
 
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. More...
 
int ghost_kacz_perf (double *perf, double time, void *arg)
 
int ghost_spmv_perf (double *perf, double time, void *arg)
 
int ghost_axpy_perf (double *perf, double time, void *arg)
 
int ghost_axpby_perf (double *perf, double time, void *arg)
 
int ghost_scale_perf (double *perf, double time, void *arg)
 
int ghost_dot_perf (double *perf, double time, void *arg)
 
int ghost_axpbypcz_perf (double *perf, double time, void *arg)
 
int ghost_gemm_perf_GFs (double *perf, double time, void *arg)
 
int ghost_gemm_perf_GBs (double *perf, double time, void *arg)
 
bool ghost_iszero (void *number, ghost_datatype dt)
 
bool ghost_isone (void *vnumber, ghost_datatype dt)
 

Detailed Description

Functions for global mathematical operations.

Author
Moritz Kreutzer morit.nosp@m.z.kr.nosp@m.eutze.nosp@m.r@fa.nosp@m.u.de

Macro Definition Documentation

#define GHOST_AXPBY_PERF_TAG   "axpby"
#define GHOST_AXPBY_PERF_UNIT   "GB/s"
#define GHOST_AXPBYPCZ_PERF_TAG   "axpbypcz"
#define GHOST_AXPBYPCZ_PERF_UNIT   "GB/s"
#define GHOST_AXPY_PERF_TAG   "axpy"
#define GHOST_AXPY_PERF_UNIT   "GB/s"
#define GHOST_DOT_PERF_TAG   "dot"
#define GHOST_DOT_PERF_UNIT   "GB/s"
#define GHOST_GEMM_ALL_REDUCE   GHOST_ALLREDUCE
#define GHOST_GEMM_NO_REDUCE   -2
#define GHOST_KACZ_PERF_TAG   "kacz"
#define GHOST_KACZ_PERF_UNIT   "GF/s"
#define GHOST_SCALE_PERF_TAG   "scale"
#define GHOST_SCALE_PERF_UNIT   "GB/s"
#define GHOST_SPMV_PERF_TAG   "spmv"
#define GHOST_SPMV_PERF_UNIT   "GF/s"
#define SELECT_BLAS1_KERNEL (   kernels,
  commonlocation,
  compute_at,
  storage,
  ret,
  ... 
)
Value:
if (commonlocation == (GHOST_LOCATION_HOST | GHOST_LOCATION_DEVICE)) {\
if (compute_at == GHOST_LOCATION_HOST) {\
if (storage == GHOST_DENSEMAT_COLMAJOR) {\
ret = kernels[GHOST_HOST_IDX][GHOST_CM_IDX](__VA_ARGS__);\
} else {\
ret = kernels[GHOST_HOST_IDX][GHOST_RM_IDX](__VA_ARGS__);\
}\
} else {\
if (storage == GHOST_DENSEMAT_COLMAJOR) {\
ret = kernels[GHOST_DEVICE_IDX][GHOST_CM_IDX](__VA_ARGS__);\
} else {\
ret = kernels[GHOST_DEVICE_IDX][GHOST_RM_IDX](__VA_ARGS__);\
}\
}\
} else {\
if (!kernels[ghost_idx_of_location(commonlocation)][ghost_idx_of_densemat_storage(storage)]) {\
GHOST_ERROR_LOG("No kernel found!");\
} else {\
ret = kernels[ghost_idx_of_location(commonlocation)][ghost_idx_of_densemat_storage(storage)](__VA_ARGS__);\
}\
}
#define GHOST_DEVICE_IDX
Definition: types.h:288
Data is located on host.
Definition: types.h:278
#define GHOST_ERROR_LOG(...)
Definition: log.h:125
Column-major storage (as in Fortran).
Definition: densemat.h:103
#define GHOST_CM_IDX
Definition: densemat.h:10
int ghost_idx_of_location(ghost_location l)
Definition: types.c:238
One or more of the arguments are invalid.
Definition: error.h:31
Data is located on device (accelerator, GPU).
Definition: types.h:282
#define GHOST_HOST_IDX
Definition: types.h:287
int ghost_idx_of_densemat_storage(ghost_densemat_storage s)
Translates a ghost_densemat_storage into an consectuive index.
Definition: densemat.c:626
#define GHOST_RM_IDX
Definition: densemat.h:11

Enumeration Type Documentation

Enumerator
GHOST_GEMM_DEFAULT 
GHOST_GEMM_NOT_SPECIAL 

Do not look for special implementations!

GHOST_GEMM_NOT_CLONE_ALIASED 
GHOST_GEMM_KAHAN 

Function Documentation

int ghost_axpby_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

int ghost_axpbypcz_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

int ghost_axpy_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

int ghost_dot_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

int ghost_gemm_perf_GBs ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

int ghost_gemm_perf_GFs ( double *  perf,
double  time,
void *  arg 
)
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 
)

Here is the call graph for this function:

bool ghost_isone ( void *  vnumber,
ghost_datatype  dt 
)
bool ghost_iszero ( void *  number,
ghost_datatype  dt 
)
int ghost_kacz_perf ( double *  perf,
double  time,
void *  arg 
)
ghost_error ghost_mpi_op_densemat_sum ( ghost_mpi_op op,
ghost_datatype  datatype 
)
ghost_error ghost_mpi_op_sum ( ghost_mpi_op op,
ghost_datatype  datatype 
)
ghost_error ghost_mpi_operations_create ( )
ghost_error ghost_mpi_operations_destroy ( )
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.

Parameters
normWhere to store the norm. Must be a pointer to the densemat's data type.
vecThe densemat.
powThe power. Must be a pointer to the densemat's data type.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

ghost_error ghost_nrm2 ( void *  norm,
ghost_densemat vec 
)

Compute the norm of a densemat: sum_i [conj(vec_i) * vec_i]^2.

Parameters
normWhere to store the norm. Must be a pointer to the densemat's data type.
vecThe densemat.
Returns
GHOST_SUCCESS on success or an error indicator.

Here is the call graph for this function:

int ghost_scale_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function:

ghost_error ghost_spmv_nflops ( int *  nFlops,
ghost_datatype  m_t,
ghost_datatype  v_t 
)

Here is the call graph for this function:

ghost_error ghost_spmv_nocomm ( ghost_densemat res,
ghost_sparsemat mat,
ghost_densemat invec,
ghost_spmv_opts  opts 
)

Here is the call graph for this function:

int ghost_spmv_perf ( double *  perf,
double  time,
void *  arg 
)

Here is the call graph for this function: