[clinfo] 72/148: Dump build log on stderr in case of failure

Andreas Beckmann anbe at moszumanska.debian.org
Mon Nov 17 14:09:48 UTC 2014


This is an automated email from the git hooks/post-receive script.

anbe pushed a commit to branch clinfo
in repository clinfo.

commit 1a32e71d0524724dd75b328233cfdd6a53856d15
Author: Giuseppe Bilotta <giuseppe.bilotta at gmail.com>
Date:   Sat Sep 27 09:08:10 2014 +0200

    Dump build log on stderr in case of failure
    
    ... during work-group size detection. This should make it easier to
    debug this situation.
---
 src/clinfo.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/src/clinfo.c b/src/clinfo.c
index 179f750..ed049c7 100644
--- a/src/clinfo.c
+++ b/src/clinfo.c
@@ -149,15 +149,20 @@ getWGsizes(cl_platform_id pid, cl_device_id dev)
 	prg = clCreateProgramWithSource(ctx, ARRAY_SIZE(sources), sources, NULL, &error);
 	RR_ERROR("create program");
 	error = clBuildProgram(prg, 1, &dev, NULL, NULL, NULL);
-#if 0
-	if (error != CL_SUCCESS) {
+	had_error = REPORT_ERROR("build program");
+	if (had_error)
+		ret = error;
+
+	/* for a program build failure, dump the log to stderr before bailing */
+	if (error == CL_BUILD_PROGRAM_FAILURE) {
 		GET_STRING(clGetProgramBuildInfo, CL_PROGRAM_BUILD_LOG, "CL_PROGRAM_BUILD_LOG", prg, dev);
-		fputs(strbuf, stderr);
-		exit(1);
+		if (error == CL_SUCCESS) {
+			fputs("=== CL_PROGRAM_BUILD_LOG ===\n", stderr);
+			fputs(strbuf, stderr);
+		}
 	}
-#else
-	RR_ERROR("build program");
-#endif
+	if (had_error)
+		goto out;
 
 	for (cursor = 0; cursor < NUM_KERNELS; ++cursor) {
 		sprintf(strbuf, "sum%u", 1<<cursor);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opencl/clinfo.git



More information about the Pkg-opencl-commits mailing list