Skip to content

Commit

Permalink
Add profilers
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiqunZhang committed Oct 31, 2024
1 parent 1a079d8 commit eb395ee
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions Src/FFT/AMReX_FFT_Helper.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <AMReX_Config.H>

#include <AMReX.H>
#inlcude <AMReX_BLProfiler.H>
#include <AMReX_DataAllocator.H>
#include <AMReX_DistributionMapping.H>
#include <AMReX_Enum.H>
Expand Down
4 changes: 4 additions & 0 deletions Src/FFT/AMReX_FFT_Poisson.H
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ private:
template <typename MF>
void Poisson<MF>::solve (MF& soln, MF const& rhs)
{
BL_PROFILE("FFT::Poisson::solve");

using T = typename MF::value_type;

GpuArray<T,AMREX_SPACEDIM> fac
Expand Down Expand Up @@ -124,6 +126,8 @@ void Poisson<MF>::solve (MF& soln, MF const& rhs)
template <typename MF>
void PoissonHybrid<MF>::solve (MF& soln, MF const& rhs)
{
BL_PROFILE("FFT::PoissonHybrid::solve");

#if (AMREX_SPACEDIM < 3)
amrex::ignore_unused(soln, rhs);
#else
Expand Down
11 changes: 11 additions & 0 deletions Src/FFT/AMReX_FFT_R2C.H
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ public:
std::enable_if_t<DIR == Direction::both, int> = 0>
void forwardThenBackward (MF const& inmf, MF& outmf, F const& post_forward)
{
BL_PROFILE("FFT::R2C::forwardbackward");
this->forward(inmf);
this->post_forward_doit(post_forward);
this->backward(outmf);
Expand Down Expand Up @@ -201,6 +202,8 @@ R2C<T,D>::R2C (Box const& domain, Info const& info)
#endif
m_info(info)
{
BL_PROFILE("FFT::R2C");

static_assert(std::is_same_v<float,T> || std::is_same_v<double,T>);
AMREX_ALWAYS_ASSERT(m_real_domain.smallEnd() == 0 &&
m_real_domain.length(0) > 1 &&
Expand Down Expand Up @@ -344,6 +347,8 @@ template <Direction DIR, std::enable_if_t<DIR == Direction::forward ||
DIR == Direction::both, int> >
void R2C<T,D>::forward (MF const& inmf)
{
BL_PROFILE("FFT::R2C::forward(in)");

m_rx.ParallelCopy(inmf, 0, 0, 1);
m_fft_fwd_x.template compute_r2c<Direction::forward>();

Expand All @@ -368,6 +373,8 @@ void R2C<T,D>::backward (MF& outmf)
template <typename T, Direction D>
void R2C<T,D>::backward_doit (MF& outmf)
{
BL_PROFILE("FFT::R2C::backward(out)");

m_fft_bwd_z.template compute_c2c<Direction::backward>();
if ( m_cmd_z2y) {
ParallelCopy(m_cy, m_cz, *m_cmd_z2y, 0, 0, 1, m_dtos_z2y);
Expand Down Expand Up @@ -471,6 +478,8 @@ template <Direction DIR, std::enable_if_t<DIR == Direction::forward ||
DIR == Direction::both, int> >
void R2C<T,D>::forward (MF const& inmf, cMF& outmf)
{
BL_PROFILE("FFT::R2C::forward(inout)");

forward(inmf);
if (!m_cz.empty()) { // m_cz's order (z,x,y) -> (x,y,z)
RotateBwd dtos{};
Expand All @@ -491,6 +500,8 @@ template <Direction DIR, std::enable_if_t<DIR == Direction::backward ||
DIR == Direction::both, int> >
void R2C<T,D>::backward (cMF const& inmf, MF& outmf)
{
BL_PROFILE("FFT::R2C::backward(inout)");

if (!m_cz.empty()) { // (x,y,z) -> m_cz's order (z,x,y)
RotateFwd dtos{};
MultiBlockCommMetaData cmd
Expand Down
4 changes: 4 additions & 0 deletions Src/FFT/AMReX_FFT_R2X.H
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ R2X<T>::R2X (Box const& domain,
: m_dom_0(domain),
m_bc(bc)
{
BL_PROFILE("FFT::R2X");

static_assert(std::is_same_v<float,T> || std::is_same_v<double,T>);
AMREX_ALWAYS_ASSERT(domain.smallEnd() == 0 &&
domain.length(0) > 1 &&
Expand Down Expand Up @@ -494,6 +496,8 @@ template <typename T>
template <typename F>
void R2X<T>::forwardThenBackward (MF const& inmf, MF& outmf, F const& post_forward)
{
BL_PROFILE("FFT::R2X::forwardbackward");

// forward

m_rx.ParallelCopy(inmf, 0, 0, 1);
Expand Down

0 comments on commit eb395ee

Please sign in to comment.