diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2014-03-07 08:23:10 +0200 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2014-04-02 12:46:09 +0300 |
commit | 56622140e3a8175c8ccc82c9717adf8372043364 (patch) | |
tree | 67fe2c81bbc31c638276f4dd0798fead5e00fc30 /test | |
parent | 840912b31159aa8ac7be4ea0cee8bdef95a539a4 (diff) |
test: Fix OpenMP clauses for the tolerance-test
Compiling with the Intel Compiler reveals a problem:
tolerance-test.c(350): error: index variable "i" of for statement following an OpenMP for pragma must be private
# pragma omp parallel for default(none) shared(i) private (result)
^
In addition to this, the 'result' variable also should not be private
(otherwise its value does not survive after the end of the loop). It
needs to be either shared or use the reduction clause to describe how
the results from multiple threads are combined together. Reduction
seems to be more appropriate here.
Diffstat (limited to 'test')
-rw-r--r-- | test/tolerance-test.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/test/tolerance-test.c b/test/tolerance-test.c index 5625630..320bb7f 100644 --- a/test/tolerance-test.c +++ b/test/tolerance-test.c @@ -347,12 +347,12 @@ main (int argc, const char *argv[]) else { #ifdef USE_OPENMP -# pragma omp parallel for default(none) shared(i) private (result) +# pragma omp parallel for default(none) reduction(|:result) #endif for (i = 0; i < N_TESTS; ++i) { if (!do_check (i)) - result = 1; + result |= 1; } } |