Browse Source

src/core/dependencies/data_concurrency.c: check a task defines a codelet before accessing its buffers

Nathalie Furmento 10 years ago
parent
commit
9abcc3b7d0
1 changed files with 7 additions and 3 deletions
  1. 7 3
      src/core/dependencies/data_concurrency.c

+ 7 - 3
src/core/dependencies/data_concurrency.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010-2015  Université de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013  Centre National de la Recherche Scientifique
+ * Copyright (C) 2010, 2011, 2012, 2013, 2015  Centre National de la Recherche Scientifique
  *
  * StarPU is free software; you can redistribute it and/or modify
  * it under the terms of the GNU Lesser General Public License as published by
@@ -251,9 +251,13 @@ static unsigned attempt_to_submit_data_request_from_job(struct _starpu_job *j, u
 /* No lock is held */
 static unsigned _submit_job_enforce_data_deps(struct _starpu_job *j, unsigned start_buffer_index)
 {
+	unsigned nbuffers;
 	unsigned buf;
 
-	unsigned nbuffers = STARPU_TASK_GET_NBUFFERS(j->task);
+	if (j->task->cl == NULL)
+		return 0;
+
+	nbuffers = STARPU_TASK_GET_NBUFFERS(j->task);
 	for (buf = start_buffer_index; buf < nbuffers; buf++)
 	{
 		if (buf)
@@ -282,7 +286,7 @@ void _starpu_submit_job_sort_data(struct _starpu_job *j)
 	struct starpu_codelet *cl = j->task->cl;
 	
 	if ((cl == NULL) || (STARPU_TASK_GET_NBUFFERS(j->task) == 0))
-		return 0;
+		return;
 	
 	/* Compute an ordered list of the different pieces of data so that we
 	 * grab then according to a total order, thus avoiding a deadlock