Simple GPU 1.0
Fortran GPU Computing Library with transparent CPU/GPU support
Loading...
Searching...
No Matches
gpu_cpu.c
Go to the documentation of this file.
1#include <stdint.h>
2#include <stdio.h>
3#include <stdlib.h>
4#include <string.h>
5#include <stdbool.h>
6#include <assert.h>
7
8/* Generic functions */
9
11 return 0;
12}
13
14void gpu_set_device(int32_t i) {
15 return;
16}
17
18void gpu_get_memory(size_t* free, size_t* total) {
19 *free = 0;
20 *total = 0;
21}
22
23
24/* Allocation functions */
25
26void gpu_allocate(void** ptr, const int64_t n) {
27 if (ptr == NULL) {
28 fprintf(stderr, "gpu_allocate: ptr argument is NULL\n");
29 return;
30 }
31 *ptr = malloc((size_t) n);
32 if (*ptr == NULL) {
33 perror("gpu_allocate: malloc failed");
34 assert(*ptr != NULL);
35 }
36}
37
38void gpu_deallocate(void** ptr) {
39 if (ptr == NULL || *ptr == NULL) {
40 return;
41 }
42 free(*ptr);
43 *ptr = NULL;
44}
45
46void gpu_free(void** ptr) {
47 gpu_deallocate(ptr);
48}
49
50
51/* Memory transfer functions */
52
53void gpu_upload(const void* cpu_ptr, void* gpu_ptr, const int64_t n) {
54 if (cpu_ptr == NULL || gpu_ptr == NULL) {
55 fprintf(stderr, "gpu_upload: NULL pointer argument\n");
56 return;
57 }
58 memcpy(gpu_ptr, cpu_ptr, n);
59}
60
61void gpu_download(const void* gpu_ptr, void* cpu_ptr, const int64_t n) {
62 if (gpu_ptr == NULL || cpu_ptr == NULL) {
63 fprintf(stderr, "gpu_download: NULL pointer argument\n");
64 return;
65 }
66 memcpy(cpu_ptr, gpu_ptr, n);
67}
68
69void gpu_copy(const void* gpu_ptr_src, void* gpu_ptr_dest, const int64_t n) {
70 if (gpu_ptr_src == NULL || gpu_ptr_dest == NULL) {
71 fprintf(stderr, "gpu_copy: NULL pointer argument\n");
72 return;
73 }
74 memcpy(gpu_ptr_dest, gpu_ptr_src, n);
75}
76
77
78/* Streams */
79
80void gpu_stream_create(void** ptr) {
81 *ptr = (void*) malloc(sizeof(char));
82}
83
84void gpu_stream_destroy(void** ptr) {
85 free(*ptr);
86 *ptr = NULL;
87}
88
89void gpu_set_stream(void* handle, void* stream) {
90 return;
91}
92
94 return;
95}
96
97void gpu_stream_synchronize(void* stream) {
98 return;
99}
100
101
102/* BLAS functions */
103
110static inline bool check_int32_overflow(int64_t value, const char* name) {
111 if (value > INT32_MAX || value < INT32_MIN) {
112 fprintf(stderr, "Integer overflow: %s value %lld exceeds int32_t range\n", name, (long long)value);
113 return true;
114 }
115 return false;
116}
117
118void gpu_blas_create(void** handle) {
119 *handle = (void*) malloc(sizeof(char));
120}
121
122
123void gpu_blas_destroy(void** handle) {
124 free(*handle);
125 *handle = NULL;
126}
127
128
129double ddot_(const int32_t* n, const double* x, const int32_t* incx, const double* y, const int32_t* incy);
130
131void gpu_ddot(void* handle, const int64_t n, const double* x, const int64_t incx, const double* y, const int64_t incy, double* result) {
132 assert (handle != NULL);
133
134 /* Convert to int32_t */
135 int32_t n_, incx_, incy_;
136
137 n_ = (int32_t) n;
138 incx_ = (int32_t) incx;
139 incy_ = (int32_t) incy;
140
141 /* Check for integer overflows */
142 if (check_int32_overflow(n, "n") ||
143 check_int32_overflow(incx, "incx") ||
144 check_int32_overflow(incy, "incy")) {
145 *result = 0.0;
146 return;
147 }
148
149 *result = ddot_(&n_, x, &incx_, y, &incy_);
150}
151
152
153float sdot_(const int32_t* n, const float* x, const int32_t* incx, const float* y, const int32_t* incy);
154#if defined(__APPLE__)
155/* CBLAS entry point (Accelerate). Declared locally: including
156 <Accelerate/Accelerate.h> would clash with the Fortran-ABI
157 prototypes above. */
158float cblas_sdot(const int N, const float* X, const int incX,
159 const float* Y, const int incY);
160#endif
161
162void gpu_sdot(void* handle, const int64_t n, const float* x, const int64_t incx, const float* y, const int64_t incy, float* result) {
163 assert (handle != NULL);
164
165 /* Convert to int32_t */
166 int32_t n_, incx_, incy_;
167
168 n_ = (int32_t) n;
169 incx_ = (int32_t) incx;
170 incy_ = (int32_t) incy;
171
172 /* Check for integer overflows */
173 assert ( (int64_t) n_ == n );
174 assert ( (int64_t) incx_ == incx);
175 assert ( (int64_t) incy_ == incy);
176
177#if defined(__APPLE__)
178 /* Apple Accelerate exports the Fortran-ABI sdot_ symbol but it
179 returns 0.0 on arm64 macOS (ddot_ is fine). Probe it once: if
180 sdot_ is correct (OpenBLAS, reference BLAS, or a fixed
181 Accelerate) use it; otherwise fall back to cblas_sdot, which is
182 always present in the broken case (Accelerate). Avoids a hard
183 cblas dependency for BLAS builds without the C interface. */
184 static int sdot_ok = -1;
185 if (sdot_ok < 0) {
186 const int32_t probe_n = 2, probe_inc = 1;
187 const float probe_x[2] = {1.0f, 2.0f};
188 const float probe_y[2] = {3.0f, 4.0f};
189 sdot_ok = (sdot_(&probe_n, probe_x, &probe_inc, probe_y, &probe_inc) == 11.0f);
190 }
191 if (sdot_ok)
192 *result = sdot_(&n_, x, &incx_, y, &incy_);
193 else
194 *result = cblas_sdot(n_, x, incx_, y, incy_);
195#else
196 *result = sdot_(&n_, x, &incx_, y, &incy_);
197#endif
198}
199
200
201void dgemv_(const char* transa, const int32_t* m, const int32_t* n, const double* alpha,
202 const double* a, const int32_t* lda, const double* x, const int32_t* incx, const double* beta, double* y, const int32_t* incy);
203
204void gpu_dgemv(void* handle, const char* transa, const int64_t m, const int64_t n, const double* alpha,
205 const double* a, const int64_t lda, const double* x, const int64_t incx, const double* beta, double* y, const int64_t incy) {
206
207 assert (handle != NULL);
208
209 /* Convert to int32_t */
210 int32_t m_, n_, lda_, incx_, incy_;
211
212 m_ = (int32_t) m;
213 n_ = (int32_t) n;
214 lda_ = (int32_t) lda;
215 incx_ = (int32_t) incx;
216 incy_ = (int32_t) incy;
217
218 /* Check for integer overflows */
219 assert ( (int64_t) m_ == m );
220 assert ( (int64_t) n_ == n );
221 assert ( (int64_t) lda_ == lda );
222 assert ( (int64_t) incx_ == incx);
223 assert ( (int64_t) incy_ == incy);
224
225 dgemv_(transa, &m_, &n_, alpha, a, &lda_, x, &incx_, beta, y, &incy_);
226}
227
228
229void sgemv_(const char* transa, const int32_t* m, const int32_t* n, const float* alpha,
230 const float* a, const int32_t* lda, const float* x, const int32_t* incx, const float* beta, float* y, const int32_t* incy);
231
232void gpu_sgemv(void* handle, const char* transa, const int64_t m, const int64_t n, const float* alpha,
233 const float* a, const int64_t lda, const float* x, const int64_t incx, const float* beta, float* y, const int64_t incy) {
234
235 assert (handle != NULL);
236
237 /* Convert to int32_t */
238 int32_t m_, n_, lda_, incx_, incy_;
239
240 m_ = (int32_t) m;
241 n_ = (int32_t) n;
242 lda_ = (int32_t) lda;
243 incx_ = (int32_t) incx;
244 incy_ = (int32_t) incy;
245
246 /* Check for integer overflows */
247 assert ( (int64_t) m_ == m );
248 assert ( (int64_t) n_ == n );
249 assert ( (int64_t) lda_ == lda );
250 assert ( (int64_t) incx_ == incx);
251 assert ( (int64_t) incy_ == incy);
252
253 sgemv_(transa, &m_, &n_, alpha, a, &lda_, x, &incx_, beta, y, &incy_);
254}
255
256
257void dgemm_(const char* transa, const char* transb, const int32_t* m, const int32_t* n, const int32_t* k, const double* alpha,
258 const double* a, const int32_t* lda, const double* b, const int32_t* ldb, const double* beta, double* c, const int32_t* ldc);
259
260void gpu_dgemm(void* handle, const char* transa, const char* transb, const int64_t m, const int64_t n, const int64_t k, const double* alpha,
261 const double* a, const int64_t lda, const double* b, const int64_t ldb, const double* beta, double* c, const int64_t ldc) {
262
263 assert (handle != NULL);
264
265 /* Convert to int32_t */
266 int32_t m_, n_, k_, lda_, ldb_, ldc_;
267
268 m_ = (int32_t) m;
269 n_ = (int32_t) n;
270 k_ = (int32_t) k;
271 lda_ = (int32_t) lda;
272 ldb_ = (int32_t) ldb;
273 ldc_ = (int32_t) ldc;
274
275 /* Check for integer overflows */
276 assert ( (int64_t) m_ == m );
277 assert ( (int64_t) n_ == n );
278 assert ( (int64_t) k_ == k );
279 assert ( (int64_t) lda_ == lda);
280 assert ( (int64_t) ldb_ == ldb);
281 assert ( (int64_t) ldc_ == ldc);
282
283 dgemm_(transa, transb, &m_, &n_, &k_, alpha, a, &lda_, b, &ldb_, beta, c, &ldc_);
284}
285
286
287
288void sgemm_(const char* transa, const char* transb, const int32_t* m, const int32_t* n, const int32_t* k, const float* alpha,
289 const float* a, const int32_t* lda, const float* b, const int32_t* ldb, const float* beta, float* c, const int32_t* ldc);
290
291void gpu_sgemm(void* handle, const char* transa, const char* transb, const int64_t m, const int64_t n, const int64_t k, const float* alpha,
292 const float* a, const int64_t lda, const float* b, const int64_t ldb, const float* beta, float* c, const int64_t ldc) {
293
294 assert (handle != NULL);
295
296 /* Convert to int32_t */
297 int32_t m_, n_, k_, lda_, ldb_, ldc_;
298
299 m_ = (int32_t) m;
300 n_ = (int32_t) n;
301 k_ = (int32_t) k;
302 lda_ = (int32_t) lda;
303 ldb_ = (int32_t) ldb;
304 ldc_ = (int32_t) ldc;
305
306 /* Check for integer overflows */
307 assert ( (int64_t) m_ == m );
308 assert ( (int64_t) n_ == n );
309 assert ( (int64_t) k_ == k );
310 assert ( (int64_t) lda_ == lda);
311 assert ( (int64_t) ldb_ == ldb);
312 assert ( (int64_t) ldc_ == ldc);
313
314 sgemm_(transa, transb, &m_, &n_, &k_, alpha, a, &lda_, b, &ldb_, beta, c, &ldc_);
315}
316
317
318void gpu_dgeam(void* handle, const char* transa, const char* transb, const int64_t m, const int64_t n, const double* alpha,
319 const double* a, const int64_t lda, const double* beta, const double* b, const int64_t ldb, double* c, const int64_t ldc) {
320 assert (handle != NULL);
321
322 if ( (*transa == 'N' && *transb == 'N') ||
323 (*transa == 'n' && *transb == 'N') ||
324 (*transa == 'N' && *transb == 'n') ||
325 (*transa == 'n' && *transb == 'n') ) {
326
327 if (*alpha == 0.) {
328
329 for (int64_t j=0 ; j<n ; ++j) {
330 for (int64_t i=0 ; i<m ; ++i) {
331 c[j*ldc+i] = *beta * b[j*ldb+i];
332 }
333 }
334
335 } else if (*beta == 0.) {
336
337 for (int64_t j=0 ; j<n ; ++j) {
338 for (int64_t i=0 ; i<m ; ++i) {
339 c[j*ldc+i] = *alpha * a[j*lda+i];
340 }
341 }
342
343 } else {
344
345 for (int64_t j=0 ; j<n ; ++j) {
346 for (int64_t i=0 ; i<m ; ++i) {
347 c[j*ldc+i] = *alpha * a[j*lda+i] + *beta * b[j*ldb+i];
348 }
349 }
350
351 }
352
353 } else if ( (*transa == 'N' && *transb == 'T') ||
354 (*transa == 'n' && *transb == 'T') ||
355 (*transa == 'N' && *transb == 't') ||
356 (*transa == 'n' && *transb == 't') ) {
357
358 if (*alpha == 0.) {
359
360 for (int64_t j=0 ; j<n ; ++j) {
361 for (int64_t i=0 ; i<m ; ++i) {
362 c[j*ldc+i] = *beta * b[i*ldb+j];
363 }
364 }
365
366 } else if (*beta == 0.) {
367
368 for (int64_t j=0 ; j<n ; ++j) {
369 for (int64_t i=0 ; i<m ; ++i) {
370 c[j*ldc+i] = *alpha * a[j*lda+i];
371 }
372 }
373
374 } else {
375
376 for (int64_t j=0 ; j<n ; ++j) {
377 for (int64_t i=0 ; i<m ; ++i) {
378 c[j*ldc+i] = *alpha * a[j*lda+i] + *beta * b[i*ldb+j];
379 }
380 }
381
382 }
383
384 } else if ( (*transa == 'T' && *transb == 'N') ||
385 (*transa == 't' && *transb == 'N') ||
386 (*transa == 'T' && *transb == 'n') ||
387 (*transa == 't' && *transb == 'n') ) {
388
389 if (*alpha == 0.) {
390
391 for (int64_t j=0 ; j<n ; ++j) {
392 for (int64_t i=0 ; i<m ; ++i) {
393 c[j*ldc+i] = *beta * b[j*ldb+i];
394 }
395 }
396
397 } else if (*beta == 0.) {
398
399 for (int64_t j=0 ; j<n ; ++j) {
400 for (int64_t i=0 ; i<m ; ++i) {
401 c[j*ldc+i] = *alpha * a[i*lda+j];
402 }
403 }
404
405 } else {
406
407 for (int64_t j=0 ; j<n ; ++j) {
408 for (int64_t i=0 ; i<m ; ++i) {
409 c[j*ldc+i] = *alpha * a[i*lda+j] + *beta * b[j*ldb+i];
410 }
411 }
412
413 }
414
415 } else if ( (*transa == 'T' && *transb == 'T') ||
416 (*transa == 't' && *transb == 'T') ||
417 (*transa == 'T' && *transb == 't') ||
418 (*transa == 't' && *transb == 't') ) {
419
420 if (*alpha == 0.) {
421
422 for (int64_t j=0 ; j<n ; ++j) {
423 for (int64_t i=0 ; i<m ; ++i) {
424 c[j*ldc+i] = *beta * b[i*ldb+j];
425 }
426 }
427
428 } else if (*beta == 0.) {
429
430 for (int64_t j=0 ; j<n ; ++j) {
431 for (int64_t i=0 ; i<m ; ++i) {
432 c[j*ldc+i] = *alpha * a[i*lda+j];
433 }
434 }
435
436 } else {
437
438 for (int64_t j=0 ; j<n ; ++j) {
439 for (int64_t i=0 ; i<m ; ++i) {
440 c[j*ldc+i] = *alpha * a[i*lda+j] + *beta * b[i*ldb+j];
441 }
442 }
443
444 }
445
446 }
447}
448
449
450void gpu_sgeam(void* handle, const char* transa, const char* transb, const int64_t m, const int64_t n, const float* alpha,
451 const float* a, const int64_t lda, const float* beta, const float* b, const int64_t ldb, float* c, const int64_t ldc) {
452 assert (handle != NULL);
453
454 if ( (*transa == 'N' && *transb == 'N') ||
455 (*transa == 'n' && *transb == 'N') ||
456 (*transa == 'N' && *transb == 'n') ||
457 (*transa == 'n' && *transb == 'n') ) {
458
459 if (*alpha == 0.) {
460
461 for (int64_t j=0 ; j<n ; ++j) {
462 for (int64_t i=0 ; i<m ; ++i) {
463 c[j*ldc+i] = *beta * b[j*ldb+i];
464 }
465 }
466
467 } else if (*beta == 0.) {
468
469 for (int64_t j=0 ; j<n ; ++j) {
470 for (int64_t i=0 ; i<m ; ++i) {
471 c[j*ldc+i] = *alpha * a[j*lda+i];
472 }
473 }
474
475 } else {
476
477 for (int64_t j=0 ; j<n ; ++j) {
478 for (int64_t i=0 ; i<m ; ++i) {
479 c[j*ldc+i] = *alpha * a[j*lda+i] + *beta * b[j*ldb+i];
480 }
481 }
482
483 }
484
485 } else if ( (*transa == 'N' && *transb == 'T') ||
486 (*transa == 'n' && *transb == 'T') ||
487 (*transa == 'N' && *transb == 't') ||
488 (*transa == 'n' && *transb == 't') ) {
489
490 if (*alpha == 0.) {
491
492 for (int64_t j=0 ; j<n ; ++j) {
493 for (int64_t i=0 ; i<m ; ++i) {
494 c[j*ldc+i] = *beta * b[i*ldb+j];
495 }
496 }
497
498 } else if (*beta == 0.) {
499
500 for (int64_t j=0 ; j<n ; ++j) {
501 for (int64_t i=0 ; i<m ; ++i) {
502 c[j*ldc+i] = *alpha * a[j*lda+i];
503 }
504 }
505
506 } else {
507
508 for (int64_t j=0 ; j<n ; ++j) {
509 for (int64_t i=0 ; i<m ; ++i) {
510 c[j*ldc+i] = *alpha * a[j*lda+i] + *beta * b[i*ldb+j];
511 }
512 }
513
514 }
515
516 } else if ( (*transa == 'T' && *transb == 'N') ||
517 (*transa == 't' && *transb == 'N') ||
518 (*transa == 'T' && *transb == 'n') ||
519 (*transa == 't' && *transb == 'n') ) {
520
521 if (*alpha == 0.) {
522
523 for (int64_t j=0 ; j<n ; ++j) {
524 for (int64_t i=0 ; i<m ; ++i) {
525 c[j*ldc+i] = *beta * b[j*ldb+i];
526 }
527 }
528
529 } else if (*beta == 0.) {
530
531 for (int64_t j=0 ; j<n ; ++j) {
532 for (int64_t i=0 ; i<m ; ++i) {
533 c[j*ldc+i] = *alpha * a[i*lda+j];
534 }
535 }
536
537 } else {
538
539 for (int64_t j=0 ; j<n ; ++j) {
540 for (int64_t i=0 ; i<m ; ++i) {
541 c[j*ldc+i] = *alpha * a[i*lda+j] + *beta * b[j*ldb+i];
542 }
543 }
544
545 }
546
547 } else if ( (*transa == 'T' && *transb == 'T') ||
548 (*transa == 't' && *transb == 'T') ||
549 (*transa == 'T' && *transb == 't') ||
550 (*transa == 't' && *transb == 't') ) {
551
552 if (*alpha == 0.) {
553
554 for (int64_t j=0 ; j<n ; ++j) {
555 for (int64_t i=0 ; i<m ; ++i) {
556 c[j*ldc+i] = *beta * b[i*ldb+j];
557 }
558 }
559
560 } else if (*beta == 0.) {
561
562 for (int64_t j=0 ; j<n ; ++j) {
563 for (int64_t i=0 ; i<m ; ++i) {
564 c[j*ldc+i] = *alpha * a[i*lda+j];
565 }
566 }
567
568 } else {
569
570 for (int64_t j=0 ; j<n ; ++j) {
571 for (int64_t i=0 ; i<m ; ++i) {
572 c[j*ldc+i] = *alpha * a[i*lda+j] + *beta * b[i*ldb+j];
573 }
574 }
575
576 }
577
578 }
579}
void gpu_set_stream(void *handle, void *stream)
Definition gpu_cpu.c:89
void gpu_blas_destroy(void **handle)
Definition gpu_cpu.c:123
void gpu_stream_create(void **ptr)
Definition gpu_cpu.c:80
void gpu_allocate(void **ptr, const int64_t n)
Definition gpu_cpu.c:26
void gpu_sgeam(void *handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const float *alpha, const float *a, const int64_t lda, const float *beta, const float *b, const int64_t ldb, float *c, const int64_t ldc)
Definition gpu_cpu.c:450
void dgemm_(const char *transa, const char *transb, const int32_t *m, const int32_t *n, const int32_t *k, const double *alpha, const double *a, const int32_t *lda, const double *b, const int32_t *ldb, const double *beta, double *c, const int32_t *ldc)
void gpu_free(void **ptr)
Definition gpu_cpu.c:46
void gpu_copy(const void *gpu_ptr_src, void *gpu_ptr_dest, const int64_t n)
Definition gpu_cpu.c:69
double ddot_(const int32_t *n, const double *x, const int32_t *incx, const double *y, const int32_t *incy)
void gpu_set_device(int32_t i)
Definition gpu_cpu.c:14
void gpu_upload(const void *cpu_ptr, void *gpu_ptr, const int64_t n)
Definition gpu_cpu.c:53
void gpu_dgemm(void *handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const int64_t k, const double *alpha, const double *a, const int64_t lda, const double *b, const int64_t ldb, const double *beta, double *c, const int64_t ldc)
Definition gpu_cpu.c:260
void gpu_get_memory(size_t *free, size_t *total)
Definition gpu_cpu.c:18
void gpu_sgemv(void *handle, const char *transa, const int64_t m, const int64_t n, const float *alpha, const float *a, const int64_t lda, const float *x, const int64_t incx, const float *beta, float *y, const int64_t incy)
Definition gpu_cpu.c:232
void gpu_sdot(void *handle, const int64_t n, const float *x, const int64_t incx, const float *y, const int64_t incy, float *result)
Definition gpu_cpu.c:162
void gpu_deallocate(void **ptr)
Definition gpu_cpu.c:38
void gpu_sgemm(void *handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const int64_t k, const float *alpha, const float *a, const int64_t lda, const float *b, const int64_t ldb, const float *beta, float *c, const int64_t ldc)
Definition gpu_cpu.c:291
void gpu_dgeam(void *handle, const char *transa, const char *transb, const int64_t m, const int64_t n, const double *alpha, const double *a, const int64_t lda, const double *beta, const double *b, const int64_t ldb, double *c, const int64_t ldc)
Definition gpu_cpu.c:318
void gpu_stream_synchronize(void *stream)
Definition gpu_cpu.c:97
int gpu_ndevices()
Definition gpu_cpu.c:10
void gpu_dgemv(void *handle, const char *transa, const int64_t m, const int64_t n, const double *alpha, const double *a, const int64_t lda, const double *x, const int64_t incx, const double *beta, double *y, const int64_t incy)
Definition gpu_cpu.c:204
void sgemv_(const char *transa, const int32_t *m, const int32_t *n, const float *alpha, const float *a, const int32_t *lda, const float *x, const int32_t *incx, const float *beta, float *y, const int32_t *incy)
void gpu_download(const void *gpu_ptr, void *cpu_ptr, const int64_t n)
Definition gpu_cpu.c:61
void gpu_ddot(void *handle, const int64_t n, const double *x, const int64_t incx, const double *y, const int64_t incy, double *result)
Definition gpu_cpu.c:131
void gpu_blas_create(void **handle)
Definition gpu_cpu.c:118
float sdot_(const int32_t *n, const float *x, const int32_t *incx, const float *y, const int32_t *incy)
void gpu_synchronize()
Definition gpu_cpu.c:93
static bool check_int32_overflow(int64_t value, const char *name)
Check if an int64_t value can be safely converted to int32_t.
Definition gpu_cpu.c:110
void gpu_stream_destroy(void **ptr)
Definition gpu_cpu.c:84
void sgemm_(const char *transa, const char *transb, const int32_t *m, const int32_t *n, const int32_t *k, const float *alpha, const float *a, const int32_t *lda, const float *b, const int32_t *ldb, const float *beta, float *c, const int32_t *ldc)
void dgemv_(const char *transa, const int32_t *m, const int32_t *n, const double *alpha, const double *a, const int32_t *lda, const double *x, const int32_t *incx, const double *beta, double *y, const int32_t *incy)