memalloc.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __MEMALLOC_H__
  17. #define __MEMALLOC_H__
  18. #include <common/list.h>
  19. #include <datawizard/interfaces/data_interface.h>
  20. #include <datawizard/coherency.h>
  21. #include <datawizard/copy-driver.h>
  22. #include <datawizard/progress.h>
  23. struct starpu_data_state_t;
  24. LIST_TYPE(mem_chunk,
  25. struct starpu_data_state_t *data;
  26. size_t size;
  27. uint32_t footprint;
  28. /* The footprint of the data is not sufficient to determine whether two
  29. * pieces of data have the same layout (there could be collision in the
  30. * hash function ...) so we still keep a copy of the actual layout (ie.
  31. * the starpu_data_interface_t) to stay on the safe side. We make a copy of
  32. * because when a data is deleted, the memory chunk remains.
  33. */
  34. struct data_interface_ops_t *ops;
  35. starpu_data_interface_t interface;
  36. unsigned automatically_allocated;
  37. unsigned data_was_deleted;
  38. )
  39. void init_mem_chunk_lists(void);
  40. void deinit_mem_chunk_lists(void);
  41. void request_mem_chunk_removal(struct starpu_data_state_t *state, unsigned node);
  42. int allocate_memory_on_node(struct starpu_data_state_t *state, uint32_t dst_node, unsigned may_alloc);
  43. #endif