This patch updates the existing OpenACC libgomp runtime tests with the new OpenACC 2.5 data clause semantics.
Is it OK for trunk? Cesar
2018-06-19 Chung-Lin Tang <clt...@codesourcery.com> Thomas Schwinge <tho...@codesourcery.com> Cesar Philippidis <ce...@codesourcery.com> libgomp/ * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Update test case to utilize OpenACC 2.5 data clause semantics. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-32.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-83.c: Likewise. * testsuite/libgomp.oacc-fortran/data-5.f90: New test. * testsuite/libgomp.oacc-fortran/data-already-1.f: Update test case to utilize OpenACC 2.5 data clause semantics. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-32-1.f: Likewise. * testsuite/libgomp.oacc-fortran/lib-32-2.f: Likewise. >From 43ba3412e27dda1fa619f39d2720bf109b83508c Mon Sep 17 00:00:00 2001 From: Cesar Philippidis <ce...@codesourcery.com> Date: Tue, 19 Jun 2018 09:29:21 -0700 Subject: [PATCH 2/7] libgomp tests --- .../data-already-1.c | 2 - .../data-already-2.c | 2 - .../data-already-3.c | 2 - .../data-already-4.c | 2 - .../data-already-5.c | 2 - .../data-already-6.c | 2 - .../data-already-7.c | 2 - .../data-already-8.c | 2 - .../libgomp.oacc-c-c++-common/lib-16.c | 23 ++++---- .../libgomp.oacc-c-c++-common/lib-25.c | 20 ++++--- .../libgomp.oacc-c-c++-common/lib-32.c | 4 +- .../libgomp.oacc-c-c++-common/lib-83.c | 22 ++++---- .../testsuite/libgomp.oacc-fortran/data-5.f90 | 56 +++++++++++++++++++ .../libgomp.oacc-fortran/data-already-1.f | 2 - .../libgomp.oacc-fortran/data-already-2.f | 2 - .../libgomp.oacc-fortran/data-already-3.f | 2 - .../libgomp.oacc-fortran/data-already-4.f | 2 - .../libgomp.oacc-fortran/data-already-5.f | 2 - .../libgomp.oacc-fortran/data-already-6.f | 2 - .../libgomp.oacc-fortran/data-already-7.f | 2 - .../libgomp.oacc-fortran/data-already-8.f | 2 - .../testsuite/libgomp.oacc-fortran/lib-32-1.f | 4 +- .../testsuite/libgomp.oacc-fortran/lib-32-2.f | 4 +- 23 files changed, 96 insertions(+), 69 deletions(-) create mode 100644 libgomp/testsuite/libgomp.oacc-fortran/data-5.f90 diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c index 0ed53a41a96..fd3b77dcff5 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-1.c @@ -18,5 +18,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c index 00adf2a2bf4..0118b2568e2 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-2.c @@ -18,5 +18,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-3.c index 04073e323d9..b346c69826f 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-3.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-3.c @@ -18,5 +18,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "already mapped to" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-4.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-4.c index cfa5cb2c44a..e99ad33d9be 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-4.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-4.c @@ -16,5 +16,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "already mapped to" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-5.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-5.c index e15c3fb1aaa..f8370c006df 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-5.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-5.c @@ -16,5 +16,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "already mapped to" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-6.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-6.c index 4570c74965c..d7f4deb18e4 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-6.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-6.c @@ -16,5 +16,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "already mapped to" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-7.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-7.c index 467cf39aa5d..54be59507ca 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-7.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-7.c @@ -16,5 +16,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "already mapped to" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c index f41431c1418..e5c0f9cfb32 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/data-already-8.c @@ -18,5 +18,3 @@ main (int argc, char *argv[]) } /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c index c81a78de26d..9a1c9d30bef 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-16.c @@ -1,8 +1,5 @@ -/* Test if duplicate data mappings with acc_copy_in. */ +/* Test if acc_copyin has present_or_ and reference counting behavior. */ -/* { dg-do run { target openacc_nvidia_accel_selected } } */ - -#include <stdio.h> #include <stdlib.h> #include <openacc.h> @@ -21,15 +18,21 @@ main (int argc, char **argv) } (void) acc_copyin (h, N); - - fprintf (stderr, "CheCKpOInT\n"); (void) acc_copyin (h, N); + acc_copyout (h, N); + + if (!acc_is_present (h, N)) + abort (); + + acc_copyout (h, N); + +#if !ACC_MEM_SHARED + if (acc_is_present (h, N)) + abort (); +#endif + free (h); return 0; } - -/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\\\] already mapped to \\\[\[0-9a-fA-FxX\]+,\\\+256\\\]" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c index 5f00ccb3885..9b42dee9d87 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-25.c @@ -1,8 +1,5 @@ -/* Exercise acc_create and acc_delete on nvidia targets. */ +/* Exercise acc_create and acc_delete. */ -/* { dg-do run { target openacc_nvidia_accel_selected } } */ - -#include <stdio.h> #include <stdlib.h> #include <openacc.h> @@ -19,18 +16,23 @@ main (int argc, char **argv) if (!d) abort (); - fprintf (stderr, "CheCKpOInT\n"); d = acc_create (h, N); if (!d) abort (); acc_delete (h, N); + if (!acc_is_present (h, N)) + abort (); + + acc_delete (h, N); + +#if !ACC_MEM_SHARED + if (acc_is_present (h, N)) + abort (); +#endif + free (h); return 0; } - -/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */ -/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\\\] already mapped to \\\[\[0-9a-fA-FxX\]+,\\\+256\\\]" } */ -/* { dg-shouldfail "" } */ diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c index 1696fb6f9ef..9ec345361d8 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-32.c @@ -127,7 +127,7 @@ main (int argc, char **argv) h[i] = i + 10; } - acc_copyout (h, S); + acc_copyout_finalize (h, S); d = NULL; if (!shared_mem) if (acc_is_present (h, S)) @@ -236,7 +236,7 @@ main (int argc, char **argv) abort (); } - acc_delete (h, S); + acc_delete_finalize (h, S); d = NULL; if (!shared_mem) if (acc_is_present (h, S)) diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-83.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-83.c index 1c2e52b4c5f..51b7ee73b9c 100644 --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-83.c +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-83.c @@ -5,21 +5,19 @@ #include <stdlib.h> #include <unistd.h> #include <openacc.h> -#include "timer.h" +#include <cuda.h> +#include <sys/time.h> int main (int argc, char **argv) { - float atime; CUstream stream; CUresult r; + struct timeval tv1, tv2; + time_t t1; acc_init (acc_device_nvidia); - (void) acc_get_device_num (acc_device_nvidia); - - init_timers (1); - stream = (CUstream) acc_get_cuda_stream (0); if (stream != NULL) abort (); @@ -34,22 +32,22 @@ main (int argc, char **argv) if (!acc_set_cuda_stream (0, stream)) abort (); - start_timer (0); + gettimeofday (&tv1, NULL); acc_wait_all_async (0); acc_wait (0); - atime = stop_timer (0); + gettimeofday (&tv2, NULL); - if (0.010 < atime) + t1 = ((tv2.tv_sec - tv1.tv_sec) * 1000000) + (tv2.tv_usec - tv1.tv_usec); + + if (t1 > 1000) { - fprintf (stderr, "actual time too long\n"); + fprintf (stderr, "too long\n"); abort (); } - fini_timers (); - acc_shutdown (acc_device_nvidia); exit (0); diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90 b/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90 new file mode 100644 index 00000000000..a8843dedc22 --- /dev/null +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-5.f90 @@ -0,0 +1,56 @@ +! { dg-do run } +! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } + +program refcount_test + use openacc + integer, allocatable :: h(:) + integer i, N + + N = 256 + allocate (h(N)) + + do i = 1, N + h(i) = i + end do + + !$acc enter data create (h(1:N)) + !$acc enter data copyin (h(1:N)) + !$acc enter data copyin (h(1:N)) + !$acc enter data copyin (h(1:N)) + + call acc_update_self (h) + do i = 1, N + if (h(i) .eq. i) c = c + 1 + end do + ! h[] should be filled with uninitialized device values, + ! abort if it's not. + if (c .eq. N) call abort + + h(:) = 0 + + !$acc parallel present (h(1:N)) + do i = 1, N + h(i) = 111 + end do + !$acc end parallel + + ! No actual copyout should happen. + call acc_copyout (h) + do i = 1, N + if (h(i) .ne. 0) call abort + end do + + !$acc exit data delete (h(1:N)) + + ! This should not actually be deleted yet. + if (acc_is_present (h) .eqv. .FALSE.) call abort + + !$acc exit data copyout (h(1:N)) finalize + + do i = 1, N + if (h(i) .ne. 111) call abort + end do + + if (acc_is_present (h) .eqv. .TRUE.) call abort + +end program refcount_test diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f index 9e99cc60be5..fab0ffc99cc 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-1.f @@ -14,5 +14,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f index b908a0c0702..bd03062670f 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-2.f @@ -14,5 +14,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-3.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-3.f index d93e1c5cedd..60ea3864e4e 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-3.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-3.f @@ -13,5 +13,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "already mapped to" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-4.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-4.f index ea76e058d9c..2abdbf0f868 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-4.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-4.f @@ -12,5 +12,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "already mapped to" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-5.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-5.f index 19df1f8bde2..f361d8c1772 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-5.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-5.f @@ -12,5 +12,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "already mapped to" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-6.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-6.f index 2bd1079087d..a864737c692 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-6.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-6.f @@ -12,5 +12,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "already mapped to" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-7.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-7.f index 1342360f53a..0d893280e40 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-7.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-7.f @@ -12,5 +12,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "already mapped to" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f b/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f index b206547bca7..7a41f67225a 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/data-already-8.f @@ -14,5 +14,3 @@ END ! { dg-output "CheCKpOInT(\n|\r\n|\r).*" } -! { dg-output "Trying to map into device \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) object when \\\[\[0-9a-fA-FxX\]+..\[0-9a-fA-FxX\]+\\\) is already mapped" } -! { dg-shouldfail "" } diff --git a/libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f b/libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f index 99e8f357764..3f979eba034 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/lib-32-1.f @@ -90,7 +90,7 @@ H(I) = I + 10 END DO - CALL ACC_COPYOUT (H, INT (SIZEOF (H), 4)) + CALL ACC_COPYOUT_FINALIZE (H, INT (SIZEOF (H), 4)) IF (.NOT. SHARED_MEM) THEN IF (ACC_IS_PRESENT (H, INT (SIZEOF (H), 8))) STOP 11 ENDIF @@ -163,7 +163,7 @@ IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) STOP 23 END DO - CALL ACC_DELETE (H) + CALL ACC_DELETE_FINALIZE (H) IF (.NOT. SHARED_MEM) THEN IF (ACC_IS_PRESENT (H, INT (SIZEOF (H), 4))) STOP 24 ENDIF diff --git a/libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f b/libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f index 514c04e7bca..642552cae60 100644 --- a/libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f +++ b/libgomp/testsuite/libgomp.oacc-fortran/lib-32-2.f @@ -90,7 +90,7 @@ H(I) = I + 10 END DO - CALL ACC_COPYOUT (H, INT (SIZEOF (H), 4)) + CALL ACC_COPYOUT_FINALIZE (H, INT (SIZEOF (H), 4)) IF (.NOT. SHARED_MEM) THEN IF (ACC_IS_PRESENT (H, INT (SIZEOF (H), 8))) STOP 11 ENDIF @@ -163,7 +163,7 @@ IF (H(I) .NE. I + MERGE (18, 17, SHARED_MEM)) STOP 23 END DO - CALL ACC_DELETE (H) + CALL ACC_DELETE_FINALIZE (H) IF (.NOT. SHARED_MEM) THEN IF (ACC_IS_PRESENT (H, INT (SIZEOF (H), 4))) STOP 24 ENDIF -- 2.17.1