瀏覽代碼

properly clean some tasks

Samuel Thibault 9 年之前
父節點
當前提交
7d3df580b6

+ 1 - 1
src/core/jobs.c

@@ -55,7 +55,7 @@ void _starpu_job_fini(void)
 	if (max_memory_use)
 	{
 		_STARPU_DISP("Memory used for tasks: %lu MiB\n", (unsigned long) (maxnjobs * (sizeof(struct starpu_task) + sizeof(struct _starpu_job))) >> 20);
-		STARPU_ASSERT(njobs == 0);
+		STARPU_ASSERT_MSG(njobs == 0, "Some tasks have not been cleaned, did you forget to call starpu_task_destroy or starpu_task_clean?");
 	}
 }
 

+ 12 - 0
tests/datawizard/interfaces/multiformat/advanced/multiformat_cuda_opencl.c

@@ -56,7 +56,11 @@ test(void)
 	task_cuda->handles[0] = handle;
 	ret = starpu_task_submit(task_cuda);
 	if (ret != 0)
+	{
+		task_cuda->destroy = 0;
+		starpu_task_destroy(task_cuda);
 		return 1;
+	}
 
 	static struct starpu_codelet cl_opencl =
 	{
@@ -70,14 +74,22 @@ test(void)
 	task_opencl->handles[0] = handle;
 	ret = starpu_task_submit(task_opencl);
 	if (ret != 0)
+	{
+		task_opencl->destroy = 0;
+		starpu_task_destroy(task_opencl);
 		return 1;
+	}
 
 	task_cuda2 = starpu_task_create();
 	task_cuda2->cl = &cl_cuda;
 	task_cuda2->handles[0] = handle;
 	ret = starpu_task_submit(task_cuda2);
 	if (ret != 0)
+	{
+		task_cuda2->destroy = 0;
+		starpu_task_destroy(task_cuda2);
 		return 1;
+	}
 
 	return 0;
 }

+ 4 - 0
tests/datawizard/interfaces/multiformat/advanced/same_handle.c

@@ -80,7 +80,11 @@ create_and_submit_tasks(void)
 
 	ret = starpu_task_submit(task);
 	if (ret == -ENODEV)
+	{
+		task->destroy = 0;
+		starpu_task_destroy(task);
 		return -ENODEV;
+	}
 
 	return 0;
 }

+ 4 - 1
tests/main/regenerate.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2014  Université de Bordeaux
+ * Copyright (C) 2010-2014, 2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -121,6 +121,9 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "Total: %f secs\n", timing/1000000);
 	FPRINTF(stderr, "Per task: %f usecs\n", timing/ntasks);
 
+	starpu_task_wait_for_all();
+	starpu_task_clean(&task);
+
 	starpu_shutdown();
 
 	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */

+ 4 - 4
tests/main/regenerate_pipeline.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2015  Université de Bordeaux
+ * Copyright (C) 2010-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -155,13 +155,13 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "Total: %f secs\n", timing/1000000);
 	FPRINTF(stderr, "Per task: %f usecs\n", timing/(ntasks*3));
 
-	starpu_shutdown();
-
-	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */
+	starpu_task_wait_for_all();
 	starpu_task_clean(&taskA);
 	starpu_task_clean(&taskB);
 	starpu_task_clean(&taskC);
 
+	starpu_shutdown();
+
 	return EXIT_SUCCESS;
 
 enodev:

+ 4 - 1
tests/main/static_restartable_tag.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2009, 2010-2014  Université de Bordeaux
+ * Copyright (C) 2009, 2010-2014, 2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012  CNRS
  * Copyright (C) 2012 INRIA
  *
@@ -104,6 +104,9 @@ int main(int argc, char **argv)
 	FPRINTF(stderr, "Total: %f secs\n", timing/1000000);
 	FPRINTF(stderr, "Per task: %f usecs\n", timing/ntasks);
 
+	starpu_task_wait_for_all();
+	starpu_task_clean(&task);
+
 	starpu_shutdown();
 
 	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */

+ 4 - 4
tests/main/subgraph_repeat.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010, 2012-2015  Université de Bordeaux
+ * Copyright (C) 2010, 2012-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -157,14 +157,14 @@ int main(int argc, char **argv)
 	starpu_free(check_cnt);
 	starpu_data_unregister(check_data);
 
-	starpu_shutdown();
-
-	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */
+	starpu_task_wait_for_all();
 	starpu_task_clean(&taskA);
 	starpu_task_clean(&taskB);
 	starpu_task_clean(&taskC);
 	starpu_task_clean(&taskD);
 
+	starpu_shutdown();
+
 	return EXIT_SUCCESS;
 
 enodev:

+ 4 - 4
tests/main/subgraph_repeat_regenerate.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2015  Université de Bordeaux
+ * Copyright (C) 2010-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -177,14 +177,14 @@ int main(int argc, char **argv)
 	starpu_free(check_cnt);
 	starpu_data_unregister(check_data);
 
-	starpu_shutdown();
-
-	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */
+	starpu_task_wait_for_all();
 	starpu_task_clean(&taskA);
 	starpu_task_clean(&taskB);
 	starpu_task_clean(&taskC);
 	starpu_task_clean(&taskD);
 
+	starpu_shutdown();
+
 	return EXIT_SUCCESS;
 
 enodev:

+ 4 - 4
tests/main/subgraph_repeat_regenerate_tag.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2015  Université de Bordeaux
+ * Copyright (C) 2010-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -216,14 +216,14 @@ int main(int argc, char **argv)
 
 	starpu_data_unregister(check_data);
 
-	starpu_shutdown();
-
-	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */
+	starpu_task_wait_for_all();
 	starpu_task_clean(&taskA);
 	starpu_task_clean(&taskB);
 	starpu_task_clean(&taskC);
 	starpu_task_clean(&taskD);
 
+	starpu_shutdown();
+
 	return EXIT_SUCCESS;
 
 enodev:

+ 4 - 4
tests/main/subgraph_repeat_tag.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2010-2015  Université de Bordeaux
+ * Copyright (C) 2010-2016  Université de Bordeaux
  * Copyright (C) 2010, 2011, 2012, 2013  CNRS
  *
  * StarPU is free software; you can redistribute it and/or modify
@@ -187,14 +187,14 @@ int main(int argc, char **argv)
 
 	starpu_data_unregister(check_data);
 
-	starpu_shutdown();
-
-	/* Cleanup the statically allocated tasks after shutdown, as StarPU is still working on it after the callback */
+	starpu_task_wait_for_all();
 	starpu_task_clean(&taskA);
 	starpu_task_clean(&taskB);
 	starpu_task_clean(&taskC);
 	starpu_task_clean(&taskD);
 
+	starpu_shutdown();
+
 	return EXIT_SUCCESS;
 
 enodev: