copy_driver.h 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012-2013 Université de Bordeaux 1
  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. #ifdef HAVE_AIO_H
  54. struct aiocb _starpu_aiocb_disk;
  55. #endif
  56. unsigned memory_node;
  57. };
  58. /* this is a structure that can be queried to see whether an asynchronous
  59. * transfer has terminated or not */
  60. union _starpu_async_channel_event
  61. {
  62. int dummy;
  63. #ifdef STARPU_SIMGRID
  64. struct {
  65. unsigned finished;
  66. starpu_pthread_mutex_t mutex;
  67. starpu_pthread_cond_t cond;
  68. };
  69. #endif
  70. #ifdef STARPU_USE_CUDA
  71. cudaEvent_t cuda_event;
  72. #endif
  73. #ifdef STARPU_USE_OPENCL
  74. cl_event opencl_event;
  75. #endif
  76. #ifdef STARPU_USE_MIC
  77. struct _starpu_mic_async_event mic_event;
  78. #endif
  79. struct _starpu_disk_async_event disk_event;
  80. };
  81. struct _starpu_async_channel
  82. {
  83. union _starpu_async_channel_event event;
  84. enum starpu_node_kind type;
  85. };
  86. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  87. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  88. struct _starpu_data_replicate *src_replicate,
  89. struct _starpu_data_replicate *dst_replicate,
  90. unsigned donotread,
  91. struct _starpu_data_request *req,
  92. unsigned may_alloc);
  93. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  94. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif // __COPY_DRIVER_H__