starpu_data.h 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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. void starpu_data_unregister(starpu_data_handle handle);
  39. /* Destroy all data replicates. After data invalidation, the first access to
  40. * the handle must be performed in write-only mode. */
  41. void starpu_data_invalidate(starpu_data_handle);
  42. void starpu_data_advise_as_important(starpu_data_handle handle, unsigned is_important);
  43. int starpu_data_acquire(starpu_data_handle handle, starpu_access_mode mode);
  44. int starpu_data_acquire_cb(starpu_data_handle handle,
  45. starpu_access_mode mode, void (*callback)(void *), void *arg);
  46. void starpu_data_release(starpu_data_handle handle);
  47. int starpu_data_malloc_pinned_if_possible(void **A, size_t dim);
  48. int starpu_data_free_pinned_if_possible(void *A);
  49. int starpu_data_request_allocation(starpu_data_handle handle, uint32_t node);
  50. int starpu_data_prefetch_on_node(starpu_data_handle handle, unsigned node, unsigned async);
  51. unsigned starpu_worker_get_memory_node(unsigned workerid);
  52. /* It is possible to associate a mask to a piece of data (and its children) so
  53. * that when it is modified, it is automatically transfered into those memory
  54. * node. For instance a (1<<0) write-through mask means that the CUDA workers will
  55. * commit their changes in main memory (node 0). */
  56. void starpu_data_set_wt_mask(starpu_data_handle handle, uint32_t wt_mask);
  57. void starpu_data_set_sequential_consistency_flag(starpu_data_handle handle, unsigned flag);
  58. unsigned starpu_data_get_default_sequential_consistency_flag(void);
  59. void starpu_data_set_default_sequential_consistency_flag(unsigned flag);
  60. /* Query the status of the handle on the specified memory node. */
  61. void starpu_data_query_status(starpu_data_handle handle, int memory_node, int *is_allocated, int *is_valid, int *is_requested);
  62. void starpu_data_set_reduction_methods(starpu_data_handle handle,
  63. void (*redux_func)(void *, void *),
  64. void (*init_func)(void *));
  65. #ifdef __cplusplus
  66. }
  67. #endif
  68. #endif // __STARPU_DATA_H__