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.
ompt.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#if defined(TIMEMORY_USE_OMPT)
28
34
35extern "C"
36{
37 // NOLINTNEXTLINE
38 int ompt_initialize(ompt_function_lookup_t lookup, int initial_device_num,
39 ompt_data_t* tool_data)
40 {
41 printf("[timemory]> OpenMP-tools configuring for initial device %i\n\n",
42 initial_device_num);
43 tim::ompt::configure<TIMEMORY_OMPT_API_TAG>(lookup, initial_device_num,
44 tool_data);
45 return 1; // success
46 }
47
48 // NOLINTNEXTLINE
49 void ompt_finalize(ompt_data_t* tool_data)
50 {
51 printf("\n[timemory]> OpenMP-tools finalized\n\n");
52 tim::consume_parameters(tool_data);
53 }
54
55 // NOLINTNEXTLINE
56 ompt_start_tool_result_t* ompt_start_tool(unsigned int omp_version,
57 const char* runtime_version)
58 {
59 printf("\n[timemory]> OpenMP version: %u, runtime version: %s\n", omp_version,
60 runtime_version);
61 static auto data =
62 new ompt_start_tool_result_t{ &ompt_initialize, &ompt_finalize, { 0 } };
63 return (ompt_start_tool_result_t*) data;
64 }
65}
66
67//--------------------------------------------------------------------------------------//
68//
69#endif // TIMEMORY_USE_OMPT
Implementation of the ompt component(s)
void consume_parameters(ArgsT &&...)
Definition: types.hpp:285