WarpX
WarpXProfilerWrapper.H
Go to the documentation of this file.
1 /* Copyright 2020 Axel Huebl, Maxence Thevenet
2  *
3  * This file is part of WarpX.
4  *
5  * License: BSD-3-Clause-LBNL
6  */
7 
8 #ifndef WARPX_PROFILERWRAPPER_H_
9 #define WARPX_PROFILERWRAPPER_H_
10 
11 #include <AMReX_BLProfiler.H>
12 #include <AMReX_GpuDevice.H>
13 #include <WarpX.H>
14 
15 AMREX_FORCE_INLINE
16 void doDeviceSynchronize(int do_device_synchronize)
17 {
18  if ( do_device_synchronize )
19  amrex::Gpu::synchronize();
20 }
21 
22 #define WARPX_PROFILE(fname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE(fname)
23 #define WARPX_PROFILE_VAR(fname, vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR(fname, vname)
24 #define WARPX_PROFILE_VAR_NS(fname, vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_NS(fname, vname)
25 #define WARPX_PROFILE_VAR_START(vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_START(vname)
26 #define WARPX_PROFILE_VAR_STOP(vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_STOP(vname)
27 #define WARPX_PROFILE_REGION(rname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_REGION(rname)
28 
29 #endif // WARPX_PROFILERWRAPPER_H_
AMREX_FORCE_INLINE void doDeviceSynchronize(int do_device_synchronize)
Definition: WarpXProfilerWrapper.H:16