modes_test.c 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // StarPU --- Runtime system for heterogeneous multicore architectures.
  2. //
  3. // Copyright (C) 2012 INRIA
  4. //
  5. // StarPU is free software; you can redistribute it and/or modify
  6. // it under the terms of the GNU Lesser General Public License as published by
  7. // the Free Software Foundation; either version 2.1 of the License, or (at
  8. // your option) any later version.
  9. //
  10. // StarPU is distributed in the hope that it will be useful, but
  11. // WITHOUT ANY WARRANTY; without even the implied warranty of
  12. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. //
  14. // See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. /* Dont change anything ! */
  16. struct starpu_codelet cummy_cl =
  17. {
  18. .cpu_funcs = { foo },
  19. .nbuffers = 42
  20. };
  21. /* Now, there is some work to do */
  22. struct starpu_codelet cl1 =
  23. {
  24. .cpu_funcs = { foo, bar },
  25. .nbuffers = 2,
  26. };
  27. int
  28. foo(void)
  29. {
  30. struct starpu_task *task = starpu_task_create();
  31. task->cl = &cl1;
  32. task->buffers[0].handle = handle1;
  33. task->buffers[0].mode = STARPU_R;
  34. task->synchronous = 1;
  35. task->buffers[1].handle = handles[1];
  36. task->buffers[1].mode = STARPU_W;
  37. }
  38. struct starpu_codelet cl2 =
  39. {
  40. .cpu_funcs = {foo},
  41. .nbuffers = 1
  42. };
  43. static void
  44. bar(void)
  45. {
  46. struct starpu_task *task = starpu_task_create();
  47. task->cl = &cl2;
  48. task->buffers[0].handle = h;
  49. task->buffers[0].mode = STARPU_RW;
  50. task->buffers[1].handle = h;
  51. task->buffers[1].mode = random_mode();
  52. }
  53. struct starpu_codelet cl3 =
  54. {
  55. .cpu_funcs = { bar, baz },
  56. .nbuffers = 1
  57. };
  58. static void
  59. baz(void)
  60. {
  61. struct starpu_task *blah;
  62. blah->cl = &cl3;
  63. blah->buffers[0].handle = some_handle;
  64. blah->buffers[0].mode = STARPU_RW;
  65. }