Mentions légales du service

Skip to content
Snippets Groups Projects
Commit f650eb5e authored by LISITO Alycia's avatar LISITO Alycia
Browse files

zgetrf: function to get the array of proc involved in panel

parent 0610ca63
No related branches found
No related tags found
1 merge request!496zgetrf: Allreduce perm
...@@ -214,10 +214,6 @@ chameleon_pzgetrf_panel_facto_blocked( struct chameleon_pzgetrf_s *ws, ...@@ -214,10 +214,6 @@ chameleon_pzgetrf_panel_facto_blocked( struct chameleon_pzgetrf_s *ws,
int m, h, b, nbblock; int m, h, b, nbblock;
int tempkm, tempkn, tempmm, minmn; int tempkm, tempkn, tempmm, minmn;
if ( ! ws->involved ) {
return;
}
tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb; tempkm = k == A->mt-1 ? A->m-k*A->mb : A->mb;
tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb; tempkn = k == A->nt-1 ? A->n-k*A->nb : A->nb;
minmn = chameleon_min( tempkm, tempkn ); minmn = chameleon_min( tempkm, tempkn );
...@@ -340,25 +336,10 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws, ...@@ -340,25 +336,10 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws,
int k, int k,
RUNTIME_option_t *options ) RUNTIME_option_t *options )
{ {
#if defined ( CHAMELEON_USE_MPI ) chameleon_get_proc_involved_in_panelk_2dbc( A, k, k, ws );
int *proc_involved = malloc( sizeof( int ) * chameleon_min( A->p, A->mt - k) ); if ( !ws->involved ) {
int b;
/* 2DBC only */
ws->involved = 0;
for ( b = k; (b < A->mt) && ((b-k) < A->p); b ++ ) {
int rank = chameleon_getrankof_2d( A, b, k );
proc_involved[ b-k ] = rank;
if ( rank == A->myrank ) {
ws->involved = 1;
}
}
ws->proc_involved = proc_involved;
if ( ws->involved == 0 ) {
free( proc_involved );
return; return;
} }
#endif
/* TODO: Should be replaced by a function pointer */ /* TODO: Should be replaced by a function pointer */
switch( ws->alg ) { switch( ws->alg ) {
...@@ -388,9 +369,6 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws, ...@@ -388,9 +369,6 @@ chameleon_pzgetrf_panel_facto( struct chameleon_pzgetrf_s *ws,
default: default:
chameleon_pzgetrf_panel_facto_nopiv( ws, A, ipiv, k, options ); chameleon_pzgetrf_panel_facto_nopiv( ws, A, ipiv, k, options );
} }
#if defined ( CHAMELEON_USE_MPI )
free( proc_involved );
#endif
} }
/** /**
......
...@@ -67,6 +67,12 @@ CHAMELEON_zgetrf_WS_Alloc( const CHAM_desc_t *A ) ...@@ -67,6 +67,12 @@ CHAMELEON_zgetrf_WS_Alloc( const CHAM_desc_t *A )
ws->alg = ChamGetrfPPiv; ws->alg = ChamGetrfPPiv;
ws->ib = CHAMELEON_IB; ws->ib = CHAMELEON_IB;
#if defined (CHAMELEON_USE_MPI)
ws->proc_involved = malloc( sizeof( int ) * A->p );
ws->involved = 0;
ws->np_involved = 0;
#endif
{ {
char *algostr = chameleon_getenv( "CHAMELEON_GETRF_ALGO" ); char *algostr = chameleon_getenv( "CHAMELEON_GETRF_ALGO" );
...@@ -160,6 +166,10 @@ CHAMELEON_zgetrf_WS_Free( void *user_ws ) ...@@ -160,6 +166,10 @@ 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 (CHAMELEON_USE_MPI)
free( ws->proc_involved );
#endif
if ( ( ws->alg == ChamGetrfNoPivPerColumn ) || if ( ( ws->alg == ChamGetrfNoPivPerColumn ) ||
( ws->alg == ChamGetrfPPiv ) || ( ws->alg == ChamGetrfPPiv ) ||
( ws->alg == ChamGetrfPPivPerColumn ) ) ( ws->alg == ChamGetrfPPivPerColumn ) )
......
...@@ -100,6 +100,52 @@ int chameleon_involved_in_panelk_2dbc( const CHAM_desc_t *A, int k ) { ...@@ -100,6 +100,52 @@ int chameleon_involved_in_panelk_2dbc( const CHAM_desc_t *A, int k ) {
return ( myrank % A->q == k % A->q ); return ( myrank % A->q == k % A->q );
} }
/**
* @brief Test if the current MPI process is involved in the panel k for 2DBC distributions.
*
* @param[in] A
* The matrix descriptor.
*
* @param[in] k
* The index of the panel to test.
*
* @param[in] n
* The index of the panel to test.
*
* @param[inout] ws_getrf
* The i.
*
*/
void chameleon_get_proc_involved_in_panelk_2dbc( const CHAM_desc_t *A,
int k,
int n,
void *ws_getrf )
{
#if defined (CHAMELEON_USE_MPI)
struct chameleon_pzgetrf_s *ws = (struct chameleon_pzgetrf_s *)ws_getrf;
int *proc_involved = ws->proc_involved;
int b, rank, np;
np = 0;
ws->involved = 0;
for ( b = k; (b < A->mt) && ((b-k) < A->p); b ++ ) {
rank = chameleon_getrankof_2d( A, b, n );
proc_involved[ b-k ] = rank;
np ++;
if ( rank == A->myrank ) {
ws->involved = 1;
}
}
ws->proc_involved = proc_involved;
ws->np_involved = np;
#else
(void)A;
(void)k;
(void)n;
(void)ws_getrf;
#endif
}
/** /**
* @brief Initializes a custom distribution based on an external file. * @brief Initializes a custom distribution based on an external file.
* *
......
...@@ -64,6 +64,10 @@ int chameleon_getrankof_custom ( const CHAM_desc_t *A, int m, int n ); ...@@ -64,6 +64,10 @@ int chameleon_getrankof_custom ( const CHAM_desc_t *A, int m, int n );
*/ */
int chameleon_involved_in_panelk_2dbc( const CHAM_desc_t *A, int An ); int chameleon_involved_in_panelk_2dbc( const CHAM_desc_t *A, int An );
void chameleon_get_proc_involved_in_panelk_2dbc( const CHAM_desc_t *A,
int k,
int n,
void *ws_getrf );
/** /**
* @} * @}
......
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