Sfoglia il codice sorgente

Make dmdar take into account the size of missing data, not only their number

Samuel Thibault 4 anni fa
parent
commit
5b4da530f7

+ 1 - 1
src/sched_policies/deque_modeling_policy_data_aware.c

@@ -259,7 +259,7 @@ static struct starpu_task *_dmda_pop_task(unsigned sched_ctx_id, int ready)
 #ifdef STARPU_VERBOSE
 		if (task->cl)
 		{
-			int non_ready = _starpu_count_non_ready_buffers(task, workerid);
+			size_t non_ready = _starpu_count_non_ready_buffers(task, workerid);
 			if (non_ready == 0)
 				dt->ready_task_cnt++;
 		}

+ 4 - 4
src/sched_policies/fifo_queues.c

@@ -352,7 +352,7 @@ int _starpu_normalize_prio(int priority, int num_priorities, unsigned sched_ctx_
 	return ((num_priorities-1)/(max-min)) * (priority - min);
 }
 
-int _starpu_count_non_ready_buffers(struct starpu_task *task, unsigned worker)
+size_t _starpu_count_non_ready_buffers(struct starpu_task *task, unsigned worker)
 {
 	int cnt = 0;
 	unsigned nbuffers = STARPU_TASK_GET_NBUFFERS(task);
@@ -369,7 +369,7 @@ int _starpu_count_non_ready_buffers(struct starpu_task *task, unsigned worker)
 		starpu_data_query_status(handle, buffer_node, NULL, &is_valid, NULL);
 
 		if (!is_valid)
-			cnt++;
+			cnt+=starpu_data_get_size(handle);
 	}
 
 	return cnt;
@@ -392,7 +392,7 @@ struct starpu_task *_starpu_fifo_pop_first_ready_task(struct _starpu_fifo_taskq
 
 		int first_task_priority = task->priority;
 
-		int non_ready_best = INT_MAX;
+		size_t non_ready_best = SIZE_MAX;
 
 		for (current = task; current; current = current->next)
 		{
@@ -400,7 +400,7 @@ struct starpu_task *_starpu_fifo_pop_first_ready_task(struct _starpu_fifo_taskq
 
 			if (priority >= first_task_priority)
 			{
-				int non_ready = _starpu_count_non_ready_buffers(current, workerid);
+				size_t non_ready = _starpu_count_non_ready_buffers(current, workerid);
 				if (non_ready < non_ready_best)
 				{
 					non_ready_best = non_ready;

+ 1 - 1
src/sched_policies/fifo_queues.h

@@ -68,7 +68,7 @@ struct starpu_task *_starpu_fifo_pop_task(struct _starpu_fifo_taskq *fifo, int w
 struct starpu_task *_starpu_fifo_pop_local_task(struct _starpu_fifo_taskq *fifo);
 struct starpu_task *_starpu_fifo_pop_every_task(struct _starpu_fifo_taskq *fifo, int workerid);
 int _starpu_normalize_prio(int priority, int num_priorities, unsigned sched_ctx_id);
-int _starpu_count_non_ready_buffers(struct starpu_task *task, unsigned worker);
+size_t _starpu_count_non_ready_buffers(struct starpu_task *task, unsigned worker);
 struct starpu_task *_starpu_fifo_pop_first_ready_task(struct _starpu_fifo_taskq *fifo_queue, unsigned workerid, int num_priorities);
 
 #endif // __FIFO_QUEUES_H__

+ 2 - 2
src/sched_policies/prio_deque.c

@@ -94,7 +94,7 @@ struct starpu_task *_starpu_prio_deque_deque_first_ready_task(struct _starpu_pri
 			return NULL;
 
 		int first_task_priority = task->priority;
-		int non_ready_best = INT_MAX;
+		size_t non_ready_best = SIZE_MAX;
 
 		for (current = starpu_task_prio_list_begin(&pdeque->list);
 		     current != starpu_task_prio_list_end(&pdeque->list);
@@ -104,7 +104,7 @@ struct starpu_task *_starpu_prio_deque_deque_first_ready_task(struct _starpu_pri
 
 			if (priority >= first_task_priority)
 			{
-				int non_ready = _starpu_count_non_ready_buffers(current, workerid);
+				size_t non_ready = _starpu_count_non_ready_buffers(current, workerid);
 				if (non_ready < non_ready_best)
 				{
 					non_ready_best = non_ready;