Commit 26596ee5 by Tom de Vries Committed by Tom de Vries

Fix openacc float reduction testcases

2017-10-04  Tom de Vries  <tom@codesourcery.com>

	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c
	(main): Reduce sum of arr elements.  Assert that hres is exactly
	representable in 32-bit floating point.
	* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c
	(main): Reduce sum of arr elements.  Assert that hres and hmres are
	exactly representable in 32-bit floating point.
	* testsuite/libgomp.oacc-c-c++-common/reduction-7.c (gwv_np_4): Same.

From-SVN: r253398
parent 8bca3f59
2017-10-04 Tom de Vries <tom@codesourcery.com>
* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-3.c
(main): Reduce sum of arr elements. Assert that hres is exactly
representable in 32-bit floating point.
* testsuite/libgomp.oacc-c-c++-common/par-loop-comb-reduction-4.c
(main): Reduce sum of arr elements. Assert that hres and hmres are
exactly representable in 32-bit floating point.
* testsuite/libgomp.oacc-c-c++-common/reduction-7.c (gwv_np_4): Same.
2017-09-28 Tom de Vries <tom@codesourcery.com> 2017-09-28 Tom de Vries <tom@codesourcery.com>
* testsuite/libgomp.c++/for-12.C: Remove superfluous -fopenmp option * testsuite/libgomp.c++/for-12.C: Remove superfluous -fopenmp option
......
...@@ -11,7 +11,7 @@ main (int argc, char *argv[]) ...@@ -11,7 +11,7 @@ main (int argc, char *argv[])
float res = 0, hres = 0; float res = 0, hres = 0;
for (i = 0; i < 32768; i++) for (i = 0; i < 32768; i++)
arr[i] = i; arr[i] = i % (32768 / 64);
#pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
reduction(+:res) copy(res) reduction(+:res) copy(res)
...@@ -36,6 +36,7 @@ main (int argc, char *argv[]) ...@@ -36,6 +36,7 @@ main (int argc, char *argv[])
hres += arr[j * 1024 + (1023 - i)]; hres += arr[j * 1024 + (1023 - i)];
} }
assert (hres <= 16777216);
assert (res == hres); assert (res == hres);
return 0; return 0;
......
...@@ -11,7 +11,7 @@ main (int argc, char *argv[]) ...@@ -11,7 +11,7 @@ main (int argc, char *argv[])
float res = 0, mres = 0, hres = 0, hmres = 0; float res = 0, mres = 0, hres = 0, hmres = 0;
for (i = 0; i < 32768; i++) for (i = 0; i < 32768; i++)
arr[i] = i; arr[i] = i % (32768 / 64);
#pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \ #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) \
reduction(+:res) reduction(max:mres) copy(res, mres) reduction(+:res) reduction(max:mres) copy(res, mres)
...@@ -48,7 +48,10 @@ main (int argc, char *argv[]) ...@@ -48,7 +48,10 @@ main (int argc, char *argv[])
hmres = arr[j * 1024 + (1023 - i)]; hmres = arr[j * 1024 + (1023 - i)];
} }
assert (hres <= 16777216);
assert (res == hres); assert (res == hres);
assert (hmres <= 16777216);
assert (mres == hmres); assert (mres == hmres);
return 0; return 0;
......
...@@ -183,7 +183,7 @@ void gwv_np_4() ...@@ -183,7 +183,7 @@ void gwv_np_4()
float res = 0, mres = 0, hres = 0, hmres = 0; float res = 0, mres = 0, hres = 0, hmres = 0;
for (i = 0; i < 32768; i++) for (i = 0; i < 32768; i++)
arr[i] = i; arr[i] = i % (32768 / 64);
#pragma acc parallel num_gangs(32) num_workers(32) vector_length(32) #pragma acc parallel num_gangs(32) num_workers(32) vector_length(32)
{ {
...@@ -219,7 +219,10 @@ void gwv_np_4() ...@@ -219,7 +219,10 @@ void gwv_np_4()
hmres = arr[j * 1024 + (1023 - i)]; hmres = arr[j * 1024 + (1023 - i)];
} }
assert (hres <= 16777216);
assert (res == hres); assert (res == hres);
assert (hmres <= 16777216);
assert (mres == hmres); assert (mres == hmres);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment