StarPU Internal Handbook
source_common.h
Go to the documentation of this file.
1 /* StarPU --- Runtime system for heterogeneous multicore architectures.
2  *
3  * Copyright (C) 2012-2023 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 __SOURCE_COMMON_H__
19 #define __SOURCE_COMMON_H__
20 
23 #ifdef STARPU_USE_MP
24 
25 #include <core/sched_policy.h>
26 #include <core/task.h>
28 
29 #pragma GCC visibility push(hidden)
30 
31 /* Array of structures containing all the informations useful to send
32  * and receive informations with devices */
33 #ifdef STARPU_USE_MPI_MASTER_SLAVE
34 extern struct _starpu_mp_node *_starpu_src_nodes[STARPU_NARCH][STARPU_MAXMPIDEVS];
35 #endif
36 
37 #ifdef STARPU_USE_TCPIP_MASTER_SLAVE
38 extern struct _starpu_mp_node *_starpu_src_nodes[STARPU_NARCH][STARPU_MAXTCPIPDEVS];
39 #endif
40 
41 int _starpu_src_common_store_message(struct _starpu_mp_node *node, void * arg, int arg_size, enum _starpu_mp_command answer);
42 
43 enum _starpu_mp_command _starpu_src_common_wait_completed_execution(struct _starpu_mp_node *node, int devid, void **arg, int * arg_size);
44 
45 int _starpu_src_common_sink_nbcores(struct _starpu_mp_node *node, int *buf);
46 
47 int _starpu_src_common_lookup(struct _starpu_mp_node *node, void (**func_ptr)(void), const char *func_name);
48 
49 starpu_cpu_func_t _starpu_src_common_get_cpu_func_from_codelet(struct starpu_codelet *cl, unsigned nimpl);
50 
51 void(* _starpu_src_common_get_cpu_func_from_job(const struct _starpu_mp_node *node STARPU_ATTRIBUTE_UNUSED, struct _starpu_job *j))(void);
52 
53 struct _starpu_mp_node *_starpu_src_common_get_mp_node_from_memory_node(int memory_node);
54 uintptr_t _starpu_src_common_allocate(unsigned dst_node, size_t size, int flags);
55 void _starpu_src_common_free(unsigned dst_node, uintptr_t addr, size_t size, int flags);
56 
57 uintptr_t _starpu_src_common_map(unsigned dst_node, uintptr_t addr, size_t size);
58 void _starpu_src_common_unmap(unsigned dst_node, uintptr_t addr, size_t size);
59 
60 int _starpu_src_common_execute_kernel(struct _starpu_mp_node *node,
61  void (*kernel)(void), unsigned coreid,
62  enum starpu_codelet_type type,
63  int is_parallel_task, int cb_workerid,
64  starpu_data_handle_t *handles,
65  void **interfaces,
66  unsigned nb_interfaces,
67  void *cl_arg, size_t cl_arg_size, int detached);
68 
69 int _starpu_src_common_copy_host_to_sink_sync(struct _starpu_mp_node *mp_node, void *src, void *dst, size_t size);
70 
71 int _starpu_src_common_copy_sink_to_host_sync(struct _starpu_mp_node *mp_node, void *src, void *dst, size_t size);
72 
73 int _starpu_src_common_copy_sink_to_sink_sync(struct _starpu_mp_node *src_node, struct _starpu_mp_node *dst_node, void *src, void *dst, size_t size);
74 
75 int _starpu_src_common_copy_host_to_sink_async(struct _starpu_mp_node *mp_node, void *src, void *dst, size_t size, void *event);
76 
77 int _starpu_src_common_copy_sink_to_host_async(struct _starpu_mp_node *mp_node, void *src, void *dst, size_t size, void *event);
78 
79 int _starpu_src_common_copy_sink_to_sink_async(struct _starpu_mp_node *src_node, struct _starpu_mp_node *dst_node, void *src, void *dst, size_t size, void *event);
80 
81 int _starpu_src_common_copy_data_host_to_sink(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);
82 int _starpu_src_common_copy_data_sink_to_host(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);
83 int _starpu_src_common_copy_data_sink_to_sink(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);
84 
85 void _starpu_src_common_init_switch_env(unsigned this);
86 void _starpu_src_common_workers_set(struct _starpu_worker_set * worker_set, int ndevices, struct _starpu_mp_node ** mp_node);
87 
88 void _starpu_src_common_deinit(void);
89 
90 #pragma GCC visibility pop
91 
92 #endif /* STARPU_USE_MP */
93 
94 #endif /* __SOURCE_COMMON_H__ */
Definition: copy_driver.h:71
@ STARPU_NARCH
Definition: starpu_worker.h:74
Definition: jobs.h:74
Definition: workers.h:339