Skip to content

Commit

Permalink
Disable optimization for computeRoundOffDomain
Browse files Browse the repository at this point in the history
It seems dangerous to have optimization on when compiling the
Geometry::computeRoundOffDomain function. In the past, we had to change the
source code for Intel compilers. Recently, there appears to be issues with
ROCm 6.0 when optimization is on. Thus, we disable optimization for that
function.
  • Loading branch information
WeiqunZhang committed Dec 29, 2023
1 parent 75571e2 commit 79be5af
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Src/Base/AMReX_Geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,14 @@ Geometry::growPeriodicDomain (int ngrow) const noexcept
return growPeriodicDomain(IntVect(ngrow));
}

#if defined(__clang__)
[[clang::optnone]]
#elif defined(__GNUC__)
__attribute__ ((optimize(0)))
#elif defined(_WIN32)
#define AMREX_WIN32_OPTIMIZE_OFF
#pragma optimize("", off)
#endif
void
Geometry::computeRoundoffDomain ()
{
Expand Down Expand Up @@ -685,6 +693,9 @@ Geometry::computeRoundoffDomain ()
}
}
}
#if defined(AMREX_WIN32_OPTIMIZE_OFF)
#pragma optimize("", on)
#endif

bool
Geometry::outsideRoundoffDomain (AMREX_D_DECL(ParticleReal x, ParticleReal y, ParticleReal z)) const
Expand Down

0 comments on commit 79be5af

Please sign in to comment.