|
@@ -18,33 +18,48 @@
|
|
|
#include "../helper.h"
|
|
|
|
|
|
static
|
|
|
-int expected_x=40;
|
|
|
-static
|
|
|
-int expected_y=12;
|
|
|
-
|
|
|
-static
|
|
|
void callback(void *ptr)
|
|
|
{
|
|
|
int *x = (int *)ptr;
|
|
|
FPRINTF(stderr, "x=%d\n", *x);
|
|
|
- STARPU_ASSERT_MSG(*x == expected_x, "%d != %d\n", *x, expected_x);
|
|
|
+ STARPU_ASSERT_MSG(*x == 40, "%d != %d\n", *x, 40);
|
|
|
(*x)++;
|
|
|
}
|
|
|
|
|
|
static
|
|
|
+void callback2(void *ptr)
|
|
|
+{
|
|
|
+ int *x2 = (int *)ptr;
|
|
|
+ FPRINTF(stderr, "x2=%d\n", *x2);
|
|
|
+ STARPU_ASSERT_MSG(*x2 == 41, "%d != %d\n", *x2, 41);
|
|
|
+ (*x2)++;
|
|
|
+}
|
|
|
+
|
|
|
+static
|
|
|
void prologue_callback(void *ptr)
|
|
|
{
|
|
|
int *y = (int *)ptr;
|
|
|
FPRINTF(stderr, "y=%d\n", *y);
|
|
|
- STARPU_ASSERT_MSG(*y == expected_y, "%d != %d\n", *y, expected_y);
|
|
|
+ STARPU_ASSERT_MSG(*y == 12, "%d != %d\n", *y, 12);
|
|
|
(*y)++;
|
|
|
}
|
|
|
|
|
|
+static
|
|
|
+void prologue_callback_pop(void *ptr)
|
|
|
+{
|
|
|
+ int *z = (int *)ptr;
|
|
|
+ FPRINTF(stderr, "z=%d\n", *z);
|
|
|
+ STARPU_ASSERT_MSG(*z == 32, "%d != %d\n", *z, 32);
|
|
|
+ (*z)++;
|
|
|
+}
|
|
|
+
|
|
|
int main(int argc, char **argv)
|
|
|
{
|
|
|
int ret;
|
|
|
int x=40;
|
|
|
+ int x2=41;
|
|
|
int y=12;
|
|
|
+ int z=32;
|
|
|
|
|
|
ret = starpu_initialize(NULL, &argc, &argv);
|
|
|
if (ret == -ENODEV) return STARPU_TEST_SKIPPED;
|
|
@@ -55,36 +70,30 @@ int main(int argc, char **argv)
|
|
|
0);
|
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
|
|
|
|
|
|
- expected_x ++;
|
|
|
ret = starpu_task_insert(NULL,
|
|
|
- STARPU_CALLBACK, callback,
|
|
|
- STARPU_CALLBACK_ARG, &x,
|
|
|
+ STARPU_CALLBACK, callback2,
|
|
|
+ STARPU_CALLBACK_ARG, &x2,
|
|
|
0);
|
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
|
|
|
|
|
|
- expected_x ++;
|
|
|
- STARPU_ASSERT_MSG(x == expected_x, "x should be equal to %d and not %d\n", expected_x, x);
|
|
|
-
|
|
|
ret = starpu_task_insert(NULL,
|
|
|
STARPU_PROLOGUE_CALLBACK, prologue_callback,
|
|
|
STARPU_PROLOGUE_CALLBACK_ARG, &y,
|
|
|
0);
|
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
|
|
|
|
|
|
-#ifdef STARPU_DEVEL
|
|
|
-#warning the following code should work
|
|
|
-#if 0
|
|
|
- expected_y ++;
|
|
|
ret = starpu_task_insert(NULL,
|
|
|
- STARPU_PROLOGUE_CALLBACK_POP, prologue_callback,
|
|
|
- STARPU_PROLOGUE_CALLBACK_ARG, &y,
|
|
|
+ STARPU_PROLOGUE_CALLBACK_POP, prologue_callback_pop,
|
|
|
+ STARPU_PROLOGUE_CALLBACK_POP_ARG, &z,
|
|
|
0);
|
|
|
STARPU_CHECK_RETURN_VALUE(ret, "starpu_task_insert");
|
|
|
-#endif
|
|
|
-#endif
|
|
|
|
|
|
- expected_y ++;
|
|
|
- STARPU_ASSERT_MSG(y == expected_y, "y should be equal to %d and not %d\n", expected_y, y);
|
|
|
+ starpu_task_wait_for_all();
|
|
|
+
|
|
|
+ STARPU_ASSERT_MSG(x == 41, "x should be equal to %d and not %d\n", 41, x);
|
|
|
+ STARPU_ASSERT_MSG(x2 == 42, "x2 should be equal to %d and not %d\n", 42, x2);
|
|
|
+ STARPU_ASSERT_MSG(y == 13, "y should be equal to %d and not %d\n", 13, y);
|
|
|
+ STARPU_ASSERT_MSG(z == 33, "z should be equal to %d and not %d\n", 33, z);
|
|
|
|
|
|
starpu_shutdown();
|
|
|
|