Parcourir la source

Add an experimental Coccinelle script that adds "STARPU_SKIP_IF_VALGRIND;" at the beginning of codelets.

Can be used with -D context, -D org, -D patch, -D report.
Cyril Roelandt il y a 13 ans
Parent
commit
057eb16b24

+ 86 - 0
tools/dev/experimental/skip_valgrind.cocci

@@ -0,0 +1,86 @@
+/*
+ * StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2012 INRIA
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+virtual context
+virtual org
+virtual patch
+virtual report
+
+@initialize:python depends on report || org@
+msg="Should you add STARPU_SKIP_IF_VALGRIND; at the beginning of this function ?"
+
+@find_codelet@
+identifier a, b;
+identifier func;
+position p;
+@@
+void func@p(void *a[], void *b)
+{
+...
+}
+
+@is_empty_codelet@
+identifier find_codelet.a, find_codelet.b;
+identifier find_codelet.func;
+position find_codelet.p;
+@@
+void func@p(void *a[], void *b)
+{
+}
+
+@is_already_ok@
+identifier find_codelet.a, find_codelet.b;
+identifier find_codelet.func;
+position find_codelet.p;
+@@
+void func@p(void *a[], void *b)
+{
+	STARPU_SKIP_IF_VALGRIND;
+...
+}
+
+
+@depends on find_codelet && !is_empty_codelet && !is_already_ok && context@
+identifier find_codelet.a, find_codelet.b;
+identifier find_codelet.func;
+position find_codelet.p;
+@@
+*void func@p(void *a[], void *b) 
+{
+...
+}
+
+@script:python depends on find_codelet && !is_empty_codelet && !is_already_ok && org@
+p << find_codelet.p;
+@@
+coccilib.org.print_todo(p[0], msg)
+
+@depends on find_codelet && !is_empty_codelet && !is_already_ok && patch@
+identifier find_codelet.a, find_codelet.b;
+identifier find_codelet.func;
+position find_codelet.p;
+@@
+void func@p(void *a[], void *b) 
+{
++STARPU_SKIP_IF_VALGRIND;
++
+...
+}
+
+@script:python depends on find_codelet && !is_empty_codelet && !is_already_ok && report@
+p << find_codelet.p;
+@@
+coccilib.report.print_report(p[0], msg)

+ 36 - 0
tools/dev/experimental/skip_valgrind_test.c

@@ -0,0 +1,36 @@
+/*
+ * StarPU --- Runtime system for heterogeneous multicore architectures.
+ *
+ * Copyright (C) 2012 INRIA
+ *
+ * StarPU is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * StarPU is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * See the GNU Lesser General Public License in COPYING.LGPL for more details.
+ */
+#include <stdio.h>
+#include <valgrind/valgrind.h>
+
+void
+cpu_func_0(void *buffers[], void *args)
+{
+	do_stg();
+}
+
+void empty_func(void *buffers[], void *args)
+{
+
+}
+
+void good_0(void *buffers[], void *args)
+{
+	STARPU_SKIP_IF_VALGRIND;
+
+
+}