standard_memory_library.doxy 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012, 2013 Centre National de la Recherche Scientifique
  5. * Copyright (C) 2011, 2012 Institut National de Recherche en Informatique et Automatique
  6. * See the file version.doxy for copying conditions.
  7. */
  8. /*! \defgroup API_Standard_Memory_Library Standard Memory Library
  9. \def starpu_data_malloc_pinned_if_possible
  10. \ingroup API_Standard_Memory_Library
  11. \deprecated
  12. Equivalent to starpu_malloc(). This macro is provided to avoid breaking old codes.
  13. \def starpu_data_free_pinned_if_possible
  14. \ingroup API_Standard_Memory_Library
  15. \deprecated
  16. Equivalent to starpu_free(). This macro is provided to avoid breaking old codes.
  17. \def STARPU_MALLOC_PINNED
  18. \ingroup API_Standard_Memory_Library
  19. Value passed to the function starpu_malloc_flags() to indicate the memory allocation should be pinned.
  20. \def STARPU_MALLOC_COUNT
  21. \ingroup API_Standard_Memory_Library
  22. Value passed to the function starpu_malloc_flags() to indicate
  23. the memory allocation should be in the limit defined by the
  24. environment variables \ref STARPU_LIMIT_CUDA_devid_MEM,
  25. \ref STARPU_LIMIT_CUDA_MEM, \ref STARPU_LIMIT_OPENCL_devid_MEM,
  26. \ref STARPU_LIMIT_OPENCL_MEM and \ref STARPU_LIMIT_CPU_MEM (see
  27. Section \ref HowToLimitMemoryPerNode).
  28. If no memory is available, it tries to reclaim memory from StarPU.
  29. Memory allocated this way needs to be freed by calling the function
  30. starpu_free_flags() with the same flag.
  31. \fn int starpu_malloc_flags(void **A, size_t dim, int flags)
  32. \ingroup API_Standard_Memory_Library
  33. Performs a memory allocation based on the constraints defined
  34. by the given flag.
  35. \fn void starpu_malloc_set_align(size_t align)
  36. \ingroup API_Standard_Memory_Library
  37. This function sets an alignment constraints for starpu_malloc()
  38. allocations. align must be a power of two. This is for instance called
  39. automatically by the OpenCL driver to specify its own alignment
  40. constraints.
  41. \fn int starpu_malloc(void **A, size_t dim)
  42. \ingroup API_Standard_Memory_Library
  43. This function allocates data of the given size in main memory.
  44. It will also try to pin it in CUDA or OpenCL, so that data transfers
  45. from this buffer can be asynchronous, and thus permit data transfer
  46. and computation overlapping. The allocated buffer must be freed thanks
  47. to the starpu_free() function.
  48. \fn int starpu_free(void *A)
  49. \ingroup API_Standard_Memory_Library
  50. This function frees memory which has previously been allocated
  51. with starpu_malloc().
  52. \fn int starpu_free_flags(void *A, size_t dim, int flags)
  53. \ingroup API_Standard_Memory_Library
  54. This function frees memory by specifying its size. The given
  55. flags should be consistent with the ones given to starpu_malloc_flags()
  56. when allocating the memory.
  57. \fn ssize_t starpu_memory_get_total(unsigned node)
  58. \ingroup API_Standard_Memory_Library
  59. If a memory limit is defined on the given node (see Section \ref
  60. HowToLimitMemoryPerNode), return the amount of total memory
  61. on the node. Otherwise return -1.
  62. \fn ssize_t starpu_memory_get_available(unsigned node)
  63. \ingroup API_Standard_Memory_Library
  64. If a memory limit is defined on the given node (see Section \ref
  65. HowToLimitMemoryPerNode), return the amount of available memory
  66. on the node. Otherwise return -1.
  67. */