diff --git a/CMakeLists.txt b/CMakeLists.txt index 96abc4568ac63a41f9b0bd9a011015666e21f7f3..52945bc4fd00a2a5e754451764cab7d547ad6131 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -669,6 +669,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_mpi_init_conf HAVE_STARPU_MPI_INIT_CONF) + if ( HAVE_STARPU_MPI_INIT_CONF ) + message("-- ${Blue}Add definition HAVE_STARPU_MPI_INIT_CONF${ColourReset}") + endif() check_function_exists(starpu_mpi_data_migrate HAVE_STARPU_MPI_DATA_MIGRATE) if ( HAVE_STARPU_MPI_DATA_MIGRATE ) message("-- ${Blue}Add definition HAVE_STARPU_MPI_DATA_MIGRATE${ColourReset}") diff --git a/cmake_modules/morse_cmake b/cmake_modules/morse_cmake index f99bada1af8f986d91f651eb9748d0ac6367ef5e..dd40b792c7f27bd8644e7837b17dbc876f92eec7 160000 --- a/cmake_modules/morse_cmake +++ b/cmake_modules/morse_cmake @@ -1 +1 @@ -Subproject commit f99bada1af8f986d91f651eb9748d0ac6367ef5e +Subproject commit dd40b792c7f27bd8644e7837b17dbc876f92eec7 diff --git a/runtime/starpu/control/runtime_control.c b/runtime/starpu/control/runtime_control.c index fac25fc0ad61984a97bf6937b9e2a10284e944fe..8b698faa7d1d6f5ac0db5ebcea2621ab9859ad74 100644 --- a/runtime/starpu/control/runtime_control.c +++ b/runtime/starpu/control/runtime_control.c @@ -25,6 +25,38 @@ /** * */ +static int chameleon_starpu_init( starpu_conf_t *conf ) +{ + int hres; + +#if defined(CHAMELEON_USE_MPI) + + { + int flag = 0; +# if !defined(CHAMELEON_SIMULATION) + MPI_Initialized( &flag ); +# endif + +# ifdef HAVE_STARPU_MPI_INIT_CONF + hres = starpu_mpi_init_conf(NULL, NULL, !flag, MPI_COMM_WORLD, conf); +# else + hres = starpu_init(conf); + if (hres < 0) { + return hres; + } + starpu_mpi_init(NULL, NULL, !flag); + } +# endif + +#else + + hres = starpu_init(conf); + +#endif + + return hres; +} + int RUNTIME_init( CHAM_context_t *chamctxt, int ncpus, int ncudas, @@ -66,7 +98,7 @@ int RUNTIME_init( CHAM_context_t *chamctxt, { chamctxt->parallel_enabled = CHAMELEON_FALSE; - hres = starpu_init( conf ); + hres = chameleon_starpu_init( conf ); } else { int worker; @@ -81,7 +113,7 @@ int RUNTIME_init( CHAM_context_t *chamctxt, conf->use_explicit_workers_bindid = 1; - hres = starpu_init( conf ); + hres = chameleon_starpu_init( conf ); chamctxt->nworkers = ncpus; chamctxt->nthreads_per_worker = nthreads_per_worker; @@ -95,16 +127,6 @@ int RUNTIME_init( CHAM_context_t *chamctxt, ); #endif -#if defined(CHAMELEON_USE_MPI) - { - int flag = 0; -#if !defined(CHAMELEON_SIMULATION) - MPI_Initialized( &flag ); -#endif - starpu_mpi_init(NULL, NULL, !flag); - } -#endif - #if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION) starpu_cublas_init(); #endif @@ -124,15 +146,17 @@ void RUNTIME_finalize( CHAM_context_t *chamctxt ) return; } -#if defined(CHAMELEON_USE_MPI) - starpu_mpi_shutdown(); -#endif - #if defined(CHAMELEON_USE_CUDA) && !defined(CHAMELEON_SIMULATION) starpu_cublas_shutdown(); #endif +#if defined(CHAMELEON_USE_MPI) + starpu_mpi_shutdown(); +#endif + +#if !defined(CHAMELEON_USE_MPI) || !defined(HAVE_STARPU_MPI_INIT_CONF) starpu_shutdown(); +#endif return; }