Difference between revisions of "GPU610/DPS915 Student Resources"

From CDOT Wiki
Jump to: navigation, search
(Student Resources)
(BLAS Documentation)
Line 10: Line 10:
  
 
===segmv===
 
===segmv===
 +
* compute the matrix-vector product for a general matrix
 +
 
void '''cblas_sgemv''' (''const enum CBLAS_ORDER '''order''', const enum CBLAS_TRANSPOSE '''TransA''', const int '''M''', const int '''N''', const float '''alpha''', const float * '''A''', const int '''lda''', const float * '''x''', const int '''incx''', const float '''beta''', float * '''y''', const int '''incy''''')[http://www.gnu.org/software/gsl/manual/html_node/Level-2-CBLAS-Functions.html 1] [http://www.prism.gatech.edu/~ndantam3/cblas-doc/doc/html/cblas_8h.html#23ac27150577c29a7ad4ddb427f255f7 2] [http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Fproguide%2Fref%2Fblaslib.htm 3]
 
void '''cblas_sgemv''' (''const enum CBLAS_ORDER '''order''', const enum CBLAS_TRANSPOSE '''TransA''', const int '''M''', const int '''N''', const float '''alpha''', const float * '''A''', const int '''lda''', const float * '''x''', const int '''incx''', const float '''beta''', float * '''y''', const int '''incy''''')[http://www.gnu.org/software/gsl/manual/html_node/Level-2-CBLAS-Functions.html 1] [http://www.prism.gatech.edu/~ndantam3/cblas-doc/doc/html/cblas_8h.html#23ac27150577c29a7ad4ddb427f255f7 2] [http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Fproguide%2Fref%2Fblaslib.htm 3]
  
Line 54: Line 56:
  
 
===segmm===
 
===segmm===
 +
*  perform combined matrix multiplication and addition for general matrices
 +
 
void '''cblas_sgemm''' (''const enum CBLAS_ORDER '''Order''', const enum CBLAS_TRANSPOSE '''TransA''', const enum CBLAS_TRANSPOSE '''TransB''', const int '''M''', const int '''N''', const int '''K''', const float '''alpha''', const float * '''A''', const int '''lda''', const float * '''B''', const int '''ldb''', const float '''beta''', float * '''C''', const int '''ldc''''')[http://www.gnu.org/software/gsl/manual/html_node/Level-3-CBLAS-Functions.html 1] [http://www.prism.gatech.edu/~ndantam3/cblas-doc/doc/html/cblas_8h.html#7d42dfcb6073c56391fee28494809cc5 2] [http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Fproguide%2Fref%2Fblaslib.htm 3]
 
void '''cblas_sgemm''' (''const enum CBLAS_ORDER '''Order''', const enum CBLAS_TRANSPOSE '''TransA''', const enum CBLAS_TRANSPOSE '''TransB''', const int '''M''', const int '''N''', const int '''K''', const float '''alpha''', const float * '''A''', const int '''lda''', const float * '''B''', const int '''ldb''', const float '''beta''', float * '''C''', const int '''ldc''''')[http://www.gnu.org/software/gsl/manual/html_node/Level-3-CBLAS-Functions.html 1] [http://www.prism.gatech.edu/~ndantam3/cblas-doc/doc/html/cblas_8h.html#7d42dfcb6073c56391fee28494809cc5 2] [http://publib.boulder.ibm.com/infocenter/comphelp/v8v101/index.jsp?topic=%2Fcom.ibm.xlcpp8a.doc%2Fproguide%2Fref%2Fblaslib.htm 3]
  

Revision as of 16:48, 20 September 2012


GPU610/DPS915 | Student List | Group and Project Index | Student Resources | Glossary

Student Resources

The purpose of this page is to share useful information that can help groups with their CUDA projects.

BLAS Documentation

Note: This information applies to the gsl_cblas library

There are 2 main functions to use

segmv

  • compute the matrix-vector product for a general matrix

void cblas_sgemv (const enum CBLAS_ORDER order, const enum CBLAS_TRANSPOSE TransA, const int M, const int N, const float alpha, const float * A, const int lda, const float * x, const int incx, const float beta, float * y, const int incy)1 2 3


order

Whether matrices are row major order (C-Style) for column major order (Fortran-style). One of enum CblasRowMajor or CblasColMajor.

TransA

Whether to transpose matrix A. One of enum CblasNoTrans, CBlasTrans.

M

represents:
the number of rows in input matrix a
The number of rows must be greater than or equal to zero, and less than the leading dimension of the matrix a (specified in lda)

N

represents:
the number of columns in input matrix a
The number of columns must be greater than or equal to zero.

alpha

is the scaling constant for matrix a

A

is the input matrix of float (for sgemv) or double (for dgemv) values

lda

is the leading dimension of the array specified by a. The leading dimension must be greater than zero. The leading dimension must be greater than or equal to 1 and greater than or equal to the value specified in m.

x

is the input vector of float (for sgemv) or double (for dgemv) values.

incx

is the stride for vector x. It can have any value.

beta

is the scaling constant for vector y

y

is the output vector of float (for sgemv) or double (for dgemv) values.

incy

is the stride for vector y. It must not be zero.

segmm

  • perform combined matrix multiplication and addition for general matrices

void cblas_sgemm (const enum CBLAS_ORDER Order, const enum CBLAS_TRANSPOSE TransA, const enum CBLAS_TRANSPOSE TransB, const int M, const int N, const int K, const float alpha, const float * A, const int lda, const float * B, const int ldb, const float beta, float * C, const int ldc)1 2 3


Order

Whether matrices are row major order (C-Style) for column major order (Fortran-style). One of enum CblasRowMajor or CblasColMajor.

TransA

Whether to transpose matrix A. One of enum CblasNoTrans, CBlasTrans, CBlasConjTrans

TransB

Whether to transpose matrix B. One of enum CblasNoTrans, CBlasTrans, CBlasConjTrans.

M

is the number of Rows in matrices A and C
M must be greater than or equal to zero.

N

is the number of Columns in Matrices B and C

K

is the number of Columns in matrix A and Rows in matrix B

alpha

is the scaling constant for matrix a

A

is the input matrix a of float (for sgemm).

lda

is the leading dimension of the array specified by a. The leading dimension must be greater than zero. If transa is specified as 'N' or 'n', the leading dimension must be greater than or equal to 1. If transa is specified as 'T' or 't', the leading dimension must be greater than or equal to the value specified in m.

B

is the input matrix b of float (for sgemm).

ldb

is the leading dimension of the array specified by b. The leading dimension must be greater than zero. If transb is specified as 'N' or 'n', the leading dimension must be greater than or equal to the value specified in m. If transa is specified as 'T' or 't', the leading dimension must be greater than or equal to the value specified in n.

beta

is the scaling constant for matrix c

C

is the output matrix c of float (for sgemm) or double (for dgemm) values.

ldc

is the leading dimension of the array specified by c. The leading dimension must be greater than zero. If transb is specified as 'N' or 'n', the leading dimension must be greater than or equal to 0 and greater than or equal to the value specified in l.

https://scs.senecac.on.ca/~gpu610/pages/content/lines.html

Getting Started on Mac

http://developer.download.nvidia.com/compute/DevZone/docs/html/C/doc/CUDA_Getting_Started_Mac.pdf

http://developer.nvidia.com/cuda/cuda-downloads

Troubleshooting

Problem with CUDA driver version 5.0.24 on MacBook Pro 2012 Fix