standard_memory_library.doxy 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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 Standard_Memory_Library Standard Memory Library
  9. \def STARPU_MALLOC_PINNED
  10. \ingroup Standard_Memory_Library
  11. \brief Value passed to the function starpu_malloc_flags() to indicate the memory allocation should be pinned.
  12. \def STARPU_MALLOC_COUNT
  13. \ingroup Standard_Memory_Library
  14. \brief 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 <c>STARPU_LIMIT_CUDA_devid_MEM</c>,
  17. <c>STARPU_LIMIT_CUDA_MEM</c>, <c>STARPU_LIMIT_OPENCL_devid_MEM</c>,
  18. <c>STARPU_LIMIT_OPENCL_MEM</c> and <c>STARPU_LIMIT_CPU_MEM</c> (see
  19. Section \ref How_to_limit_memory_per_node).
  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
  22. starpu_free_flags() function with the same flag.
  23. \fn int starpu_malloc_flags(void **A, size_t dim, int flags)
  24. \ingroup Standard_Memory_Library
  25. \brief 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 Standard_Memory_Library
  29. \brief 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 Standard_Memory_Library
  35. \brief 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 Standard_Memory_Library
  42. \brief 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 Standard_Memory_Library
  46. \brief 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 Standard_Memory_Library
  51. \brief If a memory limit is defined on the given node (see Section \ref
  52. How_to_limit_memory_per_node), return the amount of available memory
  53. on the node. Otherwise return -1.
  54. */