Kaynağa Gözat

provide file and line of errors

Samuel Thibault 14 yıl önce
ebeveyn
işleme
73ac11ecf8

+ 6 - 6
include/starpu_opencl.h

@@ -30,20 +30,20 @@
 extern "C" {
 #endif
 
-void starpu_opencl_display_error(const char *func, const char *msg, cl_int status);
+void starpu_opencl_display_error(const char *func, const char *file, int line, const char *msg, cl_int status);
 #define STARPU_OPENCL_DISPLAY_ERROR(status) \
-	starpu_opencl_display_error(__starpu_func__, NULL, status)
+	starpu_opencl_display_error(__starpu_func__, __FILE__, __LINE__, NULL, status)
 
-static inline void starpu_opencl_report_error(const char *func, const char *msg, cl_int status)
+static inline void starpu_opencl_report_error(const char *func, const char *file, int line, const char *msg, cl_int status)
 {
-        starpu_opencl_display_error(func, msg, status);
+	starpu_opencl_display_error(func, file, line, msg, status);
         assert(0);
 }
 #define STARPU_OPENCL_REPORT_ERROR(status)			\
-	starpu_opencl_display_error(__starpu_func__, NULL, status)
+	starpu_opencl_display_error(__starpu_func__, __FILE__, __LINE__, NULL, status)
 
 #define STARPU_OPENCL_REPORT_ERROR_WITH_MSG(msg, status)			\
-	starpu_opencl_display_error(__starpu_func__, msg, status)
+	starpu_opencl_display_error(__starpu_func__, __FILE__, __LINE__, msg, status)
 
 struct starpu_opencl_program {
         cl_program programs[STARPU_MAXOPENCLDEVS];

+ 3 - 3
src/drivers/opencl/driver_opencl_utils.c

@@ -255,7 +255,7 @@ int starpu_opencl_collect_stats(cl_event event STARPU_ATTRIBUTE_UNUSED)
 	return 0;
 }
 
-void starpu_opencl_display_error(const char *func, const char* msg, cl_int status)
+void starpu_opencl_display_error(const char *func, const char *file, int line, const char* msg, cl_int status)
 {
 	const char *errormsg;
 	switch (status) {
@@ -407,8 +407,8 @@ void starpu_opencl_display_error(const char *func, const char* msg, cl_int statu
 		break;
 	}
 	if (msg)
-		printf("oops in %s (%s) ... <%s> (%d) \n", func, msg, errormsg, status);
+		printf("oops in %s (%s:%u) (%s) ... <%s> (%d) \n", func, file, line, msg, errormsg, status);
 	else
-		printf("oops in %s ... <%s> (%d) \n", func, errormsg, status);
+		printf("oops in %s (%s:%u) ... <%s> (%d) \n", func, file, line, errormsg, status);
 
 }