copy_driver.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012,2016-2017 Inria
  4. * Copyright (C) 2008-2015,2017 Université de Bordeaux
  5. * Copyright (C) 2010-2011,2013,2015,2017 CNRS
  6. *
  7. * StarPU is free software; you can redistribute it and/or modify
  8. * it under the terms of the GNU Lesser General Public License as published by
  9. * the Free Software Foundation; either version 2.1 of the License, or (at
  10. * your option) any later version.
  11. *
  12. * StarPU is distributed in the hope that it will be useful, but
  13. * WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  15. *
  16. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  17. */
  18. #ifndef __COPY_DRIVER_H__
  19. #define __COPY_DRIVER_H__
  20. #ifdef HAVE_AIO_H
  21. #include <aio.h>
  22. #endif
  23. #include <common/config.h>
  24. #include <common/list.h>
  25. #ifdef STARPU_USE_CUDA
  26. #include <cuda.h>
  27. #include <cuda_runtime.h>
  28. #endif
  29. #ifdef STARPU_USE_OPENCL
  30. #include <starpu_opencl.h>
  31. #endif
  32. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  33. #include <mpi.h>
  34. #endif
  35. #ifdef __cplusplus
  36. extern "C"
  37. {
  38. #endif
  39. struct _starpu_data_request;
  40. struct _starpu_data_replicate;
  41. #ifdef STARPU_USE_MIC
  42. /* MIC needs memory_node to know which MIC is concerned.
  43. * mark is used to wait asynchronous request.
  44. * signal is used to test asynchronous request. */
  45. struct _starpu_mic_async_event
  46. {
  47. unsigned memory_node;
  48. int mark;
  49. uint64_t *signal;
  50. };
  51. #endif
  52. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  53. LIST_TYPE(_starpu_mpi_ms_event_request,
  54. MPI_Request request;
  55. );
  56. struct _starpu_mpi_ms_async_event
  57. {
  58. int is_sender;
  59. struct _starpu_mpi_ms_event_request_list * requests;
  60. };
  61. #endif
  62. LIST_TYPE(_starpu_disk_backend_event,
  63. void *backend_event;
  64. );
  65. struct _starpu_disk_async_event
  66. {
  67. unsigned memory_node;
  68. struct _starpu_disk_backend_event_list * requests;
  69. void * ptr;
  70. unsigned node;
  71. size_t size;
  72. starpu_data_handle_t handle;
  73. };
  74. /* this is a structure that can be queried to see whether an asynchronous
  75. * transfer has terminated or not */
  76. union _starpu_async_channel_event
  77. {
  78. #ifdef STARPU_SIMGRID
  79. struct
  80. {
  81. unsigned finished;
  82. starpu_pthread_queue_t *queue;
  83. };
  84. #endif
  85. #ifdef STARPU_USE_CUDA
  86. cudaEvent_t cuda_event;
  87. #endif
  88. #ifdef STARPU_USE_OPENCL
  89. cl_event opencl_event;
  90. #endif
  91. #ifdef STARPU_USE_MPI_MASTER_SLAVE
  92. struct _starpu_mpi_ms_async_event mpi_ms_event;
  93. #endif
  94. #ifdef STARPU_USE_MIC
  95. struct _starpu_mic_async_event mic_event;
  96. #endif
  97. struct _starpu_disk_async_event disk_event;
  98. };
  99. struct _starpu_async_channel
  100. {
  101. union _starpu_async_channel_event event;
  102. enum starpu_node_kind type;
  103. /* Which node to polling when needing ACK msg */
  104. struct _starpu_mp_node *polling_node_sender;
  105. struct _starpu_mp_node *polling_node_receiver;
  106. /* Used to know if the acknowlegdment msg is arrived from sinks */
  107. volatile int starpu_mp_common_finished_sender;
  108. volatile int starpu_mp_common_finished_receiver;
  109. };
  110. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  111. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  112. struct _starpu_data_replicate *src_replicate,
  113. struct _starpu_data_replicate *dst_replicate,
  114. unsigned donotread,
  115. struct _starpu_data_request *req,
  116. unsigned may_alloc,
  117. unsigned prefetch);
  118. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  119. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  120. #ifdef __cplusplus
  121. }
  122. #endif
  123. #endif // __COPY_DRIVER_H__