starpu_stdlib.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010-2013,2015-2017 CNRS
  4. * Copyright (C) 2017 Inria
  5. * Copyright (C) 2010-2016 Université de Bordeaux
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __STARPU_STDLIB_H__
  19. #define __STARPU_STDLIB_H__
  20. #include <starpu.h>
  21. #ifdef __cplusplus
  22. extern "C"
  23. {
  24. #endif
  25. #define STARPU_MALLOC_PINNED ((1ULL)<<1)
  26. #define STARPU_MALLOC_COUNT ((1ULL)<<2)
  27. #define STARPU_MALLOC_NORECLAIM ((1ULL)<<3)
  28. #define STARPU_MEMORY_WAIT ((1ULL)<<4)
  29. #define STARPU_MEMORY_OVERFLOW ((1ULL)<<5)
  30. #define STARPU_MALLOC_SIMULATION_FOLDED ((1ULL)<<6)
  31. void starpu_malloc_set_align(size_t align);
  32. int starpu_malloc(void **A, size_t dim) STARPU_ATTRIBUTE_ALLOC_SIZE(2);
  33. int starpu_free(void *A);
  34. int starpu_malloc_flags(void **A, size_t dim, int flags) STARPU_ATTRIBUTE_ALLOC_SIZE(2);
  35. int starpu_free_flags(void *A, size_t dim, int flags);
  36. int starpu_memory_pin(void *addr, size_t size);
  37. int starpu_memory_unpin(void *addr, size_t size);
  38. starpu_ssize_t starpu_memory_get_total(unsigned node);
  39. starpu_ssize_t starpu_memory_get_available(unsigned node);
  40. starpu_ssize_t starpu_memory_get_total_all_nodes();
  41. starpu_ssize_t starpu_memory_get_available_all_nodes();
  42. void starpu_memory_wait_available(unsigned node, size_t size);
  43. /* Try to allocate memory on the given node */
  44. int starpu_memory_allocate(unsigned node, size_t size, int flags);
  45. /* Indicates the given amount of memory is going to be deallocated from the given node */
  46. void starpu_memory_deallocate(unsigned node, size_t size);
  47. void starpu_sleep(float nb_sec);
  48. #ifdef __cplusplus
  49. }
  50. #endif
  51. #endif /* __STARPU_STDLIB_H__ */