copy_driver.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. /* this is a structure that can be queried to see whether an asynchronous
  34. * transfer has terminated or not */
  35. union _starpu_async_channel_event
  36. {
  37. int dummy;
  38. #ifdef STARPU_SIMGRID
  39. struct {
  40. unsigned finished;
  41. starpu_pthread_mutex_t mutex;
  42. starpu_pthread_cond_t cond;
  43. };
  44. #endif
  45. #ifdef STARPU_USE_CUDA
  46. cudaEvent_t cuda_event;
  47. #endif
  48. #ifdef STARPU_USE_OPENCL
  49. cl_event opencl_event;
  50. #endif
  51. };
  52. struct _starpu_async_channel
  53. {
  54. union _starpu_async_channel_event event;
  55. enum starpu_node_kind type;
  56. };
  57. void _starpu_wake_all_blocked_workers_on_node(unsigned nodeid);
  58. int _starpu_driver_copy_data_1_to_1(starpu_data_handle_t handle,
  59. struct _starpu_data_replicate *src_replicate,
  60. struct _starpu_data_replicate *dst_replicate,
  61. unsigned donotread,
  62. struct _starpu_data_request *req,
  63. unsigned may_alloc);
  64. unsigned _starpu_driver_test_request_completion(struct _starpu_async_channel *async_channel);
  65. void _starpu_driver_wait_request_completion(struct _starpu_async_channel *async_channel);
  66. #endif // __COPY_DRIVER_H__