Commit d73d6858 authored by THIBAULT Samuel's avatar THIBAULT Samuel

Use starpu_mpi_init_conf when available instead of starpu_mpi_init

to automatically the MPI thread to a free core.
parent 1f79c2a7
......@@ -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}")
......
Subproject commit f99bada1af8f986d91f651eb9748d0ac6367ef5e
Subproject commit dd40b792c7f27bd8644e7837b17dbc876f92eec7
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment