starpu_data.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. /*
  2. * StarPU
  3. * Copyright (C) Université Bordeaux 1, CNRS 2008-2010 (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. #define STARPU_REDUX (1<<3)
  32. typedef uint32_t starpu_access_mode;
  33. typedef struct starpu_buffer_descr_t {
  34. starpu_data_handle handle;
  35. starpu_access_mode mode;
  36. } starpu_buffer_descr;
  37. struct starpu_data_interface_ops_t;
  38. /* Destroy the data handle, in case we don't need to update the value of the
  39. * data in the home node, we can use starpu_data_unregister_no_coherency
  40. * instead. */
  41. void starpu_data_unregister(starpu_data_handle handle);
  42. void starpu_data_unregister_no_coherency(starpu_data_handle handle);
  43. /* Destroy all data replicates. After data invalidation, the first access to
  44. * the handle must be performed in write-only mode. */
  45. void starpu_data_invalidate(starpu_data_handle);
  46. void starpu_data_advise_as_important(starpu_data_handle handle, unsigned is_important);
  47. int starpu_data_acquire(starpu_data_handle handle, starpu_access_mode mode);
  48. int starpu_data_acquire_cb(starpu_data_handle handle,
  49. starpu_access_mode mode, void (*callback)(void *), void *arg);
  50. void starpu_data_release(starpu_data_handle handle);
  51. int starpu_data_malloc_pinned_if_possible(void **A, size_t dim);
  52. int starpu_data_free_pinned_if_possible(void *A);
  53. int starpu_data_request_allocation(starpu_data_handle handle, uint32_t node);
  54. int starpu_data_prefetch_on_node(starpu_data_handle handle, unsigned node, unsigned async);
  55. unsigned starpu_worker_get_memory_node(unsigned workerid);
  56. /* It is possible to associate a mask to a piece of data (and its children) so
  57. * that when it is modified, it is automatically transfered into those memory
  58. * node. For instance a (1<<0) write-through mask means that the CUDA workers will
  59. * commit their changes in main memory (node 0). */
  60. void starpu_data_set_wt_mask(starpu_data_handle handle, uint32_t wt_mask);
  61. void starpu_data_set_sequential_consistency_flag(starpu_data_handle handle, unsigned flag);
  62. unsigned starpu_data_get_default_sequential_consistency_flag(void);
  63. void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
  64. /* Query the status of the handle on the specified memory node. */
  65. void starpu_data_query_status(starpu_data_handle handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
  66. struct starpu_codelet_t;
  67. void starpu_data_set_reduction_methods(starpu_data_handle handle,
  68. struct starpu_codelet_t *redux_cl,
  69. struct starpu_codelet_t *init_cl);
  70. #ifdef __cplusplus
  71. }
  72. #endif
  73. #endif // __STARPU_DATA_H__