Skip to content

Commit be2a0b4

Browse files
authored
Merge pull request #1831 from llnl/feature/han12/slic_once
Add slic macros that log once per call site
2 parents b1844e9 + 575d98b commit be2a0b4

6 files changed

Lines changed: 1220 additions & 762 deletions

File tree

RELEASE-NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ The Axom project release numbers follow [Semantic Versioning](http://semver.org/
3737
- Adds yapf as a Python formatter.
3838
- Quest: Adds fast GWN methods for STL/Triangulated STEP input and linearized NURBS Curve input which
3939
leverage error-controlled approximation and a spatial index (BVH).
40+
- Slic: Adds new Slic macros that allow you to selectively print messages once per call-site. For example,
41+
`SLIC_INFO_ONCE(msg)` and `SLIC_INFO_ROOT_IF_ONCE(EXP, msg)`.
4042

4143
### Changed
4244
- Primal: Axom's polygon clipping was modified to handle some corner cases.

src/axom/quest/tests/quest_mesh_clipper.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,7 @@ axom::klee::Geometry createGeom_CupMesh(sidre::DataStore& ds, const std::string&
654654
std::string proeFile = axom::utilities::filesystem::joinPath(AXOM_DATA_DIR, "quest/cup.proe");
655655
reader.setFileName(proeFile);
656656
int readStatus = reader.read();
657+
AXOM_UNUSED_VAR(readStatus);
657658
SLIC_ASSERT(readStatus == 0);
658659
reader.getMesh(&tetMesh);
659660
const double extraScale = 1 / sqrt(3.0); // to ensure tetMesh remains inside mesh when rotated.

src/axom/slic/docs/sphinx/sections/wrapping_slic_in_macros.rst

Lines changed: 71 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -111,38 +111,76 @@ functions are called.
111111

112112
The table below details the built-in SLIC macros as well as some notes about when they are collective calls:
113113

114-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
115-
| Macro | Availability | Collective status |
116-
+============================+================================================+============================================================================+
117-
| | ``SLIC_ASSERT`` | | Only available in debug configurations | | Collective by default. |
118-
| | ``SLIC_ASSERT_MSG`` | | (i.e. when `AXOM_DEBUG` is defined). | | Collective after calling ``slic::enableAbortOnError()``. |
119-
| | | | Not available in device code. | | No longer collective after calling ``slic::disableAbortOnError()``. |
120-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
121-
| | ``SLIC_CHECK`` | | Only available in debug configurations | | Not collective by default. |
122-
| | ``SLIC_CHECK_MSG`` | | (i.e. when `AXOM_DEBUG` is defined). | | Collective after ``slic::debug::checksAreErrors`` is set to ``true``, |
123-
| | | | Not available in device code. | | defaults to ``false``. |
124-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
125-
| | ``SLIC_DEBUG`` | | Only available in debug configurations | | Never |
126-
| | ``SLIC_DEBUG_IF`` | | (i.e. when `AXOM_DEBUG` is defined) | | |
127-
| | ``SLIC_DEBUG_ROOT`` | | | | |
128-
| | ``SLIC_DEBUG_ROOT_IF`` | | | | |
129-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
130-
| | ``SLIC_INFO`` | | Always | | Never |
131-
| | ``SLIC_INFO_IF`` | | | | |
132-
| | ``SLIC_INFO_ROOT`` | | | | |
133-
| | ``SLIC_INFO_ROOT_IF`` | | | | |
134-
| | ``SLIC_INFO_TAGGED`` | | | | |
135-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
136-
| | ``SLIC_ERROR`` | | Always | | Collective by default. |
137-
| | ``SLIC_ERROR_IF`` | | | | Collective after calling ``slic::enableAbortOnError()``. |
138-
| | ``SLIC_ERROR_ROOT`` | | | | No longer collective after calling ``slic::disableAbortOnError()`` |
139-
| | ``SLIC_ERROR_ROOT_IF`` | | | | |
140-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
141-
| | ``SLIC_WARNING`` | | Always | | Not collective by default. |
142-
| | ``SLIC_WARNING_IF`` | | | | Collective after calling ``slic::enableAbortOnWarning()``. |
143-
| | ``SLIC_WARNING_ROOT`` | | | | No longer collective after calling ``slic::disableAbortOnWarning()`` |
144-
| | ``SLIC_WARNING_ROOT_IF`` | | | | |
145-
+----------------------------+------------------------------------------------+----------------------------------------------------------------------------+
114+
.. list-table:: SLIC macro availability and collective behavior
115+
:header-rows: 1
116+
:widths: 28 34 38
117+
118+
* - Macro
119+
- Availability
120+
- Collective status
121+
122+
* - ``SLIC_ASSERT``
123+
``SLIC_ASSERT_MSG``
124+
- - Only available in debug configurations (i.e. when ``AXOM_DEBUG`` is defined)
125+
- Not available in device code
126+
- - Collective by default
127+
- Collective after calling ``slic::enableAbortOnError()``
128+
- No longer collective after calling ``slic::disableAbortOnError()``
129+
130+
* - ``SLIC_CHECK``
131+
``SLIC_CHECK_MSG``
132+
- - Only available in debug configurations (i.e. when ``AXOM_DEBUG`` is defined)
133+
- Not available in device code
134+
- - Not collective by default
135+
- Collective after ``slic::debug::checksAreErrors`` is set to ``true``, defaults to ``false``
136+
137+
* - ``SLIC_DEBUG``
138+
``SLIC_DEBUG_IF``
139+
``SLIC_DEBUG_ROOT``
140+
``SLIC_DEBUG_ROOT_IF``
141+
``SLIC_DEBUG_PRINT_CONTAINER``
142+
``SLIC_DEBUG_ONCE``
143+
``SLIC_DEBUG_IF_ONCE``
144+
``SLIC_DEBUG_ROOT_ONCE``
145+
``SLIC_DEBUG_ROOT_IF_ONCE``
146+
``SLIC_DEBUG_PRINT_CONTAINER_ONCE``
147+
- - Only available in debug configurations (i.e. when ``AXOM_DEBUG`` is defined)
148+
- - Never
149+
150+
* - ``SLIC_INFO``
151+
``SLIC_INFO_IF``
152+
``SLIC_INFO_ROOT``
153+
``SLIC_INFO_ROOT_IF``
154+
``SLIC_INFO_TAGGED``
155+
``SLIC_INFO_ONCE``
156+
``SLIC_INFO_IF_ONCE``
157+
``SLIC_INFO_ROOT_ONCE``
158+
``SLIC_INFO_ROOT_IF_ONCE``
159+
``SLIC_INFO_TAGGED_ONCE``
160+
- - Always
161+
- - Never
162+
163+
* - ``SLIC_ERROR``
164+
``SLIC_ERROR_IF``
165+
``SLIC_ERROR_ROOT``
166+
``SLIC_ERROR_ROOT_IF``
167+
- - Always
168+
- - Collective by default
169+
- Collective after calling ``slic::enableAbortOnError()``
170+
- No longer collective after calling ``slic::disableAbortOnError()``
171+
172+
* - ``SLIC_WARNING``
173+
``SLIC_WARNING_IF``
174+
``SLIC_WARNING_ROOT``
175+
``SLIC_WARNING_ROOT_IF``
176+
``SLIC_WARNING_ONCE``
177+
``SLIC_WARNING_IF_ONCE``
178+
``SLIC_WARNING_ROOT_ONCE``
179+
``SLIC_WARNING_ROOT_IF_ONCE``
180+
- - Always
181+
- - Not collective by default
182+
- Collective after calling ``slic::enableAbortOnWarning()``
183+
- No longer collective after calling ``slic::disableAbortOnWarning()``
146184

147185
Doxygen generated API documentation on Macros can be found here: `SLIC Macros <../../../../../doxygen/html/slic__macros_8hpp.html>`_
148186

@@ -157,6 +195,7 @@ Consider the following rules of thumb when choosing from the above logging macro
157195
(i.e. their messages will not get logged), while `SLIC_INFO` macros are always available.
158196
* The `SLIC_*_ROOT` variants can help reduce logging verbosity when called in an MPI application, especially if all
159197
MPI ranks are expected to have the same data (for example, if a value was broadcast from one rank to all the other ranks).
198+
* The `SLIC_*_ONCE` variants can help reduce logging verbosity when only the first invocation at a call-site is necessary.
160199

161200

162201
.. #############################################################################

0 commit comments

Comments
 (0)