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 fla_swap_t*      fla_swap_cntl_panel = NULL;
14 fla_swap_t*      fla_swap_cntl_blas = NULL;
15 
16 fla_tpose_t*     fla_tpose_cntl = NULL;
17 fla_tpose_t*     fla_tpose_cntl_unb = NULL;
18 fla_blocksize_t* fla_tpose_bsize = NULL;
19 fla_blocksize_t* fla_tpose_swap_bsize = NULL;
20 
FLA_Transpose_cntl_init()21 void FLA_Transpose_cntl_init()
22 {
23 	// Set blocksizes based on libgoto query.
24 	fla_tpose_bsize      = FLA_Query_blocksizes( FLA_DIMENSION_MIN );
25 	fla_tpose_swap_bsize = FLA_Query_blocksizes( FLA_DIMENSION_MIN );
26 
27 	// Create a control tree that performs unblocked variant 2 transposition.
28 	fla_tpose_cntl_unb   = FLA_Cntl_tpose_obj_create( FLA_FLAT,
29 	                                                  FLA_UNBLOCKED_VARIANT2,
30 	                                                  NULL,
31 	                                                  NULL,
32 	                                                  NULL );
33 
34 	// Create a control tree that invokes an external implementation of swap.
35 	fla_swap_cntl_blas   = FLA_Cntl_swap_obj_create( FLA_FLAT,
36 	                                                 FLA_SUBPROBLEM,
37 	                                                 NULL,
38 	                                                 NULL );
39 
40 	// Create a control tree that invokes unblocked variant 2 of swap.
41 	fla_swap_cntl_panel  = FLA_Cntl_swap_obj_create( FLA_FLAT,
42 	                                                 FLA_BLOCKED_VARIANT2,
43 	                                                 fla_tpose_swap_bsize,
44 	                                                 fla_swap_cntl_blas );
45 
46 	// Create a control tree that assumes a large matrix argument.
47 	fla_tpose_cntl       = FLA_Cntl_tpose_obj_create( FLA_FLAT,
48 	                                                  FLA_BLOCKED_VARIANT2,
49 	                                                  fla_tpose_bsize,
50 	                                                  fla_tpose_cntl_unb,
51 	                                                  fla_swap_cntl_panel );
52 }
53 
FLA_Transpose_cntl_finalize()54 void FLA_Transpose_cntl_finalize()
55 {
56 	FLA_Cntl_obj_free( fla_tpose_cntl );
57 	FLA_Cntl_obj_free( fla_tpose_cntl_unb );
58 	FLA_Cntl_obj_free( fla_swap_cntl_panel );
59 	FLA_Cntl_obj_free( fla_swap_cntl_blas );
60 
61 	FLA_Blocksize_free( fla_tpose_bsize );
62 	FLA_Blocksize_free( fla_tpose_swap_bsize );
63 }
64 
65