diff --git a/control/control.c b/control/control.c index e875a90030923c08c1bf6cc3da495aff4e661b3b..5fc134b38e3a54270b68677fc3f0db9ffbde0e4b 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 622f3ce758f9dd719aff8b4b7f100aa23584db91..f3e26f4f755f90bd564d3ac434a1a9cee30fc2dd 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 54f5f2e367a7041f635ade3e6e84b3ffd5bf4ec6..dd44911534f28b355d386777422a842010441b35 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 e1e38570fdfaa8fe760b8c3806cf803563c0b07d..e673bdcef7b979590b94348d8f89bb46e502cd17 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 f6475dc03ccecd6ccfefffaf671ee50fae35c2c9..21ba5cc4e2ca3c738813396b07850890e2d70d46 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 ccf375fdf200f9f322054202bd32225e6afa7f3a..39d242c01e4d6bf4f41eeb58a22f1b1e94612393 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 5f6ff018ecaf0b63d8776438f73ad10d0145e309..4cce0886869ad16597741401c095bbdba27f36fa 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 6aa508d5ac73892d9c51a15336b01238af2e70a3..ca48506224bd04bb66cc7b5839e5a72566f25fcf 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 ) {