From 445057a75f779b2a8f0f16c171af4582e2b45ff7 Mon Sep 17 00:00:00 2001
From: Philippe SWARTVAGHER <philippe.swartvagher@inria.fr>
Date: Wed, 21 Jul 2021 16:58:58 +0200
Subject: [PATCH 1/2] runtime: Fix returned value by RUNTIME_Init and chack
 it's returned value when called

---
 control/control.c                        |  4 +---
 include/chameleon/runtime.h              |  4 ++--
 runtime/openmp/control/runtime_control.c |  3 +--
 runtime/parsec/control/runtime_control.c |  7 ++++---
 runtime/quark/control/runtime_control.c  |  4 ++--
 runtime/starpu/codelets/codelet_zgemm.c  |  2 +-
 runtime/starpu/control/runtime_control.c | 20 ++++++++++++--------
 testing/chameleon_ztesting.c             |  7 ++++++-
 8 files changed, 29 insertions(+), 22 deletions(-)

diff --git a/control/control.c b/control/control.c
index e875a9003..5fc134b38 100644
--- a/control/control.c
+++ b/control/control.c
@@ -113,9 +113,7 @@ int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker)
     }
 #endif
 
-    RUNTIME_init( chamctxt, ncpus, ncudas, nthreads_per_worker );
-
-    return CHAMELEON_SUCCESS;
+    return RUNTIME_init( chamctxt, ncpus, ncudas, nthreads_per_worker );
 }
 
 /**
diff --git a/include/chameleon/runtime.h b/include/chameleon/runtime.h
index 622f3ce75..f3e26f4f7 100644
--- a/include/chameleon/runtime.h
+++ b/include/chameleon/runtime.h
@@ -113,8 +113,8 @@ RUNTIME_disable( void *runtime_ctxt, int option );
  *            defines a better binding of the workers.
  *            -1 to disable, or > 0 to enable.
  *
- * @retval -1 on failure to initialize the runtime.
- * @retval >0 on success to initialize the runtime.
+ * @retval CHAMELEON_SUCCESS on success to initialize the runtime.
+ * @retval CHAMELEON_ERR_NOT_INITIALIZED on failure to initialize the runtime.
  *
  */
 int
diff --git a/runtime/openmp/control/runtime_control.c b/runtime/openmp/control/runtime_control.c
index 54f5f2e36..dd4491153 100644
--- a/runtime/openmp/control/runtime_control.c
+++ b/runtime/openmp/control/runtime_control.c
@@ -31,7 +31,6 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
                   int ncudas,
                   int nthreads_per_worker )
 {
-    int hres = 0;
     if ( ncudas > 0 ) {
         chameleon_warning( "RUNTIME_init_scheduler(OpenMP)", "GPUs are not supported for now");
     }
@@ -43,7 +42,7 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
     chamctxt->nworkers = ncpus;
     chamctxt->nthreads_per_worker = nthreads_per_worker;
 
-    return hres;
+    return CHAMELEON_SUCCESS;
 }
 
 /**
diff --git a/runtime/parsec/control/runtime_control.c b/runtime/parsec/control/runtime_control.c
index e1e38570f..e673bdcef 100644
--- a/runtime/parsec/control/runtime_control.c
+++ b/runtime/parsec/control/runtime_control.c
@@ -34,7 +34,8 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
                   int ncudas,
                   int nthreads_per_worker )
 {
-    int hres = -1, default_ncores = -1;
+    int hres = CHAMELEON_ERR_NOT_INITIALIZED;
+    int default_ncores = -1;
     int *argc = (int *)malloc(sizeof(int));
     *argc = 0;
 
@@ -45,10 +46,10 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
     chamctxt->parallel_enabled = CHAMELEON_TRUE;
     chamctxt->schedopt = (void *)parsec_init(default_ncores, argc, NULL);
 
-    if(NULL != chamctxt->schedopt) {
+    if ( NULL != chamctxt->schedopt ) {
         chamctxt->nworkers = ncpus;
         chamctxt->nthreads_per_worker = nthreads_per_worker;
-        hres = 0;
+        hres = CHAMELEON_SUCCESS;
     }
 
     free(argc);
diff --git a/runtime/quark/control/runtime_control.c b/runtime/quark/control/runtime_control.c
index f6475dc03..21ba5cc4e 100644
--- a/runtime/quark/control/runtime_control.c
+++ b/runtime/quark/control/runtime_control.c
@@ -32,7 +32,7 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
                   int ncudas,
                   int nthreads_per_worker )
 {
-    int hres = -1;
+    int hres = CHAMELEON_ERR_NOT_INITIALIZED;
     if ( ncudas > 0 ) {
         chameleon_warning( "RUNTIME_init_scheduler(quark)", "GPUs are not supported for now");
     }
@@ -46,7 +46,7 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
     if(NULL != chamctxt->schedopt) {
         chamctxt->nworkers = ncpus;
         chamctxt->nthreads_per_worker = nthreads_per_worker;
-        hres = 0;
+        hres = CHAMELEON_SUCCESS;
     }
 
     return hres;
diff --git a/runtime/starpu/codelets/codelet_zgemm.c b/runtime/starpu/codelets/codelet_zgemm.c
index ccf375fdf..39d242c01 100644
--- a/runtime/starpu/codelets/codelet_zgemm.c
+++ b/runtime/starpu/codelets/codelet_zgemm.c
@@ -137,7 +137,7 @@ void INSERT_TASK_zgemm( const RUNTIME_option_t *options,
     CHAMELEON_ACCESS_RW(C, Cm, Cn);
     CHAMELEON_END_ACCESS_DECLARATION;
 
-    /* Callback fro profiling information */
+    /* Callback for profiling information */
     callback = options->profiling ? cl_zgemm_callback : NULL;
 
     /* Fix the worker id */
diff --git a/runtime/starpu/control/runtime_control.c b/runtime/starpu/control/runtime_control.c
index 5f6ff018e..4cce08868 100644
--- a/runtime/starpu/control/runtime_control.c
+++ b/runtime/starpu/control/runtime_control.c
@@ -33,7 +33,8 @@
  */
 static int chameleon_starpu_init( starpu_conf_t *conf )
 {
-    int hres;
+    int hres = CHAMELEON_SUCCESS;
+    int rc;
 
 #if defined(STARPU_USE_FXT)
     starpu_fxt_autostart_profiling(0);
@@ -48,21 +49,23 @@ static int chameleon_starpu_init( starpu_conf_t *conf )
 #  endif
 
 #  if defined(HAVE_STARPU_MPI_INIT_CONF)
-        hres = starpu_mpi_init_conf(NULL, NULL, !flag, MPI_COMM_WORLD, conf);
+        rc = starpu_mpi_init_conf(NULL, NULL, !flag, MPI_COMM_WORLD, conf);
 #  else
-        hres = starpu_init(conf);
-        if (hres < 0) {
-            return hres;
+        rc = starpu_init(conf);
+        if (rc < 0) {
+            return CHAMELEON_ERR_NOT_INITIALIZED;
         }
         starpu_mpi_init(NULL, NULL, !flag);
 #  endif
     }
 #else
 
-    hres = starpu_init(conf);
+    rc = starpu_init(conf);
 
 #endif
-
+    if ( rc == -ENODEV ) {
+        hres = CHAMELEON_ERR_NOT_INITIALIZED;
+    }
     return hres;
 }
 
@@ -72,7 +75,8 @@ int RUNTIME_init( CHAM_context_t *chamctxt,
                   int nthreads_per_worker )
 {
     starpu_conf_t *conf = (starpu_conf_t*)(chamctxt->schedopt);
-    int hres = -1;
+    int hres = CHAMELEON_ERR_NOT_INITIALIZED;
+    int rc = 0;
 
     /* StarPU was already initialized by an external library */
     if (conf == NULL) {
diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c
index 6aa508d5a..ca4850622 100644
--- a/testing/chameleon_ztesting.c
+++ b/testing/chameleon_ztesting.c
@@ -523,7 +523,12 @@ int main (int argc, char **argv) {
     profile   = parameters_getvalue_int( "profile" );
     forcegpu  = parameters_getvalue_int( "forcegpu" );
 
-    CHAMELEON_Init( ncores, ngpus );
+    rc = CHAMELEON_Init( ncores, ngpus );
+
+    if ( rc != CHAMELEON_SUCCESS ) {
+        fprintf( stderr, "CHAMELEON_Init failed and returned %d.\n", rc );
+        return EXIT_FAILURE;
+    }
 
     /* Set ncores to the right value */
     if ( ncores == -1 ) {
-- 
GitLab


From 76be91b06247a6c2188c44e250f456db474f8afb Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Thu, 29 Jul 2021 00:42:10 +0200
Subject: [PATCH 2/2] ci: Enable detached build, and add the interuptible flag

---
 .gitlab/build.yml       |  3 +--
 .gitlab/common.yml      | 14 ++++++++------
 .gitlab/coverage.yml    |  6 ++----
 .gitlab/coverity.yml    |  6 +-----
 .gitlab/test_starpu.yml |  3 +--
 5 files changed, 13 insertions(+), 19 deletions(-)

diff --git a/.gitlab/build.yml b/.gitlab/build.yml
index d31150683..163ce7258 100644
--- a/.gitlab/build.yml
+++ b/.gitlab/build.yml
@@ -61,10 +61,9 @@ build_starpu_simgrid:
     VERSION: starpu_simgrid
 
 build_starpu_macosx:
+  extends: .only-master
   stage: build
   tags: ['macosx']
-  except:
-    - schedules
   artifacts:
     untracked: true
     name: build_starpu_macosx
diff --git a/.gitlab/common.yml b/.gitlab/common.yml
index 8d322c93c..91d5ee172 100644
--- a/.gitlab/common.yml
+++ b/.gitlab/common.yml
@@ -3,21 +3,26 @@
 #
 ---
 .only-master:
+  image: registry.gitlab.inria.fr/solverstack/docker/distrib
+  interruptible: true
   only:
     - master@solverstack/chameleon
     - /^ci-.*$/
+  except:
+    - schedules
 
 .only-branches:
+  image: registry.gitlab.inria.fr/solverstack/docker/distrib
+  interruptible: true
   only:
-    - branches
+    - merge_requests
     - master@solverstack/chameleon
     - /^ci-.*$/
   except:
-    - master
     - schedules
 
 .build_script_template:
-  image: registry.gitlab.inria.fr/solverstack/docker/distrib
+  extends: .only-branches
   stage: build
   tags: ["linux"]
   script:
@@ -41,7 +46,6 @@
     - schedules
 
 .test_script_template:
-  image: registry.gitlab.inria.fr/solverstack/docker/distrib
   stage: test
   tags: ["linux"]
   script:
@@ -62,8 +66,6 @@
     - lcov --directory build-$VERSION --capture --output-file ./${LOGNAME}.lcov
     - (cd build-$VERSION && lcov --directory . --capture --output-file ../bis_${LOGNAME}.lcov)
     - xsltproc -o report.xml /home/gitlab/ctest-to-junit.xsl build-$VERSION/Testing/**/Test.xml
-  except:
-    - schedules
 
 .bench_plafrim_common:
   only:
diff --git a/.gitlab/coverage.yml b/.gitlab/coverage.yml
index 6e8b7e2af..7cc9601d6 100644
--- a/.gitlab/coverage.yml
+++ b/.gitlab/coverage.yml
@@ -17,7 +17,5 @@ coverage:
     - for name in $( ls -1 bis_chameleon_*.lcov | grep -v simgrid); do export INPUT_FILES="$INPUT_FILES -a $name"; done
     - lcov $INPUT_FILES -o bis_chameleon.lcov
     - lcov --summary bis_chameleon.lcov
-  except:
-    - master
-    - /^ci-.*$/
-    - schedules
+  only:
+    - merge_requests
diff --git a/.gitlab/coverity.yml b/.gitlab/coverity.yml
index b5c666c67..f9f7b7256 100644
--- a/.gitlab/coverity.yml
+++ b/.gitlab/coverity.yml
@@ -1,6 +1,6 @@
 ---
 coverity:
-  image: registry.gitlab.inria.fr/solverstack/docker/distrib
+  extends: .only-master
   stage: analyse
   tags: ["linux"]
   dependencies: []
@@ -23,7 +23,3 @@ coverity:
            --form version="`git rev-parse --short HEAD`"
            --form description=""
            https://scan.coverity.com/builds?project=Chameleon
-  only:
-    - master@solverstack/chameleon
-  except:
-    - schedules
diff --git a/.gitlab/test_starpu.yml b/.gitlab/test_starpu.yml
index ab04956a9..492c5fad1 100644
--- a/.gitlab/test_starpu.yml
+++ b/.gitlab/test_starpu.yml
@@ -90,10 +90,9 @@ test_starpu_mpi_z:
     TESTS_RESTRICTION: "-R \"_${CATEGORY}_${PRECISION}\""
 
 test_starpu_shm_s_macosx:
+  extends: .only-master
   stage: test
   tags: ['macosx']
-  except:
-    - schedules
   needs: [build_starpu_macosx]
   dependencies:
     - build_starpu_macosx
-- 
GitLab