Skip to content

Commit f3393f1

Browse files
authored
Added BL_PROFILE statements to implicit solvers (BLAST-WarpX#5783)
1 parent 5a5fb48 commit f3393f1

File tree

6 files changed

+27
-1
lines changed

6 files changed

+27
-1
lines changed

Source/FieldSolver/ImplicitSolvers/SemiImplicitEM.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ using namespace amrex::literals;
1313

1414
void SemiImplicitEM::Define ( WarpX* a_WarpX )
1515
{
16+
BL_PROFILE("SemiImplicitEM::Define()");
17+
1618
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
1719
!m_is_defined,
1820
"SemiImplicitEM object is already defined!");
@@ -57,6 +59,8 @@ void SemiImplicitEM::OneStep ( amrex::Real start_time,
5759
amrex::Real a_dt,
5860
int a_step )
5961
{
62+
BL_PROFILE("SemiImplicitEM::OneStep()");
63+
6064
amrex::ignore_unused(a_step);
6165

6266
// Set the member time step
@@ -107,6 +111,8 @@ void SemiImplicitEM::ComputeRHS ( WarpXSolverVec& a_RHS,
107111
int a_nl_iter,
108112
bool a_from_jacobian )
109113
{
114+
BL_PROFILE("SemiImplicitEM::ComputeRHS()");
115+
110116
// Update WarpX-owned Efield_fp using current state of Eg from
111117
// the nonlinear solver at time n+theta
112118
const amrex::Real half_time = start_time + 0.5_rt*m_dt;

Source/FieldSolver/ImplicitSolvers/ThetaImplicitEM.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ using namespace amrex::literals;
1414

1515
void ThetaImplicitEM::Define ( WarpX* const a_WarpX )
1616
{
17+
BL_PROFILE("ThetaImplicitEM::Define()");
18+
1719
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
1820
!m_is_defined,
1921
"ThetaImplicitEM object is already defined!");
@@ -77,6 +79,8 @@ void ThetaImplicitEM::Define ( WarpX* const a_WarpX )
7779

7880
void ThetaImplicitEM::PrintParameters () const
7981
{
82+
BL_PROFILE("ThetaImplicitEM::PrintParameters()");
83+
8084
if (!m_WarpX->Verbose()) { return; }
8185
amrex::Print() << "\n";
8286
amrex::Print() << "-----------------------------------------------------------\n";
@@ -99,6 +103,8 @@ void ThetaImplicitEM::OneStep ( const amrex::Real start_time,
99103
const amrex::Real a_dt,
100104
const int a_step )
101105
{
106+
BL_PROFILE("ThetaImplicitEM::OneStep()");
107+
102108
amrex::ignore_unused(a_step);
103109

104110
// Fields have Eg^{n} and Bg^{n}
@@ -147,6 +153,8 @@ void ThetaImplicitEM::ComputeRHS ( WarpXSolverVec& a_RHS,
147153
int a_nl_iter,
148154
bool a_from_jacobian )
149155
{
156+
BL_PROFILE("ThetaImplicitEM::ComputeRHS()");
157+
150158
// Update WarpX-owned Efield_fp and Bfield_fp using current state of
151159
// Eg from the nonlinear solver at time n+theta
152160
UpdateWarpXFields( a_E, start_time );
@@ -163,6 +171,7 @@ void ThetaImplicitEM::ComputeRHS ( WarpXSolverVec& a_RHS,
163171
void ThetaImplicitEM::UpdateWarpXFields ( const WarpXSolverVec& a_E,
164172
amrex::Real start_time )
165173
{
174+
BL_PROFILE("ThetaImplicitEM::UpdateWarpXFields()");
166175

167176
// Update Efield_fp owned by WarpX
168177
const amrex::Real theta_time = start_time + m_theta*m_dt;
@@ -176,6 +185,7 @@ void ThetaImplicitEM::UpdateWarpXFields ( const WarpXSolverVec& a_E,
176185

177186
void ThetaImplicitEM::FinishFieldUpdate ( amrex::Real end_time )
178187
{
188+
BL_PROFILE("ThetaImplicitEM::FinishFieldUpdate()");
179189

180190
// Eg^{n+1} = (1/theta)*Eg^{n+theta} + (1-1/theta)*Eg^n
181191
// Bg^{n+1} = (1/theta)*Bg^{n+theta} + (1-1/theta)*Bg^n

Source/NonlinearSolvers/CurlCurlMLMGPC.H

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ template <class T, class Ops>
192192
void CurlCurlMLMGPC<T,Ops>::Define ( const T& a_U,
193193
Ops* const a_ops )
194194
{
195+
BL_PROFILE("CurlCurlMLMGPC::Define()");
195196
using namespace amrex;
196197

197198
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -265,6 +266,7 @@ void CurlCurlMLMGPC<T,Ops>::Define ( const T& a_U,
265266
template <class T, class Ops>
266267
void CurlCurlMLMGPC<T,Ops>::Update (const T& a_U)
267268
{
269+
BL_PROFILE("CurlCurlMLMGPC::Update()");
268270
using namespace amrex;
269271

270272
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -316,6 +318,7 @@ void CurlCurlMLMGPC<T,Ops>::Apply (T& a_x, const T& a_b)
316318
// operator:
317319
// A x = curl (alpha * curl (x) ) + beta * x
318320

321+
BL_PROFILE("CurlCurlMLMGPC::Apply()");
319322
using namespace amrex;
320323

321324
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(

Source/NonlinearSolvers/JacobiPC.H

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ template <class T, class Ops>
151151
void JacobiPC<T,Ops>::Define ( const T& a_U,
152152
Ops* const a_ops )
153153
{
154+
BL_PROFILE("JacobiPC::Define()");
154155
using namespace amrex;
155156

156157
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -177,6 +178,7 @@ void JacobiPC<T,Ops>::Define ( const T& a_U,
177178
template <class T, class Ops>
178179
void JacobiPC<T,Ops>::Update (const T& a_U)
179180
{
181+
BL_PROFILE("JacobiPC::Update()");
180182
using namespace amrex;
181183

182184
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
@@ -199,6 +201,7 @@ void JacobiPC<T,Ops>::Apply (T& a_x, const T& a_b)
199201
// A x = b
200202
// where A is the linear operator.
201203

204+
BL_PROFILE("JacobiPC::Apply()");
202205
using namespace amrex;
203206

204207
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(

Source/NonlinearSolvers/JacobianFunctionMF.H

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,7 @@ void JacobianFunctionMF<T,Ops>::define ( const T& a_U,
182182
Ops* a_ops,
183183
const PreconditionerType& a_pc_type )
184184
{
185+
BL_PROFILE("JacobianFunctionMF::::define()");
185186
m_Z.Define(a_U);
186187
m_Y0.Define(a_U);
187188
m_R0.Define(a_U);
@@ -211,6 +212,7 @@ void JacobianFunctionMF<T,Ops>::define ( const T& a_U,
211212
template <class T, class Ops>
212213
auto JacobianFunctionMF<T,Ops>::makeVecRHS () const -> T
213214
{
215+
BL_PROFILE("JacobianFunctionMF::::makeVecRHS()");
214216
T Vec;
215217
Vec.Define(m_R);
216218
return Vec;
@@ -219,6 +221,7 @@ auto JacobianFunctionMF<T,Ops>::makeVecRHS () const -> T
219221
template <class T, class Ops>
220222
auto JacobianFunctionMF<T,Ops>::makeVecLHS () const -> T
221223
{
224+
BL_PROFILE("JacobianFunctionMF::::makeVecLHS()");
222225
T Vec;
223226
Vec.Define(m_R);
224227
return Vec;

Source/NonlinearSolvers/NewtonSolver.H

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ template <class Vec, class Ops>
180180
void NewtonSolver<Vec,Ops>::Define ( const Vec& a_U,
181181
Ops* a_ops )
182182
{
183+
BL_PROFILE("NewtonSolver::Define()");
183184
WARPX_ALWAYS_ASSERT_WITH_MESSAGE(
184185
!this->m_is_defined,
185186
"Newton nonlinear solver object is already defined!");
@@ -389,7 +390,7 @@ void NewtonSolver<Vec,Ops>::EvalResidual ( Vec& a_F,
389390
amrex::Real a_time,
390391
int a_iter ) const
391392
{
392-
393+
BL_PROFILE("NewtonSolver::EvalResidual()");
393394
m_ops->ComputeRHS( m_R, a_U, a_time, a_iter, false );
394395

395396
// set base U and R(U) for matrix-free Jacobian action calculation

0 commit comments

Comments
 (0)