copy_driver.h 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2008-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
  4. *
  5. * StarPU 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. * StarPU 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 __COPY_DRIVER_H__
  17. #define __COPY_DRIVER_H__
  18. /** @file */
  19. #ifdef HAVE_AIO_H
  20. #include <aio.h>
  21. #endif
  22. #include <common/config.h>
  23. #include <common/list.h>
  24. #ifdef STARPU_USE_CUDA
  25. #include <cuda.h>
  26. #include <cuda_runtime.h>
  27. #endif
  28. #ifdef STARPU_USE_OPENCL
  29. #include <starpu_opencl.h>
  30. #endif
  31. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  32. #include <mpi.h>
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. struct _starpu_data_request;
  39. struct _starpu_data_replicate;
  40. enum _starpu_may_alloc
  41. {
  42. _STARPU_DATAWIZARD_DO_NOT_ALLOC,
  43. _STARPU_DATAWIZARD_DO_ALLOC,
  44. _STARPU_DATAWIZARD_ONLY_FAST_ALLOC
  45. };
  46. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  47. LIST_TYPE(_starpu_mpi_ms_event_request,
  48. MPI_Request request;
  49. );
  50. struct _starpu_mpi_ms_async_event
  51. {
  52. int is_sender;
  53. struct _starpu_mpi_ms_event_request_list * requests;
  54. };
  55. #endif
  56. LIST_TYPE(_starpu_disk_backend_event,
  57. void *backend_event;
  58. );
  59. struct _starpu_disk_async_event
  60. {
  61. unsigned memory_node;
  62. struct _starpu_disk_backend_event_list * requests;
  63. void * ptr;
  64. unsigned node;
  65. size_t size;
  66. starpu_data_handle_t handle;
  67. };
  68. /** this is a structure that can be queried to see whether an asynchronous
  69. * transfer has terminated or not */
  70. union _starpu_async_channel_event
  71. {
  72. #ifdef STARPU_SIMGRID
  73. struct
  74. {
  75. unsigned finished;
  76. starpu_pthread_queue_t *queue;
  77. };
  78. #endif
  79. #ifdef STARPU_USE_CUDA
  80. cudaEvent_t cuda_event;
  81. #endif
  82. #ifdef STARPU_USE_OPENCL
  83. cl_event opencl_event;
  84. #endif
  85. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  86. struct _starpu_mpi_ms_async_event mpi_ms_event;
  87. #endif
  88. struct _starpu_disk_async_event disk_event;
  89. };
  90. struct _starpu_async_channel
  91. {
  92. union _starpu_async_channel_event event;
  93. struct _starpu_node_ops *node_ops;
  94. /** Which node to polling when needing ACK msg */
  95. struct _starpu_mp_node *polling_node_sender;
  96. struct _starpu_mp_node *polling_node_receiver;
  97. /** Used to know if the acknowlegdment msg is arrived from sinks */
  98. volatile int starpu_mp_common_finished_sender;
  99. volatile int starpu_mp_common_finished_receiver;
  100. };
  101. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  102. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  103. struct _starpu_data_replicate *src_replicate,
  104. struct _starpu_data_replicate *dst_replicate,
  105. unsigned donotread,
  106. struct _starpu_data_request *req,
  107. enum _starpu_may_alloc may_alloc,
  108. enum starpu_is_prefetch prefetch);
  109. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  110. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  111. #ifdef __cplusplus
  112. }
  113. #endif
  114. #endif // __COPY_DRIVER_H__