From c68ddd5e2a9dd0cfe21c3661404d7d4c323b23cf Mon Sep 17 00:00:00 2001
From: Thomas Schwinge <thomas@codesourcery.com>
Date: Thu, 31 Oct 2019 17:40:13 +0100
Subject: [PATCH] Enable more 'libgomp.oacc-*/lib-*' testcases for
non-'openacc_nvidia_accel_selected'
libgomp/
* testsuite/libgomp.oacc-c-c++-common/lib-11.c: Enable for all but
'-DACC_MEM_SHARED=0'.
* testsuite/libgomp.oacc-c-c++-common/lib-13.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-14.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-15.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-24.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-88.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-89.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-92.c: Likewise.
* testsuite/libgomp.oacc-fortran/lib-14.f90: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-5.c: Add
'acc_device_radeon' testing.
* testsuite/libgomp.oacc-c-c++-common/lib-6.c: Likewise.
* testsuite/libgomp.oacc-fortran/lib-5.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-7.f90: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-52.c: Enable for all.
* testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-86.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-87.c: Likewise.
* testsuite/libgomp.oacc-fortran/lib-10.f90: Likewise.
* testsuite/libgomp.oacc-fortran/lib-8.f90: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-57.c: Improve checking
for non-'openacc_nvidia_accel_selected'.
* testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-62.c: Clarify that "Not
all implement this checking".
* testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise.
* testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise.
---
.../libgomp.oacc-c-c++-common/lib-11.c | 10 ++--
.../libgomp.oacc-c-c++-common/lib-13.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-14.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-15.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-20.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-23.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-24.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-34.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-42.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-44.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-48.c | 4 +-
.../libgomp.oacc-c-c++-common/lib-5.c | 20 +++++++-
.../libgomp.oacc-c-c++-common/lib-52.c | 6 +--
.../libgomp.oacc-c-c++-common/lib-53.c | 6 +--
.../libgomp.oacc-c-c++-common/lib-54.c | 6 +--
.../libgomp.oacc-c-c++-common/lib-57.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-58.c | 2 +-
.../libgomp.oacc-c-c++-common/lib-6.c | 47 ++++++++++++++-----
.../libgomp.oacc-c-c++-common/lib-62.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-63.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-64.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-65.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-67.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-68.c | 3 +-
.../libgomp.oacc-c-c++-common/lib-86.c | 27 +++++++----
.../libgomp.oacc-c-c++-common/lib-87.c | 27 +++++++----
.../libgomp.oacc-c-c++-common/lib-88.c | 9 +---
.../libgomp.oacc-c-c++-common/lib-89.c | 18 +++----
.../libgomp.oacc-c-c++-common/lib-92.c | 18 +++----
.../testsuite/libgomp.oacc-fortran/lib-10.f90 | 6 +--
.../testsuite/libgomp.oacc-fortran/lib-14.f90 | 3 +-
.../testsuite/libgomp.oacc-fortran/lib-5.f90 | 46 ++++++++++++++----
.../testsuite/libgomp.oacc-fortran/lib-7.f90 | 46 ++++++++++++++----
.../testsuite/libgomp.oacc-fortran/lib-8.f90 | 6 +--
34 files changed, 225 insertions(+), 130 deletions(-)
@@ -1,5 +1,4 @@
-/* Only nvptx plugin does the required error checking.
- { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -22,6 +21,9 @@ main (int argc, char **argv)
return 0;
}
-/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "invalid device address" } */
+/* { dg-output "CheCKpOInT(\n|\r\n|\r)+" } */
+/* { dg-output "libgomp: invalid device address(\n|\r\n|\r)+" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "libgomp: GCN fatal error: Could not free device memory(\n|\r\n|\r)+" { target openacc_radeon_accel_selected } }
+ { dg-output "Runtime message: HSA_STATUS_ERROR_INVALID_ALLOCATION: The requested allocation is not valid\.(\n|\r\n|\r)+" { target openacc_radeon_accel_selected } } */
+/* { dg-output "libgomp: error in freeing device memory in acc_free(\n|\r\n|\r)+$" } */
/* { dg-shouldfail "" } */
@@ -1,6 +1,6 @@
/* Check acc_is_present and acc_delete. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdlib.h>
#include <openacc.h>
@@ -1,6 +1,6 @@
/* Check acc_is_present. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdlib.h>
#include <openacc.h>
@@ -1,6 +1,6 @@
/* Check acc_is_present and acc_copyout. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdlib.h>
#include <openacc.h>
@@ -1,6 +1,6 @@
-/* Exercise acc_copyin and acc_copyout on nvidia targets. */
+/* Exercise acc_copyin and acc_copyout. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -1,6 +1,6 @@
-/* Exercise acc_copyin and acc_copyout on nvidia targets. */
+/* Exercise acc_copyin and acc_copyout. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -1,6 +1,6 @@
/* Exercise acc_create, acc_is_present and acc_delete. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdlib.h>
#include <openacc.h>
@@ -1,6 +1,6 @@
-/* Exercise an invalid acc_present_or_create on nvidia targets. */
+/* Exercise an invalid acc_present_or_create. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -1,6 +1,6 @@
-/* Exercise acc_update_device on unmapped data on nvidia targets. */
+/* Exercise acc_update_device on unmapped data. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -1,6 +1,6 @@
-/* Exercise acc_update_device with size zero data on nvidia targets. */
+/* Exercise acc_update_device with size zero data. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <stdlib.h>
@@ -1,6 +1,6 @@
-/* Exercise acc_update_self with a size zero data mapping on nvidia targets. */
+/* Exercise acc_update_self with a size zero data mapping. */
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <string.h>
@@ -35,6 +35,24 @@ main (int argc, char **argv)
acc_shutdown (acc_device_nvidia);
}
- return 0;
+ if (acc_get_num_devices (acc_device_radeon) != 0)
+ {
+ acc_init (acc_device_radeon);
+
+ if (acc_get_device_type () != acc_device_radeon)
+ abort ();
+
+ acc_shutdown (acc_device_radeon);
+
+ acc_init (acc_device_default);
+ acc_set_device_type (acc_device_radeon);
+
+ if (acc_get_device_type () != acc_device_radeon)
+ abort ();
+
+ acc_shutdown (acc_device_radeon);
+ }
+
+ return 0;
}
@@ -1,6 +1,4 @@
-/* Exercise acc_map_data with a NULL data mapping on nvidia targets. */
-
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Exercise acc_map_data with a NULL data mapping. */
#include <stdio.h>
#include <stdlib.h>
@@ -30,6 +28,6 @@ main (int argc, char **argv)
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "\\\[\[^\n\r]*,\\\+256\]->\[\[0-9a-fA-FxX\]+,\\\+256\\\] is a bad map" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "\\\[\[^\n\r]*,\\\+256\]->\[\[0-9a-fA-FxX\]+,\\\+256\\\] is a bad map" { target { ! openacc_host_selected } } } */
/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */
/* { dg-shouldfail "" } */
@@ -1,6 +1,4 @@
-/* Exercise acc_map_data with a NULL data mapping on nvidia targets. */
-
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Exercise acc_map_data with a NULL data mapping. */
#include <stdio.h>
#include <stdlib.h>
@@ -30,6 +28,6 @@ main (int argc, char **argv)
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\]->\\\[\[^\n\r]*,\\\+256\\\] is a bad map" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+256\]->\\\[\[^\n\r]*,\\\+256\\\] is a bad map" { target { ! openacc_host_selected } } } */
/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */
/* { dg-shouldfail "" } */
@@ -1,6 +1,4 @@
-/* Exercise acc_map_data with data size of zero on nvidia targets. */
-
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Exercise acc_map_data with data size of zero. */
#include <stdio.h>
#include <stdlib.h>
@@ -30,6 +28,6 @@ main (int argc, char **argv)
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\]->\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad map" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "\\\[\[0-9a-fA-FxX\]+,\\\+0\\\]->\\\[\[0-9a-fA-FxX\]+,\\\+0\\\] is a bad map" { target { ! openacc_host_selected } } } */
/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */
/* { dg-shouldfail "" } */
@@ -33,6 +33,6 @@ main (int argc, char **argv)
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "\[0-9a-fA-FxX\]+ is not a mapped block" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "\[0-9a-fA-FxX\]+ is not a mapped block" { target { ! openacc_host_selected } } } */
/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */
/* { dg-shouldfail "" } */
@@ -33,6 +33,6 @@ main (int argc, char **argv)
}
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
-/* { dg-output "\[^\n\r]* is not a mapped block" { target openacc_nvidia_accel_selected } } */
+/* { dg-output "\[^\n\r]* is not a mapped block" { target { ! openacc_host_selected } } } */
/* { dg-output "cannot map data on shared-memory system" { target openacc_host_selected } } */
/* { dg-shouldfail "" } */
@@ -11,26 +11,47 @@ main (int argc, char **argv)
if (acc_get_device_type () == acc_device_default)
abort ();
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
+ if (acc_get_num_devices (acc_device_nvidia))
+ {
+ acc_set_device_type (acc_device_nvidia);
- acc_set_device_type (acc_device_nvidia);
+ if (acc_get_device_type () != acc_device_nvidia)
+ abort ();
- if (acc_get_device_type () != acc_device_nvidia)
- abort ();
+ acc_shutdown (acc_device_nvidia);
- acc_shutdown (acc_device_nvidia);
+ acc_set_device_type (acc_device_nvidia);
- acc_set_device_type (acc_device_nvidia);
+ if (acc_get_device_type () != acc_device_nvidia)
+ abort ();
- if (acc_get_device_type () != acc_device_nvidia)
- abort ();
+ devnum = acc_get_num_devices (acc_device_host);
+ if (devnum != 1)
+ abort ();
- devnum = acc_get_num_devices (acc_device_host);
- if (devnum != 1)
- abort ();
+ acc_shutdown (acc_device_nvidia);
+ }
+
+ if (acc_get_num_devices (acc_device_radeon))
+ {
+ acc_set_device_type (acc_device_radeon);
+
+ if (acc_get_device_type () != acc_device_radeon)
+ abort ();
+
+ acc_shutdown (acc_device_radeon);
+
+ acc_set_device_type (acc_device_radeon);
+
+ if (acc_get_device_type () != acc_device_radeon)
+ abort ();
+
+ devnum = acc_get_num_devices (acc_device_host);
+ if (devnum != 1)
+ abort ();
- acc_shutdown (acc_device_nvidia);
+ acc_shutdown (acc_device_radeon);
+ }
if (acc_get_device_type () == acc_device_default)
abort ();
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -1,4 +1,5 @@
-/* { dg-do run { target openacc_nvidia_accel_selected } } */
+/* Not all implement this checking.
+ { dg-skip-if "" { openacc_radeon_accel_selected || openacc_host_selected } } */
#include <stdio.h>
#include <string.h>
@@ -7,9 +7,6 @@
int
main (int argc, char **argv)
{
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
if (acc_get_current_cuda_device () != 0)
abort ();
@@ -20,18 +17,28 @@ main (int argc, char **argv)
acc_shutdown (acc_device_host);
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
if (acc_get_current_cuda_device () != 0)
abort ();
- acc_init (acc_device_nvidia);
+ if (acc_get_num_devices (acc_device_nvidia))
+ {
+ acc_init (acc_device_nvidia);
- if (acc_get_current_cuda_device () == 0)
- abort ();
+ if (acc_get_current_cuda_device () == 0)
+ abort ();
+
+ acc_shutdown (acc_device_nvidia);
+ }
+
+ if (acc_get_num_devices (acc_device_radeon))
+ {
+ acc_init (acc_device_radeon);
+
+ if (acc_get_current_cuda_device () != 0)
+ abort ();
- acc_shutdown (acc_device_nvidia);
+ acc_shutdown (acc_device_radeon);
+ }
if (acc_get_current_cuda_device () != 0)
abort ();
@@ -7,9 +7,6 @@
int
main (int argc, char **argv)
{
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
if (acc_get_current_cuda_context () != 0)
abort ();
@@ -20,18 +17,28 @@ main (int argc, char **argv)
acc_shutdown (acc_device_host);
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
if (acc_get_current_cuda_context () != 0)
abort ();
- acc_init (acc_device_nvidia);
+ if (acc_get_num_devices (acc_device_nvidia))
+ {
+ acc_init (acc_device_nvidia);
- if (acc_get_current_cuda_context () == 0)
- abort ();
+ if (acc_get_current_cuda_context () == 0)
+ abort ();
+
+ acc_shutdown (acc_device_nvidia);
+ }
+
+ if (acc_get_num_devices (acc_device_radeon))
+ {
+ acc_init (acc_device_radeon);
+
+ if (acc_get_current_cuda_context () != 0)
+ abort ();
- acc_shutdown (acc_device_nvidia);
+ acc_shutdown (acc_device_radeon);
+ }
if (acc_get_current_cuda_context () != 0)
abort ();
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <pthread.h>
@@ -47,10 +47,7 @@ main (int argc, char **argv)
pthread_attr_t attr;
pthread_t *tid;
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
- acc_init (acc_device_nvidia);
+ acc_init (acc_device_default);
x = (unsigned char *) malloc (N);
@@ -103,8 +100,6 @@ main (int argc, char **argv)
if (acc_is_present (x, N) != 0)
abort ();
- acc_shutdown (acc_device_nvidia);
-
return 0;
}
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <stdio.h>
#include <pthread.h>
@@ -23,11 +23,16 @@ test (void *arg)
tid = (int) (long) arg;
- devnum = acc_get_device_num (acc_device_nvidia);
- acc_set_device_num (devnum, acc_device_nvidia);
+ devnum = acc_get_device_num (acc_device_default);
+ acc_set_device_num (devnum, acc_device_default);
+#if ACC_DEVICE_TYPE_nvidia
if (acc_get_current_cuda_context () == NULL)
abort ();
+#else
+ if (acc_get_current_cuda_context () != NULL)
+ abort ();
+#endif
p = (unsigned char *) malloc (N);
@@ -50,10 +55,7 @@ main (int argc, char **argv)
pthread_attr_t attr;
pthread_t *tid;
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
- acc_init (acc_device_nvidia);
+ acc_init (acc_device_default);
x = (unsigned char **) malloc (NTHREADS * N);
d_x = (void **) malloc (NTHREADS * N);
@@ -110,8 +112,6 @@ main (int argc, char **argv)
abort ();
}
- acc_shutdown (acc_device_nvidia);
-
return 0;
}
@@ -1,4 +1,4 @@
-/* { dg-do run } */
+/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <pthread.h>
#include <stdio.h>
@@ -22,11 +22,16 @@ test (void *arg)
tid = (int) (long) arg;
- devnum = acc_get_device_num (acc_device_nvidia);
- acc_set_device_num (devnum, acc_device_nvidia);
+ devnum = acc_get_device_num (acc_device_default);
+ acc_set_device_num (devnum, acc_device_default);
+#if ACC_DEVICE_TYPE_nvidia
if (acc_get_current_cuda_context () == NULL)
abort ();
+#else
+ if (acc_get_current_cuda_context () != NULL)
+ abort ();
+#endif
acc_copyout (x[tid], N);
@@ -49,10 +54,7 @@ main (int argc, char **argv)
pthread_t *tid;
unsigned char *p;
- if (acc_get_num_devices (acc_device_nvidia) == 0)
- return 0;
-
- acc_init (acc_device_nvidia);
+ acc_init (acc_device_default);
x = (unsigned char **) malloc (NTHREADS * N);
d_x = (void **) malloc (NTHREADS * N);
@@ -104,8 +106,6 @@ main (int argc, char **argv)
abort ();
}
- acc_shutdown (acc_device_nvidia);
-
return 0;
}
@@ -15,9 +15,7 @@ program main
integer, parameter :: c_size = sizeof (c)
integer, parameter :: r_size = sizeof (r)
- if (acc_get_num_devices (acc_device_nvidia) .eq. 0) call exit
-
- call acc_init (acc_device_nvidia)
+ call acc_init (acc_device_default)
call set3d (.FALSE., a_3d_i, a_3d_c, a_3d_r)
@@ -39,8 +37,6 @@ program main
end do
end do
- call acc_shutdown (acc_device_nvidia)
-
contains
subroutine set3d (clear, a_i, a_c, a_r)
@@ -1,7 +1,8 @@
! Exercise the data movement runtime library functions on non-shared memory
! targets.
-! { dg-do run { target openacc_nvidia_accel_selected } }
+! { dg-do run }
+! { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } }
program main
use openacc
@@ -6,26 +6,52 @@ program main
integer n
- if (acc_get_num_devices (acc_device_nvidia) .eq. 0) call exit
+ if (acc_get_num_devices (acc_device_nvidia) .ne. 0) then
- call acc_init (acc_device_nvidia)
+ call acc_init (acc_device_nvidia)
- n = 0
+ n = 0
- call acc_set_device_num (n, acc_device_nvidia)
+ call acc_set_device_num (n, acc_device_nvidia)
- if (acc_get_device_num (acc_device_nvidia) .ne. 0) STOP 1
+ if (acc_get_device_num (acc_device_nvidia) .ne. 0) stop 11
- if (acc_get_num_devices (acc_device_nvidia) .gt. 1) then
+ if (acc_get_num_devices (acc_device_nvidia) .gt. 1) then
- n = 1
+ n = 1
- call acc_set_device_num (n, acc_device_nvidia)
+ call acc_set_device_num (n, acc_device_nvidia)
- if (acc_get_device_num (acc_device_nvidia) .ne. 1) STOP 2
+ if (acc_get_device_num (acc_device_nvidia) .ne. 1) stop 12
+
+ end if
+
+ call acc_shutdown (acc_device_nvidia)
end if
- call acc_shutdown (acc_device_nvidia)
+ if (acc_get_num_devices (acc_device_radeon) .ne. 0) then
+
+ call acc_init (acc_device_radeon)
+
+ n = 0
+
+ call acc_set_device_num (n, acc_device_radeon)
+
+ if (acc_get_device_num (acc_device_radeon) .ne. 0) stop 21
+
+ if (acc_get_num_devices (acc_device_radeon) .gt. 1) then
+
+ n = 1
+
+ call acc_set_device_num (n, acc_device_radeon)
+
+ if (acc_get_device_num (acc_device_radeon) .ne. 1) stop 22
+
+ end if
+
+ call acc_shutdown (acc_device_radeon)
+
+ end if
end program
@@ -6,26 +6,52 @@ program main
integer n
- if (acc_get_num_devices (acc_device_nvidia) .eq. 0) call exit
+ if (acc_get_num_devices (acc_device_nvidia) .ne. 0) then
- call acc_init (acc_device_nvidia)
+ call acc_init (acc_device_nvidia)
- n = 0
+ n = 0
- call acc_set_device_num (n, acc_device_nvidia)
+ call acc_set_device_num (n, acc_device_nvidia)
- if (acc_get_device_num (acc_device_nvidia) .ne. 0) STOP 1
+ if (acc_get_device_num (acc_device_nvidia) .ne. 0) STOP 1
- if (acc_get_num_devices (acc_device_nvidia) .gt. 1) then
+ if (acc_get_num_devices (acc_device_nvidia) .gt. 1) then
- n = 1
+ n = 1
- call acc_set_device_num (n, acc_device_nvidia)
+ call acc_set_device_num (n, acc_device_nvidia)
- if (acc_get_device_num (acc_device_nvidia) .ne. 1) STOP 2
+ if (acc_get_device_num (acc_device_nvidia) .ne. 1) STOP 2
+
+ end if
+
+ call acc_shutdown (acc_device_nvidia)
end if
- call acc_shutdown (acc_device_nvidia)
+ if (acc_get_num_devices (acc_device_radeon) .ne. 0) then
+
+ call acc_init (acc_device_radeon)
+
+ n = 0
+
+ call acc_set_device_num (n, acc_device_radeon)
+
+ if (acc_get_device_num (acc_device_radeon) .ne. 0) STOP 1
+
+ if (acc_get_num_devices (acc_device_radeon) .gt. 1) then
+
+ n = 1
+
+ call acc_set_device_num (n, acc_device_radeon)
+
+ if (acc_get_device_num (acc_device_radeon) .ne. 1) STOP 2
+
+ end if
+
+ call acc_shutdown (acc_device_radeon)
+
+ end if
end program
@@ -16,9 +16,7 @@ program main
integer, parameter :: c_size = sizeof (c)
integer, parameter :: r_size = sizeof (r)
- if (acc_get_num_devices (acc_device_nvidia) .eq. 0) call exit
-
- call acc_init (acc_device_nvidia)
+ call acc_init (acc_device_default)
call set3d (.FALSE., a_3d_i, a_3d_c, a_3d_r)
@@ -40,8 +38,6 @@ program main
end do
end do
- call acc_shutdown (acc_device_nvidia)
-
contains
subroutine set3d (clear, a_i, a_c, a_r)
--
2.30.2