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 
14 AMREX_FORCE_INLINE
15 void doDeviceSynchronize(int do_device_synchronize)
16 {
17  if ( do_device_synchronize )
18  amrex::Gpu::synchronize();
19 }
20 
21 #define WARPX_PROFILE(fname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE(fname)
22 #define WARPX_PROFILE_VAR(fname, vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR(fname, vname)
23 #define WARPX_PROFILE_VAR_NS(fname, vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_NS(fname, vname)
24 #define WARPX_PROFILE_VAR_START(vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_START(vname)
25 #define WARPX_PROFILE_VAR_STOP(vname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_VAR_STOP(vname)
26 #define WARPX_PROFILE_REGION(rname) doDeviceSynchronize(WarpX::do_device_synchronize_before_profile); BL_PROFILE_REGION(rname)
27 
28 #endif // WARPX_PROFILERWRAPPER_H_
AMREX_FORCE_INLINE void doDeviceSynchronize(int do_device_synchronize)
Definition: WarpXProfilerWrapper.H:15