StarPU Internal Handbook

starpu_mpi_fxt.h
Go to the documentation of this file.
1/* StarPU --- Runtime system for heterogeneous multicore architectures.
2 *
3 * Copyright (C) 2010-2021 Université de Bordeaux, CNRS (LaBRI UMR 5800), Inria
4 * Copyright (C) 2019 Federal University of Rio Grande do Sul (UFRGS)
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 __STARPU_MPI_FXT_H__
19#define __STARPU_MPI_FXT_H__
20
21#include <starpu.h>
22#include <common/config.h>
23#include <common/fxt.h>
24
27#ifdef __cplusplus
28 extern "C"
29{
30#endif
31
32#define _STARPU_MPI_FUT_START 0x5201
33#define _STARPU_MPI_FUT_STOP 0x5202
34#define _STARPU_MPI_FUT_BARRIER 0x5203
35#define _STARPU_MPI_FUT_ISEND_SUBMIT_BEGIN 0x5204
36#define _STARPU_MPI_FUT_ISEND_SUBMIT_END 0x5205
37#define _STARPU_MPI_FUT_IRECV_SUBMIT_BEGIN 0x5206
38#define _STARPU_MPI_FUT_IRECV_SUBMIT_END 0x5207
39#define _STARPU_MPI_FUT_ISEND_COMPLETE_BEGIN 0x5208
40#define _STARPU_MPI_FUT_ISEND_COMPLETE_END 0x5209
41#define _STARPU_MPI_FUT_DATA_SET_RANK 0x521a
42#define _STARPU_MPI_FUT_IRECV_TERMINATED 0x521b
43#define _STARPU_MPI_FUT_ISEND_TERMINATED 0x521c
44#define _STARPU_MPI_FUT_TESTING_DETACHED_BEGIN 0x521d
45#define _STARPU_MPI_FUT_TESTING_DETACHED_END 0x521e
46#define _STARPU_MPI_FUT_TEST_BEGIN 0x521f
47#define _STARPU_MPI_FUT_TEST_END 0x5220
48#define _STARPU_MPI_FUT_IRECV_COMPLETE_BEGIN 0x520a
49#define _STARPU_MPI_FUT_IRECV_COMPLETE_END 0x520b
50#define _STARPU_MPI_FUT_SLEEP_BEGIN 0x520c
51#define _STARPU_MPI_FUT_SLEEP_END 0x520d
52#define _STARPU_MPI_FUT_DTESTING_BEGIN 0x520e
53#define _STARPU_MPI_FUT_DTESTING_END 0x520f
54#define _STARPU_MPI_FUT_UTESTING_BEGIN 0x5210
55#define _STARPU_MPI_FUT_UTESTING_END 0x5211
56#define _STARPU_MPI_FUT_UWAIT_BEGIN 0x5212
57#define _STARPU_MPI_FUT_UWAIT_END 0x5213
58#define _STARPU_MPI_FUT_POLLING_BEGIN 0x5214
59#define _STARPU_MPI_FUT_POLLING_END 0x5215
60#define _STARPU_MPI_FUT_DRIVER_RUN_BEGIN 0x5216
61#define _STARPU_MPI_FUT_DRIVER_RUN_END 0x5217
62#define _STARPU_MPI_FUT_DATA_SET_TAG 0x5218
63
64#ifdef STARPU_USE_FXT
65
66#define _STARPU_MPI_TRACE_START(rank, worldsize) \
67 FUT_DO_PROBE3(_STARPU_MPI_FUT_START, (rank), (worldsize), _starpu_gettid());
68#define _STARPU_MPI_TRACE_STOP(rank, worldsize) \
69 FUT_DO_PROBE3(_STARPU_MPI_FUT_STOP, (rank), (worldsize), _starpu_gettid());
70#define _STARPU_MPI_TRACE_BARRIER(rank, worldsize, key) do {\
71 if (_starpu_fxt_started) \
72 FUT_DO_ALWAYS_PROBE4(_STARPU_MPI_FUT_BARRIER, (rank), (worldsize), (key), _starpu_gettid()); \
73} while (0)
74#define _STARPU_MPI_TRACE_ISEND_SUBMIT_BEGIN(dest, data_tag, size) \
75 FUT_DO_PROBE4(_STARPU_MPI_FUT_ISEND_SUBMIT_BEGIN, (dest), (data_tag), (size), _starpu_gettid());
76#define _STARPU_MPI_TRACE_ISEND_SUBMIT_END(dest, data_tag, size, jobid) \
77 FUT_DO_PROBE5(_STARPU_MPI_FUT_ISEND_SUBMIT_END, (dest), (data_tag), (size), (jobid), _starpu_gettid());
78#define _STARPU_MPI_TRACE_IRECV_SUBMIT_BEGIN(src, data_tag) \
79 FUT_DO_PROBE3(_STARPU_MPI_FUT_IRECV_SUBMIT_BEGIN, (src), (data_tag), _starpu_gettid());
80#define _STARPU_MPI_TRACE_IRECV_SUBMIT_END(src, data_tag) \
81 FUT_DO_PROBE3(_STARPU_MPI_FUT_IRECV_SUBMIT_END, (src), (data_tag), _starpu_gettid());
82#define _STARPU_MPI_TRACE_ISEND_COMPLETE_BEGIN(dest, data_tag, size) \
83 FUT_DO_PROBE4(_STARPU_MPI_FUT_ISEND_COMPLETE_BEGIN, (dest), (data_tag), (size), _starpu_gettid());
84#define _STARPU_MPI_TRACE_COMPLETE_BEGIN(type, rank, data_tag) \
85 if (type == RECV_REQ) { _STARPU_MPI_TRACE_IRECV_COMPLETE_BEGIN((rank), (data_tag)); } else if (type == SEND_REQ) { _STARPU_MPI_TRACE_ISEND_COMPLETE_BEGIN((rank), (data_tag), 0); }
86#define _STARPU_MPI_TRACE_ISEND_COMPLETE_END(dest, data_tag, size) \
87 FUT_DO_PROBE4(_STARPU_MPI_FUT_ISEND_COMPLETE_END, (dest), (data_tag), (size), _starpu_gettid());
88#define _STARPU_MPI_TRACE_IRECV_COMPLETE_BEGIN(src, data_tag) \
89 FUT_DO_PROBE3(_STARPU_MPI_FUT_IRECV_COMPLETE_BEGIN, (src), (data_tag), _starpu_gettid());
90#define _STARPU_MPI_TRACE_IRECV_COMPLETE_END(src, data_tag) \
91 FUT_DO_PROBE3(_STARPU_MPI_FUT_IRECV_COMPLETE_END, (src), (data_tag), _starpu_gettid());
92#define _STARPU_MPI_TRACE_COMPLETE_END(type, rank, data_tag) \
93 if (type == RECV_REQ) { _STARPU_MPI_TRACE_IRECV_COMPLETE_END((rank), (data_tag)); } else if (type == SEND_REQ) { _STARPU_MPI_TRACE_ISEND_COMPLETE_END((rank), (data_tag), 0); }
94#define _STARPU_MPI_TRACE_TERMINATED(req, rank, data_tag) \
95 if ((req)->request_type == RECV_REQ) FUT_DO_PROBE4(_STARPU_MPI_FUT_IRECV_TERMINATED, (rank), (data_tag), (req)->post_sync_jobid, _starpu_gettid()); else \
96 if ((req)->request_type == SEND_REQ) FUT_DO_PROBE3(_STARPU_MPI_FUT_ISEND_TERMINATED, (rank), (data_tag), _starpu_gettid());
97#define _STARPU_MPI_TRACE_SLEEP_BEGIN() \
98 FUT_DO_PROBE1(_STARPU_MPI_FUT_SLEEP_BEGIN, _starpu_gettid());
99#define _STARPU_MPI_TRACE_SLEEP_END() \
100 FUT_DO_PROBE1(_STARPU_MPI_FUT_SLEEP_END, _starpu_gettid());
101#define _STARPU_MPI_TRACE_DTESTING_BEGIN() \
102 FUT_DO_PROBE1(_STARPU_MPI_FUT_DTESTING_BEGIN, _starpu_gettid());
103#define _STARPU_MPI_TRACE_DTESTING_END() \
104 FUT_DO_PROBE1(_STARPU_MPI_FUT_DTESTING_END, _starpu_gettid());
105#define _STARPU_MPI_TRACE_UTESTING_BEGIN(src, data_tag) \
106 FUT_DO_PROBE3(_STARPU_MPI_FUT_UTESTING_BEGIN, (src), (data_tag), _starpu_gettid());
107#define _STARPU_MPI_TRACE_UTESTING_END(src, data_tag) \
108 FUT_DO_PROBE3(_STARPU_MPI_FUT_UTESTING_END, (src), (data_tag), _starpu_gettid());
109#define _STARPU_MPI_TRACE_UWAIT_BEGIN(src, data_tag) \
110 FUT_DO_PROBE3(_STARPU_MPI_FUT_UWAIT_BEGIN, (src), (data_tag), _starpu_gettid());
111#define _STARPU_MPI_TRACE_UWAIT_END(src, data_tag) \
112 FUT_DO_PROBE3(_STARPU_MPI_FUT_UWAIT_END, (src), (data_tag), _starpu_gettid());
113#define _STARPU_MPI_TRACE_DATA_SET_RANK(handle, rank) \
114 FUT_DO_PROBE3(_STARPU_MPI_FUT_DATA_SET_RANK, (handle), (rank), _starpu_gettid());
115#define _STARPU_MPI_TRACE_DATA_SET_TAG(handle, data_tag) \
116 FUT_DO_PROBE3(_STARPU_MPI_FUT_DATA_SET_TAG, (handle), (data_tag), _starpu_gettid());
117#if 0
118/* This is very expensive in the trace, only enable for debugging */
119#define _STARPU_MPI_TRACE_TESTING_DETACHED_BEGIN() \
120 FUT_DO_PROBE1(_STARPU_MPI_FUT_TESTING_DETACHED_BEGIN, _starpu_gettid());
121#define _STARPU_MPI_TRACE_TESTING_DETACHED_END() \
122 FUT_DO_PROBE1(_STARPU_MPI_FUT_TESTING_DETACHED_END, _starpu_gettid());
123#define _STARPU_MPI_TRACE_TEST_BEGIN(peer, data_tag) \
124 FUT_DO_PROBE3(_STARPU_MPI_FUT_TEST_BEGIN, (peer), (data_tag), _starpu_gettid());
125#define _STARPU_MPI_TRACE_TEST_END(peer, data_tag) \
126 FUT_DO_PROBE3(_STARPU_MPI_FUT_TEST_END, (peer), (data_tag), _starpu_gettid());
127#else
128#define _STARPU_MPI_TRACE_TESTING_DETACHED_BEGIN() do {} while(0)
129#define _STARPU_MPI_TRACE_TESTING_DETACHED_END() do {} while(0)
130#define _STARPU_MPI_TRACE_TEST_BEGIN(peer, data_tag) do {} while(0)
131#define _STARPU_MPI_TRACE_TEST_END(peer, data_tag) do {} while(0)
132#endif
133#define _STARPU_MPI_TRACE_POLLING_BEGIN() \
134 if(!trace_loop) { \
135 trace_loop = 1; \
136 FUT_DO_PROBE1(_STARPU_MPI_FUT_POLLING_BEGIN, _starpu_gettid()); \
137 }
138#define _STARPU_MPI_TRACE_POLLING_END() \
139 if(trace_loop) { \
140 trace_loop = 0; \
141 FUT_DO_PROBE1(_STARPU_MPI_FUT_POLLING_END, _starpu_gettid()); \
142 }
143#define _STARPU_MPI_TRACE_DRIVER_RUN_BEGIN() \
144 FUT_DO_PROBE1(_STARPU_MPI_FUT_DRIVER_RUN_BEGIN, _starpu_gettid());
145#define _STARPU_MPI_TRACE_DRIVER_RUN_END() \
146 FUT_DO_PROBE1(_STARPU_MPI_FUT_DRIVER_RUN_END, _starpu_gettid());
147#define _STARPU_MPI_TRACE_DRIVER_RUN_BEGIN() \
148 FUT_DO_PROBE1(_STARPU_MPI_FUT_DRIVER_RUN_BEGIN, _starpu_gettid());
149#define _STARPU_MPI_TRACE_DRIVER_RUN_END() \
150 FUT_DO_PROBE1(_STARPU_MPI_FUT_DRIVER_RUN_END, _starpu_gettid());
151#define TRACE
152#else
153#define _STARPU_MPI_TRACE_START(a, b) do {} while(0);
154#define _STARPU_MPI_TRACE_STOP(a, b) do {} while(0);
155#define _STARPU_MPI_TRACE_BARRIER(a, b, c) do {} while(0);
156#define _STARPU_MPI_TRACE_ISEND_SUBMIT_BEGIN(a, b, c) do {} while(0);
157#define _STARPU_MPI_TRACE_ISEND_SUBMIT_END(a, b, c, d) do {} while(0);
158#define _STARPU_MPI_TRACE_IRECV_SUBMIT_BEGIN(a, b) do {} while(0);
159#define _STARPU_MPI_TRACE_IRECV_SUBMIT_END(a, b) do {} while(0);
160#define _STARPU_MPI_TRACE_ISEND_COMPLETE_BEGIN(a, b, c) do {} while(0);
161#define _STARPU_MPI_TRACE_COMPLETE_BEGIN(a, b, c) do {} while(0);
162#define _STARPU_MPI_TRACE_COMPLETE_END(a, b, c) do {} while(0);
163#define _STARPU_MPI_TRACE_TERMINATED(a, b, c) do {} while(0);
164#define _STARPU_MPI_TRACE_ISEND_COMPLETE_END(a, b, c) do {} while(0);
165#define _STARPU_MPI_TRACE_IRECV_COMPLETE_BEGIN(a, b) do {} while(0);
166#define _STARPU_MPI_TRACE_IRECV_COMPLETE_END(a, b) do {} while(0);
167#define _STARPU_MPI_TRACE_SLEEP_BEGIN() do {} while(0);
168#define _STARPU_MPI_TRACE_SLEEP_END() do {} while(0);
169#define _STARPU_MPI_TRACE_DTESTING_BEGIN() do {} while(0);
170#define _STARPU_MPI_TRACE_DTESTING_END() do {} while(0);
171#define _STARPU_MPI_TRACE_UTESTING_BEGIN(a, b) do {} while(0);
172#define _STARPU_MPI_TRACE_UTESTING_END(a, b) do {} while(0);
173#define _STARPU_MPI_TRACE_UWAIT_BEGIN(a, b) do {} while(0);
174#define _STARPU_MPI_TRACE_UWAIT_END(a, b) do {} while(0);
175#define _STARPU_MPI_TRACE_DATA_SET_RANK(a, b) do {} while(0);
176#define _STARPU_MPI_TRACE_DATA_SET_TAG(a, b) do {} while(0);
177#define _STARPU_MPI_TRACE_TESTING_DETACHED_BEGIN() do {} while(0)
178#define _STARPU_MPI_TRACE_TESTING_DETACHED_END() do {} while(0)
179#define _STARPU_MPI_TRACE_TEST_BEGIN(peer, data_tag) do {} while(0)
180#define _STARPU_MPI_TRACE_TEST_END(peer, data_tag) do {} while(0)
181#define _STARPU_MPI_TRACE_POLLING_BEGIN() do {} while(0);
182#define _STARPU_MPI_TRACE_POLLING_END() do {} while(0);
183#define _STARPU_MPI_TRACE_DRIVER_RUN_BEGIN() do {} while(0);
184#define _STARPU_MPI_TRACE_DRIVER_RUN_END() do {} while(0);
185#endif
186
187#ifdef __cplusplus
188}
189#endif
190
191
192#endif // __STARPU_MPI_FXT_H__
fxt.h