test: add threadsafe execute test and sanitizer CI modes#832
Conversation
6c71103 to
d786291
Compare
Add threadsafe_execute regression test verifying concurrent execute() calls on the same plan produce correct results. Add sanitizer mode selection via FINUFFT_USE_SANITIZERS=OFF|ON|MEMSAN|TSAN, and extend the sanitizer GitHub workflow to run a focused Linux TSAN job.
d786291 to
c1e4918
Compare
lu1and10
left a comment
There was a problem hiding this comment.
Thanks, looks good to me. More tests are good. I guess the Jenkins failure is not related.
| std::vector<std::thread> workers; | ||
| workers.reserve(nthreads); | ||
| for (int tid = 0; tid < nthreads; ++tid) { | ||
| workers.emplace_back([&, tid]() { |
There was a problem hiding this comment.
I never tried this. Is this emplace_back non-block, so workers.reserve(nthreads) for nthreads==4 will execute 4 finufft_execute simultaneously, and that's how you test the thread safety of executing parallel execution?
There was a problem hiding this comment.
A brief explanation here may be useful. workers.emplace_back(...) constructs each std::thread directly in the vector. The new thread begins running the lambda immediately, and the thread constructor returns without waiting for completion, so the loop launches all threads without blocking.
After that, I call join() on each thread to wait for them all to finish. So yes, for nthreads == 4, this is intended to execute 4 finufft_execute calls concurrently and test thread safety.
d360f7f
into
flatironinstitute:master
Add threadsafe_execute regression test verifying concurrent execute() calls on the same plan produce correct results. Add sanitizer mode selection via FINUFFT_USE_SANITIZERS=OFF|ON|MEMSAN|TSAN, and extend the sanitizer GitHub workflow to run a focused Linux TSAN job.