Browse Source

drop the right task from the current_tasks pipeline on CUDA

Olivier Aumage 8 years ago
parent
commit
b71f91a262
1 changed files with 22 additions and 4 deletions
  1. 22 4
      src/drivers/cuda/driver_cuda.c

+ 22 - 4
src/drivers/cuda/driver_cuda.c

@@ -900,13 +900,31 @@ int _starpu_cuda_driver_run_once(struct _starpu_worker_set *worker_set)
 		if (!_STARPU_CUDA_MAY_PERFORM(j))
 		if (!_STARPU_CUDA_MAY_PERFORM(j))
 		{
 		{
 			/* this is neither a cuda or a cublas task */
 			/* this is neither a cuda or a cublas task */
-			worker->ntasks--;
-			_starpu_set_current_task(NULL);
 			if (worker->pipeline_length)
 			if (worker->pipeline_length)
-				worker->current_tasks[worker->first_task] = NULL;
+			{
+				int j;
+				for (j = 0; j < worker->ntasks; j++)
+				{
+					const int j_mod = (j+worker->first_task)%STARPU_MAX_PIPELINE;
+					if (task == worker->current_tasks[j_mod])
+					{
+						worker->current_tasks[j_mod] = NULL;
+						if (j == 0)
+						{
+							worker->first_task = (worker->first_task + 1) % STARPU_MAX_PIPELINE;
+							_starpu_set_current_task(NULL);
+						}
+						break;
+					}
+				}
+				STARPU_ASSERT(j<worker->ntasks);
+			}
 			else
 			else
+			{
 				worker->current_task = NULL;
 				worker->current_task = NULL;
-			worker->first_task = (worker->first_task + 1) % STARPU_MAX_PIPELINE;
+				_starpu_set_current_task(NULL);
+			}
+			worker->ntasks--;
 			int res = _starpu_push_task_to_workers(task);
 			int res = _starpu_push_task_to_workers(task);
 			STARPU_ASSERT_MSG(res == 0, "_starpu_push_task_to_workers() unexpectedly returned = %d\n", res);
 			STARPU_ASSERT_MSG(res == 0, "_starpu_push_task_to_workers() unexpectedly returned = %d\n", res);
 			continue;
 			continue;