starpu-data.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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. typedef enum {
  28. STARPU_R,
  29. STARPU_W,
  30. STARPU_RW
  31. } 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 data_interface_ops_t;
  37. starpu_data_handle starpu_data_state_create(struct data_interface_ops_t *interface_ops);
  38. void starpu_unpartition_data(starpu_data_handle root_data, uint32_t gathering_node);
  39. void starpu_delete_data(starpu_data_handle state);
  40. void starpu_advise_if_data_is_important(starpu_data_handle state, unsigned is_important);
  41. int starpu_sync_data_with_mem(starpu_data_handle state, starpu_access_mode mode);
  42. int starpu_sync_data_with_mem_non_blocking(starpu_data_handle handle,
  43. starpu_access_mode mode, void (*callback)(void *), void *arg);
  44. void starpu_release_data_from_mem(starpu_data_handle state);
  45. int starpu_malloc_pinned_if_possible(void **A, size_t dim);
  46. int starpu_free_pinned_if_possible(void *A);
  47. int starpu_request_data_allocation(starpu_data_handle state, uint32_t node);
  48. int starpu_prefetch_data_on_node(starpu_data_handle state, unsigned node, unsigned async);
  49. unsigned starpu_get_worker_memory_node(unsigned workerid);
  50. /* It is possible to associate a mask to a piece of data (and its children) so
  51. * that when it is modified, it is automatically transfered into those memory
  52. * node. For instance a (1<<0) write-back mask means that the CUDA workers will
  53. * commit their changes in main memory (node 0). */
  54. void starpu_data_set_wb_mask(starpu_data_handle state, uint32_t wb_mask);
  55. unsigned starpu_test_if_data_is_allocated_on_node(starpu_data_handle handle, uint32_t memory_node);
  56. #ifdef __cplusplus
  57. }
  58. #endif
  59. #endif // __STARPU_DATA_H__