From e39d4c4c563942e1e66c8c728e24206db2607676 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] Check that CHAMELEON_Init() was successful in testing --- control/control.c | 5 +++-- testing/chameleon_ztesting.c | 7 ++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/control/control.c b/control/control.c index e875a9003..61068fdb5 100644 --- a/control/control.c +++ b/control/control.c @@ -82,6 +82,7 @@ int __chameleon_init(int cores, int gpus) int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker) { CHAM_context_t *chamctxt; + int res = -1; /* Create context and insert in the context map */ chamctxt = chameleon_context_create(); @@ -113,9 +114,9 @@ int __chameleon_initpar(int ncpus, int ncudas, int nthreads_per_worker) } #endif - RUNTIME_init( chamctxt, ncpus, ncudas, nthreads_per_worker ); + res = RUNTIME_init( chamctxt, ncpus, ncudas, nthreads_per_worker ); - return CHAMELEON_SUCCESS; + return res == 0 ? CHAMELEON_SUCCESS : res; } /** diff --git a/testing/chameleon_ztesting.c b/testing/chameleon_ztesting.c index 6aa508d5a..39d06bc7a 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