memalloc.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  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 <starpu.h>
  19. #include <common/config.h>
  20. #include <common/list.h>
  21. #include <datawizard/interfaces/data_interface.h>
  22. #include <datawizard/coherency.h>
  23. #include <datawizard/copy-driver.h>
  24. #include <datawizard/progress.h>
  25. LIST_TYPE(starpu_mem_chunk,
  26. starpu_data_handle data;
  27. size_t size;
  28. uint32_t footprint;
  29. /* The footprint of the data is not sufficient to determine whether two
  30. * pieces of data have the same layout (there could be collision in the
  31. * hash function ...) so we still keep a copy of the actual layout (ie.
  32. * the data interface) to stay on the safe side. We make a copy of
  33. * because when a data is deleted, the memory chunk remains.
  34. */
  35. struct starpu_data_interface_ops_t *ops;
  36. void *interface;
  37. unsigned automatically_allocated;
  38. unsigned data_was_deleted;
  39. )
  40. void _starpu_init_mem_chunk_lists(void);
  41. void _starpu_deinit_mem_chunk_lists(void);
  42. void _starpu_request_mem_chunk_removal(starpu_data_handle handle, unsigned node);
  43. int _starpu_allocate_memory_on_node(starpu_data_handle handle, uint32_t dst_node, unsigned may_alloc);
  44. size_t _starpu_liberate_all_automatically_allocated_buffers(uint32_t node);
  45. #endif