MAGMA  magma-1.4.0
Matrix Algebra on GPU and Multicore Architectures
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
transpose.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  @author Mathieu Faverge
9 
10  Macro to transpose matrices before and after computation
11  in LU kernels
12 */
13 
14 #ifndef MAGMA_TRANSPOSE_H
15 #define MAGMA_TRANSPOSE_H
16 
17 #define magmablas_sgetmo_in( dA, dAT, ldda, m, n ) \
18  dAT = dA; \
19  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
20  magmablas_stranspose_inplace( ldda, dAT, ldda ); \
21  } else { \
22  cublasStatus_t status = cublasAlloc( (m)*(n), sizeof(float), (void**)&dAT); \
23  if (status != CUBLAS_STATUS_SUCCESS) \
24  return -7; \
25  magmablas_stranspose2( dAT, ldda, dA, ldda, m, n ); \
26  }
27 
28 #define magmablas_sgetmo_out( dA, dAT, ldda, m, n ) \
29  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
30  magmablas_stranspose_inplace( ldda, dAT, ldda ); \
31  } else { \
32  magmablas_stranspose2( dA, ldda, dAT, ldda, n, m ); \
33  cublasFree(dAT); \
34  }
35 
36 #define magmablas_dgetmo_in( dA, dAT, ldda, m, n ) \
37  dAT = dA; \
38  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
39  magmablas_dtranspose_inplace( ldda, dAT, ldda ); \
40  } else { \
41  cublasStatus_t status = cublasAlloc( (m)*(n), sizeof(double), (void**)&dAT); \
42  if (status != CUBLAS_STATUS_SUCCESS) \
43  return -7; \
44  magmablas_dtranspose2( dAT, ldda, dA, ldda, m, n ); \
45  }
46 
47 #define magmablas_dgetmo_out( dA, dAT, ldda, m, n ) \
48  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
49  magmablas_dtranspose_inplace( ldda, dAT, ldda ); \
50  } else { \
51  magmablas_dtranspose2( dA, ldda, dAT, ldda, n, m ); \
52  cublasFree(dAT); \
53  }
54 
55 #define magmablas_cgetmo_in( dA, dAT, ldda, m, n ) \
56  dAT = dA; \
57  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
58  magmablas_ctranspose_inplace( ldda, dAT, ldda ); \
59  } else { \
60  cublasStatus_t status = cublasAlloc( (m)*(n), sizeof(magmaFloatComplex), (void**)&dAT); \
61  if (status != CUBLAS_STATUS_SUCCESS) \
62  return -7; \
63  magmablas_ctranspose2( dAT, ldda, dA, ldda, m, n ); \
64  }
65 
66 #define magmablas_cgetmo_out( dA, dAT, ldda, m, n ) \
67  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
68  magmablas_ctranspose_inplace( ldda, dAT, ldda ); \
69  } else { \
70  magmablas_ctranspose2( dA, ldda, dAT, ldda, n, m ); \
71  cublasFree(dAT); \
72  }
73 
74 #define magmablas_zgetmo_in( dA, dAT, ldda, m, n ) \
75  dAT = dA; \
76  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
77  magmablas_ztranspose_inplace( ldda, dAT, ldda ); \
78  } else { \
79  cublasStatus_t status = cublasAlloc( (m)*(n), sizeof(magmaDoubleComplex), (void**)&dAT); \
80  if (status != CUBLAS_STATUS_SUCCESS) \
81  return -7; \
82  magmablas_ztranspose2( dAT, ldda, dA, ldda, m, n ); \
83  }
84 
85 #define magmablas_zgetmo_out( dA, dAT, ldda, m, n ) \
86  if ( ( (m) == (n) ) && ( (m)%32 == 0) && ( (ldda)%32 == 0) ){ \
87  magmablas_ztranspose_inplace( ldda, dAT, ldda ); \
88  } else { \
89  magmablas_ztranspose2( dA, ldda, dAT, ldda, n, m ); \
90  cublasFree(dAT); \
91  }
92 
93 #endif /* MAGMA_TRANSPOSE_H */