Commit 9d63d59
authored
Improvements to AMREX_ASSERT (#4581)
## Summary
Previously the `AMREX_ASSERT_WITH_MESSAGE` and
`AMREX_ALWAYS_ASSERT_WITH_MESSAGE` macros converted the messege to a
string using `# MSG` which resulted in strange formatting and the
printing of runtime values to not work.
Additionally, `ALWAYS_ASSERT` and `ASSERT` did not work in device code
even when compiling with `AMREX_USE_ASSERTION` due to the `#if
defined(NDEBUG)` in `Assert (...)`.
Now `ALWAYS_ASSERT` and `ASSERT` will work in device code with
`AMREX_USE_ASSERTION`, but not without so the behaviour doesn't change
of the few places that use `ALWAYS_ASSERT` on the GPU (meaning
`ALWAYS_ASSERT` still does not always assert).
Test of the assert:
https://github.com/AMReX-Codes/amrex/blob/5bd9494f9229b6a7a60cbc6f2560e5a831aaa3de/Src/Particle/AMReX_StructOfArrays.H#L122
Dev:
```
0::Assertion `pos != m_rdata_names->end()' failed, file "/users/sinnalex/hipace/build/_deps/fetchedamrex-src/Src/Particle/AMReX_StructOfArrays.H", line 122,
Msg: "Soa Real name='" + name + "' was not found components" !!!
SIGABRT
See Backtrace.0 file for details
```
PR:
```
0::Assertion `pos != m_rdata_names->end()' failed, file "/users/sinnalex/amrex/Src/Particle/AMReX_StructOfArrays.H", line 122,
Msg: Soa Real name='wrong name' was not found components !!!
SIGABRT
See Backtrace.0 file for details
```1 parent 7d82235 commit 9d63d59
File tree
5 files changed
+41
-24
lines changed- Src/Base
5 files changed
+41
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
| 14 | + | |
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| |||
188 | 189 | | |
189 | 190 | | |
190 | 191 | | |
191 | | - | |
| 192 | + | |
| 193 | + | |
192 | 194 | | |
193 | 195 | | |
194 | | - | |
195 | | - | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
196 | 212 | | |
197 | 213 | | |
198 | 214 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
207 | 218 | | |
208 | 219 | | |
209 | | - | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
210 | 226 | | |
211 | 227 | | |
212 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
| 272 | + | |
| 273 | + | |
273 | 274 | | |
274 | 275 | | |
275 | 276 | | |
276 | 277 | | |
277 | | - | |
| 278 | + | |
278 | 279 | | |
279 | | - | |
| 280 | + | |
280 | 281 | | |
281 | 282 | | |
282 | | - | |
| 283 | + | |
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
286 | 287 | | |
287 | 288 | | |
288 | 289 | | |
289 | 290 | | |
290 | | - | |
| 291 | + | |
291 | 292 | | |
292 | 293 | | |
293 | 294 | | |
| |||
296 | 297 | | |
297 | 298 | | |
298 | 299 | | |
299 | | - | |
| 300 | + | |
300 | 301 | | |
301 | | - | |
| 302 | + | |
302 | 303 | | |
303 | | - | |
| 304 | + | |
304 | 305 | | |
305 | 306 | | |
306 | 307 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2044 | 2044 | | |
2045 | 2045 | | |
2046 | 2046 | | |
2047 | | - | |
| 2047 | + | |
2048 | 2048 | | |
2049 | 2049 | | |
2050 | 2050 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
279 | 279 | | |
280 | 280 | | |
281 | 281 | | |
282 | | - | |
| 282 | + | |
283 | 283 | | |
284 | 284 | | |
285 | 285 | | |
| |||
0 commit comments