Explorar el Código

starpu_codelet_unpack_args: use 0 instead of NULL as an end marker

Nathalie Furmento hace 8 años
padre
commit
22b699d03c

+ 3 - 3
doc/doxygen/chapters/301_tasks.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -371,7 +371,7 @@ void func_cpu(void *descr[], void *_args)
         int ifactor;
         float ffactor;
 
-        starpu_codelet_unpack_args(_args, &ifactor, NULL);
+        starpu_codelet_unpack_args(_args, &ifactor, 0);
         starpu_codelet_unpack_args(_args, &ifactor, &ffactor);
 }
 \endcode
@@ -383,7 +383,7 @@ void func_cpu(void *descr[], void *_args)
         float ffactor;
 	char buffer[100];
 
-        starpu_codelet_unpack_args_and_copyleft(_args, buffer, 100, &ifactor, NULL);
+        starpu_codelet_unpack_args_and_copyleft(_args, buffer, 100, &ifactor, 0);
         starpu_codelet_unpack_args(buffer, &ffactor);
 }
 \endcode

+ 4 - 4
doc/doxygen/chapters/api/insert_task.doxy

@@ -1,7 +1,7 @@
 /*
  * This file is part of the StarPU Handbook.
  * Copyright (C) 2009--2011  Universit@'e de Bordeaux
- * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016  CNRS
+ * Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017  CNRS
  * Copyright (C) 2011, 2012 INRIA
  * See the file version.doxy for copying conditions.
  */
@@ -140,13 +140,13 @@ starpu_codelet_unpack_args().
 \ingroup API_Insert_Task
 Retrieve the arguments of type ::STARPU_VALUE associated to a
 task automatically created using the function starpu_task_insert(). If
-some parameter is NULL, unpacking will stop there and ignore the remaining
+any parameter's value is 0, unpacking will stop there and ignore the remaining
 parameters.
 
 \fn void starpu_codelet_unpack_args_and_copyleft(void *cl_arg, void *buffer, size_t buffer_size, ...)
 \ingroup API_Insert_Task
-Similar to starpu_codelet_unpack_args(), but if some parameter is
-NULL, copy the part of cl_arg that has not been read in buffer which
+Similar to starpu_codelet_unpack_args(), but if any parameter is
+0, copy the part of cl_arg that has not been read in buffer which
 can then be used in a later call to one of the unpack functions.
 
 \fn struct starpu_task *starpu_task_build(struct starpu_codelet *cl, ...)

+ 5 - 2
src/util/starpu_task_insert.c

@@ -1,7 +1,7 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
  * Copyright (C) 2010, 2012, 2014-2016  Université de Bordeaux
- * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016  CNRS
+ * Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016, 2017  CNRS
  *
  * 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
@@ -46,7 +46,10 @@ void _starpu_codelet_unpack_args_and_copyleft(char *cl_arg, void *_buffer, size_
 		void *argptr = va_arg(varg_list, void *);
 
 		/* If not reading all cl_args */
-		if(argptr == NULL)
+		// NULL was the initial end marker, we now use 0
+		// 0 and NULL should be the same value, but we
+		// keep both equalities for systems on which they could be different
+		if(argptr == 0 || argptr == NULL)
 			break;
 
 		size_t arg_size;

+ 5 - 5
tests/main/insert_task_value.c

@@ -1,6 +1,6 @@
 /* StarPU --- Runtime system for heterogeneous multicore architectures.
  *
- * Copyright (C) 2015, 2016  CNRS
+ * Copyright (C) 2015, 2016, 2017  CNRS
  *
  * 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
@@ -43,7 +43,7 @@ void func_cpu_int_float_multiple_unpack(void *descr[], void *_args)
 	float ffactor;
 	(void) descr;
 
-	starpu_codelet_unpack_args(_args, ifactor, NULL);
+	starpu_codelet_unpack_args(_args, ifactor, 0);
 	starpu_codelet_unpack_args(_args, ifactor, &ffactor);
 
 	FPRINTF(stderr, "[func_cpu_int_float_multiple_unpack] Values %d - %3.2f\n", ifactor[0], ffactor);
@@ -60,7 +60,7 @@ void func_cpu_int_float_unpack_copyleft(void *descr[], void *_args)
 
 	buffer_size = sizeof(int)+sizeof(float)+sizeof(size_t);
 	buffer = calloc(buffer_size, 1);
-	starpu_codelet_unpack_args_and_copyleft(_args, buffer, buffer_size, ifactor, NULL);
+	starpu_codelet_unpack_args_and_copyleft(_args, buffer, buffer_size, ifactor, 0);
 	starpu_codelet_unpack_args(buffer, &ffactor);
 
 	FPRINTF(stderr, "[func_cpu_int_float_unpack_copyleft] Values %d - %3.2f\n", ifactor[0], ffactor);
@@ -86,7 +86,7 @@ void func_cpu_float_int_multiple_unpack(void *descr[], void *_args)
 	float ffactor;
 	(void) descr;
 
-	starpu_codelet_unpack_args(_args, &ffactor, NULL);
+	starpu_codelet_unpack_args(_args, &ffactor, 0);
 	starpu_codelet_unpack_args(_args, &ffactor, ifactor);
 
 	FPRINTF(stderr, "[func_cpu_float_int_multiple_unpack] Values %d - %3.2f\n", ifactor[0], ffactor);
@@ -103,7 +103,7 @@ void func_cpu_float_int_unpack_copyleft(void *descr[], void *_args)
 
 	buffer_size = sizeof(int)+2048*sizeof(int)+sizeof(size_t);
 	buffer = calloc(buffer_size, 1);
-	starpu_codelet_unpack_args_and_copyleft(_args, buffer, buffer_size, &ffactor, NULL);
+	starpu_codelet_unpack_args_and_copyleft(_args, buffer, buffer_size, &ffactor, 0);
 	starpu_codelet_unpack_args(buffer, ifactor);
 
 	FPRINTF(stderr, "[func_cpu_float_int_multiple_unpack] Values %d - %3.2f\n", ifactor[0], ffactor);