Hi!

On Wed, 22 Jul 2015 16:32:17 +0200, I wrote:
> On Wed, 1 Jul 2015 13:16:14 +0200, Tom de Vries <tom_devr...@mentor.com> 
> wrote:
> > testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.

>     libgomp: Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c

Working on this, I also came up with the following cleanup; committed to
gomp-4_0-branch in r226072:

commit be5ec016c6e0e3981c609851a40fc1645e6b5d36
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jul 22 14:24:47 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/branches/gomp-4_0-branch@226072 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                               |  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.gomp libgomp/ChangeLog.gomp
index 0d3c62f..33e7b3b 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,11 @@
 2015-07-22  Thomas Schwinge  <tho...@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 5ff23b2..b7729df 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-1.c
@@ -5,18 +5,8 @@
 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 (devtype);
+  acc_init (acc_device_default);
+  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 b16e9e6..90e67d4 100644
--- libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-2.c
@@ -5,20 +5,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 (acc_device_nvidia) == 0)
-    return 0;
-#endif
-
-  acc_init (devtype);
-
-  acc_shutdown (devtype);
-
-  acc_shutdown (devtype);
+  acc_init (acc_device_default);
+  acc_shutdown (acc_device_default);
+  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: pgptgcbLdJ0zj.pgp
Description: PGP signature

Reply via email to