Sfoglia il codice sorgente

opencl: fix bug when compilation produces too many error
messages (thanks to Philippe Helluy for reporting the bug)

Nathalie Furmento 9 anni fa
parent
commit
6115156c56
1 ha cambiato i file con 8 aggiunte e 2 eliminazioni
  1. 8 2
      src/drivers/opencl/driver_opencl_utils.c

+ 8 - 2
src/drivers/opencl/driver_opencl_utils.c

@@ -516,12 +516,18 @@ int starpu_opencl_load_binary_opencl(const char *kernel_id, struct starpu_opencl
 		{
 			cl_build_status status;
 			size_t len;
-			static char buffer[4096] = "";
 
-			clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, sizeof(buffer), buffer, &len);
+			clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, 0, NULL, &len);
 			if (len > 2)
+			{
+				char *buffer = malloc(len);
+
+				clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_LOG, len, buffer, &len);
 				_STARPU_DISP("Compilation output\n%s\n", buffer);
 
+				free(buffer);
+			}
+
 			clGetProgramBuildInfo(program, device, CL_PROGRAM_BUILD_STATUS, sizeof(status), &status, NULL);
 			if (err != CL_SUCCESS || status != CL_BUILD_SUCCESS)
 			{