libflame  revision_anchor
Functions
FLA_Trsm_external_gpu.c File Reference

(r)

Functions

FLA_Error FLA_Trsm_external_gpu (FLA_Side side, FLA_Uplo uplo, FLA_Trans trans, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, void *A_gpu, FLA_Obj B, void *B_gpu)
 

Function Documentation

◆ FLA_Trsm_external_gpu()

FLA_Error FLA_Trsm_external_gpu ( FLA_Side  side,
FLA_Uplo  uplo,
FLA_Trans  trans,
FLA_Diag  diag,
FLA_Obj  alpha,
FLA_Obj  A,
void *  A_gpu,
FLA_Obj  B,
void *  B_gpu 
)

References FLA_Check_error_level(), FLA_Obj_datatype(), FLA_Obj_has_zero_dim(), FLA_Obj_length(), FLA_Obj_width(), FLA_Param_map_flame_to_netlib_diag(), FLA_Param_map_flame_to_netlib_side(), FLA_Param_map_flame_to_netlib_trans(), FLA_Param_map_flame_to_netlib_uplo(), and FLA_Trsm_check().

Referenced by FLASH_Queue_exec_task_gpu().

18 {
19  FLA_Datatype datatype;
20  int m_B, n_B;
21  int ldim_A;
22  int ldim_B;
23  char blas_side;
24  char blas_uplo;
25  char blas_trans;
26  char blas_diag;
27 
28  if ( FLA_Check_error_level() == FLA_FULL_ERROR_CHECKING )
29  FLA_Trsm_check( side, uplo, trans, diag, alpha, A, B );
30 
31  if ( FLA_Obj_has_zero_dim( B ) ) return FLA_SUCCESS;
32 
33  datatype = FLA_Obj_datatype( A );
34 
35  ldim_A = FLA_Obj_length( A );
36 
37  m_B = FLA_Obj_length( B );
38  n_B = FLA_Obj_width( B );
39  ldim_B = FLA_Obj_length( B );
40 
41  FLA_Param_map_flame_to_netlib_side( side, &blas_side );
42  FLA_Param_map_flame_to_netlib_uplo( uplo, &blas_uplo );
43  FLA_Param_map_flame_to_netlib_trans( trans, &blas_trans );
44  FLA_Param_map_flame_to_netlib_diag( diag, &blas_diag );
45 
46 
47  switch( datatype ){
48 
49  case FLA_FLOAT:
50  {
51  float *buff_alpha = ( float * ) FLA_FLOAT_PTR( alpha );
52 
53  cublasStrsm( blas_side,
54  blas_uplo,
55  blas_trans,
56  blas_diag,
57  m_B,
58  n_B,
59  *buff_alpha,
60  ( float * ) A_gpu, ldim_A,
61  ( float * ) B_gpu, ldim_B );
62 
63  break;
64  }
65 
66  case FLA_DOUBLE:
67  {
68  double *buff_alpha = ( double * ) FLA_DOUBLE_PTR( alpha );
69 
70  cublasDtrsm( blas_side,
71  blas_uplo,
72  blas_trans,
73  blas_diag,
74  m_B,
75  n_B,
76  *buff_alpha,
77  ( double * ) A_gpu, ldim_A,
78  ( double * ) B_gpu, ldim_B );
79 
80  break;
81  }
82 
83  case FLA_COMPLEX:
84  {
85  cuComplex *buff_alpha = ( cuComplex * ) FLA_COMPLEX_PTR( alpha );
86 
87  cublasCtrsm( blas_side,
88  blas_uplo,
89  blas_trans,
90  blas_diag,
91  m_B,
92  n_B,
93  *buff_alpha,
94  ( cuComplex * ) A_gpu, ldim_A,
95  ( cuComplex * ) B_gpu, ldim_B );
96 
97  break;
98  }
99 
100  case FLA_DOUBLE_COMPLEX:
101  {
102  cuDoubleComplex *buff_alpha = ( cuDoubleComplex * ) FLA_DOUBLE_COMPLEX_PTR( alpha );
103 
104  cublasZtrsm( blas_side,
105  blas_uplo,
106  blas_trans,
107  blas_diag,
108  m_B,
109  n_B,
110  *buff_alpha,
111  ( cuDoubleComplex * ) A_gpu, ldim_A,
112  ( cuDoubleComplex * ) B_gpu, ldim_B );
113 
114  break;
115  }
116 
117  }
118 
119  return FLA_SUCCESS;
120 }
void FLA_Param_map_flame_to_netlib_uplo(FLA_Uplo uplo, void *blas_uplo)
Definition: FLA_Param.c:47
void FLA_Param_map_flame_to_netlib_side(FLA_Uplo side, void *blas_side)
Definition: FLA_Param.c:71
void FLA_Param_map_flame_to_netlib_trans(FLA_Trans trans, void *blas_trans)
Definition: FLA_Param.c:15
FLA_Error FLA_Trsm_check(FLA_Side side, FLA_Uplo uplo, FLA_Trans trans, FLA_Diag diag, FLA_Obj alpha, FLA_Obj A, FLA_Obj B)
Definition: FLA_Trsm_check.c:13
FLA_Datatype FLA_Obj_datatype(FLA_Obj obj)
Definition: FLA_Query.c:13
FLA_Bool FLA_Obj_has_zero_dim(FLA_Obj A)
Definition: FLA_Query.c:400
void FLA_Param_map_flame_to_netlib_diag(FLA_Diag diag, void *blas_diag)
Definition: FLA_Param.c:95
dim_t FLA_Obj_width(FLA_Obj obj)
Definition: FLA_Query.c:123
unsigned int FLA_Check_error_level(void)
Definition: FLA_Check.c:18
int FLA_Datatype
Definition: FLA_type_defs.h:49
dim_t FLA_Obj_length(FLA_Obj obj)
Definition: FLA_Query.c:116