memalloc.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2009, 2010, 2012 Université de Bordeaux 1
  4. * Copyright (C) 2010, 2011, 2012 Centre National de la Recherche Scientifique
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __MEMALLOC_H__
  18. #define __MEMALLOC_H__
  19. #include <starpu.h>
  20. #include <common/config.h>
  21. #include <common/list.h>
  22. #include <datawizard/interfaces/data_interface.h>
  23. #include <datawizard/coherency.h>
  24. #include <datawizard/copy_driver.h>
  25. struct _starpu_data_replicate;
  26. LIST_TYPE(_starpu_mem_chunk,
  27. starpu_data_handle_t data;
  28. size_t size;
  29. uint32_t footprint;
  30. /* The footprint of the data is not sufficient to determine whether two
  31. * pieces of data have the same layout (there could be collision in the
  32. * hash function ...) so we still keep a copy of the actual layout (ie.
  33. * the data interface) to stay on the safe side. We make a copy of
  34. * because when a data is deleted, the memory chunk remains.
  35. */
  36. struct starpu_data_interface_ops *ops;
  37. void *chunk_interface;
  38. unsigned automatically_allocated;
  39. unsigned data_was_deleted;
  40. /* A buffer that is used for SCRATCH or reduction cannnot be used with
  41. * filters. */
  42. unsigned relaxed_coherency;
  43. struct _starpu_data_replicate *replicate;
  44. )
  45. /* LRU list */
  46. LIST_TYPE(_starpu_mem_chunk_lru,
  47. struct _starpu_mem_chunk *mc;
  48. )
  49. void _starpu_init_mem_chunk_lists(void);
  50. void _starpu_deinit_mem_chunk_lists(void);
  51. void _starpu_request_mem_chunk_removal(starpu_data_handle_t handle, unsigned node, int handle_deleted);
  52. int _starpu_allocate_memory_on_node(starpu_data_handle_t handle, struct _starpu_data_replicate *replicate, unsigned is_prefetch);
  53. size_t _starpu_free_all_automatically_allocated_buffers(uint32_t node);
  54. void _starpu_memchunk_recently_used(struct _starpu_mem_chunk *mc, unsigned node);
  55. void _starpu_display_memory_stats_by_node(int node);
  56. #endif