Skip to content

Commit

Permalink
update doc for amrex::Abort on GPU (AMReX-Codes#3605)
Browse files Browse the repository at this point in the history
The docs on the behavior of amrex::Abort and related functions appear to
be out of date, so this clarifies that when running on GPU these
functions do not do anything when called from within GPU kernels unless
you compile in debug mode or with `USE_ASSERTION=TRUE`.
  • Loading branch information
baperry2 authored Oct 23, 2023
1 parent da79aff commit 152fdac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
3 changes: 3 additions & 0 deletions Docs/sphinx_documentation/source/Basics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2812,3 +2812,6 @@ Backtrace files are produced by AMReX signal handler by default when
segfault occurs or ``Abort`` is called. If the application does not
want AMReX to handle this, ``ParmParse`` parameter
`amrex.signal_handling=0` can be used to disable it.

See :ref:`sec:gpu:assertion` for considerations on using these functions in
GPU-enabled code.
10 changes: 7 additions & 3 deletions Docs/sphinx_documentation/source/GPU.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1553,9 +1553,13 @@ Assertions and Error Checking
To help debugging, we often use :cpp:`amrex::Assert` and
:cpp:`amrex::Abort`. These functions are GPU safe and can be used in
GPU kernels. However, implementing these functions requires additional
GPU registers, which will reduce overall performance. Therefore, it
is preferred to implement such calls in debug mode only by wrapping the
calls using ``#ifdef AMREX_DEBUG``.
GPU registers, which will reduce overall performance. Therefore, by
default these functions and the macro ``AMREX_ALWAYS_ASSERT`` are no-ops
for optimized builds (e.g., ``DEBUG=FALSE`` using the GNU Make build
system) when called from kernels run on GPU. Calls to these functions from
GPU kernels are active for debug builds and can optionally be activated
at compile time for optimized builds (e.g., ``DEBUG=FALSE`` and
``USE_ASSERTION=TRUE`` using the GNU Make build system).

In CPU code, :cpp:`AMREX_GPU_ERROR_CHECK()` can be called
to check the health of previous GPU launches. This call
Expand Down

0 comments on commit 152fdac

Please sign in to comment.