From b269b11917304bd3457bb491a4bb4d615c13321d Mon Sep 17 00:00:00 2001
From: Guillaume Sylvand <guillaume.sylvand@airbus.com>
Date: Wed, 12 Oct 2016 12:09:00 +0000
Subject: [PATCH] timing: add option --bigmat to choose if we allocate one big
 'mat' array or if the runtime allocates the tile one by one

---
 timing/timing.c | 10 ++++++++++
 timing/timing.h | 11 +++++++++--
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/timing/timing.c b/timing/timing.c
index 1c83dbd16..372ca8c3e 100644
--- a/timing/timing.c
+++ b/timing/timing.c
@@ -62,6 +62,10 @@
 #endif
 
 static int RunTest(int *iparam, _PREC *dparam, double *t_);
+static void* morse_getaddr_null(const MORSE_desc_t *A, int m, int n)
+{
+    return (void*)( NULL );
+}
 
 int ISEED[4] = {0,0,0,1};   /* initial seed for zlarnv() */
 
@@ -347,6 +351,7 @@ show_help(char *prog_name) {
             "  --gpus=X         Number of GPU workers (default: 0)\n"
             "\n"
             "  --[a]sync        Enable/Disable synchronous calls in wrapper function such as POTRI. (default: async)\n"
+            "  --[no]bigmat     Allocating one big mat or plenty of small (default: bigmat)\n"
             "  --[no]check      Check result (default: nocheck)\n"
             "  --[no]progress   Display progress indicator (default: noprogress)\n"
             "  --[no]gemm3m     Use gemm3m complex method (default: nogemm3m)\n"
@@ -468,6 +473,7 @@ main(int argc, char *argv[]) {
     iparam[IPARAM_NITER         ] = 1;
     iparam[IPARAM_WARMUP        ] = 1;
     iparam[IPARAM_CHECK         ] = 0;
+    iparam[IPARAM_BIGMAT        ] = 1;
     iparam[IPARAM_VERBOSE       ] = 0;
     iparam[IPARAM_AUTOTUNING    ] = 0;
     iparam[IPARAM_INPUTFMT      ] = 0;
@@ -512,6 +518,10 @@ main(int argc, char *argv[]) {
             iparam[IPARAM_CHECK] = 1;
         } else if (startswith( argv[i], "--nocheck" )) {
             iparam[IPARAM_CHECK] = 0;
+        } else if (startswith( argv[i], "--bigmat" )) {
+            iparam[IPARAM_BIGMAT] = 1;
+        } else if (startswith( argv[i], "--nobigmat" )) {
+            iparam[IPARAM_BIGMAT] = 0;
         } else if (startswith( argv[i], "--inv" )) {
             iparam[IPARAM_INVERSE] = 1;
         } else if (startswith( argv[i], "--noinv" )) {
diff --git a/timing/timing.h b/timing/timing.h
index a1636491c..3492c285d 100644
--- a/timing/timing.h
+++ b/timing/timing.h
@@ -12,6 +12,7 @@
 #define TIMING_H
 
 typedef double morse_time_t;
+static void* morse_getaddr_null(const MORSE_desc_t *A, int m, int n);
 
 enum iparam_timing {
     IPARAM_THRDNBR,        /* Number of cores                            */
@@ -28,6 +29,7 @@ enum iparam_timing {
     IPARAM_MB,             /* Number of rows in a tile                   */
     IPARAM_NITER,          /* Number of iteration of each test           */
     IPARAM_WARMUP,         /* Run one test to load dynamic libraries     */
+    IPARAM_BIGMAT,         /* Allocating one big mat or plenty of small  */
     IPARAM_CHECK,          /* Checking activated or not                  */
     IPARAM_VERBOSE,        /* How much noise do we want?                 */
     IPARAM_AUTOTUNING,     /* Disable/enable autotuning                  */
@@ -93,6 +95,7 @@ enum dparam_timing {
     int64_t Q     = iparam[IPARAM_Q];              \
     int64_t MT    = (M%MB==0) ? (M/MB) : (M/MB+1); \
     int64_t NT    = (N%NB==0) ? (N/NB) : (N/NB+1); \
+    int bigmat     = iparam[IPARAM_BIGMAT];         \
     int check     = iparam[IPARAM_CHECK];          \
     int loud      = iparam[IPARAM_VERBOSE];        \
     (void)M;(void)N;(void)K;(void)NRHS;            \
@@ -104,8 +107,12 @@ enum dparam_timing {
 #define PASTE_CODE_ALLOCATE_MATRIX_TILE(_desc_, _cond_, _type_, _type2_, _lda_, _m_, _n_) \
     MORSE_desc_t *_desc_ = NULL;                                        \
     if( _cond_ ) {                                                      \
-        MORSE_Desc_Create(&(_desc_), NULL, _type2_, MB, NB, MB*NB, _lda_, _n_, 0, 0, _m_, _n_, \
-                          P, Q);          \
+       if (!bigmat) \
+           MORSE_Desc_Create_User(&(_desc_), NULL, _type2_, MB, NB, MB*NB, _lda_, _n_, 0, 0, _m_, _n_, \
+                          P, Q, morse_getaddr_null, NULL, NULL);\
+       else \
+           MORSE_Desc_Create(&(_desc_), NULL, _type2_, MB, NB, MB*NB, _lda_, _n_, 0, 0, _m_, _n_, \
+                    P, Q);\
     }
 
 #define PASTE_CODE_FREE_MATRIX(_desc_)                                  \
-- 
GitLab