From dfee81a1b66d0623e392fbbd9c1ca4430f310790 Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Thu, 18 May 2023 10:28:06 +0200 Subject: [PATCH] zgetrf: Add a function using map to initialize the IPIV array (may be unused in the future) --- compute/pzgetrf.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/compute/pzgetrf.c b/compute/pzgetrf.c index c4501d591..1d93acc5e 100644 --- a/compute/pzgetrf.c +++ b/compute/pzgetrf.c @@ -24,6 +24,50 @@ #define A(m,n) A, m, n #define U(m,n) &(ws->U), m, n +#define IPIV(m) IPIV, m, 1 + +/* + * Static variable to know how to handle the data within the kernel + * This assumes that only one runtime is enabled at a time. + */ +static RUNTIME_id_t zgetrf_runtime_id = RUNTIME_SCHED_STARPU; + +static inline int +zgetrf_ipiv_init( const CHAM_desc_t *descIPIV, + cham_uplo_t uplo, int m, int n, + CHAM_tile_t *tileIPIV, void *op_args ) +{ + int *IPIV; + (void)op_args; + + if ( zgetrf_runtime_id == RUNTIME_SCHED_PARSEC ) { + IPIV = (int*)tileIPIV; + } + else { + IPIV = CHAM_tile_get_ptr( tileIPIV ); + } + +#if !defined(CHAMELEON_SIMULATION) + { + int tempmm = m == descIPIV->mt-1 ? descIPIV->m - m * descIPIV->mb : descIPIV->mb; + int i; + + for( i=0; i<tempmm; i++ ) { + IPIV[i] = m * descIPIV->mb + i + 1; + } + } +#endif + + return 0; +} + +static inline void +chameleon_pzgetrf_ipiv_init( CHAM_desc_t *IPIV, + RUNTIME_sequence_t *sequence, + RUNTIME_request_t *request ) +{ + chameleon_pmap( ChamW, ChamUpperLower, IPIV, zgetrf_ipiv_init, NULL, sequence, request ); +} /* * All the functions below are panel factorization variant. @@ -199,6 +243,9 @@ void chameleon_pzgetrf( struct chameleon_pzgetrf_s *ws, } RUNTIME_options_init( &options, chamctxt, sequence, request ); + /* Initialize IPIV */ + chameleon_pzgetrf_ipiv_init( IPIV, sequence, request ); + for (k = 0; k < min_mnt; k++) { RUNTIME_iteration_push( chamctxt, k ); -- GitLab