standard_memory_library.doxy 3.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * This file is part of the StarPU Handbook.
  3. * Copyright (C) 2009--2011 Universit@'e de Bordeaux
  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. \def STARPU_MALLOC_NORECLAIM
  32. \ingroup API_Standard_Memory_Library
  33. Value passed to the function starpu_malloc_flags() along STARPU_MALLOC_COUNT
  34. to indicate that while the memory allocation should be kept in the limits
  35. defined for STARPU_MALLOC_COUNT, no reclaiming should be performed by
  36. starpu_malloc_flags itself, thus potentially overflowing the memory node a
  37. bit. StarPU will reclaim memory after next task termination, according to
  38. the STARPU_MINIMUM_AVAILABLE_MEM and STARPU_TARGET_AVAILABLE_MEM environment
  39. variables.
  40. \fn int starpu_malloc_flags(void **A, size_t dim, int flags)
  41. \ingroup API_Standard_Memory_Library
  42. Performs a memory allocation based on the constraints defined
  43. by the given flag.
  44. \fn void starpu_malloc_set_align(size_t align)
  45. \ingroup API_Standard_Memory_Library
  46. This function sets an alignment constraints for starpu_malloc()
  47. allocations. align must be a power of two. This is for instance called
  48. automatically by the OpenCL driver to specify its own alignment
  49. constraints.
  50. \fn int starpu_malloc(void **A, size_t dim)
  51. \ingroup API_Standard_Memory_Library
  52. This function allocates data of the given size in main memory.
  53. It will also try to pin it in CUDA or OpenCL, so that data transfers
  54. from this buffer can be asynchronous, and thus permit data transfer
  55. and computation overlapping. The allocated buffer must be freed thanks
  56. to the starpu_free() function.
  57. \fn int starpu_free(void *A)
  58. \ingroup API_Standard_Memory_Library
  59. This function frees memory which has previously been allocated
  60. with starpu_malloc().
  61. \fn int starpu_free_flags(void *A, size_t dim, int flags)
  62. \ingroup API_Standard_Memory_Library
  63. This function frees memory by specifying its size. The given
  64. flags should be consistent with the ones given to starpu_malloc_flags()
  65. when allocating the memory.
  66. \fn ssize_t starpu_memory_get_total(unsigned node)
  67. \ingroup API_Standard_Memory_Library
  68. If a memory limit is defined on the given node (see Section \ref
  69. HowToLimitMemoryPerNode), return the amount of total memory
  70. on the node. Otherwise return -1.
  71. \fn ssize_t starpu_memory_get_available(unsigned node)
  72. \ingroup API_Standard_Memory_Library
  73. If a memory limit is defined on the given node (see Section \ref
  74. HowToLimitMemoryPerNode), return the amount of available memory
  75. on the node. Otherwise return -1.
  76. */