Skip to content

Commit 0e71997

Browse files
authored
Document how to enable assertions (#7084)
1 parent dc80635 commit 0e71997

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

docs/cudax/stf.rst

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2016,6 +2016,47 @@ A token corresponds to a ``logical_data<void_interface>`` object, so that the
20162016
``token`` type serves as a short-hand for this type. ``ctx.token()`` thus
20172017
returns an object with a ``token`` type.
20182018

2019+
Debugging
2020+
---------
2021+
2022+
Enabling internal checks
2023+
^^^^^^^^^^^^^^^^^^^^^^^^
2024+
2025+
CUDASTF includes internal assertions (``_CCCL_ASSERT``) that help detect
2026+
programming errors and invalid usage patterns during development. These checks
2027+
are disabled by default for performance but can be enabled to aid debugging.
2028+
2029+
**With CMake:**
2030+
2031+
When building in Debug mode, assertions are enabled automatically:
2032+
2033+
.. code:: bash
2034+
2035+
cmake -DCMAKE_BUILD_TYPE=Debug ..
2036+
2037+
To explicitly enable assertions for any build type, add the compile definition
2038+
to your target:
2039+
2040+
.. code:: cmake
2041+
2042+
target_compile_definitions(your_target PRIVATE CCCL_ENABLE_ASSERTIONS)
2043+
2044+
**With Makefile or manual compilation:**
2045+
2046+
Add the ``-DCCCL_ENABLE_ASSERTIONS`` flag to your compiler invocation:
2047+
2048+
.. code:: bash
2049+
2050+
# For nvcc
2051+
nvcc -DCCCL_ENABLE_ASSERTIONS ...
2052+
2053+
# For host compiler
2054+
g++ -DCCCL_ENABLE_ASSERTIONS ...
2055+
2056+
Note that this flag enables the assertion checks themselves. For full debugging
2057+
support (setting breakpoints, inspecting variables), you may also want to add
2058+
debug symbol flags (``-g`` for host code, ``-G`` for device code).
2059+
20192060
Tools
20202061
-----
20212062

0 commit comments

Comments
 (0)