18 #if !defined(PASTIX_WITH_STARPU)
19 #error "This file should not be compiled if Starpu is not enabled"
24 #if defined(PASTIX_STARPU_HETEROPRIO)
25 #include <starpu_heteroprio.h>
36 init_heteroprio(
unsigned ctx )
40 starpu_heteroprio_set_nb_prios( ctx, STARPU_CPU_WORKER, BucketNumber );
42 for ( idx = 0; idx < BucketNumber; ++idx ) {
43 starpu_heteroprio_set_mapping( ctx, STARPU_CPU_WORKER, idx, idx );
45 starpu_heteroprio_set_faster_arch( ctx, STARPU_CPU_WORKER, idx );
47 if ( starpu_cuda_worker_get_count() ) {
48 const int cuda_matching[] = { BucketGEMM2D, BucketTRSM2D, BucketGEMM1D };
49 const float cuda_factor = 125.0f / starpu_cpu_worker_get_count();
50 const float cuda_factors[] = { cuda_factor, cuda_factor, cuda_factor };
52 starpu_heteroprio_set_nb_prios( ctx, STARPU_CUDA_WORKER, 3 );
54 for ( idx = 0; idx < 3; ++idx ) {
56 starpu_heteroprio_set_mapping( ctx, STARPU_CUDA_WORKER, idx, cuda_matching[idx] );
58 starpu_heteroprio_set_faster_arch( ctx, STARPU_CUDA_WORKER, cuda_matching[idx] );
60 starpu_heteroprio_set_arch_slow_factor(
61 ctx, STARPU_CPU_WORKER, cuda_matching[idx], cuda_factors[idx] );
93 int *argc,
char **argv[],
96 struct starpu_conf *conf;
100 if (
pastix->starpu != NULL )
103 pastix->starpu = malloc(
sizeof(
struct starpu_conf));
104 starpu_conf_init(
pastix->starpu );
106 #if defined(PASTIX_STARPU_PROFILING_LOG)
108 profiling_log_init(
pastix->dir_local );
112 #if !defined(PASTIX_WITH_CUDA)
121 #if defined(PASTIX_STARPU_HETEROPRIO)
125 conf->sched_policy_name =
"heteroprio";
126 #if !defined(HAVE_STARPU_SCHED_POLICY_CALLBACK )
127 conf->sched_policy_init = &init_heteroprio;
129 conf->sched_policy_callback = &init_heteroprio;
133 if (conf->ncuda > 0) {
134 #if defined(PASTIX_GENERATE_MODEL)
135 pastix_print(
pastix->procnum, 0,
136 "WARNING: PaStiX compiled with -DPASTIX_GENERATE_MODEL forces:\n"
137 " - a single event per stream\n"
138 " - a single stream per GPU\n"
139 " - restore the automatic detection of the number of threads\n" );
143 pastix_setenv(
"STARPU_NWORKER_PER_CUDA",
"1", 1 );
144 pastix_setenv(
"STARPU_CUDA_PIPELINE",
"0", 1 );
147 conf->sched_policy_name =
"dmdas";
156 #if (STARPU_MAJOR_VERSION > 1) || ((STARPU_MAJOR_VERSION == 1) && (STARPU_MINOR_VERSION >= 2))
157 conf->sched_policy_name =
"lws";
159 conf->sched_policy_name =
"ws";
164 if ( bindtab != NULL ) {
168 conf->use_explicit_workers_bindid = 1;
170 for(i=0; i < pastix_imin( iparm[
IPARM_THREAD_NBR], STARPU_NMAXWORKERS ); i++) {
171 conf->workers_bindid[i] = bindtab[i];
174 #if defined(STARPU_USE_FXT)
175 starpu_fxt_autostart_profiling( 0 );
177 rc = starpu_init( conf );
179 starpu_malloc_on_node_set_default_flags( STARPU_MAIN_RAM,
181 | STARPU_MALLOC_COUNT
182 #
if defined(PASTIX_STARPU_SIMULATION)
183 | STARPU_MALLOC_SIMULATION_FOLDED
187 #if defined(PASTIX_WITH_MPI)
188 #if defined(PASTIX_DEBUG_MPI) && !defined(PASTIX_STARPU_SIMULATION)
191 MPI_Initialized( &flag );
195 starpu_mpi_init_comm( argc, argv, 0,
pastix->inter_node_comm );
200 #if defined(PASTIX_WITH_CUDA) && !defined(PASTIX_STARPU_SIMULATION)
201 starpu_cublas_init();
207 assert(
pastix->starpu != NULL );
209 (void)argc; (void)argv;
229 if (
pastix->starpu != NULL ) {
235 profiling_log_fini();
237 #if defined(PASTIX_WITH_MPI)
238 starpu_mpi_shutdown();
240 #if defined(PASTIX_WITH_CUDA) && !defined(PASTIX_STARPU_SIMULATION)
241 starpu_cublas_shutdown();
BEGIN_C_DECLS typedef int pastix_int_t
BEGIN_C_DECLS int pastix(pastix_data_t **pastix_data, PASTIX_Comm pastix_comm, pastix_int_t n, pastix_int_t *colptr, pastix_int_t *rowptr, void *values, pastix_int_t *perm, pastix_int_t *invp, void *B, pastix_int_t nrhs, pastix_int_t *iparm, double *dparm)
Main function for compatibility with former releases.
void pastix_gendirectories(pastix_data_t *pastix_data)
Generate a unique temporary directory to store output files.
void pastix_starpu_interface_init()
Initialize the interface ID.
void pastix_starpu_init(pastix_data_t *pastix, int *argc, char **argv[], const int *bindtab)
Startup the StarPU runtime system.
void pastix_starpu_interface_fini()
Finalize the interface and reset the ID.
void pastix_starpu_finalize(pastix_data_t *pastix)
Finalize the StarPU runtime system.
int pastix_starpu_tag_init(pastix_data_t *pastix)
Initialize the StarPU tags manager.
static void profiling_display_allinfo()
Displays all profiling data collected into all measurements tables of the profile_list.
Main PaStiX data structure.