Page MenuHomePhabricator

Make runtime/test/barrier/omp_barrier.c pass on 2-core machines

Authored by dsanders on Jan 25 2016, 7:17 AM.



This test currently expects omp_get_thread_num() to return 1 and 2, effectively requiring three threads. 2-core machines only seem to spawn two threads, preventing omp_get_thread_num() from returning 2. This patch changes the expected thread numbers to 0 and 1 so that it passes on 2-core machines.

This fixes the last issue in the x86_64-linux-gnu-debian8 build of the 3.8.0 release.

Diff Detail


Event Timeline

dsanders updated this revision to Diff 45863.Jan 25 2016, 7:17 AM
dsanders retitled this revision from to Make runtime/test/barrier/omp_barrier.c pass on 2-core machines.
dsanders updated this object.
dsanders added a reviewer: AndreyChurbanov.
dsanders set the repository for this revision to rL LLVM.

Please note, that I don't know OpenMP very well. I don't think this changes the nature of the test based on what little I've read of the spec but I could be mistaken.

Suggested change does not fix the test reliably, because it will still fail on a single processor machine.

I am sorry if I broken some rules here, but I have committed more reliable fix for the test (revision #258695) so that
(1) it now passes on any number of processors, and (2) it runs in 1 sec instead of in 10 sec in initial implementation.

I don't think it makes much sense to have threads to spin 10 times per 1 sec in order to check the barrier, much smaller delay is perfectly enough (I've reduced it to 10 x 0.1 sec).

Feel free to comment.
Thanks, Andrey.

dsanders abandoned this revision.Jan 25 2016, 12:37 PM

Thanks for the quick response. As you say, your version fixes more cases than mine does and also speeds it up.

Abandoning this review since a better fix has been committed.