cholesky_pragma.c 623 B

1234567891011121314151617181920212223242526272829303132
  1. extern void cholesky(unsigned nblocks, unsigned size,
  2. float mat[nblocks][nblocks][size])
  3. __attribute__ ((task));
  4. int
  5. main (int argc, char *argv[])
  6. {
  7. #pragma starpu initialize
  8. /* ... */
  9. int nblocks, size;
  10. parse_args (&nblocks, &size);
  11. /* Allocate an array of the required size on the heap,
  12. and register it. */
  13. {
  14. float matrix[nblocks][nblocks][size]
  15. __attribute__ ((heap_allocated, registered));
  16. cholesky (nblocks, size, matrix);
  17. #pragma starpu wait
  18. } /* MATRIX is automatically unregistered & freed here. */
  19. #pragma starpu shutdown
  20. return EXIT_SUCCESS;
  21. }