From 3ce718a71bdf23072e6eddd5c73538ac97b5b1dd Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Wed, 29 Mar 2023 20:39:27 +0200 Subject: [PATCH] pzxxmm: fix the reduceC initialization to avoid the warning from SonarQube and reduce the memory space used --- compute/pzgemm.c | 7 +++---- compute/pzhemm.c | 6 +++--- compute/pzsymm.c | 6 +++--- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/compute/pzgemm.c b/compute/pzgemm.c index dee1fc2fc..a863579d6 100644 --- a/compute/pzgemm.c +++ b/compute/pzgemm.c @@ -45,14 +45,12 @@ chameleon_pzgemm_Astat( CHAM_context_t *chamctxt, cham_trans_t transA, cham_tran RUNTIME_sequence_t *sequence = options->sequence; int m, n, k; int tempmm, tempnn, tempkn, tempkm; - int myrank = RUNTIME_comm_rank( chamctxt ); - int reduceC[ C->mt * C->nt ]; + int myrank = RUNTIME_comm_rank( chamctxt ); + int8_t *reduceC = calloc( C->mt * C->nt, sizeof(int8_t) ); /* Set C tiles to redux mode. */ for (n = 0; n < C->nt; n++) { for (m = 0; m < C->mt; m++) { - reduceC[ n * C->mt + m ] = 0; - /* The node owns the C tile. */ if ( C->get_rankof( C(m, n) ) == myrank ) { reduceC[ n * C->mt + m ] = 1; @@ -169,6 +167,7 @@ chameleon_pzgemm_Astat( CHAM_context_t *chamctxt, cham_trans_t transA, cham_tran } } options->forcesub = 0; + free( reduceC ); (void)chamctxt; } diff --git a/compute/pzhemm.c b/compute/pzhemm.c index 56b2c7267..4cbe3deaf 100644 --- a/compute/pzhemm.c +++ b/compute/pzhemm.c @@ -48,13 +48,11 @@ chameleon_pzhemm_Astat( CHAM_context_t *chamctxt, cham_side_t side, cham_uplo_t int k, m, n, l, Am, An; int tempmm, tempnn, tempkn, tempkm; int myrank = RUNTIME_comm_rank( chamctxt ); - int reduceC[ C->mt * C->nt ]; + int8_t *reduceC = calloc( C->mt * C->nt, sizeof(int8_t) ); /* Set C tiles to redux mode */ for (n = 0; n < C->nt; n++) { for (m = 0; m < C->mt; m++) { - reduceC[ n * C->mt + m ] = 0; - /* The node owns the C tile. */ if ( C->get_rankof( C(m, n) ) == myrank ) { reduceC[ n * C->mt + m ] = 1; @@ -278,6 +276,8 @@ chameleon_pzhemm_Astat( CHAM_context_t *chamctxt, cham_side_t side, cham_uplo_t } } options->forcesub = 0; + free( reduceC ); + (void)chamctxt; } diff --git a/compute/pzsymm.c b/compute/pzsymm.c index 481b32be8..f4b76fb07 100644 --- a/compute/pzsymm.c +++ b/compute/pzsymm.c @@ -49,13 +49,11 @@ chameleon_pzsymm_Astat( CHAM_context_t *chamctxt, cham_side_t side, cham_uplo_t int k, m, n, l, Am, An; int tempmm, tempnn, tempkn, tempkm; int myrank = RUNTIME_comm_rank( chamctxt ); - int reduceC[ C->mt * C->nt ]; + int8_t *reduceC = calloc( C->mt * C->nt, sizeof(int8_t) ); /* Set C tiles to redux mode */ for (n = 0; n < C->nt; n++) { for (m = 0; m < C->mt; m++) { - reduceC[ n * C->mt + m ] = 0; - /* The node owns the C tile. */ if ( C->get_rankof( C(m, n) ) == myrank ) { reduceC[ n * C->mt + m ] = 1; @@ -279,6 +277,8 @@ chameleon_pzsymm_Astat( CHAM_context_t *chamctxt, cham_side_t side, cham_uplo_t } } options->forcesub = 0; + free( reduceC ); + (void)chamctxt; } -- GitLab