timemory 3.3.0
Modular C++ Toolkit for Performance Analysis and Logging. Profiling API and Tools for C, C++, CUDA, Fortran, and Python. The C++ template API is essentially a framework to creating tools: it is designed to provide a unifying interface for recording various performance measurements alongside data logging and interfaces to other tools.
mpip.hpp
Go to the documentation of this file.
1// MIT License
2//
3// Copyright (c) 2020, The Regents of the University of California,
4// through Lawrence Berkeley National Laboratory (subject to receipt of any
5// required approvals from the U.S. Dept. of Energy). All rights reserved.
6//
7// Permission is hereby granted, free of charge, to any person obtaining a copy
8// of this software and associated documentation files (the "Software"), to deal
9// in the Software without restriction, including without limitation the rights
10// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11// copies of the Software, and to permit persons to whom the Software is
12// furnished to do so, subject to the following conditions:
13//
14// The above copyright notice and this permission notice shall be included in all
15// copies or substantial portions of the Software.
16//
17// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23// SOFTWARE.
24
25#pragma once
26
27#include "timemory/api.hpp"
29#include "timemory/components/gotcha/backends.hpp"
34#include "timemory/units.hpp"
36
37#include <memory>
38#include <set>
39#include <string>
40#include <unordered_map>
41
42#if defined(TIMEMORY_USE_MPI) || defined(TIMEMORY_USE_MPI_HEADERS)
43# include <mpi.h>
44#endif
45
46#if !defined(NUM_TIMEMORY_MPIP_WRAPPERS)
47# define NUM_TIMEMORY_MPIP_WRAPPERS 246
48#endif
49
50namespace tim
51{
52namespace component
53{
54//
55//--------------------------------------------------------------------------------------//
56//
57template <typename Toolset, typename Tag>
58TIMEMORY_VISIBILITY("default")
59TIMEMORY_NOINLINE void configure_mpip(std::set<std::string> permit = {},
60 std::set<std::string> reject = {});
61//
62//--------------------------------------------------------------------------------------//
63//
64template <typename Toolset, typename Tag>
65TIMEMORY_VISIBILITY("default")
66TIMEMORY_NOINLINE uint64_t activate_mpip();
67//
68//--------------------------------------------------------------------------------------//
69//
70template <typename Toolset, typename Tag>
71TIMEMORY_VISIBILITY("default")
72TIMEMORY_NOINLINE uint64_t deactivate_mpip(uint64_t);
73//
74//--------------------------------------------------------------------------------------//
75//
76template <typename Toolset, typename Tag>
77struct mpip_handle : base<mpip_handle<Toolset, Tag>, void>
78{
80
81 using value_type = void;
84
88 using toolset_ptr_t = std::shared_ptr<mpip_tuple_t>;
89
90 static std::string label() { return "mpip_handle"; }
91 static std::string description() { return "Handle for activating MPI wrappers"; }
92
93 void get() {}
94
95 void start()
96 {
97 if(get_tool_count()++ == 0)
98 {
99 get_tool_instance() = std::make_shared<mpip_tuple_t>("timemory_mpip");
100 get_tool_instance()->start();
101 }
102 }
103
104 void stop()
105 {
106 auto idx = --get_tool_count();
107 if(get_tool_instance().get())
108 {
109 get_tool_instance()->stop();
110 if(idx == 0)
111 get_tool_instance().reset();
112 }
113 }
114
115 int get_count() { return get_tool_count().load(); }
116
117private:
118 struct persistent_data
119 {
120 std::atomic<short> m_configured;
121 std::atomic<int64_t> m_count;
122 toolset_ptr_t m_tool;
123 };
124
125 static persistent_data& get_persistent_data()
126 {
127 static persistent_data _instance;
128 return _instance;
129 }
130
131 static std::atomic<short>& get_configured()
132 {
133 return get_persistent_data().m_configured;
134 }
135
136 static toolset_ptr_t& get_tool_instance() { return get_persistent_data().m_tool; }
137
138 static std::atomic<int64_t>& get_tool_count()
139 {
140 return get_persistent_data().m_count;
141 }
142};
143//
144//======================================================================================//
145//
146} // namespace component
147} // namespace tim
148//
149//======================================================================================//
150//
151#include "timemory/timemory.hpp"
152//
153//======================================================================================//
154//
155/// \fn uint64_t tim::component::activate_mpip()
156/// \brief The thread that first activates mpip will be the thread that turns it off.
157/// Function returns the number of new mpip handles
158///
159template <typename Toolset, typename Tag>
160uint64_t
162{
164
165 static std::shared_ptr<handle_t> _handle;
166
167 if(!_handle.get())
168 {
169 _handle = std::make_shared<handle_t>();
170 _handle->start();
171
172 auto cleanup_functor = [=]() {
173 if(_handle)
174 {
175 _handle->stop();
176 _handle.reset();
177 }
178 };
179
180 static std::string _label = []() {
181 std::stringstream ss;
182 ss << "timemory-mpip-" << demangle<Toolset>() << "-" << demangle<Tag>();
183 return ss.str();
184 }();
185 DEBUG_PRINT_HERE("Adding cleanup for %s", _label.c_str());
186 tim::manager::instance()->add_cleanup(_label, cleanup_functor);
187 return 1;
188 }
189 return 0;
190}
191//
192//======================================================================================//
193//
194/// \fn uint64_t tim::component::deactivate_mpip(uint64_t id)
195/// \brief The thread that created the initial mpip handle will turn off. Returns
196/// the number of handles active
197///
198template <typename Toolset, typename Tag>
199uint64_t
201{
202 if(id > 0)
203 {
204 static std::string _label = []() {
205 std::stringstream ss;
206 ss << "timemory-mpip-" << demangle<Toolset>() << "-" << demangle<Tag>();
207 return ss.str();
208 }();
209 DEBUG_PRINT_HERE("Removing cleanup for %s", _label.c_str());
210 tim::manager::instance()->cleanup(_label);
211 return 0;
212 }
213 return 1;
214}
215//
216//======================================================================================//
217//
218#if !defined(TIMEMORY_USE_GOTCHA) || \
219 (!defined(TIMEMORY_USE_MPI) && !defined(TIMEMORY_USE_MPI_HEADERS))
220//
221template <typename Toolset, typename Tag>
222void tim::component::configure_mpip(std::set<std::string>, std::set<std::string>)
223{}
224//
225#else
226//
227template <typename Toolset, typename Tag>
228void
229tim::component::configure_mpip(std::set<std::string> permit, std::set<std::string> reject)
230{
231 static constexpr size_t mpip_wrapper_count = NUM_TIMEMORY_MPIP_WRAPPERS;
232 static bool is_initialized = false;
233
235
236 if(!is_initialized)
237 {
238 // generate the gotcha wrappers
239 mpip_gotcha_t::get_initializer() = []() {
240 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 0, MPI_Accumulate);
241 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 1, MPI_Add_error_class);
242 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 2, MPI_Add_error_code);
243 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 3, MPI_Add_error_string);
244 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 4, MPI_Aint_add);
245 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 5, MPI_Aint_diff);
246 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 6, MPI_Allgather);
247 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 7, MPI_Allgatherv);
248 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 8, MPI_Alloc_mem);
249 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 9, MPI_Allreduce);
250 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 10, MPI_Alltoall);
251 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 11, MPI_Alltoallv);
252 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 12, MPI_Alltoallw);
253 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 13, MPI_Barrier);
254 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 14, MPI_Bcast);
255 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 15, MPI_Bsend);
256 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 16, MPI_Bsend_init);
257 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 17, MPI_Buffer_attach);
258 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 18, MPI_Buffer_detach);
259 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 19, MPI_Cancel);
260 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 20, MPI_Cart_coords);
261 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 21, MPI_Cart_create);
262 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 22, MPI_Cart_get);
263 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 23, MPI_Cart_map);
264 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 24, MPI_Cart_rank);
265 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 25, MPI_Cart_shift);
266 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 26, MPI_Cart_sub);
267 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 27, MPI_Cartdim_get);
268 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 28, MPI_Close_port);
269 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 29, MPI_Comm_accept);
270 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 30, MPI_Comm_call_errhandler);
271 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 31, MPI_Comm_compare);
272 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 32, MPI_Comm_connect);
273 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 33, MPI_Comm_create);
274 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 34, MPI_Comm_create_errhandler);
275 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 35, MPI_Comm_create_group);
276 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 36, MPI_Comm_create_keyval);
277 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 37, MPI_Comm_delete_attr);
278 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 38, MPI_Comm_disconnect);
279 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 39, MPI_Comm_dup);
280 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 40, MPI_Comm_dup_with_info);
281 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 41, MPI_Comm_free);
282 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 42, MPI_Comm_free_keyval);
283 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 43, MPI_Comm_get_attr);
284 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 44, MPI_Comm_get_errhandler);
285 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 45, MPI_Comm_get_info);
286 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 46, MPI_Comm_get_name);
287 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 47, MPI_Comm_get_parent);
288 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 48, MPI_Comm_group);
289 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 49, MPI_Comm_idup);
290 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 50, MPI_Comm_join);
291 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 51, MPI_Comm_rank);
292 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 52, MPI_Comm_remote_group);
293 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 53, MPI_Comm_remote_size);
294 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 54, MPI_Comm_set_attr);
295 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 55, MPI_Comm_set_errhandler);
296 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 56, MPI_Comm_set_info);
297 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 57, MPI_Comm_set_name);
298 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 58, MPI_Comm_size);
299 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 59, MPI_Comm_spawn);
300 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 60, MPI_Comm_spawn_multiple);
301 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 61, MPI_Comm_split);
302 // TIMEMORY_C_GOTCHA(mpip_gotcha_t, 62, MPI_Comm_split_type);
303 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 63, MPI_Comm_test_inter);
304 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 64, MPI_Compare_and_swap);
305 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 65, MPI_Dims_create);
306 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 66, MPI_Dist_graph_create);
307 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 67, MPI_Dist_graph_create_adjacent);
308 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 68, MPI_Dist_graph_neighbors);
309 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 69, MPI_Dist_graph_neighbors_count);
310 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 70, MPI_Error_class);
311 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 71, MPI_Error_string);
312 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 72, MPI_Exscan);
313 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 73, MPI_Fetch_and_op);
314 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 74, MPI_File_call_errhandler);
315 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 75, MPI_File_create_errhandler);
316 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 76, MPI_File_get_errhandler);
317 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 77, MPI_File_set_errhandler);
318 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 78, MPI_Free_mem);
319 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 79, MPI_Gather);
320 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 80, MPI_Gatherv);
321 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 81, MPI_Get);
322 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 82, MPI_Get_accumulate);
323 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 83, MPI_Get_address);
324 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 84, MPI_Get_count);
325 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 85, MPI_Get_elements);
326 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 86, MPI_Get_elements_x);
327 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 87, MPI_Get_library_version);
328 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 88, MPI_Get_processor_name);
329 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 89, MPI_Get_version);
330 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 90, MPI_Graph_create);
331 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 91, MPI_Graph_get);
332 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 92, MPI_Graph_map);
333 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 93, MPI_Graph_neighbors);
334 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 94, MPI_Graph_neighbors_count);
335 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 95, MPI_Graphdims_get);
336 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 96, MPI_Grequest_complete);
337 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 97, MPI_Grequest_start);
338 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 98, MPI_Group_compare);
339 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 99, MPI_Group_difference);
340 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 100, MPI_Group_excl);
341 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 101, MPI_Group_free);
342 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 102, MPI_Group_incl);
343 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 103, MPI_Group_intersection);
344 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 104, MPI_Group_range_excl);
345 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 105, MPI_Group_range_incl);
346 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 106, MPI_Group_rank);
347 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 107, MPI_Group_size);
348 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 108, MPI_Group_translate_ranks);
349 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 109, MPI_Group_union);
350 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 110, MPI_Iallgather);
351 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 111, MPI_Iallgatherv);
352 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 112, MPI_Iallreduce);
353 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 113, MPI_Ialltoall);
354 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 114, MPI_Ialltoallv);
355 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 115, MPI_Ialltoallw);
356 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 116, MPI_Ibarrier);
357 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 117, MPI_Ibcast);
358 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 118, MPI_Ibsend);
359 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 119, MPI_Iexscan);
360 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 120, MPI_Igather);
361 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 121, MPI_Igatherv);
362 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 122, MPI_Improbe);
363 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 123, MPI_Imrecv);
364 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 124, MPI_Ineighbor_allgather);
365 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 125, MPI_Ineighbor_allgatherv);
366 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 126, MPI_Ineighbor_alltoall);
367 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 127, MPI_Ineighbor_alltoallv);
368 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 128, MPI_Ineighbor_alltoallw);
369 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 129, MPI_Info_create);
370 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 130, MPI_Info_delete);
371 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 131, MPI_Info_dup);
372 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 132, MPI_Info_free);
373 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 133, MPI_Info_get);
374 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 134, MPI_Info_get_nkeys);
375 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 135, MPI_Info_get_nthkey);
376 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 136, MPI_Info_get_valuelen);
377 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 137, MPI_Info_set);
378 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 138, MPI_Intercomm_create);
379 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 139, MPI_Intercomm_merge);
380 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 140, MPI_Iprobe);
381 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 141, MPI_Irecv);
382 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 142, MPI_Ireduce);
383 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 143, MPI_Ireduce_scatter);
384 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 144, MPI_Ireduce_scatter_block);
385 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 145, MPI_Irsend);
386 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 146, MPI_Is_thread_main);
387 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 147, MPI_Iscan);
388 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 148, MPI_Iscatter);
389 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 149, MPI_Iscatterv);
390 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 150, MPI_Isend);
391 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 151, MPI_Issend);
392 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 152, MPI_Lookup_name);
393 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 153, MPI_Mprobe);
394 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 154, MPI_Mrecv);
395 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 155, MPI_Neighbor_allgather);
396 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 156, MPI_Neighbor_allgatherv);
397 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 157, MPI_Neighbor_alltoall);
398 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 158, MPI_Neighbor_alltoallv);
399 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 159, MPI_Neighbor_alltoallw);
400 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 160, MPI_Op_commutative);
401 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 161, MPI_Op_create);
402 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 162, MPI_Op_free);
403 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 163, MPI_Open_port);
404 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 164, MPI_Pack);
405 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 165, MPI_Pack_external);
406 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 166, MPI_Pack_external_size);
407 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 167, MPI_Pack_size);
408 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 168, MPI_Probe);
409 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 169, MPI_Publish_name);
410 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 170, MPI_Put);
411 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 171, MPI_Query_thread);
412 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 172, MPI_Raccumulate);
413 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 173, MPI_Recv);
414 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 174, MPI_Recv_init);
415 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 175, MPI_Reduce);
416 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 176, MPI_Reduce_local);
417 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 177, MPI_Reduce_scatter);
418 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 178, MPI_Reduce_scatter_block);
419 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 179, MPI_Request_free);
420 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 180, MPI_Request_get_status);
421 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 181, MPI_Rget);
422 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 182, MPI_Rget_accumulate);
423 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 183, MPI_Rput);
424 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 184, MPI_Rsend);
425 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 185, MPI_Rsend_init);
426 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 186, MPI_Scan);
427 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 187, MPI_Scatter);
428 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 188, MPI_Scatterv);
429 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 189, MPI_Send);
430 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 190, MPI_Send_init);
431 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 191, MPI_Sendrecv);
432 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 192, MPI_Sendrecv_replace);
433 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 193, MPI_Ssend);
434 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 194, MPI_Ssend_init);
435 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 195, MPI_Start);
436 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 196, MPI_Startall);
437 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 197, MPI_Status_f2c);
438 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 198, MPI_Status_set_cancelled);
439 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 199, MPI_Status_set_elements);
440 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 200, MPI_Status_set_elements_x);
441 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 201, MPI_Topo_test);
442 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 202, MPI_Unpack);
443 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 203, MPI_Unpack_external);
444 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 204, MPI_Unpublish_name);
445 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 205, MPI_Wait);
446 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 206, MPI_Waitall);
447 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 207, MPI_Waitany);
448 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 208, MPI_Waitsome);
449 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 209, MPI_Win_allocate);
450 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 210, MPI_Win_allocate_shared);
451 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 211, MPI_Win_attach);
452 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 212, MPI_Win_call_errhandler);
453 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 213, MPI_Win_complete);
454 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 214, MPI_Win_create);
455 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 215, MPI_Win_create_dynamic);
456 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 216, MPI_Win_create_errhandler);
457 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 217, MPI_Win_create_keyval);
458 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 218, MPI_Win_delete_attr);
459 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 219, MPI_Win_detach);
460 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 220, MPI_Win_fence);
461 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 221, MPI_Win_flush);
462 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 222, MPI_Win_flush_all);
463 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 223, MPI_Win_flush_local);
464 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 224, MPI_Win_flush_local_all);
465 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 225, MPI_Win_free);
466 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 226, MPI_Win_free_keyval);
467 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 227, MPI_Win_get_attr);
468 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 228, MPI_Win_get_errhandler);
469 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 229, MPI_Win_get_group);
470 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 230, MPI_Win_get_info);
471 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 231, MPI_Win_get_name);
472 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 232, MPI_Win_lock);
473 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 233, MPI_Win_lock_all);
474 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 234, MPI_Win_post);
475 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 235, MPI_Win_set_attr);
476 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 236, MPI_Win_set_errhandler);
477 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 237, MPI_Win_set_info);
478 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 238, MPI_Win_set_name);
479 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 239, MPI_Win_shared_query);
480 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 240, MPI_Win_start);
481 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 241, MPI_Win_sync);
482 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 242, MPI_Win_test);
483 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 243, MPI_Win_unlock);
484 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 244, MPI_Win_unlock_all);
485 TIMEMORY_C_GOTCHA(mpip_gotcha_t, 245, MPI_Win_wait);
486 };
487
488 // provide environment variable for suppressing wrappers
489 mpip_gotcha_t::get_reject_list() = [reject]() {
490 auto _reject = reject;
491 // check environment
492 auto reject_list = tim::get_env<std::string>("TIMEMORY_MPIP_REJECT_LIST", "");
493 // add environment setting
494 for(const auto& itr : tim::delimit(reject_list))
495 _reject.insert(itr);
496 return _reject;
497 };
498
499 // provide environment variable for selecting wrappers
500 mpip_gotcha_t::get_permit_list() = [permit]() {
501 auto _permit = permit;
502 // check environment
503 auto permit_list = tim::get_env<std::string>("TIMEMORY_MPIP_PERMIT_LIST", "");
504 // add environment setting
505 for(const auto& itr : tim::delimit(permit_list))
506 _permit.insert(itr);
507 return _permit;
508 };
509
510 is_initialized = true;
511 }
512}
513//
514#endif
515//
516//======================================================================================//
517//
This is a variadic component wrapper where all components are allocated on the stack and cannot be di...
static pointer_t instance()
Get a shared pointer to the instance for the current thread.
Toolset
Definition: types.hpp:40
#define TIMEMORY_C_GOTCHA(...)
Definition: macros.hpp:323
The declaration for the types for manager without definitions.
#define NUM_TIMEMORY_MPIP_WRAPPERS
Definition: mpip.hpp:47
uint64_t activate_mpip()
The thread that first activates mpip will be the thread that turns it off. Function returns the numbe...
Definition: mpip.hpp:161
void configure_mpip(std::set< std::string > permit={}, std::set< std::string > reject={})
Definition: mpip.hpp:222
uint64_t deactivate_mpip(uint64_t)
The thread that created the initial mpip handle will turn off. Returns the number of handles active.
Definition: mpip.hpp:200
Definition: kokkosp.cpp:39
tim::mpl::apply< std::string > string
Definition: macros.hpp:53
ContainerT delimit(const std::string &line, const std::string &delimiters="\"',;: ", PredicateT &&predicate=[](const std::string &s) -> std::string { return s;})
Definition: delimit.hpp:68
The gotcha component rewrites the global offset table such that calling the wrapped function actually...
Definition: components.hpp:179
static std::string label()
Definition: mpip.hpp:90
static constexpr size_t mpip_wrapper_count
Definition: mpip.hpp:79
std::shared_ptr< mpip_tuple_t > toolset_ptr_t
Definition: mpip.hpp:88
static std::string description()
Definition: mpip.hpp:91
#define DEBUG_PRINT_HERE(...)
Definition: macros.hpp:168