Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 7ff0faac authored by Mathieu Faverge's avatar Mathieu Faverge
Browse files

getrf: add an alg parameter to dynamically switch from one algorithm to...

getrf: add an alg parameter to dynamically switch from one algorithm to another through environment variable
parent f344492c
No related branches found
No related tags found
1 merge request!389getrf: Add option to dynamically change the getrf algorithm through environment variable
...@@ -113,11 +113,13 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws, ...@@ -113,11 +113,13 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws,
int k, int k,
RUNTIME_option_t *options ) RUNTIME_option_t *options )
{ {
#if defined(GETRF_NOPIV_PER_COLUMN) /* TODO: Should be replaced by a function pointer */
chameleon_pzgetrf_panel_facto_nopiv_percol( ws, A, k, options ); if ( ws->alg == ChamGetrfNoPivPerColumn ) {
#else chameleon_pzgetrf_panel_facto_nopiv_percol( ws, A, k, options );
chameleon_pzgetrf_panel_facto_nopiv( ws, A, k, options ); }
#endif else {
chameleon_pzgetrf_panel_facto_nopiv( ws, A, k, options );
}
} }
/** /**
...@@ -180,9 +182,9 @@ chameleon_pzgetrf_panel_update( struct chameleon_pzgetrf_s *ws, ...@@ -180,9 +182,9 @@ chameleon_pzgetrf_panel_update( struct chameleon_pzgetrf_s *ws,
* Parallel tile LU factorization with no pivoting - dynamic scheduling * Parallel tile LU factorization with no pivoting - dynamic scheduling
*/ */
void chameleon_pzgetrf( struct chameleon_pzgetrf_s *ws, void chameleon_pzgetrf( struct chameleon_pzgetrf_s *ws,
CHAM_desc_t *A, CHAM_desc_t *A,
RUNTIME_sequence_t *sequence, RUNTIME_sequence_t *sequence,
RUNTIME_request_t *request ) RUNTIME_request_t *request )
{ {
CHAM_context_t *chamctxt; CHAM_context_t *chamctxt;
RUNTIME_option_t options; RUNTIME_option_t options;
......
...@@ -61,15 +61,33 @@ CHAMELEON_zgetrf_WS_Alloc( const CHAM_desc_t *A ) ...@@ -61,15 +61,33 @@ CHAMELEON_zgetrf_WS_Alloc( const CHAM_desc_t *A )
} }
ws = calloc( 1, sizeof( struct chameleon_pzgetrf_s ) ); ws = calloc( 1, sizeof( struct chameleon_pzgetrf_s ) );
ws->alg = ChamGetrfNoPiv;
ws->ib = CHAMELEON_IB; ws->ib = CHAMELEON_IB;
#if defined(GETRF_NOPIV_PER_COLUMN) {
chameleon_desc_init( &(ws->U), CHAMELEON_MAT_ALLOC_TILE, char *algostr = chameleon_getenv( "CHAMELEON_GETRF_ALGO" );
ChamComplexDouble, 1, A->nb, A->nb,
A->mt, A->nt * A->nb, 0, 0, if ( algostr ) {
A->mt, A->nt * A->nb, A->p, A->q, if ( strcasecmp( algostr, "nopiv" ) ) {
NULL, NULL, A->get_rankof_init ); ws->alg = ChamGetrfNoPiv;
#endif }
else if ( strcasecmp( algostr, "nopivpercolumn" ) == 0 ) {
ws->alg = ChamGetrfNoPivPerColumn;
}
else {
fprintf( stderr, "ERROR: CHAMELEON_GETRF_ALGO is not one of NoPiv, NoPivPerColumn => Switch back to NoPiv\n" );
}
}
chameleon_cleanenv( algostr );
}
if ( ws->alg == ChamGetrfNoPivPerColumn ) {
chameleon_desc_init( &(ws->U), CHAMELEON_MAT_ALLOC_TILE,
ChamComplexDouble, 1, A->nb, A->nb,
A->mt, A->nt * A->nb, 0, 0,
A->mt, A->nt * A->nb, A->p, A->q,
NULL, NULL, A->get_rankof_init );
}
return ws; return ws;
} }
...@@ -98,9 +116,9 @@ CHAMELEON_zgetrf_WS_Free( void *user_ws ) ...@@ -98,9 +116,9 @@ CHAMELEON_zgetrf_WS_Free( void *user_ws )
{ {
struct chameleon_pzgetrf_s *ws = (struct chameleon_pzgetrf_s *)user_ws; struct chameleon_pzgetrf_s *ws = (struct chameleon_pzgetrf_s *)user_ws;
#if defined(GETRF_NOPIV_PER_COLUMN) if ( ws->alg == ChamGetrfNoPivPerColumn ) {
chameleon_desc_destroy( &(ws->U) ); chameleon_desc_destroy( &(ws->U) );
#endif }
free( ws ); free( ws );
} }
......
...@@ -41,8 +41,9 @@ struct chameleon_pzgemm_s { ...@@ -41,8 +41,9 @@ struct chameleon_pzgemm_s {
* @brief Data structure to handle the GETRF workspaces with partial pivoting * @brief Data structure to handle the GETRF workspaces with partial pivoting
*/ */
struct chameleon_pzgetrf_s { struct chameleon_pzgetrf_s {
int ib; /* Internal blocking parameter */ cham_getrf_t alg;
CHAM_desc_t U; int ib; /* Internal blocking parameter */
CHAM_desc_t U;
}; };
/** /**
......
...@@ -194,6 +194,14 @@ typedef enum chameleon_gemm_e { ...@@ -194,6 +194,14 @@ typedef enum chameleon_gemm_e {
ChamGemmAlgSummaC ChamGemmAlgSummaC
} cham_gemm_t; } cham_gemm_t;
/**
* @brief Chameleon GETRF algorithm variants
*/
typedef enum chameleon_getrf_e {
ChamGetrfNoPiv,
ChamGetrfNoPivPerColumn,
} cham_getrf_t;
#define ChameleonTrd 1001 #define ChameleonTrd 1001
#define ChameleonBrd 1002 #define ChameleonBrd 1002
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment