This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: libgomp testsuite: Remove some explicit acc_device_nvidia usage


Hi!

On Wed, 14 Oct 2015 14:05:49 +0200, Bernd Schmidt <bschmidt@redhat.com> wrote:
> On 10/09/2015 05:11 PM, Thomas Schwinge wrote:
> > On Wed, 22 Jul 2015 16:39:54 +0200, I wrote:
> >> [...] cleanup; committed to
> >> gomp-4_0-branch in r226072: [...]
> >
> > OK for trunk?
> 
> I think all three patches here look OK.

Thanks for the review.  Committed in r229379, r229380, r229381:

commit 54c8f61c735f98c73033ad04fc5db9062f8ad3a8
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Oct 26 16:24:28 2015 +0000

    [libgomp/66518] Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c
    
    	libgomp/
    	PR libgomp/66518
    	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229379 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                   | 3 +++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c | 7 ++++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index 76cb423..e99f924 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,5 +1,8 @@
 2015-10-26  Thomas Schwinge  <thomas@codesourcery.com>
 
+	PR libgomp/66518
+	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
+
 	PR libgomp/65437
 	PR libgomp/66518
 	* oacc-mem.c (update_dev_host): Call goacc_lazy_initialize.
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
index 7118797..f9a73397 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
@@ -1,4 +1,6 @@
-/* { dg-do run } */
+/* Expect an error message when shutting down a device different from the one
+   that has been initialized.  */
+/* { dg-do run { target { ! openacc_host_selected } } } */
 
 #include <stdio.h>
 #include <openacc.h>
@@ -15,6 +17,5 @@ main (int argc, char **argv)
 }
 
 /* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* TODO: currently prints: "libgomp: no device found".  */
-/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" { xfail *-*-* } } */
+/* { dg-output "no device initialized" } */
 /* { dg-shouldfail "" } */

commit cfe316ad3a766aa93361cec6325a3bc75c310e59
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Oct 26 16:24:44 2015 +0000

    libgomp: Additional acc_shutdown bug fixing and testing
    
    	libgomp/
    	* oacc-init.c (acc_shutdown): Call gomp_init_targets_once.
    	* testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229380 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                   |  3 +++
 libgomp/oacc-init.c                                 |  2 ++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c | 19 +++++++++++++++++++
 3 files changed, 24 insertions(+)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index e99f924..ad970df 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,5 +1,8 @@
 2015-10-26  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* oacc-init.c (acc_shutdown): Call gomp_init_targets_once.
+	* testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file.
+
 	PR libgomp/66518
 	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
 
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index a0e62a4..9a9a0b0 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -449,6 +449,8 @@ ialias (acc_init)
 void
 acc_shutdown (acc_device_t d)
 {
+  gomp_init_targets_once ();
+
   gomp_mutex_lock (&acc_device_lock);
 
   acc_shutdown_1 (d);
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c
new file mode 100644
index 0000000..ea28b6b
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c
@@ -0,0 +1,19 @@
+/* Expect error message when shutting down a device that has never been
+   initialized.  */
+/* { dg-do run } */
+
+#include <stdio.h>
+#include <openacc.h>
+
+int
+main (int argc, char **argv)
+{
+  fprintf (stderr, "CheCKpOInT\n");
+  acc_shutdown (acc_device_default);
+
+  return 0;
+}
+
+/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
+/* { dg-output "no device initialized" } */
+/* { dg-shouldfail "" } */

commit 3c41a4f17f727373340749ec0699c62b62b93b67
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Mon Oct 26 16:24:54 2015 +0000

    libgomp testsuite: Remove some explicit acc_device_nvidia usage.
    
    	libgomp/
    	* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Remove explicit
    	acc_device_nvidia usage.
    	* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
    	* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229381 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog                                    |  6 ++++++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c  | 14 ++------------
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-10.c |  9 +--------
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c  | 17 +++--------------
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c  | 14 ++++++--------
 5 files changed, 18 insertions(+), 42 deletions(-)

diff --git libgomp/ChangeLog libgomp/ChangeLog
index ad970df..fa9027b 100644
--- libgomp/ChangeLog
+++ libgomp/ChangeLog
@@ -1,5 +1,11 @@
 2015-10-26  Thomas Schwinge  <thomas@codesourcery.com>
 
+	* testsuite/libgomp.oacc-c-c++-common/lib-1.c: Remove explicit
+	acc_device_nvidia usage.
+	* testsuite/libgomp.oacc-c-c++-common/lib-10.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise.
+	* testsuite/libgomp.oacc-c-c++-common/lib-9.c: Likewise.
+
 	* oacc-init.c (acc_shutdown): Call gomp_init_targets_once.
 	* testsuite/libgomp.oacc-c-c++-common/lib-8.c: New file.
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c
index 26318f1..8ed743d 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c
@@ -6,19 +6,9 @@
 int
 main (int argc, char **argv)
 {
-  acc_device_t devtype = acc_device_host;
-
-#if ACC_DEVICE_TYPE_nvidia
-  devtype = acc_device_nvidia;
-
-  if (acc_get_num_devices (devtype) == 0)
-    return 0;
-#endif
-
-  acc_init (devtype);
-
+  acc_init (acc_device_default);
   fprintf (stderr, "CheCKpOInT\n");
-  acc_init (devtype);
+  acc_init (acc_device_default);
 
   return 0;
 }
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-10.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-10.c
index cf1af8c..55054c0 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-10.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-10.c
@@ -7,14 +7,7 @@ int
 main (int argc, char **argv)
 {
   void *d;
-  acc_device_t devtype = acc_device_host;
-
-#if ACC_DEVICE_TYPE_nvidia
-  devtype = acc_device_nvidia;
-
-  if (acc_get_num_devices (acc_device_nvidia) == 0)
-    return 0;
-#endif
+  acc_device_t devtype = acc_device_default;
 
   acc_init (devtype);
 
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c
index c658dd6..353cd1c 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c
@@ -6,21 +6,10 @@
 int
 main (int argc, char **argv)
 {
-  acc_device_t devtype = acc_device_host;
-
-#if ACC_DEVICE_TYPE_nvidia
-  devtype = acc_device_nvidia;
-
-  if (acc_get_num_devices (acc_device_nvidia) == 0)
-    return 0;
-#endif
-
-  acc_init (devtype);
-
-  acc_shutdown (devtype);
-
+  acc_init (acc_device_default);
+  acc_shutdown (acc_device_default);
   fprintf (stderr, "CheCKpOInT\n");
-  acc_shutdown (devtype);
+  acc_shutdown (acc_device_default);
 
   return 0;
 }
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c
index a4cf7f2..5dce9b8 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-9.c
@@ -9,18 +9,17 @@ main (int argc, char **argv)
   int i;
   int num_devices;
   int devnum;
-  acc_device_t devtype = acc_device_host;
-
-#if ACC_DEVICE_TYPE_nvidia
-  devtype = acc_device_nvidia;
-#endif
+  acc_device_t devtype = acc_device_default;
 
   num_devices = acc_get_num_devices (devtype);
   if (num_devices == 0)
-    return 0;
+    abort ();
 
   acc_init (devtype);
 
+  if (num_devices != acc_get_num_devices (devtype))
+    abort ();
+
   for (i = 0; i < num_devices; i++)
     {
       acc_set_device_num (i, devtype);
@@ -31,8 +30,7 @@ main (int argc, char **argv)
 
   acc_shutdown (devtype);
 
-  num_devices = acc_get_num_devices (devtype);
-  if (num_devices == 0)
+  if (num_devices != acc_get_num_devices (devtype))
     abort ();
 
   for (i = 0; i < num_devices; i++)


GrÃÃe
 Thomas

Attachment: signature.asc
Description: PGP signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]