hello_pragma.c 485 B

12345678910111213141516171819202122232425262728
  1. #include <stdio.h>
  2. /* Task declaration. */
  3. static void my_task (int x) __attribute__ ((task));
  4. /* Definition of the CPU implementation of `my_task'. */
  5. static void my_task (int x)
  6. {
  7. printf ("Hello, world! With x = %d\n", x);
  8. }
  9. int main ()
  10. {
  11. /* Initialize StarPU. */
  12. #pragma starpu initialize
  13. /* Do an asynchronous call to `my_task'. */
  14. my_task (42);
  15. /* Wait for the call to complete. */
  16. #pragma starpu wait
  17. /* Terminate. */
  18. #pragma starpu shutdown
  19. return 0;
  20. }