public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c
@ 2015-07-01 11:16 Tom de Vries
  2015-07-22  7:43 ` [PING][gomp4, " Tom de Vries
  2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
  0 siblings, 2 replies; 10+ messages in thread
From: Tom de Vries @ 2015-07-01 11:16 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 704 bytes --]

Hi,

testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.

It fails currently in two ways:
- no device found, if there is no nonhost device type supported, so
   just host and host_nonshm
- no device initialized, if there is a nonhost device type supported,
   f.i. nvidia

The reason for the different failure modes is the usage of 
acc_device_not_host.

Neither of the current failure modes is matches by the current dg-output:
...
/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
...
I don't understand what this dg-output is trying to achieve.

Attached patch makes sure that both current failure modes are tested and 
accepted.

OK for gomp-4_0-branch?

Thanks,
- Tom

[-- Attachment #2: 0003-Fix-libgomp.oacc-c-c-common-lib-3.c.patch --]
[-- Type: text/x-patch, Size: 3439 bytes --]

Fix libgomp.oacc-c-c++-common/lib-3.c

2015-07-01  Tom de Vries  <tom@codesourcery.com>

	* testsuite/lib/libgomp.exp (offload_targets_nonhost): New var.
	(check_effective_target_offload_target_nonhost_supported): New proc.
	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Only run if
	offload_target_nonhost_supported.
	* testsuite/libgomp.oacc-c-c++-common/lib-3b.c: New test.  Copy of
	lib-3.c, but only run if !offload_target_nonhost_supported.
---
 libgomp/testsuite/lib/libgomp.exp                    | 13 +++++++++++++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c  |  4 ++--
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c | 16 ++++++++++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
 create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c

diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
index 6dba22b..951e043 100644
--- a/libgomp/testsuite/lib/libgomp.exp
+++ b/libgomp/testsuite/lib/libgomp.exp
@@ -38,9 +38,11 @@ load_file libgomp-test-support.exp
 # Populate offload_targets_s (offloading targets separated by a space), and
 # offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
 # some of them a little differently).
+set offload_targets_nonhost 0
 set offload_targets_s [split $offload_targets ","]
 set offload_targets_s_openacc {}
 foreach offload_target_openacc $offload_targets_s {
+    set nonhost 1
     switch $offload_target_openacc {
 	intelmic {
 	    # TODO.  Skip; will all FAIL because of missing
@@ -50,8 +52,14 @@ foreach offload_target_openacc $offload_targets_s {
 	nvptx {
 	    set offload_target_openacc "nvidia"
 	}
+	host_nonshm {
+	    set nonhost 0
+	}
     }
     lappend offload_targets_s_openacc "$offload_target_openacc"
+    if { $nonhost == 1 } {
+	set offload_targets_nonhost 1
+    }
 }
 lappend offload_targets_s_openacc "host"
 
@@ -369,6 +377,11 @@ proc check_effective_target_offload_device { } {
     } ]
 }
 
+proc check_effective_target_offload_target_nonhost_supported { } {
+    global offload_targets_nonhost
+    return $offload_targets_nonhost;
+}
+
 proc check_effective_target_openacc_nvidia_accel_supported { } {
     global offload_targets_s_openacc
     set res [lsearch $offload_targets_s_openacc "nvidia" ]
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
index bb76c82..2a8c437 100644
--- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-do run { target { offload_target_nonhost_supported } } } */
 
 #include <openacc.h>
 
@@ -12,5 +12,5 @@ main (int argc, char **argv)
   return 0;
 }
 
-/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
+/* { dg-output "no device initialized" } */
 /* { dg-shouldfail "" } */
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
new file mode 100644
index 0000000..f21830c
--- /dev/null
+++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
@@ -0,0 +1,16 @@
+/* { dg-do run { target { ! offload_target_nonhost_supported } } } */
+
+#include <openacc.h>
+
+int
+main (int argc, char **argv)
+{
+  acc_init (acc_device_host);
+
+  acc_shutdown (acc_device_not_host);
+
+  return 0;
+}
+
+/* { dg-output "no device found" } */
+/* { dg-shouldfail "" } */
-- 
1.9.1


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PING][gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c
  2015-07-01 11:16 [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c Tom de Vries
@ 2015-07-22  7:43 ` Tom de Vries
  2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
  1 sibling, 0 replies; 10+ messages in thread
From: Tom de Vries @ 2015-07-22  7:43 UTC (permalink / raw)
  To: Thomas Schwinge; +Cc: gcc-patches, Jakub Jelinek

On 01/07/15 13:16, Tom de Vries wrote:
> Hi,
>
> testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.
>
> It fails currently in two ways:
> - no device found, if there is no nonhost device type supported, so
>    just host and host_nonshm
> - no device initialized, if there is a nonhost device type supported,
>    f.i. nvidia
>
> The reason for the different failure modes is the usage of
> acc_device_not_host.
>
> Neither of the current failure modes is matches by the current dg-output:
> ...
> /* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
> ...
> I don't understand what this dg-output is trying to achieve.
>
> Attached patch makes sure that both current failure modes are tested and
> accepted.
>
> OK for gomp-4_0-branch?
>

Ping.

Thanks,
- Tom

> 0003-Fix-libgomp.oacc-c-c-common-lib-3.c.patch
>
>
> Fix libgomp.oacc-c-c++-common/lib-3.c
>
> 2015-07-01  Tom de Vries<tom@codesourcery.com>
>
> 	* testsuite/lib/libgomp.exp (offload_targets_nonhost): New var.
> 	(check_effective_target_offload_target_nonhost_supported): New proc.
> 	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Only run if
> 	offload_target_nonhost_supported.
> 	* testsuite/libgomp.oacc-c-c++-common/lib-3b.c: New test.  Copy of
> 	lib-3.c, but only run if !offload_target_nonhost_supported.
> ---
>   libgomp/testsuite/lib/libgomp.exp                    | 13 +++++++++++++
>   libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c  |  4 ++--
>   libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c | 16 ++++++++++++++++
>   3 files changed, 31 insertions(+), 2 deletions(-)
>   create mode 100644 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
>
> diff --git a/libgomp/testsuite/lib/libgomp.exp b/libgomp/testsuite/lib/libgomp.exp
> index 6dba22b..951e043 100644
> --- a/libgomp/testsuite/lib/libgomp.exp
> +++ b/libgomp/testsuite/lib/libgomp.exp
> @@ -38,9 +38,11 @@ load_file libgomp-test-support.exp
>   # Populate offload_targets_s (offloading targets separated by a space), and
>   # offload_targets_s_openacc (the same, but with OpenACC names; OpenACC spells
>   # some of them a little differently).
> +set offload_targets_nonhost 0
>   set offload_targets_s [split $offload_targets ","]
>   set offload_targets_s_openacc {}
>   foreach offload_target_openacc $offload_targets_s {
> +    set nonhost 1
>       switch $offload_target_openacc {
>   	intelmic {
>   	    # TODO.  Skip; will all FAIL because of missing
> @@ -50,8 +52,14 @@ foreach offload_target_openacc $offload_targets_s {
>   	nvptx {
>   	    set offload_target_openacc "nvidia"
>   	}
> +	host_nonshm {
> +	    set nonhost 0
> +	}
>       }
>       lappend offload_targets_s_openacc "$offload_target_openacc"
> +    if { $nonhost == 1 } {
> +	set offload_targets_nonhost 1
> +    }
>   }
>   lappend offload_targets_s_openacc "host"
>
> @@ -369,6 +377,11 @@ proc check_effective_target_offload_device { } {
>       } ]
>   }
>
> +proc check_effective_target_offload_target_nonhost_supported { } {
> +    global offload_targets_nonhost
> +    return $offload_targets_nonhost;
> +}
> +
>   proc check_effective_target_openacc_nvidia_accel_supported { } {
>       global offload_targets_s_openacc
>       set res [lsearch $offload_targets_s_openacc "nvidia" ]
> diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
> index bb76c82..2a8c437 100644
> --- a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
> @@ -1,4 +1,4 @@
> -/* { dg-do run } */
> +/* { dg-do run { target { offload_target_nonhost_supported } } } */
>
>   #include <openacc.h>
>
> @@ -12,5 +12,5 @@ main (int argc, char **argv)
>     return 0;
>   }
>
> -/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
> +/* { dg-output "no device initialized" } */
>   /* { dg-shouldfail "" } */
> diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
> new file mode 100644
> index 0000000..f21830c
> --- /dev/null
> +++ b/libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3b.c
> @@ -0,0 +1,16 @@
> +/* { dg-do run { target { ! offload_target_nonhost_supported } } } */
> +
> +#include <openacc.h>
> +
> +int
> +main (int argc, char **argv)
> +{
> +  acc_init (acc_device_host);
> +
> +  acc_shutdown (acc_device_not_host);
> +
> +  return 0;
> +}
> +
> +/* { dg-output "no device found" } */
> +/* { dg-shouldfail "" } */
> -- 1.9.1
>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c
  2015-07-01 11:16 [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c Tom de Vries
  2015-07-22  7:43 ` [PING][gomp4, " Tom de Vries
@ 2015-07-22 14:38 ` Thomas Schwinge
  2015-07-22 14:49   ` [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Thomas Schwinge @ 2015-07-22 14:38 UTC (permalink / raw)
  To: Tom de Vries, gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 3653 bytes --]

Hi Tom!

On Wed, 1 Jul 2015 13:16:14 +0200, Tom de Vries <Tom_deVries@mentor.com> wrote:
> testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.
> 
> It fails currently in two ways:
> - no device found, if there is no nonhost device type supported, so
>    just host and host_nonshm
> - no device initialized, if there is a nonhost device type supported,
>    f.i. nvidia
> 
> The reason for the different failure modes is the usage of 
> acc_device_not_host.
> 
> Neither of the current failure modes is matches by the current dg-output:
> ...
> /* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" } */
> ...
> I don't understand what this dg-output is trying to achieve.

Yeah, neither do I.  I guess the behavior of libgomp changed at some
point.  (For avoidance of doubt, the current behavior is in accord with
the specification, as far as I can tell.)

> Attached patch makes sure that both current failure modes are tested and 
> accepted.

> Fix libgomp.oacc-c-c++-common/lib-3.c
> 
> 2015-07-01  Tom de Vries  <tom@codesourcery.com>
> 
> 	* testsuite/lib/libgomp.exp (offload_targets_nonhost): New var.
> 	(check_effective_target_offload_target_nonhost_supported): New proc.
> 	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Only run if
> 	offload_target_nonhost_supported.
> 	* testsuite/libgomp.oacc-c-c++-common/lib-3b.c: New test.  Copy of
> 	lib-3.c, but only run if !offload_target_nonhost_supported.

Thanks, but that seemed a bit heavy-weight to me to justify this for just
the small thing that this test case is, so in r226070, I committed the
following to gomp-4_0-branch:

commit bb8f2ef333bb999e6d5e9fe834efab3fbbefa6d8
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jul 22 14:24:22 2015 +0000

    libgomp: Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c
    
    	libgomp/
    	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@226070 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                              |  4 ++++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c | 10 +++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 746003f..d71282c 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,3 +1,7 @@
+2015-07-22  Thomas Schwinge  <thomas@codesourcery.com>
+
+	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
+
 2015-07-21  James Norris  <jnorris@codesourcery.com>
 
 	* testsuite/libgomp.oacc-c-c++-common/asyncwait-1.c: Additional tests.
diff --git libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c
index d5f390d..e00053c 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 <openacc.h>
 
@@ -6,12 +8,10 @@ int
 main (int argc, char **argv)
 {
   acc_init (acc_device_host);
-
-  acc_shutdown (acc_device_not_host);
+  acc_shutdown (acc_device_default);
 
   return 0;
 }
 
-/* TODO: currently prints: "libgomp: no device found".  */
-/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" { xfail *-*-* } } */
+/* { dg-output "no device initialized" } */
 /* { dg-shouldfail "" } */


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c)
  2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
@ 2015-07-22 14:49   ` Thomas Schwinge
  2015-10-09 15:12     ` libgomp: Additional acc_shutdown bug fixing and testing Thomas Schwinge
  2015-07-22 14:55   ` [gomp4] libgomp testsuite: Remove some explicit acc_device_nvidia usage (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
  2015-10-09 15:12   ` [libgomp/66518] Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c Thomas Schwinge
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Schwinge @ 2015-07-22 14:49 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, Tom de Vries

[-- Attachment #1: Type: text/plain, Size: 3268 bytes --]

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_deVries@mentor.com> wrote:
> > testcase libgomp.oacc-c-c++-common/lib-3.c is supposed to fail.

> --- 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 <openacc.h>
>  
> @@ -6,12 +8,10 @@ int
>  main (int argc, char **argv)
>  {
>    acc_init (acc_device_host);
> -
> -  acc_shutdown (acc_device_not_host);
> +  acc_shutdown (acc_device_default);
>  
>    return 0;
>  }
>  
> -/* TODO: currently prints: "libgomp: no device found".  */
> -/* { dg-output "device \[0-9\]+\\\(\[0-9\]+\\\) is initialized" { xfail *-*-* } } */
> +/* { dg-output "no device initialized" } */
>  /* { dg-shouldfail "" } */

Looking at this issue, I had found an inconsistency in libgomp; committed
to gomp-4_0-branch in r226071:

commit 4e1d42a292c3f868f63ec0b9a3577b6344e087e5
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Jul 22 14:24:33 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/branches/gomp-4_0-branch@226071 138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                              |  3 +++
 libgomp/oacc-init.c                                 |  2 ++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c | 16 ++++++++++++++++
 3 files changed, 21 insertions(+)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index d71282c..0d3c62f 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,5 +1,8 @@
 2015-07-22  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.
+
 	* testsuite/libgomp.oacc-c-c++-common/lib-3.c: Resolve XFAIL.
 
 2015-07-21  James Norris  <jnorris@codesourcery.com>
diff --git libgomp/oacc-init.c libgomp/oacc-init.c
index 63ac710..f0d1df9 100644
--- libgomp/oacc-init.c
+++ libgomp/oacc-init.c
@@ -461,6 +461,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..5eb28af
--- /dev/null
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c
@@ -0,0 +1,16 @@
+/* Expect error message when shutting down a device that has never been
+   initialized.  */
+/* { dg-do run } */
+
+#include <openacc.h>
+
+int
+main (int argc, char **argv)
+{
+  acc_shutdown (acc_device_default);
+
+  return 0;
+}
+
+/* { dg-output "no device initialized" } */
+/* { dg-shouldfail "" } */


Grüße,
 Thomas

[-- Attachment #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [gomp4] libgomp testsuite: Remove some explicit acc_device_nvidia usage (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c)
  2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
  2015-07-22 14:49   ` [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
@ 2015-07-22 14:55   ` Thomas Schwinge
  2015-10-09 15:12     ` libgomp testsuite: Remove some explicit acc_device_nvidia usage Thomas Schwinge
  2015-10-09 15:12   ` [libgomp/66518] Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c Thomas Schwinge
  2 siblings, 1 reply; 10+ messages in thread
From: Thomas Schwinge @ 2015-07-22 14:55 UTC (permalink / raw)
  To: gcc-patches; +Cc: Jakub Jelinek, Tom de Vries

[-- Attachment #1: Type: text/plain, Size: 5190 bytes --]

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_deVries@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  <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 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 #2: Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* libgomp: Additional acc_shutdown bug fixing and testing
  2015-07-22 14:49   ` [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
@ 2015-10-09 15:12     ` Thomas Schwinge
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2015-10-09 15:12 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 1726 bytes --]

Hi!

On Wed, 22 Jul 2015 16:37:46 +0200, I wrote:
> [...] found an inconsistency in libgomp; committed
> to gomp-4_0-branch in r226071: [...]

OK for trunk?

commit dc0c73e9ac5decf5b36be25497ed5f4b99136fba
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Oct 9 13:22:52 2015 +0200

    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.
---
 libgomp/oacc-init.c                                 |  2 ++
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-8.c | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+)

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 "" } */


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* libgomp testsuite: Remove some explicit acc_device_nvidia usage
  2015-07-22 14:55   ` [gomp4] libgomp testsuite: Remove some explicit acc_device_nvidia usage (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
@ 2015-10-09 15:12     ` Thomas Schwinge
  2015-10-14 12:06       ` Bernd Schmidt
  0 siblings, 1 reply; 10+ messages in thread
From: Thomas Schwinge @ 2015-10-09 15:12 UTC (permalink / raw)
  To: gcc-patches, Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 4193 bytes --]

Hi!

On Wed, 22 Jul 2015 16:39:54 +0200, I wrote:
> [...] cleanup; committed to
> gomp-4_0-branch in r226072: [...]

OK for trunk?

commit a8bd7234d7b6b0111a1e3b3dc032ea5eead7e258
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Oct 9 16:40:56 2015 +0200

    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.
---
 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 ++++++--------
 4 files changed, 12 insertions(+), 42 deletions(-)

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [libgomp/66518] Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c
  2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
  2015-07-22 14:49   ` [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
  2015-07-22 14:55   ` [gomp4] libgomp testsuite: Remove some explicit acc_device_nvidia usage (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
@ 2015-10-09 15:12   ` Thomas Schwinge
  2 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2015-10-09 15:12 UTC (permalink / raw)
  To: Jakub Jelinek, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1471 bytes --]

Hi!

On Wed, 22 Jul 2015 16:32:17 +0200, I wrote:
> [...] in r226070, I committed the
> following to gomp-4_0-branch: [...]

OK for trunk?

commit 8ba8b058417afc2e7979ef25fdb943ae4e8838dd
Author: Thomas Schwinge <thomas@codesourcery.com>
Date:   Fri Oct 9 13:20:52 2015 +0200

    [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.
---
 libgomp/testsuite/libgomp.oacc-c-c++-common/lib-3.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

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 "" } */


Grüße,
 Thomas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: libgomp testsuite: Remove some explicit acc_device_nvidia usage
  2015-10-09 15:12     ` libgomp testsuite: Remove some explicit acc_device_nvidia usage Thomas Schwinge
@ 2015-10-14 12:06       ` Bernd Schmidt
  2015-10-26 16:28         ` Thomas Schwinge
  0 siblings, 1 reply; 10+ messages in thread
From: Bernd Schmidt @ 2015-10-14 12:06 UTC (permalink / raw)
  To: Thomas Schwinge, gcc-patches, Jakub Jelinek

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.


Bernd

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: libgomp testsuite: Remove some explicit acc_device_nvidia usage
  2015-10-14 12:06       ` Bernd Schmidt
@ 2015-10-26 16:28         ` Thomas Schwinge
  0 siblings, 0 replies; 10+ messages in thread
From: Thomas Schwinge @ 2015-10-26 16:28 UTC (permalink / raw)
  To: Bernd Schmidt, gcc-patches; +Cc: Jakub Jelinek

[-- Attachment #1: Type: text/plain, Size: 9264 bytes --]

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 472 bytes --]

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2015-10-26 16:27 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-01 11:16 [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c Tom de Vries
2015-07-22  7:43 ` [PING][gomp4, " Tom de Vries
2015-07-22 14:38 ` [gomp4, " Thomas Schwinge
2015-07-22 14:49   ` [gomp4] libgomp: Additional acc_shutdown bug fixing and testing (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
2015-10-09 15:12     ` libgomp: Additional acc_shutdown bug fixing and testing Thomas Schwinge
2015-07-22 14:55   ` [gomp4] libgomp testsuite: Remove some explicit acc_device_nvidia usage (was: [gomp4, PATCH] Fix libgomp.oacc-c-c++-common/lib-3.c) Thomas Schwinge
2015-10-09 15:12     ` libgomp testsuite: Remove some explicit acc_device_nvidia usage Thomas Schwinge
2015-10-14 12:06       ` Bernd Schmidt
2015-10-26 16:28         ` Thomas Schwinge
2015-10-09 15:12   ` [libgomp/66518] Resolve XFAIL in libgomp.oacc-c-c++-common/lib-3.c Thomas Schwinge

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).