Browse Source

replicate's initialized field is protected by the handle header lock

Samuel Thibault 4 years ago
parent
commit
dcaa90ea54
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/datawizard/coherency.c

+ 3 - 1
src/datawizard/coherency.c

@@ -1214,6 +1214,7 @@ void _starpu_fetch_task_input_tail(struct starpu_task *task, struct _starpu_job
 		int node = descrs[index].node;
 
 		struct _starpu_data_replicate *local_replicate;
+		int needs_init;
 
 		local_replicate = get_replicate(handle, mode, workerid, node);
 		_starpu_spin_lock(&handle->header_lock);
@@ -1234,12 +1235,13 @@ void _starpu_fetch_task_input_tail(struct starpu_task *task, struct _starpu_job
 					local_replicate->nb_tasks_prefetch--;
 			}
 		}
+		needs_init = !local_replicate->initialized;
 		_starpu_spin_unlock(&handle->header_lock);
 
 		_STARPU_TASK_SET_INTERFACE(task , local_replicate->data_interface, descrs[index].index);
 
 		/* If the replicate was not initialized yet, we have to do it now */
-		if (!(mode & STARPU_SCRATCH) && !local_replicate->initialized)
+		if (!(mode & STARPU_SCRATCH) && needs_init)
 			_starpu_redux_init_data_replicate(handle, local_replicate, workerid);
 
 #ifdef STARPU_USE_FXT