standard_memory_library.doxy 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_MALLOC_PINNED
  10. \ingroup API_Standard_Memory_Library
  11. Value passed to the function starpu_malloc_flags() to indicate the memory allocation should be pinned.
  12. \def STARPU_MALLOC_COUNT
  13. \ingroup API_Standard_Memory_Library
  14. Value passed to the function starpu_malloc_flags() to indicate
  15. the memory allocation should be in the limit defined by the
  16. environment variables \ref STARPU_LIMIT_CUDA_devid_MEM,
  17. \ref STARPU_LIMIT_CUDA_MEM, \ref STARPU_LIMIT_OPENCL_devid_MEM,
  18. \ref STARPU_LIMIT_OPENCL_MEM and \ref STARPU_LIMIT_CPU_MEM (see
  19. Section \ref HowToLimitMemoryPerNode).
  20. If no memory is available, it tries to reclaim memory from StarPU.
  21. Memory allocated this way needs to be freed by calling the function
  22. starpu_free_flags() with the same flag.
  23. \fn int starpu_malloc_flags(void **A, size_t dim, int flags)
  24. \ingroup API_Standard_Memory_Library
  25. Performs a memory allocation based on the constraints defined
  26. by the given flag.
  27. \fn void starpu_malloc_set_align(size_t align)
  28. \ingroup API_Standard_Memory_Library
  29. This function sets an alignment constraints for starpu_malloc()
  30. allocations. align must be a power of two. This is for instance called
  31. automatically by the OpenCL driver to specify its own alignment
  32. constraints.
  33. \fn int starpu_malloc(void **A, size_t dim)
  34. \ingroup API_Standard_Memory_Library
  35. This function allocates data of the given size in main memory.
  36. It will also try to pin it in CUDA or OpenCL, so that data transfers
  37. from this buffer can be asynchronous, and thus permit data transfer
  38. and computation overlapping. The allocated buffer must be freed thanks
  39. to the starpu_free() function.
  40. \fn int starpu_free(void *A)
  41. \ingroup API_Standard_Memory_Library
  42. This function frees memory which has previously been allocated
  43. with starpu_malloc().
  44. \fn int starpu_free_flags(void *A, size_t dim, int flags)
  45. \ingroup API_Standard_Memory_Library
  46. This function frees memory by specifying its size. The given
  47. flags should be consistent with the ones given to starpu_malloc_flags()
  48. when allocating the memory.
  49. \fn ssize_t starpu_memory_get_available(unsigned node)
  50. \ingroup API_Standard_Memory_Library
  51. If a memory limit is defined on the given node (see Section \ref
  52. HowToLimitMemoryPerNode), return the amount of available memory
  53. on the node. Otherwise return -1.
  54. */