hello_world_plugin.c 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2013,2017 CNRS
  4. * Copyright (C) 2012 Inria
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #include <stdio.h>
  18. /* Task declaration. */
  19. static void my_task (int x) __attribute__ ((task));
  20. /* Definition of the CPU implementation of ‘my task’. */
  21. static void my_task (int x)
  22. {
  23. printf ("Hello, world! With x = %d\n", x);
  24. }
  25. int main ()
  26. {
  27. /* Initialize StarPU. */
  28. #pragma starpu initialize
  29. /* Do an asynchronous call to ‘my task’. */
  30. my_task (42);
  31. /* Wait for the call to complete. */
  32. #pragma starpu wait
  33. /* Terminate. */
  34. #pragma starpu shutdown
  35. return 0;
  36. }