From 31d99cd9800f2d5163cb3703c39721142bed8b2e Mon Sep 17 00:00:00 2001
From: THIBAULT Samuel <samuel.thibault@inria.fr>
Date: Tue, 22 Jan 2019 15:59:27 +0100
Subject: [PATCH] Notify StarPU of which data is not OOC, to avoid evicting it
 to the disk

---
 CMakeLists.txt                               |  4 ++++
 runtime/starpu/control/runtime_descriptor.c  | 10 ++++++++--
 runtime/starpu/include/chameleon_starpu.h.in |  1 +
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9ddfa195..d190850f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -653,6 +653,10 @@ if( CHAMELEON_SCHED_STARPU )
         if ( HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS )
             message("-- ${Blue}Add definition HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS${ColourReset}")
         endif()
+        check_function_exists(starpu_data_set_ooc_flag HAVE_STARPU_DATA_SET_OOC_FLAGS)
+        if ( HAVE_STARPU_DATA_SET_OOC_FLAGS )
+            message("-- ${Blue}Add definition HAVE_STARPU_DATA_SET_OOC_FLAGS${ColourReset}")
+        endif()
         check_function_exists(starpu_mpi_init_conf HAVE_STARPU_MPI_INIT_CONF)
         if ( HAVE_STARPU_MPI_INIT_CONF )
             message("-- ${Blue}Add definition HAVE_STARPU_MPI_INIT_CONF${ColourReset}")
diff --git a/runtime/starpu/control/runtime_descriptor.c b/runtime/starpu/control/runtime_descriptor.c
index 7cb55b12a..92b63ce46 100644
--- a/runtime/starpu/control/runtime_descriptor.c
+++ b/runtime/starpu/control/runtime_descriptor.c
@@ -4,7 +4,7 @@
  *
  * @copyright 2009-2014 The University of Tennessee and The University of
  *                      Tennessee Research Foundation. All rights reserved.
- * @copyright 2012-2018 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
+ * @copyright 2012-2019 Bordeaux INP, CNRS (LaBRI UMR 5800), Inria,
  *                      Univ. Bordeaux. All rights reserved.
  *
  ***
@@ -470,7 +470,13 @@ void *RUNTIME_data_getaddr( const CHAM_desc_t *A, int m, int n )
                                      BLKLDD(A, m),
                                      tempmm, tempnn, eltsze );
 
-#ifdef HAVE_STARPU_DATA_SET_COORDINATES
+#if defined(HAVE_STARPU_DATA_SET_OOC_FLAG)
+        if ( A->ooc == 0 ) {
+            starpu_data_set_ooc_flag( *ptrtile, 0 );
+        }
+#endif
+
+#if defined(HAVE_STARPU_DATA_SET_COORDINATES)
         starpu_data_set_coordinates( *ptrtile, 2, m, n );
 #endif
 
diff --git a/runtime/starpu/include/chameleon_starpu.h.in b/runtime/starpu/include/chameleon_starpu.h.in
index c7508388c..920aeeb8e 100644
--- a/runtime/starpu/include/chameleon_starpu.h.in
+++ b/runtime/starpu/include/chameleon_starpu.h.in
@@ -30,6 +30,7 @@
 #cmakedefine HAVE_STARPU_DATA_WONT_USE
 #cmakedefine HAVE_STARPU_DATA_SET_COORDINATES
 #cmakedefine HAVE_STARPU_MALLOC_ON_NODE_SET_DEFAULT_FLAGS
+#cmakedefine HAVE_STARPU_DATA_SET_OOC_FLAGS
 #cmakedefine HAVE_STARPU_MPI_DATA_MIGRATE
 #cmakedefine HAVE_STARPU_MPI_DATA_REGISTER
 #cmakedefine HAVE_STARPU_MPI_COMM_RANK
-- 
GitLab