1 /*
2
3 Copyright (C) 2014, The University of Texas at Austin
4
5 This file is part of libflame and is available under the 3-Clause
6 BSD license, which can be found in the LICENSE file at the top-level
7 directory, or at http://opensource.org/licenses/BSD-3-Clause
8
9 */
10
11 #include "FLAME.h"
12
13 extern fla_scal_t* fla_scal_cntl_blas;
14 extern fla_gemm_t* fla_gemm_cntl_blas;
15
16 fla_trsm_t* fla_trsm_cntl_blas = NULL;
17 fla_trsm_t* fla_trsm_cntl_bp = NULL;
18 fla_trsm_t* fla_trsm_cntl_mp = NULL;
19 fla_trsm_t* fla_trsm_cntl_mm = NULL;
20 fla_blocksize_t* fla_trsm_var2_bsize = NULL;
21 fla_blocksize_t* fla_trsm_var3_bsize = NULL;
22
FLA_Trsm_cntl_init()23 void FLA_Trsm_cntl_init()
24 {
25 // Set blocksizes with default values for conventional storage.
26 fla_trsm_var2_bsize = FLA_Query_blocksizes( FLA_DIMENSION_MIN );
27 fla_trsm_var3_bsize = FLA_Query_blocksizes( FLA_DIMENSION_MIN );
28
29 // Create a control tree that assumes A and B are b x b blocks.
30 fla_trsm_cntl_blas = FLA_Cntl_trsm_obj_create( FLA_FLAT,
31 FLA_SUBPROBLEM,
32 NULL,
33 NULL,
34 NULL,
35 NULL );
36
37 // Create a control tree that assumes A is a block and B is a panel.
38 fla_trsm_cntl_bp = FLA_Cntl_trsm_obj_create( FLA_FLAT,
39 FLA_BLOCKED_VARIANT3,
40 fla_trsm_var3_bsize,
41 fla_scal_cntl_blas,
42 fla_trsm_cntl_blas,
43 NULL );
44
45 // Create a control tree that assumes A is large and B is a panel.
46 fla_trsm_cntl_mp = FLA_Cntl_trsm_obj_create( FLA_FLAT,
47 FLA_BLOCKED_VARIANT2,
48 fla_trsm_var2_bsize,
49 fla_scal_cntl_blas,
50 fla_trsm_cntl_blas,
51 fla_gemm_cntl_blas );
52
53 // Create a control tree that assumes A and B are both large.
54 fla_trsm_cntl_mm = FLA_Cntl_trsm_obj_create( FLA_FLAT,
55 FLA_BLOCKED_VARIANT3,
56 fla_trsm_var3_bsize,
57 fla_scal_cntl_blas,
58 fla_trsm_cntl_mp,
59 NULL );
60 }
61
FLA_Trsm_cntl_finalize()62 void FLA_Trsm_cntl_finalize()
63 {
64 FLA_Cntl_obj_free( fla_trsm_cntl_blas );
65
66 FLA_Cntl_obj_free( fla_trsm_cntl_bp );
67 FLA_Cntl_obj_free( fla_trsm_cntl_mp );
68 FLA_Cntl_obj_free( fla_trsm_cntl_mm );
69
70 FLA_Blocksize_free( fla_trsm_var2_bsize );
71 FLA_Blocksize_free( fla_trsm_var3_bsize );
72 }
73
74