driver_mic_source.h 3.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /* StarPU --- Runtime system for heterogeneous multicore architectures.
  2. *
  3. * Copyright (C) 2012 INRIA
  4. *
  5. * StarPU 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. * StarPU 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_MIC_SOURCE_H__
  17. #define __DRIVER_MIC_SOURCE_H__
  18. #include <starpu_mic.h>
  19. #include <common/config.h>
  20. #ifdef STARPU_USE_MIC
  21. #include <source/COIProcess_source.h>
  22. #include <source/COIEngine_source.h>
  23. #include <core/workers.h>
  24. #include <drivers/mp_common/mp_common.h>
  25. /* Array of structures containing all the informations useful to send
  26. * and receive informations with devices */
  27. extern struct _starpu_mp_node *mic_nodes[STARPU_MAXMICDEVS];
  28. struct _starpu_mic_async_event *event;
  29. #define STARPU_MIC_REQUEST_COMPLETE 42
  30. #define STARPU_MIC_SRC_REPORT_COI_ERROR(status) \
  31. _starpu_mic_src_report_coi_error(__starpu_func__, __FILE__, __LINE__, status)
  32. #define STARPU_MIC_SRC_REPORT_SCIF_ERROR(status) \
  33. _starpu_mic_src_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
  34. struct _starpu_mp_node *_starpu_mic_src_get_actual_thread_mp_node();
  35. const struct _starpu_mp_node *_starpu_mic_src_get_mp_node_from_memory_node(int memory_node);
  36. void(* _starpu_mic_src_get_kernel_from_job(const struct _starpu_mp_node *node STARPU_ATTRIBUTE_UNUSED, struct _starpu_job *j))(void);
  37. int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char *func_name);
  38. starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol);
  39. void _starpu_mic_src_report_coi_error(const char *func, const char *file, int line, const COIRESULT status);
  40. void _starpu_mic_src_report_scif_error(const char *func, const char *file, int line, const int status);
  41. unsigned _starpu_mic_src_get_device_count(void);
  42. starpu_mic_kernel_t _starpu_mic_src_get_kernel_from_codelet(struct starpu_codelet *cl, unsigned nimpl);
  43. void _starpu_mic_src_init(struct _starpu_mp_node *node);
  44. void _starpu_mic_clear_kernels(void);
  45. void _starpu_mic_src_deinit(struct _starpu_mp_node *node);
  46. size_t _starpu_mic_get_global_mem_size(int devid);
  47. size_t _starpu_mic_get_free_mem_size(int devid);
  48. int _starpu_mic_allocate_memory(void **addr, size_t size, unsigned memory_node);
  49. void _starpu_mic_free_memory(void *addr, size_t size, unsigned memory_node);
  50. int _starpu_mic_copy_ram_to_mic(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
  51. int _starpu_mic_copy_mic_to_ram(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
  52. int _starpu_mic_copy_ram_to_mic_async(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
  53. int _starpu_mic_copy_mic_to_ram_async(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
  54. int _starpu_mic_init_event(struct _starpu_mic_async_event *event, unsigned memory_node);
  55. void _starpu_mic_wait_request_completion(struct _starpu_mic_async_event *event);
  56. int _starpu_mic_request_is_complete(struct _starpu_mic_async_event *event);
  57. void *_starpu_mic_src_worker(void *arg);
  58. #endif /* STARPU_USE_MIC */
  59. #endif /* __DRIVER_MIC_SOURCE_H__ */