Do more. Code less. Free software for GPU computing.
<scroll to top>
Namespaces | Defines | Functions

blas.h File Reference

#include <cuComplex.h>
#include "constants.h"
#include <cublas_v2.h>

Go to the source code of this file.

Namespaces

namespace  af

Defines

#define ZERO   =0

Functions

template<typename ty >
ty norm (const array &in, float p=af::nan)
 Matrix or vector norm.
template<typename ty >
ty inner (const array &x, const array &y)
 Inner (scalar) product between two vectors.
array inner (const array &X, const array &Y, int dim=-1)
 Dot product along a dimension.
afError af_norm_S (float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
afError af_norm_D (double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
 norm the value along a dimension in double precision matrix
afError cublasSgemmN (cublasOperation_t transa, cublasOperation_t transb, int m, int n, int k, float alpha, const float *d_A, int lda, const float *d_B, int ldb, float beta, float *d_C, int ldc, unsigned batch_A=0, unsigned batch_B=0)
afError cublasDgemmN (cublasOperation_t transa, cublasOperation_t transb, int m, int n, int k, double alpha, const double *d_A, int lda, const double *d_B, int ldb, double beta, double *d_C, int ldc, unsigned batch_A=0, unsigned batch_B=0)
afError cublasCgemmN (cublasOperation_t transa, cublasOperation_t transb, int m, int n, int k, cuComplex alpha, const cuComplex *d_A, int lda, const cuComplex *d_B, int ldb, cuComplex beta, cuComplex *d_C, int ldc, unsigned batch_A=0, unsigned batch_B=0)
afError cublasZgemmN (cublasOperation_t transa, cublasOperation_t transb, int m, int n, int k, cuDoubleComplex alpha, const cuDoubleComplex *d_A, int lda, const cuDoubleComplex *d_B, int ldb, cuDoubleComplex beta, cuDoubleComplex *d_C, int ldc, unsigned batch_A=0, unsigned batch_B=0)
afError cublasSgemvN (cublasOperation_t TRANSA, int M, int N, float ALPHA, const float *d_A, int LDA, const float *d_x, int incx, float BETA, float *d_y, int incy, unsigned batch_A=0, unsigned batch_x=0)
afError cublasDgemvN (cublasOperation_t TRANSA, int M, int N, double ALPHA, const double *d_A, int LDA, const double *d_x, int incx, double BETA, double *d_y, int incy, unsigned batch_A=0, unsigned batch_x=0)
afError cublasCgemvN (cublasOperation_t TRANSA, int M, int N, cuComplex ALPHA, const cuComplex *d_A, int LDA, const cuComplex *d_x, int incx, cuComplex BETA, cuComplex *d_y, int incy, unsigned batch_A=0, unsigned batch_x=0)
afError cublasZgemvN (cublasOperation_t TRANSA, int M, int N, cuDoubleComplex ALPHA, const cuDoubleComplex *d_A, int LDA, const cuDoubleComplex *d_x, int incx, cuDoubleComplex BETA, cuDoubleComplex *d_y, int incy, unsigned batch_A=0, unsigned batch_x=0)
afError cublasSgerN (int M, int N, float ALPHA, const float *d_x, int incx, const float *d_y, int incy, float *d_A, int lda, unsigned batch_x=0, unsigned batch_y=0)
afError cublasDgerN (int M, int N, double ALPHA, const double *d_x, int incx, const double *d_y, int incy, double *d_A, int lda, unsigned batch_x=0, unsigned batch_y=0)
afError cublasCgeruN (int M, int N, cuComplex ALPHA, const cuComplex *d_x, int incx, const cuComplex *d_y, int incy, cuComplex *d_A, int lda, unsigned batch_x=0, unsigned batch_y=0)
afError cublasZgeruN (int M, int N, cuDoubleComplex ALPHA, const cuDoubleComplex *d_x, int incx, const cuDoubleComplex *d_y, int incy, cuDoubleComplex *d_A, int lda, unsigned batch_x=0, unsigned batch_y=0)
afError cublasSdotN (int N, const float *d_x, int incx, const float *d_y, int incy, float *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError cublasDdotN (int N, const double *d_x, int incx, const double *d_y, int incy, double *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError cublasCdotuN (int N, const cuComplex *d_x, int incx, const cuComplex *d_y, int incy, cuComplex *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError cublasZdotuN (int N, const cuDoubleComplex *d_x, int incx, const cuDoubleComplex *d_y, int incy, cuDoubleComplex *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError cublasCdotcN (int N, const cuComplex *d_x, int incx, const cuComplex *d_y, int incy, cuComplex *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError cublasZdotcN (int N, const cuDoubleComplex *d_x, int incx, const cuDoubleComplex *d_y, int incy, cuDoubleComplex *h_dot, unsigned batch_x=0, unsigned batch_y=0)
afError af_norm_vector (float *h_dst, unsigned numel, const float *d_src)
 norm The value of a single precision vector
afError af_norm_vector (double *h_dst, unsigned numel, const double *d_src)
 norm The value of a double precision vector
afError af_norm (float *d_dst, unsigned ndims, const unsigned *dims, const float *d_src, int dim)
 norm the value along a dimension in single precision matrix
afError af_norm (double *d_dst, unsigned ndims, const unsigned *dims, const double *d_src, int dim)
 norm the value along a dimension in double precision matrix
Matrix multiply: Device pointer interface
Parameters:
TRANSAMust be 'N' indicating non-transposed
TRANSBMust be 'N' indicating non-transposed.
MRows of A and C
NColumns of B and C
KColumns of A and rows of B
ALPHAMust be 1.0
[in]d_ALeft matrix (A).
[in]d_BRight matrix (B).
[out]d_COutput matrix (C).
BETAMust be 0.0
batch_ANumber of tiles in matrix A
batch_BNumber of tiles in matrix A
afError af_gemm_SS (char TRANSA, char TRANSB, int M, int N, int K, float ALPHA, const float *d_A, int LDA, const float *d_B, int LDB, float BETA, float *d_C, int LDC, unsigned batch_A=0, unsigned batch_B=0)
 Single precision, Real matrix multiply.
afError af_gemm_DD (char TRANSA, char TRANSB, int M, int N, int K, double ALPHA, const double *d_A, int LDA, const double *d_B, int LDB, double BETA, double *d_C, int LDC, unsigned batch_A=0, unsigned batch_B=0)
 Double precision, Real matrix multiply.
afError af_gemm_CC (char TRANSA, char TRANSB, int M, int N, int K, cuComplex ALPHA, const cuComplex *d_A, int LDA, const cuComplex *d_B, int LDB, cuComplex BETA, cuComplex *d_C, int LDC, unsigned batch_A=0, unsigned batch_B=0)
 Single precision, Complex matrix multiply.
afError af_gemm_ZZ (char TRANSA, char TRANSB, int M, int N, int K, cuDoubleComplex ALPHA, const cuDoubleComplex *d_A, int LDA, const cuDoubleComplex *d_B, int LDB, cuDoubleComplex BETA, cuDoubleComplex *d_C, int LDC, unsigned batch_A=0, unsigned batch_B=0)
 Double precision, Complex matrix multiply.
afError af_matmul_SS (const float *d_A, const float *d_B, float *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
 Mixed precision, mixed complexity matrix multiply.
afError af_matmul_DS (const double *d_A, const float *d_B, float *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_SD (const float *d_A, const double *d_B, float *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_DD (const double *d_A, const double *d_B, double *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_CS (const cuComplex *d_A, const float *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_ZS (const cuDoubleComplex *d_A, const float *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_CD (const cuComplex *d_A, const double *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_ZD (const cuDoubleComplex *d_A, const double *d_B, cuDoubleComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_SC (const float *d_A, const cuComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_DC (const double *d_A, const cuComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_SZ (const float *d_A, const cuDoubleComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_DZ (const double *d_A, const cuDoubleComplex *d_B, cuDoubleComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_CC (const cuComplex *d_A, const cuComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_ZC (const cuDoubleComplex *d_A, const cuComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_CZ (const cuComplex *d_A, const cuDoubleComplex *d_B, cuComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
afError af_matmul_ZZ (const cuDoubleComplex *d_A, const cuDoubleComplex *d_B, cuDoubleComplex *d_C, int M, int N, int K, unsigned batch_A=0, unsigned batch_B=0)
Euclidean norm of entire matrix
Parameters:
[out]h_dstNorm of the vector
[in]numelNumber of elements in vector
[in]d_srcInput vector
afError af_norm_vector_S (float *h_dst, unsigned numel, const float *d_src)
 norm The value of a single precision vector
afError af_norm_vector_D (double *h_dst, unsigned numel, const double *d_src)
 norm The value of a double precision vector
Dot product: Device pointer interface
Parameters:
[out]h_resThe output. (Host pointer);
[in]lenThe length of the vectors
[in]d_ADevice pointer to the first vector
[in]d_BDevice pointer to the second vector
afError af_inner_S (float *h_res, unsigned len, const float *d_A, const float *d_B)
afError af_inner_D (double *h_res, unsigned len, const double *d_A, const double *d_B)
afError af_inner_C (cuComplex *h_res, unsigned len, const cuComplex *d_A, const cuComplex *d_B)
afError af_inner_Z (cuDoubleComplex *h_res, unsigned len, const cuDoubleComplex *d_A, const cuDoubleComplex *d_B)

Define Documentation

#define ZERO   =0

Function Documentation

afError af_norm_S ( float *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const float *  d_src,
int  dim 
)

norm the value along a dimension in single precision matrix

afError af_norm_D ( double *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const double *  d_src,
int  dim 
)

norm the value along a dimension in double precision matrix

afError cublasSgemmN ( cublasOperation_t  transa,
cublasOperation_t  transb,
int  m,
int  n,
int  k,
float  alpha,
const float *  d_A,
int  lda,
const float *  d_B,
int  ldb,
float  beta,
float *  d_C,
int  ldc,
unsigned  batch_A = 0,
unsigned  batch_B = 0 
)
afError cublasDgemmN ( cublasOperation_t  transa,
cublasOperation_t  transb,
int  m,
int  n,
int  k,
double  alpha,
const double *  d_A,
int  lda,
const double *  d_B,
int  ldb,
double  beta,
double *  d_C,
int  ldc,
unsigned  batch_A = 0,
unsigned  batch_B = 0 
)
afError cublasCgemmN ( cublasOperation_t  transa,
cublasOperation_t  transb,
int  m,
int  n,
int  k,
cuComplex  alpha,
const cuComplex *  d_A,
int  lda,
const cuComplex *  d_B,
int  ldb,
cuComplex  beta,
cuComplex *  d_C,
int  ldc,
unsigned  batch_A = 0,
unsigned  batch_B = 0 
)
afError cublasZgemmN ( cublasOperation_t  transa,
cublasOperation_t  transb,
int  m,
int  n,
int  k,
cuDoubleComplex  alpha,
const cuDoubleComplex *  d_A,
int  lda,
const cuDoubleComplex *  d_B,
int  ldb,
cuDoubleComplex  beta,
cuDoubleComplex *  d_C,
int  ldc,
unsigned  batch_A = 0,
unsigned  batch_B = 0 
)
afError cublasSgemvN ( cublasOperation_t  TRANSA,
int  M,
int  N,
float  ALPHA,
const float *  d_A,
int  LDA,
const float *  d_x,
int  incx,
float  BETA,
float *  d_y,
int  incy,
unsigned  batch_A = 0,
unsigned  batch_x = 0 
)
afError cublasDgemvN ( cublasOperation_t  TRANSA,
int  M,
int  N,
double  ALPHA,
const double *  d_A,
int  LDA,
const double *  d_x,
int  incx,
double  BETA,
double *  d_y,
int  incy,
unsigned  batch_A = 0,
unsigned  batch_x = 0 
)
afError cublasCgemvN ( cublasOperation_t  TRANSA,
int  M,
int  N,
cuComplex  ALPHA,
const cuComplex *  d_A,
int  LDA,
const cuComplex *  d_x,
int  incx,
cuComplex  BETA,
cuComplex *  d_y,
int  incy,
unsigned  batch_A = 0,
unsigned  batch_x = 0 
)
afError cublasZgemvN ( cublasOperation_t  TRANSA,
int  M,
int  N,
cuDoubleComplex  ALPHA,
const cuDoubleComplex *  d_A,
int  LDA,
const cuDoubleComplex *  d_x,
int  incx,
cuDoubleComplex  BETA,
cuDoubleComplex *  d_y,
int  incy,
unsigned  batch_A = 0,
unsigned  batch_x = 0 
)
afError cublasSgerN ( int  M,
int  N,
float  ALPHA,
const float *  d_x,
int  incx,
const float *  d_y,
int  incy,
float *  d_A,
int  lda,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasDgerN ( int  M,
int  N,
double  ALPHA,
const double *  d_x,
int  incx,
const double *  d_y,
int  incy,
double *  d_A,
int  lda,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasCgeruN ( int  M,
int  N,
cuComplex  ALPHA,
const cuComplex *  d_x,
int  incx,
const cuComplex *  d_y,
int  incy,
cuComplex *  d_A,
int  lda,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasZgeruN ( int  M,
int  N,
cuDoubleComplex  ALPHA,
const cuDoubleComplex *  d_x,
int  incx,
const cuDoubleComplex *  d_y,
int  incy,
cuDoubleComplex *  d_A,
int  lda,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasSdotN ( int  N,
const float *  d_x,
int  incx,
const float *  d_y,
int  incy,
float *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasDdotN ( int  N,
const double *  d_x,
int  incx,
const double *  d_y,
int  incy,
double *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasCdotuN ( int  N,
const cuComplex *  d_x,
int  incx,
const cuComplex *  d_y,
int  incy,
cuComplex *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasZdotuN ( int  N,
const cuDoubleComplex *  d_x,
int  incx,
const cuDoubleComplex *  d_y,
int  incy,
cuDoubleComplex *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasCdotcN ( int  N,
const cuComplex *  d_x,
int  incx,
const cuComplex *  d_y,
int  incy,
cuComplex *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError cublasZdotcN ( int  N,
const cuDoubleComplex *  d_x,
int  incx,
const cuDoubleComplex *  d_y,
int  incy,
cuDoubleComplex *  h_dot,
unsigned  batch_x = 0,
unsigned  batch_y = 0 
)
afError af_norm_vector ( float *  h_dst,
unsigned  numel,
const float *  d_src 
)

norm The value of a single precision vector

afError af_norm_vector ( double *  h_dst,
unsigned  numel,
const double *  d_src 
)

norm The value of a double precision vector

afError af_norm ( float *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const float *  d_src,
int  dim 
)

norm the value along a dimension in single precision matrix

afError af_norm ( double *  d_dst,
unsigned  ndims,
const unsigned *  dims,
const double *  d_src,
int  dim 
)

norm the value along a dimension in double precision matrix

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines