StarPU Internal Handbook
driver_mic_source.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2012-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4  * Copyright (C) 2013 Thibaut Lambert
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 
18 #ifndef __DRIVER_MIC_SOURCE_H__
19 #define __DRIVER_MIC_SOURCE_H__
20 
23 #include <starpu_mic.h>
24 #include <common/config.h>
25 
26 #ifdef STARPU_USE_MIC
27 
28 #include <source/COIProcess_source.h>
29 #include <source/COIEngine_source.h>
30 #include <core/workers.h>
31 
33 #include <datawizard/node_ops.h>
34 
35 extern struct _starpu_node_ops _starpu_driver_mic_node_ops;
36 
39 extern struct _starpu_mp_node *_starpu_mic_nodes[STARPU_MAXMICDEVS];
40 
41 struct _starpu_mic_async_event *event;
42 
43 #define STARPU_MIC_REQUEST_COMPLETE 42
44 
45 #define STARPU_MIC_SRC_REPORT_COI_ERROR(status) \
46  _starpu_mic_src_report_coi_error(__starpu_func__, __FILE__, __LINE__, status)
47 
48 #define STARPU_MIC_SRC_REPORT_SCIF_ERROR(status) \
49  _starpu_mic_src_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
50 
51 struct _starpu_mp_node *_starpu_mic_src_get_actual_thread_mp_node();
52 struct _starpu_mp_node *_starpu_mic_src_get_mp_node_from_memory_node(int memory_node);
53 
54 void(* _starpu_mic_src_get_kernel_from_job(const struct _starpu_mp_node *node STARPU_ATTRIBUTE_UNUSED, struct _starpu_job *j))(void);
55 int _starpu_mic_src_register_kernel(starpu_mic_func_symbol_t *symbol, const char *func_name);
56 starpu_mic_kernel_t _starpu_mic_src_get_kernel(starpu_mic_func_symbol_t symbol);
57 
58 void _starpu_mic_src_report_coi_error(const char *func, const char *file, int line, const COIRESULT status);
59 void _starpu_mic_src_report_scif_error(const char *func, const char *file, int line, const int status);
60 
61 unsigned _starpu_mic_src_get_device_count(void);
62 starpu_mic_kernel_t _starpu_mic_src_get_kernel_from_codelet(struct starpu_codelet *cl, unsigned nimpl);
63 
64 void _starpu_mic_src_init(struct _starpu_mp_node *node);
65 void _starpu_mic_clear_kernels(void);
66 void _starpu_mic_src_deinit(struct _starpu_mp_node *node);
67 
68 size_t _starpu_mic_get_global_mem_size(int devid);
69 size_t _starpu_mic_get_free_mem_size(int devid);
70 
71 int _starpu_mic_allocate_memory(void **addr, size_t size, unsigned memory_node);
72 void _starpu_mic_free_memory(void *addr, size_t size, unsigned memory_node);
73 
74 int _starpu_mic_copy_ram_to_mic(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
75 int _starpu_mic_copy_mic_to_ram(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
76 int _starpu_mic_copy_ram_to_mic_async(void *src, unsigned src_node STARPU_ATTRIBUTE_UNUSED, void *dst, unsigned dst_node, size_t size);
77 int _starpu_mic_copy_mic_to_ram_async(void *src, unsigned src_node, void *dst, unsigned dst_node STARPU_ATTRIBUTE_UNUSED, size_t size);
78 
79 int _starpu_mic_init_event(struct _starpu_mic_async_event *event, unsigned memory_node);
80 
81 void *_starpu_mic_src_worker(void *arg);
82 
83 #endif /* STARPU_USE_MIC */
84 
85 unsigned _starpu_mic_test_request_completion(struct _starpu_async_channel *async_channel);
86 void _starpu_mic_wait_request_completion(struct _starpu_async_channel *async_channel);
87 
88 int _starpu_mic_copy_data_from_mic_to_cpu(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
89 int _starpu_mic_copy_data_from_cpu_to_mic(starpu_data_handle_t handle, void *src_interface, unsigned src_node, void *dst_interface, unsigned dst_node, struct _starpu_data_request *req);
90 
91 int _starpu_mic_copy_interface_from_mic_to_cpu(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
92 int _starpu_mic_copy_interface_from_cpu_to_mic(uintptr_t src, size_t src_offset, unsigned src_node, uintptr_t dst, size_t dst_offset, unsigned dst_node, size_t size, struct _starpu_async_channel *async_channel);
93 
94 int _starpu_mic_is_direct_access_supported(unsigned node, unsigned handling_node);
95 uintptr_t _starpu_mic_malloc_on_node(unsigned dst_node, size_t size, int flags);
96 void _starpu_mic_free_on_node(unsigned dst_node, uintptr_t addr, size_t size, int flags);
97 
98 #endif /* __DRIVER_MIC_SOURCE_H__ */
Definition: copy_driver.h:127
Definition: copy_driver.h:66
struct _starpu_mp_node * _starpu_mic_nodes[STARPU_MAXMICDEVS]
Definition: jobs.h:79
Definition: node_ops.h:48