Teuchos Package Browser (Single Doxygen Collection)  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Teuchos_CommUtilities.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Teuchos: Common Tools Package
4 //
5 // Copyright 2004 NTESS and the Teuchos contributors.
6 // SPDX-License-Identifier: BSD-3-Clause
7 // *****************************************************************************
8 // @HEADER
9 
10 #ifndef TEUCHOS_COMM_UTILTIES_HPP
11 #define TEUCHOS_COMM_UTILTIES_HPP
12 
13 #include "Teuchos_TimeMonitor.hpp"
14 #if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
15 #include "Kokkos_Profiling_ScopedRegion.hpp"
16 #endif
17 
18 #ifdef HAVE_TEUCHOS_COMM_TIMERS
19 
20 #define TEUCHOS_COMM_TIME_MONITOR( FUNCNAME ) \
21  TEUCHOS_FUNC_TIME_MONITOR( FUNCNAME )
22 
23 #else // HAVE_TEUCHOS_COMM_TIMERS
24 
25 #if defined(HAVE_TEUCHOS_KOKKOS_PROFILING) && defined(HAVE_TEUCHOSCORE_KOKKOS)
26 
27 #define TEUCHOS_COMM_TIME_MONITOR( FUNCNAME ) \
28  std::ostringstream TEUCHOS_COMM_TIME_MONITOR_oss; \
29  TEUCHOS_COMM_TIME_MONITOR_oss << FUNCNAME; \
30  ::Kokkos::Profiling::ScopedRegion TEUCHOS_COMM_TIME_MONITOR_scopedRegion( TEUCHOS_COMM_TIME_MONITOR_oss.str().c_str() )
31 
32 #else
33 
34 #define TEUCHOS_COMM_TIME_MONITOR( FUNCNAME )
35 
36 #endif
37 
38 #endif // HAVE_TEUCHOS_COMM_TIMERS
39 
40 #endif // TEUCHOS_COMM_UTILTIES_HPP
Scope guard for Teuchos::Time, with MPI collective timer reporting.