MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
magmablas.h
Go to the documentation of this file.
1 /*
2  -- MAGMA (version 1.4.0) --
3  Univ. of Tennessee, Knoxville
4  Univ. of California, Berkeley
5  Univ. of Colorado, Denver
6  August 2013
7 */
8 
9 #ifndef MAGMABLAS_H
10 #define MAGMABLAS_H
11 
12 #include "magmablas_z.h"
13 #include "magmablas_c.h"
14 #include "magmablas_d.h"
15 #include "magmablas_s.h"
16 #include "magmablas_zc.h"
17 #include "magmablas_ds.h"
18 
19 #if (GPUSHMEM < 200)
20 #define magmablas_zgemm cublasZgemm
21 #endif
22 #define magmablas_cgemm cublasCgemm
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 // ========================================
29 // Define magma streams
30 extern magma_queue_t magma_stream;
31 
32 cublasStatus_t magmablasSetKernelStream( magma_queue_t stream );
33 cublasStatus_t magmablasGetKernelStream( magma_queue_t *stream );
34 
35 
36 // ========================================
37 // copying vectors
38 // set copies host to device
39 // get copies device to host
40 // Add the function, file, and line for error-reporting purposes.
41 
42 #define magma_setvector( n, elemSize, hx_src, incx, dy_dst, incy ) \
43  magma_setvector_internal( n, elemSize, hx_src, incx, dy_dst, incy, __func__, __FILE__, __LINE__ )
44 
45 #define magma_getvector( n, elemSize, dx_src, incx, hy_dst, incy ) \
46  magma_getvector_internal( n, elemSize, dx_src, incx, hy_dst, incy, __func__, __FILE__, __LINE__ )
47 
48 #define magma_setvector_async( n, elemSize, hx_src, incx, dy_dst, incy, stream ) \
49  magma_setvector_async_internal( n, elemSize, hx_src, incx, dy_dst, incy, stream, __func__, __FILE__, __LINE__ )
50 
51 #define magma_getvector_async( n, elemSize, dx_src, incx, hy_dst, incy, stream ) \
52  magma_getvector_async_internal( n, elemSize, dx_src, incx, hy_dst, incy, stream, __func__, __FILE__, __LINE__ )
53 
55  magma_int_t n, size_t elemSize,
56  const void *hx_src, magma_int_t incx,
57  void *dy_dst, magma_int_t incy,
58  const char* func, const char* file, int line );
59 
61  magma_int_t n, size_t elemSize,
62  const void *dx_src, magma_int_t incx,
63  void *hy_dst, magma_int_t incy,
64  const char* func, const char* file, int line );
65 
67  magma_int_t n, size_t elemSize,
68  const void *hx_src, magma_int_t incx,
69  void *dy_dst, magma_int_t incy,
70  magma_queue_t stream,
71  const char* func, const char* file, int line );
72 
74  magma_int_t n, size_t elemSize,
75  const void *dx_src, magma_int_t incx,
76  void *hy_dst, magma_int_t incy,
77  magma_queue_t stream,
78  const char* func, const char* file, int line );
79 
80 
81 // ========================================
82 // copying sub-matrices (contiguous columns )
83 // set copies host to device
84 // get copies device to host
85 // copy copies device to device
86 // (with CUDA unified addressing, copy can be between same or different devices )
87 // Add the function, file, and line for error-reporting purposes.
88 
89 #define magma_setmatrix( m, n, elemSize, hA_src, lda, dB_dst, lddb ) \
90  magma_setmatrix_internal( m, n, elemSize, hA_src, lda, dB_dst, lddb, __func__, __FILE__, __LINE__ )
91 
92 #define magma_getmatrix( m, n, elemSize, dA_src, ldda, hB_dst, ldb ) \
93  magma_getmatrix_internal( m, n, elemSize, dA_src, ldda, hB_dst, ldb, __func__, __FILE__, __LINE__ )
94 
95 #define magma_copymatrix( m, n, elemSize, dA_src, ldda, dB_dst, lddb ) \
96  magma_copymatrix_internal( m, n, elemSize, dA_src, ldda, dB_dst, lddb, __func__, __FILE__, __LINE__ )
97 
98 #define magma_setmatrix_async( m, n, elemSize, hA_src, lda, dB_dst, lddb, stream ) \
99  magma_setmatrix_async_internal( m, n, elemSize, hA_src, lda, dB_dst, lddb, stream, __func__, __FILE__, __LINE__ )
100 
101 #define magma_getmatrix_async( m, n, elemSize, dA_src, ldda, hB_dst, ldb, stream ) \
102  magma_getmatrix_async_internal( m, n, elemSize, dA_src, ldda, hB_dst, ldb, stream, __func__, __FILE__, __LINE__ )
103 
104 #define magma_copymatrix_async( m, n, elemSize, dA_src, ldda, dB_dst, lddb, stream ) \
105  magma_copymatrix_async_internal( m, n, elemSize, dA_src, ldda, dB_dst, lddb, stream, __func__, __FILE__, __LINE__ )
106 
108  magma_int_t m, magma_int_t n, size_t elemSize,
109  const void *hA_src, magma_int_t lda,
110  void *dB_dst, magma_int_t lddb,
111  const char* func, const char* file, int line );
112 
114  magma_int_t m, magma_int_t n, size_t elemSize,
115  const void *dA_src, magma_int_t ldda,
116  void *hB_dst, magma_int_t ldb,
117  const char* func, const char* file, int line );
118 
120  magma_int_t m, magma_int_t n, size_t elemSize,
121  const void *dA_src, magma_int_t ldda,
122  void *dB_dst, magma_int_t lddb,
123  const char* func, const char* file, int line );
124 
126  magma_int_t m, magma_int_t n, size_t elemSize,
127  const void *hA_src, magma_int_t lda,
128  void *dB_dst, magma_int_t lddb,
129  magma_queue_t stream,
130  const char* func, const char* file, int line );
131 
133  magma_int_t m, magma_int_t n, size_t elemSize,
134  const void *dA_src, magma_int_t ldda,
135  void *hB_dst, magma_int_t ldb,
136  magma_queue_t stream,
137  const char* func, const char* file, int line );
138 
140  magma_int_t m, magma_int_t n, size_t elemSize,
141  const void *dA_src, magma_int_t ldda,
142  void *dB_dst, magma_int_t lddb,
143  magma_queue_t stream,
144  const char* func, const char* file, int line );
145 
146 #ifdef __cplusplus
147 }
148 #endif
149 
150 #endif /* MAGMABLAS_H */
void magma_copymatrix_async_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *dA_src, magma_int_t ldda, void *dB_dst, magma_int_t lddb, magma_queue_t stream, const char *func, const char *file, int line)
void magma_getvector_async_internal(magma_int_t n, size_t elemSize, const void *dx_src, magma_int_t incx, void *hy_dst, magma_int_t incy, magma_queue_t stream, const char *func, const char *file, int line)
void magma_getvector_internal(magma_int_t n, size_t elemSize, const void *dx_src, magma_int_t incx, void *hy_dst, magma_int_t incy, const char *func, const char *file, int line)
int magma_int_t
Definition: magmablas.h:12
magma_queue_t magma_stream
void magma_copymatrix_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *dA_src, magma_int_t ldda, void *dB_dst, magma_int_t lddb, const char *func, const char *file, int line)
void magma_setmatrix_async_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *hA_src, magma_int_t lda, void *dB_dst, magma_int_t lddb, magma_queue_t stream, const char *func, const char *file, int line)
cublasStatus_t magmablasSetKernelStream(magma_queue_t stream)
void magma_getmatrix_async_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *dA_src, magma_int_t ldda, void *hB_dst, magma_int_t ldb, magma_queue_t stream, const char *func, const char *file, int line)
void magma_setvector_internal(magma_int_t n, size_t elemSize, const void *hx_src, magma_int_t incx, void *dy_dst, magma_int_t incy, const char *func, const char *file, int line)
void magma_setvector_async_internal(magma_int_t n, size_t elemSize, const void *hx_src, magma_int_t incx, void *dy_dst, magma_int_t incy, magma_queue_t stream, const char *func, const char *file, int line)
void magma_getmatrix_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *dA_src, magma_int_t ldda, void *hB_dst, magma_int_t ldb, const char *func, const char *file, int line)
void magma_setmatrix_internal(magma_int_t m, magma_int_t n, size_t elemSize, const void *hA_src, magma_int_t lda, void *dB_dst, magma_int_t lddb, const char *func, const char *file, int line)
cublasStatus_t magmablasGetKernelStream(magma_queue_t *stream)