1 #ifndef VIENNACL_VIENNACL_HPP
2 #define VIENNACL_VIENNACL_HPP
3 
4 /* =========================================================================
5    Copyright (c) 2010-2014, Institute for Microelectronics,
6                             Institute for Analysis and Scientific Computing,
7                             TU Wien.
8    Portions of this software are copyright by UChicago Argonne, LLC.
9 
10                             -----------------
11                   ViennaCL - The Vienna Computing Library
12                             -----------------
13 
14    Project Head:    Karl Rupp                   rupp@iue.tuwien.ac.at
15 
16    (A list of authors and contributors can be found in the PDF manual)
17 
18    License:         MIT (X11), see file LICENSE in the base directory
19 ============================================================================= */
20 
21 #include <stdlib.h>
22 
23 #ifdef VIENNACL_WITH_OPENCL
24 #ifdef __APPLE__
25 #include <OpenCL/cl.h>
26 #else
27 #include <CL/cl.h>
28 #endif
29 #endif
30 
31 
32 // Extra export declarations when building with Visual Studio:
33 #if defined(_MSC_VER)
34   #if defined(viennacl_EXPORTS)
35     #define  VIENNACL_EXPORTED_FUNCTION __declspec(dllexport)
36   #else
37     #define  VIENNACL_EXPORTED_FUNCTION __declspec(dllimport)
38   #endif /* viennacl_EXPORTS */
39 #else /* defined (_MSC_VER) */
40  #define VIENNACL_EXPORTED_FUNCTION
41 #endif
42 
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif
47 
48 typedef int ViennaCLInt;
49 
50 
51 /************** Enums ***************/
52 
53 typedef enum
54 {
55   ViennaCLInvalidBackend, // for catching uninitialized and invalid values
56   ViennaCLCUDA,
57   ViennaCLOpenCL,
58   ViennaCLHost
59 } ViennaCLBackendTypes;
60 
61 typedef enum
62 {
63   ViennaCLInvalidOrder,  // for catching uninitialized and invalid values
64   ViennaCLRowMajor,
65   ViennaCLColumnMajor
66 } ViennaCLOrder;
67 
68 typedef enum
69 {
70   ViennaCLInvalidTranspose, // for catching uninitialized and invalid values
71   ViennaCLNoTrans,
72   ViennaCLTrans
73 } ViennaCLTranspose;
74 
75 typedef enum
76 {
77   ViennaCLInvalidUplo, // for catching uninitialized and invalid values
78   ViennaCLUpper,
79   ViennaCLLower
80 } ViennaCLUplo;
81 
82 typedef enum
83 {
84   ViennaCLInvalidDiag, // for catching uninitialized and invalid values
85   ViennaCLUnit,
86   ViennaCLNonUnit
87 } ViennaCLDiag;
88 
89 typedef enum
90 {
91   ViennaCLInvalidPrecision,  // for catching uninitialized and invalid values
92   ViennaCLFloat,
93   ViennaCLDouble
94 } ViennaCLPrecision;
95 
96 // Error codes:
97 typedef enum
98 {
99   ViennaCLSuccess = 0,
100   ViennaCLGenericFailure
101 } ViennaCLStatus;
102 
103 
104 /************* Backend Management ******************/
105 
106 /** @brief Generic backend for CUDA, OpenCL, host-based stuff */
107 struct ViennaCLBackend_impl;
108 typedef ViennaCLBackend_impl*   ViennaCLBackend;
109 
110 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendCreate(ViennaCLBackend * backend);
111 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendSetOpenCLContextID(ViennaCLBackend backend, ViennaCLInt context_id);
112 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLBackendDestroy(ViennaCLBackend * backend);
113 
114 /******** User Types **********/
115 
116 struct ViennaCLHostScalar_impl;
117 typedef ViennaCLHostScalar_impl*    ViennaCLHostScalar;
118 
119 struct ViennaCLScalar_impl;
120 typedef ViennaCLScalar_impl*        ViennaCLScalar;
121 
122 struct ViennaCLVector_impl;
123 typedef ViennaCLVector_impl*        ViennaCLVector;
124 
125 struct ViennaCLMatrix_impl;
126 typedef ViennaCLMatrix_impl*        ViennaCLMatrix;
127 
128 
129 /******************** BLAS Level 1 ***********************/
130 
131 // IxASUM
132 
133 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLiamax(ViennaCLInt *alpha, ViennaCLVector x);
134 
135 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDAiSamax(ViennaCLBackend backend, ViennaCLInt n,
136                                                              ViennaCLInt *alpha,
137                                                              float *x, ViennaCLInt offx, ViennaCLInt incx);
138 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDAiDamax(ViennaCLBackend backend, ViennaCLInt n,
139                                                              ViennaCLInt *alpha,
140                                                              double *x, ViennaCLInt offx, ViennaCLInt incx);
141 
142 #ifdef VIENNACL_WITH_OPENCL
143 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLiSamax(ViennaCLBackend backend, ViennaCLInt n,
144                                                                ViennaCLInt *alpha,
145                                                                cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
146 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLiDamax(ViennaCLBackend backend, ViennaCLInt n,
147                                                                ViennaCLInt *alpha,
148                                                                cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
149 #endif
150 
151 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostiSamax(ViennaCLBackend backend, ViennaCLInt n,
152                                                              ViennaCLInt *alpha,
153                                                              float *x, ViennaCLInt offx, ViennaCLInt incx);
154 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostiDamax(ViennaCLBackend backend, ViennaCLInt n,
155                                                              ViennaCLInt *alpha,
156                                                              double *x, ViennaCLInt offx, ViennaCLInt incx);
157 
158 
159 // xASUM
160 
161 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLasum(ViennaCLHostScalar *alpha, ViennaCLVector x);
162 
163 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASasum(ViennaCLBackend backend, ViennaCLInt n,
164                                                             float *alpha,
165                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
166 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADasum(ViennaCLBackend backend, ViennaCLInt n,
167                                                             double *alpha,
168                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
169 
170 #ifdef VIENNACL_WITH_OPENCL
171 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSasum(ViennaCLBackend backend, ViennaCLInt n,
172                                                               float *alpha,
173                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
174 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDasum(ViennaCLBackend backend, ViennaCLInt n,
175                                                               double *alpha,
176                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
177 #endif
178 
179 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSasum(ViennaCLBackend backend, ViennaCLInt n,
180                                                             float *alpha,
181                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
182 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDasum(ViennaCLBackend backend, ViennaCLInt n,
183                                                             double *alpha,
184                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
185 
186 
187 
188 // xAXPY
189 
190 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLaxpy(ViennaCLHostScalar alpha, ViennaCLVector x, ViennaCLVector y);
191 
192 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASaxpy(ViennaCLBackend backend, ViennaCLInt n,
193                                                             float alpha,
194                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
195                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
196 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADaxpy(ViennaCLBackend backend, ViennaCLInt n,
197                                                             double alpha,
198                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
199                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
200 
201 #ifdef VIENNACL_WITH_OPENCL
202 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSaxpy(ViennaCLBackend backend, ViennaCLInt n,
203                                                               float alpha,
204                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
205                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
206 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDaxpy(ViennaCLBackend backend, ViennaCLInt n,
207                                                               double alpha,
208                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
209                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
210 #endif
211 
212 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSaxpy(ViennaCLBackend backend, ViennaCLInt n,
213                                                             float alpha,
214                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
215                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
216 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDaxpy(ViennaCLBackend backend, ViennaCLInt n,
217                                                             double alpha,
218                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
219                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
220 
221 
222 // xCOPY
223 
224 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLcopy(ViennaCLVector x, ViennaCLVector y);
225 
226 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDAScopy(ViennaCLBackend backend, ViennaCLInt n,
227                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
228                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
229 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADcopy(ViennaCLBackend backend, ViennaCLInt n,
230                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
231                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
232 
233 #ifdef VIENNACL_WITH_OPENCL
234 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLScopy(ViennaCLBackend backend, ViennaCLInt n,
235                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
236                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
237 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDcopy(ViennaCLBackend backend, ViennaCLInt n,
238                                    cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
239                                    cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
240 #endif
241 
242 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostScopy(ViennaCLBackend backend, ViennaCLInt n,
243                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
244                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
245 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDcopy(ViennaCLBackend backend, ViennaCLInt n,
246                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
247                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
248 
249 // xDOT
250 
251 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLdot(ViennaCLHostScalar *alpha, ViennaCLVector x, ViennaCLVector y);
252 
253 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASdot(ViennaCLBackend backend, ViennaCLInt n,
254                                                            float *alpha,
255                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
256                                                            float *y, ViennaCLInt offy, ViennaCLInt incy);
257 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADdot(ViennaCLBackend backend, ViennaCLInt n,
258                                                            double *alpha,
259                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
260                                                            double *y, ViennaCLInt offy, ViennaCLInt incy);
261 
262 #ifdef VIENNACL_WITH_OPENCL
263 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSdot(ViennaCLBackend backend, ViennaCLInt n,
264                                                              float *alpha,
265                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
266                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
267 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDdot(ViennaCLBackend backend, ViennaCLInt n,
268                                                              double *alpha,
269                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
270                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
271 #endif
272 
273 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSdot(ViennaCLBackend backend, ViennaCLInt n,
274                                                            float *alpha,
275                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
276                                                            float *y, ViennaCLInt offy, ViennaCLInt incy);
277 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDdot(ViennaCLBackend backend, ViennaCLInt n,
278                                                            double *alpha,
279                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
280                                                            double *y, ViennaCLInt offy, ViennaCLInt incy);
281 
282 // xNRM2
283 
284 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLnrm2(ViennaCLHostScalar *alpha, ViennaCLVector x);
285 
286 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASnrm2(ViennaCLBackend backend, ViennaCLInt n,
287                                                             float *alpha,
288                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
289 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADnrm2(ViennaCLBackend backend, ViennaCLInt n,
290                                                             double *alpha,
291                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
292 
293 #ifdef VIENNACL_WITH_OPENCL
294 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSnrm2(ViennaCLBackend backend, ViennaCLInt n,
295                                                               float *alpha,
296                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
297 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDnrm2(ViennaCLBackend backend, ViennaCLInt n,
298                                                               double *alpha,
299                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
300 #endif
301 
302 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSnrm2(ViennaCLBackend backend, ViennaCLInt n,
303                                                             float *alpha,
304                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
305 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDnrm2(ViennaCLBackend backend, ViennaCLInt n,
306                                                             double *alpha,
307                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
308 
309 
310 // xROT
311 
312 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLrot(ViennaCLVector     x,     ViennaCLVector y,
313                                                       ViennaCLHostScalar c, ViennaCLHostScalar s);
314 
315 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASrot(ViennaCLBackend backend, ViennaCLInt n,
316                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
317                                                            float *y, ViennaCLInt offy, ViennaCLInt incy,
318                                                            float c, float s);
319 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADrot(ViennaCLBackend backend, ViennaCLInt n,
320                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
321                                                            double *y, ViennaCLInt offy, ViennaCLInt incy,
322                                                            double c, double s);
323 
324 #ifdef VIENNACL_WITH_OPENCL
325 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSrot(ViennaCLBackend backend, ViennaCLInt n,
326                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
327                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy,
328                                                              float c, float s);
329 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDrot(ViennaCLBackend backend, ViennaCLInt n,
330                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
331                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy,
332                                                              double c, double s);
333 #endif
334 
335 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSrot(ViennaCLBackend backend, ViennaCLInt n,
336                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
337                                                            float *y, ViennaCLInt offy, ViennaCLInt incy,
338                                                            float c, float s);
339 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDrot(ViennaCLBackend backend, ViennaCLInt n,
340                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
341                                                            double *y, ViennaCLInt offy, ViennaCLInt incy,
342                                                            double c, double s);
343 
344 
345 
346 // xSCAL
347 
348 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLscal(ViennaCLHostScalar alpha, ViennaCLVector x);
349 
350 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASscal(ViennaCLBackend backend, ViennaCLInt n,
351                                                             float alpha,
352                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
353 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADscal(ViennaCLBackend backend, ViennaCLInt n,
354                                                             double alpha,
355                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
356 
357 #ifdef VIENNACL_WITH_OPENCL
358 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSscal(ViennaCLBackend backend, ViennaCLInt n,
359                                                               float alpha,
360                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
361 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDscal(ViennaCLBackend backend, ViennaCLInt n,
362                                                               double alpha,
363                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
364 #endif
365 
366 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSscal(ViennaCLBackend backend, ViennaCLInt n,
367                                                             float alpha,
368                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
369 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDscal(ViennaCLBackend backend, ViennaCLInt n,
370                                                             double alpha,
371                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
372 
373 
374 // xSWAP
375 
376 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLswap(ViennaCLVector x, ViennaCLVector y);
377 
378 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASswap(ViennaCLBackend backend, ViennaCLInt n,
379                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
380                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
381 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADswap(ViennaCLBackend backend, ViennaCLInt n,
382                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
383                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
384 
385 #ifdef VIENNACL_WITH_OPENCL
386 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSswap(ViennaCLBackend backend, ViennaCLInt n,
387                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
388                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
389 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDswap(ViennaCLBackend backend, ViennaCLInt n,
390                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
391                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
392 #endif
393 
394 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSswap(ViennaCLBackend backend, ViennaCLInt n,
395                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
396                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
397 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDswap(ViennaCLBackend backend, ViennaCLInt n,
398                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
399                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
400 
401 
402 
403 /******************** BLAS Level 2 ***********************/
404 
405 // xGEMV: y <- alpha * Ax + beta * y
406 
407 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLgemv(ViennaCLHostScalar alpha, ViennaCLMatrix A, ViennaCLVector x, ViennaCLHostScalar beta, ViennaCLVector y);
408 
409 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASgemv(ViennaCLBackend backend,
410                                                             ViennaCLOrder order, ViennaCLTranspose transA,
411                                                             ViennaCLInt m, ViennaCLInt n, float alpha, float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
412                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
413                                                             float beta,
414                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
415 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADgemv(ViennaCLBackend backend,
416                                                             ViennaCLOrder order, ViennaCLTranspose transA,
417                                                             ViennaCLInt m, ViennaCLInt n, double alpha, double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
418                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
419                                                             double beta,
420                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
421 
422 #ifdef VIENNACL_WITH_OPENCL
423 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSgemv(ViennaCLBackend backend,
424                                                               ViennaCLOrder order, ViennaCLTranspose transA,
425                                                               ViennaCLInt m, ViennaCLInt n, float alpha, cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
426                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
427                                                               float beta,
428                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
429 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDgemv(ViennaCLBackend backend,
430                                                               ViennaCLOrder order, ViennaCLTranspose transA,
431                                                               ViennaCLInt m, ViennaCLInt n, double alpha, cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
432                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
433                                                               double beta,
434                                                               cl_mem y, ViennaCLInt offy, ViennaCLInt incy);
435 #endif
436 
437 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSgemv(ViennaCLBackend backend,
438                                                             ViennaCLOrder order, ViennaCLTranspose transA,
439                                                             ViennaCLInt m, ViennaCLInt n, float alpha, float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
440                                                             float *x, ViennaCLInt offx, ViennaCLInt incx,
441                                                             float beta,
442                                                             float *y, ViennaCLInt offy, ViennaCLInt incy);
443 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDgemv(ViennaCLBackend backend,
444                                                             ViennaCLOrder order, ViennaCLTranspose transA,
445                                                             ViennaCLInt m, ViennaCLInt n, double alpha, double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
446                                                             double *x, ViennaCLInt offx, ViennaCLInt incx,
447                                                             double beta,
448                                                             double *y, ViennaCLInt offy, ViennaCLInt incy);
449 
450 // xTRSV: Ax <- x
451 
452 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLtrsv(ViennaCLMatrix A, ViennaCLVector x, ViennaCLUplo uplo);
453 
454 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDAStrsv(ViennaCLBackend backend,
455                                                             ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
456                                                             ViennaCLInt n, float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
457                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
458 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADtrsv(ViennaCLBackend backend,
459                                                             ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
460                                                             ViennaCLInt n, double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
461                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
462 
463 #ifdef VIENNACL_WITH_OPENCL
464 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLStrsv(ViennaCLBackend backend,
465                                                               ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
466                                                               ViennaCLInt n, cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
467                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
468 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDtrsv(ViennaCLBackend backend,
469                                                               ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
470                                                               ViennaCLInt n, cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
471                                                               cl_mem x, ViennaCLInt offx, ViennaCLInt incx);
472 #endif
473 
474 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostStrsv(ViennaCLBackend backend,
475                                                             ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
476                                                             ViennaCLInt n, float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
477                                                             float *x, ViennaCLInt offx, ViennaCLInt incx);
478 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDtrsv(ViennaCLBackend backend,
479                                                             ViennaCLUplo uplo, ViennaCLOrder order, ViennaCLTranspose transA, ViennaCLDiag diag,
480                                                             ViennaCLInt n, double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
481                                                             double *x, ViennaCLInt offx, ViennaCLInt incx);
482 
483 
484 // xGER: A <- alpha * x * y + A
485 
486 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLger(ViennaCLHostScalar alpha, ViennaCLVector x, ViennaCLVector y, ViennaCLMatrix A);
487 
488 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASger(ViennaCLBackend backend,
489                                                            ViennaCLOrder order,
490                                                            ViennaCLInt m, ViennaCLInt n,
491                                                            float alpha,
492                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
493                                                            float *y, ViennaCLInt offy, ViennaCLInt incy,
494                                                            float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
495 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADger(ViennaCLBackend backend,
496                                                            ViennaCLOrder order,
497                                                            ViennaCLInt m,  ViennaCLInt n,
498                                                            double alpha,
499                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
500                                                            double *y, ViennaCLInt offy, ViennaCLInt incy,
501                                                            double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
502 
503 #ifdef VIENNACL_WITH_OPENCL
504 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSger(ViennaCLBackend backend,
505                                                              ViennaCLOrder order,
506                                                              ViennaCLInt m, ViennaCLInt n,
507                                                              float alpha,
508                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
509                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy,
510                                                              cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
511 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDger(ViennaCLBackend backend,
512                                                              ViennaCLOrder order,
513                                                              ViennaCLInt m, ViennaCLInt n,
514                                                              double alpha,
515                                                              cl_mem x, ViennaCLInt offx, ViennaCLInt incx,
516                                                              cl_mem y, ViennaCLInt offy, ViennaCLInt incy,
517                                                              cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
518 #endif
519 
520 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSger(ViennaCLBackend backend,
521                                                            ViennaCLOrder order,
522                                                            ViennaCLInt m, ViennaCLInt n,
523                                                            float alpha,
524                                                            float *x, ViennaCLInt offx, ViennaCLInt incx,
525                                                            float *y, ViennaCLInt offy, ViennaCLInt incy,
526                                                            float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
527 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDger(ViennaCLBackend backend,
528                                                            ViennaCLOrder order,
529                                                            ViennaCLInt m, ViennaCLInt n,
530                                                            double alpha,
531                                                            double *x, ViennaCLInt offx, ViennaCLInt incx,
532                                                            double *y, ViennaCLInt offy, ViennaCLInt incy,
533                                                            double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda);
534 
535 
536 
537 /******************** BLAS Level 3 ***********************/
538 
539 // xGEMM: C <- alpha * AB + beta * C
540 
541 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLgemm(ViennaCLHostScalar alpha, ViennaCLMatrix A, ViennaCLMatrix B, ViennaCLHostScalar beta, ViennaCLMatrix C);
542 
543 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDASgemm(ViennaCLBackend backend,
544                                                             ViennaCLOrder orderA, ViennaCLTranspose transA,
545                                                             ViennaCLOrder orderB, ViennaCLTranspose transB,
546                                                             ViennaCLOrder orderC,
547                                                             ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
548                                                             float alpha,
549                                                             float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
550                                                             float *B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
551                                                             float beta,
552                                                             float *C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
553 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLCUDADgemm(ViennaCLBackend backend,
554                                                             ViennaCLOrder orderA, ViennaCLTranspose transA,
555                                                             ViennaCLOrder orderB, ViennaCLTranspose transB,
556                                                             ViennaCLOrder orderC,
557                                                             ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
558                                                             double alpha,
559                                                             double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
560                                                             double *B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
561                                                             double beta,
562                                                             double *C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
563 
564 #ifdef VIENNACL_WITH_OPENCL
565 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLSgemm(ViennaCLBackend backend,
566                                                               ViennaCLOrder orderA, ViennaCLTranspose transA,
567                                                               ViennaCLOrder orderB, ViennaCLTranspose transB,
568                                                               ViennaCLOrder orderC,
569                                                               ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
570                                                               float alpha,
571                                                               cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
572                                                               cl_mem B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
573                                                               float beta,
574                                                               cl_mem C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
575 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLOpenCLDgemm(ViennaCLBackend backend,
576                                                               ViennaCLOrder orderA, ViennaCLTranspose transA,
577                                                               ViennaCLOrder orderB, ViennaCLTranspose transB,
578                                                               ViennaCLOrder orderC,
579                                                               ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
580                                                               double alpha,
581                                                               cl_mem A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
582                                                               cl_mem B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
583                                                               double beta,
584                                                               cl_mem C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
585 #endif
586 
587 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostSgemm(ViennaCLBackend backend,
588                                                             ViennaCLOrder orderA, ViennaCLTranspose transA,
589                                                             ViennaCLOrder orderB, ViennaCLTranspose transB,
590                                                             ViennaCLOrder orderC,
591                                                             ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
592                                                             float alpha,
593                                                             float *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
594                                                             float *B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
595                                                             float beta,
596                                                             float *C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
597 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLHostDgemm(ViennaCLBackend backend,
598                                                             ViennaCLOrder orderA, ViennaCLTranspose transA,
599                                                             ViennaCLOrder orderB, ViennaCLTranspose transB,
600                                                             ViennaCLOrder orderC,
601                                                             ViennaCLInt m, ViennaCLInt n, ViennaCLInt k,
602                                                             double alpha,
603                                                             double *A, ViennaCLInt offA_row, ViennaCLInt offA_col, ViennaCLInt incA_row, ViennaCLInt incA_col, ViennaCLInt lda,
604                                                             double *B, ViennaCLInt offB_row, ViennaCLInt offB_col, ViennaCLInt incB_row, ViennaCLInt incB_col, ViennaCLInt ldb,
605                                                             double beta,
606                                                             double *C, ViennaCLInt offC_row, ViennaCLInt offC_col, ViennaCLInt incC_row, ViennaCLInt incC_col, ViennaCLInt ldc);
607 
608 // xTRSM: Triangular solves with multiple right hand sides
609 
610 VIENNACL_EXPORTED_FUNCTION ViennaCLStatus ViennaCLtrsm(ViennaCLMatrix A, ViennaCLUplo uplo, ViennaCLDiag diag, ViennaCLMatrix B);
611 
612 #ifdef __cplusplus
613 }
614 #endif
615 
616 
617 #endif
618