StarPU Internal Handbook

driver_mic_common.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
19#ifndef __DRIVER_MIC_COMMON_H__
20#define __DRIVER_MIC_COMMON_H__
21
24#include <common/config.h>
25
26#ifdef STARPU_USE_MIC
27
28#include <source/COIProcess_source.h>
29
30#define STARPU_TO_MIC_ID(id) ((id) + 1)
31
32/* TODO: rather allocate ports on the host and pass them as parameters to the device process */
33// We use the last SCIF reserved port and add 1000 to be safe
34#define STARPU_MIC_PORTS_BEGIN SCIF_PORT_RSVD+1000
35
36#define STARPU_MIC_SOURCE_PORT_NUMBER STARPU_MIC_PORTS_BEGIN
37#define STARPU_MIC_SINK_PORT_NUMBER(id) ((id) + STARPU_MIC_PORTS_BEGIN)
38
39#define STARPU_MIC_SOURCE_DT_PORT_NUMBER (STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN)
40#define STARPU_MIC_SINK_DT_PORT_NUMBER(id) ((id) + STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN + 1)
41
42#define STARPU_MIC_SINK_SINK_DT_PORT_NUMBER(me, peer_id) \
43((me) * STARPU_MAXMICDEVS + (peer_id) + 2 * STARPU_MAXMICDEVS + STARPU_MIC_PORTS_BEGIN + 1)
44
45#define STARPU_MIC_PAGE_SIZE 0x1000
46#define STARPU_MIC_GET_PAGE_SIZE_MULTIPLE(size) \
47(((size) % STARPU_MIC_PAGE_SIZE == 0) ? (size) : (((size) / STARPU_MIC_PAGE_SIZE + 1) * STARPU_MIC_PAGE_SIZE))
48
49#define STARPU_MIC_COMMON_REPORT_SCIF_ERROR(status) \
50 _starpu_mic_common_report_scif_error(__starpu_func__, __FILE__, __LINE__, status)
51
52 struct _starpu_mic_free_command
53{
54 void *addr;
55 size_t size;
56};
57
58 void _starpu_mic_common_report_scif_error(const char *func, const char *file, int line, const int status);
59
60 int _starpu_mic_common_recv_is_ready(const struct _starpu_mp_node *mp_node);
61
62 void _starpu_mic_common_send(const struct _starpu_mp_node *node, void *msg, int len);
63
64 void _starpu_mic_common_recv(const struct _starpu_mp_node *node, void *msg, int len);
65
66 void _starpu_mic_common_dt_send(const struct _starpu_mp_node *node, void *msg, int len, void * event);
67
68 void _starpu_mic_common_dt_recv(const struct _starpu_mp_node *node, void *msg, int len, void * event);
69
70 void _starpu_mic_common_connect(scif_epd_t *endpoint, uint16_t remote_node, COIPROCESS process,
71 uint16_t local_port_number, uint16_t remote_port_number);
72 void _starpu_mic_common_accept(scif_epd_t *endpoint, uint16_t port_number);
73
74#endif /* STARPU_USE_MIC */
75
76#endif /* __DRIVER_MIC_COMMON_H__ */
_starpu_mic_free_command
Definition: driver_mic_common.h:53