driver_opencl.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /*
  2. * StarPU
  3. * Copyright (C) INRIA 2008-2009 (see AUTHORS file)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation; either version 2.1 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13. *
  14. * See the GNU Lesser General Public License in COPYING.LGPL for more details.
  15. */
  16. #ifndef __DRIVER_OPENCL_H__
  17. #define __DRIVER_OPENCL_H__
  18. #ifndef _GNU_SOURCE
  19. #define _GNU_SOURCE
  20. #endif
  21. #include <CL/cl.h>
  22. extern
  23. int _starpu_opencl_init_context(int devid);
  24. extern
  25. int _starpu_opencl_deinit_context(int devid);
  26. extern
  27. unsigned _starpu_opencl_get_device_count(void);
  28. extern
  29. int _starpu_opencl_allocate_memory(void **addr, size_t size, cl_mem_flags flags);
  30. extern
  31. int _starpu_opencl_copy_ram_to_opencl(void *ptr, cl_mem buffer, size_t size, size_t offset, cl_event *event);
  32. extern
  33. int _starpu_opencl_copy_opencl_to_ram(cl_mem buffer, void *ptr, size_t size, size_t offset, cl_event *event);
  34. extern
  35. int _starpu_opencl_copy_ram_to_opencl_async_sync(void *ptr, cl_mem buffer, size_t size, size_t offset, cl_event *event, int *ret);
  36. extern
  37. int _starpu_opencl_copy_opencl_to_ram_async_sync(cl_mem buffer, void *ptr, size_t size, size_t offset, cl_event *event, int *ret);
  38. extern
  39. int _starpu_opencl_copy_rect_opencl_to_ram(cl_mem buffer, void *ptr, const size_t buffer_origin[3], const size_t host_origin[3],
  40. const size_t region[3], size_t buffer_row_pitch, size_t buffer_slice_pitch,
  41. size_t host_row_pitch, size_t host_slice_pitch, cl_event *event);
  42. extern
  43. int _starpu_opencl_copy_rect_ram_to_opencl(void *ptr, cl_mem buffer, const size_t buffer_origin[3], const size_t host_origin[3],
  44. const size_t region[3], size_t buffer_row_pitch, size_t buffer_slice_pitch,
  45. size_t host_row_pitch, size_t host_slice_pitch, cl_event *event);
  46. extern
  47. void _starpu_opencl_init(void);
  48. extern
  49. void *_starpu_opencl_worker(void *);
  50. #endif // __DRIVER_OPENCL_H__