cholesky_pragma.c 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013 Centre National de la Recherche Scientifique
  4. * Copyright (C) 2010-2013 Université de Bordeaux 1
  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. //! [To be included. You should update doxygen if you see that text.]
  18. extern void cholesky(unsigned nblocks, unsigned size,
  19. float mat[nblocks][nblocks][size])
  20. __attribute__ ((task));
  21. int
  22. main (int argc, char *argv[])
  23. {
  24. #pragma starpu initialize
  25. /* ... */
  26. int nblocks, size;
  27. parse_args (&nblocks, &size);
  28. /* Allocate an array of the required size on the heap,
  29. and register it. */
  30. {
  31. float matrix[nblocks][nblocks][size]
  32. __attribute__ ((heap_allocated, registered));
  33. cholesky (nblocks, size, matrix);
  34. #pragma starpu wait
  35. } /* MATRIX is automatically unregistered & freed here. */
  36. #pragma starpu shutdown
  37. return EXIT_SUCCESS;
  38. }
  39. //! [To be included. You should update doxygen if you see that text.]