Hi!

Committed to gomp-4_0-branch in r218846:

commit cf4f8a78be8da33b991590a1ac24cd001b58bdb7
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Dec 17 22:52:20 2014 +0000

    libgomp: Only test with configured (supported) offloading devices.
    
        libgomp/
        * testsuite/lib/libgomp.exp: Set offload_targets_s, and
        offload_targets_s_openacc.
        (check_effective_target_openacc_nvidia_accel_selected): Look for
        global offload_target_openacc instead of ACC_DEVICE_TYPE
        environment variable.
        * testsuite/libgomp.oacc-c++/c++.exp: Loop through
        offload_targets_s_openacc.
        * testsuite/libgomp.oacc-c/c.exp: Likewise.
        * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gomp-4_0-branch@218846 
138bc75d-0d04-0410-961f-82ee72b054a4
---
 libgomp/ChangeLog.gomp                             | 13 +++++++++++++
 libgomp/testsuite/lib/libgomp.exp                  | 21 +++++++++++++++++----
 libgomp/testsuite/libgomp.oacc-c++/c++.exp         | 14 ++++----------
 libgomp/testsuite/libgomp.oacc-c/c.exp             | 14 ++++----------
 libgomp/testsuite/libgomp.oacc-fortran/fortran.exp | 14 ++++----------
 5 files changed, 42 insertions(+), 34 deletions(-)

diff --git libgomp/ChangeLog.gomp libgomp/ChangeLog.gomp
index 9c23c80..6181f1a 100644
--- libgomp/ChangeLog.gomp
+++ libgomp/ChangeLog.gomp
@@ -1,4 +1,17 @@
 2014-12-17  Thomas Schwinge  <tho...@codesourcery.com>
+           Tom de Vries  <t...@codesourcery.com>
+
+       * testsuite/lib/libgomp.exp: Set offload_targets_s, and
+       offload_targets_s_openacc.
+       (check_effective_target_openacc_nvidia_accel_selected): Look for
+       global offload_target_openacc instead of ACC_DEVICE_TYPE
+       environment variable.
+       * testsuite/libgomp.oacc-c++/c++.exp: Loop through
+       offload_targets_s_openacc.
+       * testsuite/libgomp.oacc-c/c.exp: Likewise.
+       * testsuite/libgomp.oacc-fortran/fortran.exp: Likewise.
+
+2014-12-17  Thomas Schwinge  <tho...@codesourcery.com>
 
        * testsuite/Makefile.am: Don't export OFFLOAD_TARGETS,
        OFFLOAD_ADDITIONAL_OPTIONS, and OFFLOAD_ADDITIONAL_LIB_PATHS...
diff --git libgomp/testsuite/lib/libgomp.exp libgomp/testsuite/lib/libgomp.exp
index 6600c25..1e69098 100644
--- libgomp/testsuite/lib/libgomp.exp
+++ libgomp/testsuite/lib/libgomp.exp
@@ -35,6 +35,21 @@ load_gcc_lib fortran-modules.exp
 # Try to load a test support file, built during libgomp configuration.
 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).
+set offload_targets_s [split $offload_targets ","]
+# OpenACC spells some of them a little differently.
+set offload_targets_s_openacc {}
+foreach offload_target_openacc $offload_targets_s {
+    switch $offload_target_openacc {
+       nvptx {
+           set offload_target_openacc "nvidia"
+       }
+    }
+    lappend offload_targets_s_openacc "$offload_target_openacc"
+}
+lappend offload_targets_s_openacc "host"
+
 set dg-do-what-default run
 
 #
@@ -320,10 +335,8 @@ proc check_effective_target_openacc_nvidia_accel_selected 
{ } {
     if { ![check_effective_target_openacc_nvidia_accel_present] } {
        return 0;
     }
-    if { ![info exists ::env(ACC_DEVICE_TYPE)] } {
-       return 0;
-    }
-    if { $::env(ACC_DEVICE_TYPE) == "nvidia" } {
+    global offload_target_openacc
+    if { $offload_target_openacc == "nvidia" } {
         return 1;
     }
     return 0;
diff --git libgomp/testsuite/libgomp.oacc-c++/c++.exp 
libgomp/testsuite/libgomp.oacc-c++/c++.exp
index 2e2b618..81d445c 100644
--- libgomp/testsuite/libgomp.oacc-c++/c++.exp
+++ libgomp/testsuite/libgomp.oacc-c++/c++.exp
@@ -68,18 +68,12 @@ if { $lang_test_file_found } {
        set libstdcxx_includes ""
     }
 
-    # Todo: get list of accelerators from configure options 
--enable-accelerator.
-    set accels { "nvidia" "host_nonshm" }
-
-    # Run on host (or fallback) accelerator.
-    lappend accels "host"
-
     # Test OpenACC with available accelerators.
-    foreach accel $accels {
-       set tagopt "-DACC_DEVICE_TYPE_$accel=1"
+    foreach offload_target_openacc $offload_targets_s_openacc {
+       set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
 
        # Todo: Determine shared memory or not using run-time test.
-       switch $accel {
+       switch $offload_target_openacc {
            host {
                set acc_mem_shared 1
            }
@@ -102,7 +96,7 @@ if { $lang_test_file_found } {
        set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
        # Todo: Verify that this works for both local and remote testing.
-       setenv ACC_DEVICE_TYPE $accel
+       setenv ACC_DEVICE_TYPE $offload_target_openacc
 
        dg-runtest $tests "$tagopt" $libstdcxx_includes
     }
diff --git libgomp/testsuite/libgomp.oacc-c/c.exp 
libgomp/testsuite/libgomp.oacc-c/c.exp
index d7e5536..85943f0 100644
--- libgomp/testsuite/libgomp.oacc-c/c.exp
+++ libgomp/testsuite/libgomp.oacc-c/c.exp
@@ -34,20 +34,14 @@ set ld_library_path $always_ld_library_path
 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
 set_ld_library_path_env_vars
 
-# Todo: get list of accelerators from configure options --enable-accelerator.
-set accels { "nvidia" "host_nonshm" }
-
-# Run on host (or fallback) accelerator.
-lappend accels "host"
-
 # Test OpenACC with available accelerators.
 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
-foreach accel $accels {
+foreach offload_target_openacc $offload_targets_s_openacc {
     set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
-    set tagopt "-DACC_DEVICE_TYPE_$accel=1"
+    set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
 
     # Todo: Determine shared memory or not using run-time test.
-    switch $accel {
+    switch $offload_target_openacc {
        host {
            set acc_mem_shared 1
        }
@@ -70,7 +64,7 @@ foreach accel $accels {
     set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
     # Todo: Verify that this works for both local and remote testing.
-    setenv ACC_DEVICE_TYPE $accel
+    setenv ACC_DEVICE_TYPE $offload_target_openacc
 
     dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
 }
diff --git libgomp/testsuite/libgomp.oacc-fortran/fortran.exp 
libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
index ae11748..a68e039 100644
--- libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
+++ libgomp/testsuite/libgomp.oacc-fortran/fortran.exp
@@ -65,18 +65,12 @@ if { $lang_test_file_found } {
     append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
     set_ld_library_path_env_vars
 
-    # Todo: get list of accelerators from configure options 
--enable-accelerator.
-    set accels { "nvidia" "host_nonshm" }
-
-    # Run on host (or fallback) accelerator.
-    lappend accels "host"
-
     # Test OpenACC with available accelerators.
-    foreach accel $accels {
-       set tagopt "-DACC_DEVICE_TYPE_$accel=1"
+    foreach offload_target_openacc $offload_targets_s_openacc {
+       set tagopt "-DACC_DEVICE_TYPE_$offload_target_openacc=1"
 
        # Todo: Determine shared memory or not using run-time test.
-       switch $accel {
+       switch $offload_target_openacc {
            host {
                set acc_mem_shared 1
            }
@@ -93,7 +87,7 @@ if { $lang_test_file_found } {
        set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
 
        # Todo: Verify that this works for both local and remote testing.
-       setenv ACC_DEVICE_TYPE $accel
+       setenv ACC_DEVICE_TYPE $offload_target_openacc
 
        # For Fortran we're doing torture testing, as Fortran has far more tests
        # with arrays etc. that testing just -O0 or -O2 is insufficient, that is


Grüße,
 Thomas

Attachment: pgph_Gx1II_B7.pgp
Description: PGP signature

Reply via email to