copy_driver.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012-2015 Université de Bordeaux
  4. * Copyright (C) 2010, 2011, 2013, 2015 CNRS
  5. *
  6. * StarPU is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU Lesser General Public License as published by
  8. * the Free Software Foundation; either version 2.1 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * StarPU is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  14. *
  15. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  16. */
  17. #ifndef __COPY_DRIVER_H__
  18. #define __COPY_DRIVER_H__
  19. #ifdef HAVE_AIO_H
  20. #include <aio.h>
  21. #endif
  22. #include <common/config.h>
  23. #ifdef STARPU_USE_CUDA
  24. #include <cuda.h>
  25. #include <cuda_runtime.h>
  26. #include <cublas.h>
  27. #endif
  28. #ifdef STARPU_USE_OPENCL
  29. #include <starpu_opencl.h>
  30. #endif
  31. #ifdef __cplusplus
  32. extern "C"
  33. {
  34. #endif
  35. struct _starpu_data_request;
  36. struct _starpu_data_replicate;
  37. #ifdef STARPU_USE_MIC
  38. /* MIC needs memory_node to know which MIC is concerned.
  39. * mark is used to wait asynchronous request.
  40. * signal is used to test asynchronous request. */
  41. struct _starpu_mic_async_event
  42. {
  43. unsigned memory_node;
  44. int mark;
  45. uint64_t *signal;
  46. };
  47. #endif
  48. struct _starpu_disk_async_event
  49. {
  50. unsigned memory_node;
  51. void *backend_event;
  52. };
  53. /* this is a structure that can be queried to see whether an asynchronous
  54. * transfer has terminated or not */
  55. union _starpu_async_channel_event
  56. {
  57. #ifdef STARPU_SIMGRID
  58. struct
  59. {
  60. unsigned finished;
  61. starpu_pthread_mutex_t mutex;
  62. starpu_pthread_cond_t cond;
  63. };
  64. #endif
  65. #ifdef STARPU_USE_CUDA
  66. cudaEvent_t cuda_event;
  67. #endif
  68. #ifdef STARPU_USE_OPENCL
  69. cl_event opencl_event;
  70. #endif
  71. #ifdef STARPU_USE_MIC
  72. struct _starpu_mic_async_event mic_event;
  73. #endif
  74. struct _starpu_disk_async_event disk_event;
  75. };
  76. struct _starpu_async_channel
  77. {
  78. union _starpu_async_channel_event event;
  79. enum starpu_node_kind type;
  80. };
  81. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  82. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  83. struct _starpu_data_replicate *src_replicate,
  84. struct _starpu_data_replicate *dst_replicate,
  85. unsigned donotread,
  86. struct _starpu_data_request *req,
  87. unsigned may_alloc,
  88. unsigned prefetch);
  89. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  90. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  91. #ifdef __cplusplus
  92. }
  93. #endif
  94. #endif // __COPY_DRIVER_H__