|
@@ -392,7 +392,7 @@ starpu_conf_init(&conf);
|
|
|
conf.sched_policy_name = "heteroprio";
|
|
|
// Inform StarPU about the function that will init the priorities in Heteroprio
|
|
|
// where init_heteroprio is a function to implement
|
|
|
-conf.sched_policy_init = &init_heteroprio;
|
|
|
+conf.sched_policy_callback = &init_heteroprio;
|
|
|
// Do other things with conf if needed, then init StarPU
|
|
|
starpu_init(&conf);
|
|
|
\endcode
|
|
@@ -400,31 +400,31 @@ starpu_init(&conf);
|
|
|
\code{.c}
|
|
|
void init_heteroprio(unsigned sched_ctx) {
|
|
|
// CPU uses 5 buckets and visits them in the natural order
|
|
|
- starpu_heteroprio_set_nb_prios(ctx, STARPU_CPU_WORKER, 5);
|
|
|
+ starpu_heteroprio_set_nb_prios(sched_ctx, STARPU_CPU_WORKER, 5);
|
|
|
// It uses direct mapping idx => idx
|
|
|
for(unsigned idx = 0; idx < 5; ++idx){
|
|
|
- starpu_heteroprio_set_mapping(ctx, STARPU_CPU_WORKER, idx, idx);
|
|
|
+ starpu_heteroprio_set_mapping(sched_ctx, STARPU_CPU_WORKER, idx, idx);
|
|
|
// If there is no CUDA worker we must tell that CPU is faster
|
|
|
- starpu_heteroprio_set_faster_arch(ctx, STARPU_CPU_WORKER, idx);
|
|
|
+ starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_CPU_WORKER, idx);
|
|
|
}
|
|
|
|
|
|
if(starpu_cuda_worker_get_count()){
|
|
|
// CUDA is enabled and uses 2 buckets
|
|
|
- starpu_heteroprio_set_nb_prios(ctx, STARPU_CUDA_WORKER, 2);
|
|
|
+ starpu_heteroprio_set_nb_prios(sched_ctx, STARPU_CUDA_WORKER, 2);
|
|
|
// CUDA will first look at bucket 1
|
|
|
- starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_WORKER, 0, 1);
|
|
|
+ starpu_heteroprio_set_mapping(sched_ctx, STARPU_CUDA_WORKER, 0, 1);
|
|
|
// CUDA will then look at bucket 2
|
|
|
- starpu_heteroprio_set_mapping(ctx, STARPU_CUDA_WORKER, 1, 2);
|
|
|
+ starpu_heteroprio_set_mapping(sched_ctx, STARPU_CUDA_WORKER, 1, 2);
|
|
|
|
|
|
// For bucket 1 CUDA is the fastest
|
|
|
- starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_WORKER, 1);
|
|
|
+ starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_CUDA_WORKER, 1);
|
|
|
// And CPU is 30 times slower
|
|
|
- starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_WORKER, 1, 30.0f);
|
|
|
+ starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_CPU_WORKER, 1, 30.0f);
|
|
|
|
|
|
// For bucket 0 CUDA is the fastest
|
|
|
- starpu_heteroprio_set_faster_arch(ctx, STARPU_CUDA_WORKER, 0);
|
|
|
+ starpu_heteroprio_set_faster_arch(sched_ctx, STARPU_CUDA_WORKER, 0);
|
|
|
// And CPU is 20 times slower
|
|
|
- starpu_heteroprio_set_arch_slow_factor(ctx, STARPU_CPU_WORKER, 0, 20.0f);
|
|
|
+ starpu_heteroprio_set_arch_slow_factor(sched_ctx, STARPU_CPU_WORKER, 0, 20.0f);
|
|
|
}
|
|
|
}
|
|
|
\endcode
|