Explorar el Código

sched_policies: do not allocate too much memory for ws sched

Using starpu_worker_get_count() to get the maximum of number of workers instead
of NMAXWORKS will decrease the amount of memory used by this scheduler.
Samuel Pitoiset hace 10 años
padre
commit
5b5aec21b3
Se han modificado 1 ficheros con 2 adiciones y 1 borrados
  1. 2 1
      src/sched_policies/work_stealing_policy.c

+ 2 - 1
src/sched_policies/work_stealing_policy.c

@@ -433,7 +433,8 @@ static void initialize_ws_policy(unsigned sched_ctx_id)
 	ws->last_pop_worker = 0;
 	ws->last_push_worker = 0;
 
-	ws->queue_array = (struct _starpu_deque_jobq**)malloc(STARPU_NMAXWORKERS*sizeof(struct _starpu_deque_jobq*));
+	unsigned nw = starpu_worker_get_count();
+	ws->queue_array = (struct _starpu_deque_jobq**)malloc(nw*sizeof(struct _starpu_deque_jobq*));
 }
 
 static void deinit_ws_policy(unsigned sched_ctx_id)