starpu_data.h 2.9 KB

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