瀏覽代碼

mpi_lu: Fix double-free

The implicit and outofcore versions were actually using cl_arg_free to
avoid the leak.
Samuel Thibault 4 年之前
父節點
當前提交
a2d69e3b64
共有 2 個文件被更改,包括 12 次插入4 次删除
  1. 4 0
      mpi/examples/mpi_lu/pxlu.c
  2. 8 4
      mpi/examples/mpi_lu/pxlu_kernels.c

+ 4 - 0
mpi/examples/mpi_lu/pxlu.c

@@ -274,6 +274,7 @@ static void create_task_11_real(unsigned k)
 	task->color = 0xffff00;
 
 	task->cl_arg = create_debug_info(k, k, k);
+	task->cl_arg_free = 1;
 
 	/* which sub-data is manipulated ? */
 	task->handles[0] = STARPU_PLU(get_block_handle)(k, k);
@@ -434,6 +435,7 @@ static void create_task_12_real(unsigned k, unsigned j)
 	task->color = 0x8080ff;
 
 	task->cl_arg = create_debug_info(j, j, k);
+	task->cl_arg_free = 1;
 
 	unsigned diag_block_is_local = (get_block_rank(k, k) == rank);
 
@@ -620,6 +622,7 @@ static void create_task_21_real(unsigned k, unsigned i)
 	task->color = 0x8080c0;
 
 	task->cl_arg = create_debug_info(i, i, k);
+	task->cl_arg_free = 1;
 
 	unsigned diag_block_is_local = (get_block_rank(k, k) == rank);
 
@@ -719,6 +722,7 @@ static void create_task_22_real(unsigned k, unsigned i, unsigned j)
 	task->color = 0x00ff00;
 
 	task->cl_arg = create_debug_info(i, j, k);
+	task->cl_arg_free = 1;
 
 	/* which sub-data is manipulated ? */
 

+ 8 - 4
mpi/examples/mpi_lu/pxlu_kernels.c

@@ -49,6 +49,8 @@ static inline void STARPU_PLU(common_u22)(void *descr[], int s, void *_args)
 	int rank;
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
 	fprintf(stderr, "KERNEL 22 %d - k = %u i = %u j = %u\n", rank, info->k, info->i, info->j);
+#else
+	(void)_args;
 #endif
 
 #ifdef STARPU_USE_CUDA
@@ -85,7 +87,6 @@ static inline void STARPU_PLU(common_u22)(void *descr[], int s, void *_args)
 #ifdef VERBOSE_KERNELS
 	fprintf(stderr, "KERNEL 22 %d - k = %u i = %u j = %u done\n", rank, info->k, info->i, info->j);
 #endif
-	free(_args);
 }
 
 static void STARPU_PLU(cpu_u22)(void *descr[], void *_args)
@@ -164,6 +165,8 @@ static inline void STARPU_PLU(common_u12)(void *descr[], int s, void *_args)
 	//fprintf(stderr, "INPUT 12 U12\n");
 	fprintf(stderr, "INPUT 21 U21\n");
 	STARPU_PLU(display_data_content)(sub12, nx12);
+#else
+	(void)_args;
 #endif
 
 #ifdef STARPU_USE_CUDA
@@ -200,7 +203,6 @@ static inline void STARPU_PLU(common_u12)(void *descr[], int s, void *_args)
 	fprintf(stderr, "OUTPUT 21 U21\n");
 	STARPU_PLU(display_data_content)(sub12, nx12);
 #endif
-	free(_args);
 }
 
 static void STARPU_PLU(cpu_u12)(void *descr[], void *_args)
@@ -277,6 +279,8 @@ static inline void STARPU_PLU(common_u21)(void *descr[], int s, void *_args)
 	//fprintf(stderr, "INPUT 21 U21\n");
 	fprintf(stderr, "INPUT 12 U12\n");
 	STARPU_PLU(display_data_content)(sub21, nx21);
+#else
+	(void)_args;
 #endif
 
 #ifdef STARPU_USE_CUDA
@@ -314,7 +318,6 @@ static inline void STARPU_PLU(common_u21)(void *descr[], int s, void *_args)
 	fprintf(stderr, "OUTPUT 12 U12\n");
 	STARPU_PLU(display_data_content)(sub21, nx21);
 #endif
-	free(_args);
 }
 
 static void STARPU_PLU(cpu_u21)(void *descr[], void *_args)
@@ -386,6 +389,8 @@ static inline void STARPU_PLU(common_u11)(void *descr[], int s, void *_args)
 	int rank;
 	starpu_mpi_comm_rank(MPI_COMM_WORLD, &rank);
 	fprintf(stderr, "KERNEL 11 %d - k = %u\n", rank, info->k);
+#else
+	(void)_args;
 #endif
 
 	switch (s)
@@ -445,7 +450,6 @@ static inline void STARPU_PLU(common_u11)(void *descr[], int s, void *_args)
 #ifdef VERBOSE_KERNELS
 	fprintf(stderr, "KERNEL 11 %d - k = %u\n", rank, info->k);
 #endif
-	free(_args);
 }
 
 static void STARPU_PLU(cpu_u11)(void *descr[], void *_args)