You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/install/debug.md
+25-53
Original file line number
Diff line number
Diff line change
@@ -128,8 +128,8 @@ the next valgrind error.
128
128
129
129
130
130
#### Sanitizers
131
-
The `AddressSanitizer` (ASan), `LeakSanitizer` (LSan), `ThreadSanitizer` (TSan,
132
-
see below) and `UndefinedBehaviorSanitizer` (UBSan) are a collection of tools
131
+
The `AddressSanitizer` (ASan), `LeakSanitizer` (LSan), `ThreadSanitizer` (TSan)
132
+
and `UndefinedBehaviorSanitizer` (UBSan) are a collection of tools
133
133
that rely on compiler instrumentation to catch dangerous behaviour at runtime.
134
134
Compiler support is widespread but not ubiquitous, but both Clang and GCC
135
135
provide support.
@@ -147,13 +147,14 @@ The typical example of this case is loading NEURON from Python, where the
147
147
As of [#1842](https://github.com/neuronsimulator/nrn/pull/1842), the NEURON
148
148
build system is aware of ASan, LSan and UBSan, and it tries to configure the
149
149
sanitizers correctly based on the `NRN_SANITIZERS` CMake variable.
150
+
In [#2034](https://github.com/neuronsimulator/nrn/pull/2034) this was extended
151
+
to TSan via `-DNRN_SANITIZERS=thread`, and support for GCC was added.
150
152
For example, `cmake -DNRN_SANITIZERS=address,leak ...` will enable ASan and
151
153
LSan, while `-DNRN_SANITIZERS=undefined` will enable UBSan.
152
-
Not all combinations of sanitizers are possible, so far ASan, ASan+LSan and
153
-
UBSan have been tested with Clang, GCC has not been tested and likely needs
154
-
minor changes.
155
-
Support for standalone LSan and for TSan (see below for manual instructions)
156
-
should be possible without major difficulties, but is not yet implemented.
154
+
Not all combinations of sanitizers are possible, so far ASan, ASan+LSan, TSan
155
+
and UBSan have been tested with Clang.
156
+
Support for standalone LSan should be possible without major difficulties, but
157
+
is not yet implemented.
157
158
158
159
Depending on your system, you may also need to set the `LLVM_SYMBOLIZER_PATH`
159
160
variable to point to the `llvm-symbolizer` executable matching your Clang.
@@ -176,59 +177,30 @@ use `nrn-enable-sanitizer special -python path/to/script.py` or
176
177
because the `python` binary is (presumably) not linked against the sanitizer
177
178
runtime library.
178
179
179
-
LSan and UBSan support suppression files, which can be used to prevent tests
180
-
failing due to known issues.
181
-
NEURON includes a suppression file for UBSan under `.sanitizers/undefined.supp`
182
-
in the GitHub repository, no LSan equivalent exists for the moment.
180
+
LSan, TSan and UBSan support suppression files, which can be used to prevent
181
+
tests failing due to known issues.
182
+
NEURON includes a suppression file for TSan under `.sanitizers/thread.supp` and
183
+
one for UBSan under `.sanitizers/undefined.supp` in the GitHub repository, no
184
+
LSan equivalent exists for the moment.
183
185
184
186
Note that LSan and MPI implementations typically do not play nicely together, so
185
187
if you want to use LSan with NEURON, you may need to disable MPI or add a
186
188
suppression file that is tuned to your MPI implementation.
187
189
188
-
The GitHub Actions CI for NEURON at the time of writing includes test jobs for
189
-
ASan and UBSan using Clang 14, but does not enable LSan.
190
+
Similarly, TSan does not work very well with MPI and (especially) OpenMP
191
+
implementations that were not compiled with TSan instrumentation (which they
192
+
are typically not).
190
193
191
-
CoreNEURON and NMODL both support the sanitizers in a similar way, but this has
192
-
to be enabled explicitly: `-DNRN_SANITIZERS=undefined` will not compile
193
-
CoreNEURON code with UBSan enabled, you must additionally pass
194
-
`-DCORENRN_SANITIZERS=undefined` to enable instrumentation of CoreNEURON code.
195
-
The equivalent variable for NMODL is `NMODL_SANITIZERS`.
196
-
197
-
#### ThreadSanitizer (TSAN)
198
-
`ThreadSanitizer` is a tool that detects data races. Be aware that a slowdown is incurred by using ThreadSanitizer of about 5x-15x, with typical memory overhead of about 5x-10x.
You can then target a specific test (for example `ctest -VV -R test_name` or `bin/nrniv -nogui -nopython test.hoc`) and have a look at the generated output. In case of data races, you would see something similar to:
205
-
```
206
-
94: WARNING: ThreadSanitizer: data race (pid=2572)
207
-
94: Read of size 8 at 0x7b3c00000bf0 by thread T1:
0 commit comments