starpu_data.h 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 __STARPU_DATA_H__
  17. #define __STARPU_DATA_H__
  18. #include <starpu.h>
  19. #include <starpu_config.h>
  20. struct starpu_data_state_t;
  21. typedef struct starpu_data_state_t * starpu_data_handle;
  22. #include <starpu_data_interfaces.h>
  23. #include <starpu_data_filters.h>
  24. #ifdef __cplusplus
  25. extern "C" {
  26. #endif
  27. #define STARPU_R (1<<0)
  28. #define STARPU_W (1<<1)
  29. #define STARPU_RW (STARPU_R|STARPU_W)
  30. #define STARPU_SCRATCH (1<<2)
  31. typedef uint32_t starpu_access_mode;
  32. typedef struct starpu_buffer_descr_t {
  33. starpu_data_handle handle;
  34. starpu_access_mode mode;
  35. } starpu_buffer_descr;
  36. struct starpu_data_interface_ops_t;
  37. void starpu_data_unpartition(starpu_data_handle root_data, uint32_t gathering_node);
  38. void starpu_data_unregister(starpu_data_handle state);
  39. void starpu_data_advise_as_important(starpu_data_handle state, unsigned is_important);
  40. int starpu_data_sync_with_mem(starpu_data_handle state, starpu_access_mode mode);
  41. int starpu_data_sync_with_mem_non_blocking(starpu_data_handle handle,
  42. starpu_access_mode mode, void (*callback)(void *), void *arg);
  43. void starpu_data_release_from_mem(starpu_data_handle state);
  44. int starpu_data_malloc_pinned_if_possible(void **A, size_t dim);
  45. int starpu_data_free_pinned_if_possible(void *A);
  46. int starpu_data_request_allocation(starpu_data_handle state, uint32_t node);
  47. int starpu_data_prefetch_on_node(starpu_data_handle state, unsigned node, unsigned async);
  48. unsigned starpu_worker_get_memory_node(unsigned workerid);
  49. /* It is possible to associate a mask to a piece of data (and its children) so
  50. * that when it is modified, it is automatically transfered into those memory
  51. * node. For instance a (1<<0) write-back mask means that the CUDA workers will
  52. * commit their changes in main memory (node 0). */
  53. void starpu_data_set_wb_mask(starpu_data_handle state, uint32_t wb_mask);
  54. void starpu_data_set_sequential_consistency_flag(starpu_data_handle handle, unsigned flag);
  55. unsigned starpu_data_get_default_sequential_consistency_flag(void);
  56. void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
  57. unsigned starpu_data_test_if_allocated_on_node(starpu_data_handle handle, uint32_t memory_node);
  58. #ifdef __cplusplus
  59. }
  60. #endif
  61. #endif // __STARPU_DATA_H__