copy_driver.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2010, 2012 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. #include <common/config.h>
  20. #include <datawizard/memory_nodes.h>
  21. #include "coherency.h"
  22. #include "memalloc.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. struct _starpu_data_request;
  32. struct _starpu_data_replicate;
  33. #ifdef STARPU_USE_MIC
  34. /* MIC need memory_node to now which MIC is concerned.
  35. * mark is used to wait asynchronous request.
  36. * signal is used to test asynchronous request. */
  37. struct _starpu_mic_async_event
  38. {
  39. unsigned memory_node;
  40. int mark;
  41. uint64_t *signal;
  42. };
  43. #endif
  44. /* this is a structure that can be queried to see whether an asynchronous
  45. * transfer has terminated or not */
  46. union _starpu_async_channel_event
  47. {
  48. int dummy;
  49. #ifdef STARPU_SIMGRID
  50. struct {
  51. unsigned finished;
  52. starpu_pthread_mutex_t mutex;
  53. starpu_pthread_cond_t cond;
  54. };
  55. #endif
  56. #ifdef STARPU_USE_CUDA
  57. cudaEvent_t cuda_event;
  58. #endif
  59. #ifdef STARPU_USE_OPENCL
  60. cl_event opencl_event;
  61. #endif
  62. #ifdef STARPU_USE_MIC
  63. struct _starpu_mic_async_event mic_event;
  64. #endif
  65. };
  66. struct _starpu_async_channel
  67. {
  68. union _starpu_async_channel_event event;
  69. enum starpu_node_kind type;
  70. };
  71. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  72. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  73. struct _starpu_data_replicate *src_replicate,
  74. struct _starpu_data_replicate *dst_replicate,
  75. unsigned donotread,
  76. struct _starpu_data_request *req,
  77. unsigned may_alloc);
  78. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  79. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  80. #endif // __COPY_DRIVER_H__