瀏覽代碼

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 9 年之前
父節點
當前提交
5b5aec21b3
共有 1 個文件被更改,包括 2 次插入1 次删除
  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)