From e2c471c27e71e08dd97306b2fa3c6b152dcddcca Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Mon, 9 Dec 2024 22:37:43 +0100
Subject: [PATCH] getrf: Add a ringswitch parameter to define when to switch
 from classic bcast to ring bcast

---
 compute/zgetrf.c    |  3 +++
 control/compute_z.h | 11 ++++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/compute/zgetrf.c b/compute/zgetrf.c
index 9c3377bda..514e89d3e 100644
--- a/compute/zgetrf.c
+++ b/compute/zgetrf.c
@@ -27,6 +27,7 @@
  *
  */
 #include "control/common.h"
+#include <limits.h>
 
 /**
  ********************************************************************************
@@ -103,6 +104,8 @@ CHAMELEON_zgetrf_WS_Alloc( const CHAM_desc_t *A )
         ws->batch_size = CHAMELEON_BATCH_SIZE;
     }
 
+    ws->ringswitch = chameleon_getenv_get_value_int( "CHAMELEON_GETRF_RINGSWITCH", INT_MAX );
+
     /* Allocation of U for permutation of the panels */
     if ( ws->alg == ChamGetrfNoPivPerColumn ) {
         chameleon_desc_init( &(ws->U), CHAMELEON_MAT_ALLOC_TILE,
diff --git a/control/compute_z.h b/control/compute_z.h
index f1002522d..b75c303a1 100644
--- a/control/compute_z.h
+++ b/control/compute_z.h
@@ -44,12 +44,13 @@ struct chameleon_pzgemm_s {
  */
 struct chameleon_pzgetrf_s {
     cham_getrf_t   alg;
-    int            ib;         /**< Internal blocking parameter */
-    int            batch_size; /**< Batch size for the panel    */
+    int            ib;         /**< Internal blocking parameter                   */
+    int            batch_size; /**< Batch size for the panel                      */
+    int            ringswitch; /**< Define when to switch to ring bcast           */
     CHAM_desc_t    U;
-    CHAM_desc_t    Up; /**< Workspace used for the panel factorization    */
-    CHAM_desc_t    Wu; /**< Workspace used for the permutation and update */
-    CHAM_desc_t    Wl; /**< Workspace used the update                     */
+    CHAM_desc_t    Up;         /**< Workspace used for the panel factorization    */
+    CHAM_desc_t    Wu;         /**< Workspace used for the permutation and update */
+    CHAM_desc_t    Wl;         /**< Workspace used the update                     */
     int           *proc_involved;
     unsigned int   involved;
     int            np_involved;
-- 
GitLab