ソースを参照

make sure codelet structures are completely zeroed

Samuel Thibault 14 年 前
コミット
3c73626fb1
共有6 個のファイルを変更した7 個の追加9 個の削除を含む
  1. 2 2
      doc/starpu.texi
  2. 1 1
      examples/basic_examples/block.c
  3. 1 1
      examples/basic_examples/variable.c
  4. 1 2
      examples/heat/dw_sparse_cg.c
  5. 1 1
      examples/matvecmult/matvecmult.c
  6. 1 2
      examples/spmv/dw_spmv.c

+ 2 - 2
doc/starpu.texi

@@ -2993,8 +2993,8 @@ This partitions a 3D matrix along the X axis.
 @subsection @code{struct starpu_codelet} -- StarPU codelet structure
 @table @asis
 @item @emph{Description}:
-The codelet structure describes a kernel that is possibly implemented on
-various targets.
+The codelet structure describes a kernel that is possibly implemented on various
+targets. For compatibility, make sure to initialize the whole structure to zero.
 @item @emph{Fields}:
 @table @asis
 @item @code{where}:

+ 1 - 1
examples/basic_examples/block.c

@@ -32,7 +32,7 @@ typedef void (*device_func)(void **, void *);
 
 int execute_on(uint32_t where, device_func func, float *block, int pnx, int pny, int pnz, float multiplier)
 {
-	starpu_codelet cl;
+	starpu_codelet cl = {};
 	starpu_data_handle block_handle;
         int i;
 

+ 1 - 1
examples/basic_examples/variable.c

@@ -36,7 +36,7 @@ int main(int argc, char **argv)
 	unsigned i;
         float foo;
 	starpu_data_handle float_array_handle;
-	starpu_codelet cl;
+	starpu_codelet cl = {};
 
 	starpu_init(NULL);
         if (argc == 2) niter = atoi(argv[1]);

+ 1 - 2
examples/heat/dw_sparse_cg.c

@@ -22,8 +22,7 @@
 
 static struct starpu_task *create_task(starpu_tag_t id)
 {
-	starpu_codelet *cl = malloc(sizeof(starpu_codelet));
-		cl->model = NULL;
+	starpu_codelet *cl = calloc(sizeof(starpu_codelet));
 
 	struct starpu_task *task = starpu_task_create();
 		task->cl = cl;

+ 1 - 1
examples/matvecmult/matvecmult.c

@@ -112,7 +112,7 @@ int compareL2fe(const float* reference, const float* data, const unsigned int le
 
 int main(int argc, char **argv)
 {
-	starpu_codelet cl;
+	starpu_codelet cl = {};
 
 	struct starpu_conf conf = {
 		.ncpus = 0,

+ 1 - 2
examples/spmv/dw_spmv.c

@@ -263,8 +263,7 @@ void call_spmv_codelet_filters(void)
         }
 #endif
 
-	starpu_codelet cl;
-	memset(&cl, 0, sizeof(starpu_codelet));
+	starpu_codelet cl = {};
 
 	cl.where = STARPU_CPU|STARPU_CUDA|STARPU_OPENCL;
 	cl.cpu_func =  cpu_spmv;