Skip to content

test prism rng testing#98

Merged
stevengj merged 2 commits into
NanoComp:masterfrom
Luochenghuang:test-prism-rng-testing
Jul 6, 2026
Merged

test prism rng testing#98
stevengj merged 2 commits into
NanoComp:masterfrom
Luochenghuang:test-prism-rng-testing

Conversation

@Luochenghuang

@Luochenghuang Luochenghuang commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Thread all random helpers through an unsigned *seed and use rand_r(), with one seed per thread (seed[tid] = tid) passed as &seed[omp_get_thread_num()]. schedule(dynamic) -> schedule(static) fixes the iteration->thread mapping so the per thread seeds actually yield reproducible results; the failure count is an integer reduction, so it's independent of thread combination order. The geometry calls still run in parallel, preserving thread-safety coverage. rand()/srand are removed; non-OpenMP builds get omp_get_* stubs.

Closes #97

Luochenghuang and others added 2 commits July 6, 2026 03:12
The point/segment/normal tests call rand() inside OpenMP parallel loops.
rand() uses global shared state, so even with a fixed seed the parallel
execution order changes which iteration consumes which random value:
failures weren't reproducible and varied between the omp=1 and omp=8 CI legs.

Thread all random helpers through an 'unsigned *seed' and use rand_r(), with
one seed per thread (seed[tid] = tid) passed as &seed[omp_get_thread_num()].
schedule(dynamic) -> schedule(static) fixes the iteration->thread mapping so
the per-thread seeds actually yield reproducible results; the failure count is
an integer reduction, so it's independent of thread combination order. The
geometry calls still run in parallel, preserving thread-safety coverage.
rand()/srand are removed; non-OpenMP builds get omp_get_* stubs.
@stevengj stevengj merged commit 41011c4 into NanoComp:master Jul 6, 2026
2 checks passed
@Luochenghuang Luochenghuang deleted the test-prism-rng-testing branch July 6, 2026 12:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

using deterministic random numbers in test

2 participants