imate
C++/CUDA Reference
Loading...
Searching...
No Matches
cublas_types.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright 2021, Siavash Ameli <sameli@berkeley.edu>
3 * SPDX-License-Identifier: BSD-3-Clause
4 * SPDX-FileType: SOURCE
5 *
6 * This program is free software: you can redistribute it and/or modify it
7 * under the terms of the license found in the LICENSE.txt file in the root
8 * directory of this source tree.
9 */
10
11
12#ifndef _CUDA_DYNAMIC_LOADING_CUBLAS_TYPES_H_
13#define _CUDA_DYNAMIC_LOADING_CUBLAS_TYPES_H_
14
15// =======
16// Headers
17// =======
18
19// Avoid CUBLAS numeration value not handled in switch [-Wswitch-enum] warning
20#ifdef _MSC_VER
21 #pragma warning(push, 0) // Suppress all warnings from the followings
22 #include <cublas_v2.h>
23 #pragma warning(pop) // Restore previous warning level
24#elif defined(__INTEL_LLVM_COMPILER) || defined(__INTEL_COMPILER)
25 #pragma warning(push, 0)
26 #include <cublas_v2.h>
27 #pragma warning(pop)
28#elif defined(__GNUC__) || defined(__clang__)
29 #pragma GCC diagnostic push
30 #pragma GCC diagnostic ignored "-Wswitch-enum"
31 #include <cublas_v2.h>
32 #pragma GCC diagnostic pop
33#else
34 #include <cublas_v2.h> // cublasSgemv, cublasDgemv, cublasScopy,
35 // cublasDcopy, cublasSaxpy, cublasDaxpy,
36 // cublasSdot, cublasDdot, cublasSnrm2,
37 // cublasDnrm2, cublasSscal, cublasDscal
38 // cublasHandle_t, cublasStatus_t,
39 // cublasSetMathMode
40#endif
41
42// =====
43// Types
44// =====
45
46// cublasCreate
47typedef cublasStatus_t (*cublasCreate_type)(cublasHandle_t* handle);
48
49// cublasDestroy
50typedef cublasStatus_t (*cublasDestroy_type)(cublasHandle_t handle);
51
52// cublasSetMathMode
53typedef cublasStatus_t (*cublasSetMathMode_type)(
54 cublasHandle_t handle,
55 cublasMath_t mode);
56
57// cublasSgemv
58typedef cublasStatus_t (*cublasSgemv_type)(
59 cublasHandle_t handle,
60 cublasOperation_t trans,
61 int m,
62 int n,
63 const float* alpha,
64 const float* A,
65 int lda,
66 const float* x,
67 int incx,
68 const float* beta,
69 float* y,
70 int incy);
71
72// cublasDgemv
73typedef cublasStatus_t (*cublasDgemv_type)(
74 cublasHandle_t handle,
75 cublasOperation_t trans,
76 int m,
77 int n,
78 const double* alpha,
79 const double* A,
80 int lda,
81 const double* x,
82 int incx,
83 const double* beta,
84 double* y,
85 int incy);
86
87// cublasScopy
88typedef cublasStatus_t (*cublasScopy_type)(
89 cublasHandle_t handle, int n,
90 const float* x,
91 int incx,
92 float* y,
93 int incy);
94
95// cublasDcopy
96typedef cublasStatus_t (*cublasDcopy_type)(
97 cublasHandle_t handle, int n,
98 const double* x,
99 int incx,
100 double* y,
101 int incy);
102
103// cublasSaxpy
104typedef cublasStatus_t (*cublasSaxpy_type)(
105 cublasHandle_t handle,
106 int n,
107 const float *alpha,
108 const float *x,
109 int incx,
110 float *y,
111 int incy);
112
113// cublasDaxpy
114typedef cublasStatus_t (*cublasDaxpy_type)(
115 cublasHandle_t handle,
116 int n,
117 const double *alpha,
118 const double *x,
119 int incx,
120 double *y,
121 int incy);
122
123// cublasSdot
124typedef cublasStatus_t (*cublasSdot_type)(
125 cublasHandle_t handle,
126 int n,
127 const float *x,
128 int incx,
129 const float *y,
130 int incy,
131 float *result);
132
133// cublasDdot
134typedef cublasStatus_t (*cublasDdot_type)(
135 cublasHandle_t handle,
136 int n,
137 const double *x,
138 int incx,
139 const double *y,
140 int incy,
141 double *result);
142
143// cublasSnrm2
144typedef cublasStatus_t (*cublasSnrm2_type)(
145 cublasHandle_t handle,
146 int n,
147 const float *x,
148 int incx,
149 float *result);
150
151// cublasDnrm2
152typedef cublasStatus_t (*cublasDnrm2_type)(
153 cublasHandle_t handle,
154 int n,
155 const double *x,
156 int incx,
157 double *result);
158
159// cublasSscal
160typedef cublasStatus_t (*cublasSscal_type)(
161 cublasHandle_t handle,
162 int n,
163 const float *alpha,
164 float *x,
165 int incx);
166
167// cublasDscal
168typedef cublasStatus_t (*cublasDscal_type)(
169 cublasHandle_t handle,
170 int n,
171 const double *alpha,
172 double *x,
173 int incx);
174
175#endif // _CUDA_DYNAMIC_LOADING_CUBLAS_TYPES_H_
cublasStatus_t(* cublasDestroy_type)(cublasHandle_t handle)
cublasStatus_t(* cublasDgemv_type)(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const double *alpha, const double *A, int lda, const double *x, int incx, const double *beta, double *y, int incy)
cublasStatus_t(* cublasDcopy_type)(cublasHandle_t handle, int n, const double *x, int incx, double *y, int incy)
cublasStatus_t(* cublasDaxpy_type)(cublasHandle_t handle, int n, const double *alpha, const double *x, int incx, double *y, int incy)
cublasStatus_t(* cublasDscal_type)(cublasHandle_t handle, int n, const double *alpha, double *x, int incx)
cublasStatus_t(* cublasSaxpy_type)(cublasHandle_t handle, int n, const float *alpha, const float *x, int incx, float *y, int incy)
cublasStatus_t(* cublasCreate_type)(cublasHandle_t *handle)
cublasStatus_t(* cublasSetMathMode_type)(cublasHandle_t handle, cublasMath_t mode)
cublasStatus_t(* cublasSscal_type)(cublasHandle_t handle, int n, const float *alpha, float *x, int incx)
cublasStatus_t(* cublasSgemv_type)(cublasHandle_t handle, cublasOperation_t trans, int m, int n, const float *alpha, const float *A, int lda, const float *x, int incx, const float *beta, float *y, int incy)
cublasStatus_t(* cublasSdot_type)(cublasHandle_t handle, int n, const float *x, int incx, const float *y, int incy, float *result)
cublasStatus_t(* cublasScopy_type)(cublasHandle_t handle, int n, const float *x, int incx, float *y, int incy)
cublasStatus_t(* cublasSnrm2_type)(cublasHandle_t handle, int n, const float *x, int incx, float *result)
cublasStatus_t(* cublasDdot_type)(cublasHandle_t handle, int n, const double *x, int incx, const double *y, int incy, double *result)
cublasStatus_t(* cublasDnrm2_type)(cublasHandle_t handle, int n, const double *x, int incx, double *result)