modes_test.c 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* Dont change anything ! */
  2. struct starpu_codelet cummy_cl =
  3. {
  4. .cpu_funcs = { foo, NULL },
  5. .nbuffers = 42
  6. };
  7. /* Now, there is some work to do */
  8. struct starpu_codelet cl1 =
  9. {
  10. .cpu_funcs = { foo, bar, NULL },
  11. .nbuffers = 2,
  12. };
  13. int
  14. foo(void)
  15. {
  16. struct starpu_task *task = starpu_task_create();
  17. task->cl = &cl1;
  18. task->buffers[0].handle = handle1;
  19. task->buffers[0].mode = STARPU_R;
  20. task->synchronous = 1;
  21. task->buffers[1].handle = handles[1];
  22. task->buffers[1].mode = STARPU_W;
  23. }
  24. struct starpu_codelet cl2 =
  25. {
  26. .cpu_funcs = {foo, NULL},
  27. .nbuffers = 1
  28. };
  29. static void
  30. bar(void)
  31. {
  32. struct starpu_task *task = starpu_task_create();
  33. task->cl = &cl2;
  34. task->buffers[0].handle = h;
  35. task->buffers[0].mode = STARPU_RW;
  36. task->buffers[1].handle = h;
  37. task->buffers[1].mode = random_mode();
  38. }
  39. struct starpu_codelet cl3 =
  40. {
  41. .cpu_funcs = { bar, baz, NULL },
  42. .nbuffers = 1
  43. };
  44. static void
  45. baz(void)
  46. {
  47. struct starpu_task *blah;
  48. blah->cl = &cl3;
  49. blah->buffers[0].handle = some_handle;
  50. blah->buffers[0].mode = STARPU_RW;
  51. }