copy_driver.h 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012-2014 Université de Bordeaux
  4. * Copyright (C) 2010, 2011, 2013 Centre National de la Recherche Scientifique
  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. #include <datawizard/memory_nodes.h>
  24. #include "coherency.h"
  25. #include "memalloc.h"
  26. #ifdef STARPU_USE_CUDA
  27. #include <cuda.h>
  28. #include <cuda_runtime.h>
  29. #include <cublas.h>
  30. #endif
  31. #ifdef STARPU_USE_OPENCL
  32. #include <starpu_opencl.h>
  33. #endif
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. struct _starpu_data_request;
  39. struct _starpu_data_replicate;
  40. #ifdef STARPU_USE_MIC
  41. /* MIC need memory_node to now which MIC is concerned.
  42. * mark is used to wait asynchronous request.
  43. * signal is used to test asynchronous request. */
  44. struct _starpu_mic_async_event
  45. {
  46. unsigned memory_node;
  47. int mark;
  48. uint64_t *signal;
  49. };
  50. #endif
  51. struct _starpu_disk_async_event
  52. {
  53. unsigned memory_node;
  54. void *backend_event;
  55. };
  56. /* this is a structure that can be queried to see whether an asynchronous
  57. * transfer has terminated or not */
  58. union _starpu_async_channel_event
  59. {
  60. #ifdef STARPU_SIMGRID
  61. struct {
  62. unsigned finished;
  63. starpu_pthread_mutex_t mutex;
  64. starpu_pthread_cond_t cond;
  65. };
  66. #endif
  67. #ifdef STARPU_USE_CUDA
  68. cudaEvent_t cuda_event;
  69. #endif
  70. #ifdef STARPU_USE_OPENCL
  71. cl_event opencl_event;
  72. #endif
  73. #ifdef STARPU_USE_MIC
  74. struct _starpu_mic_async_event mic_event;
  75. #endif
  76. struct _starpu_disk_async_event disk_event;
  77. };
  78. struct _starpu_async_channel
  79. {
  80. union _starpu_async_channel_event event;
  81. enum starpu_node_kind type;
  82. };
  83. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  84. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  85. struct _starpu_data_replicate *src_replicate,
  86. struct _starpu_data_replicate *dst_replicate,
  87. unsigned donotread,
  88. struct _starpu_data_request *req,
  89. unsigned may_alloc);
  90. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  91. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  92. #ifdef __cplusplus
  93. }
  94. #endif
  95. #endif // __COPY_DRIVER_H__