libgomp: Don't refer to CUDA installation in /opt/nvidia/cuda-5.5/.
[official-gcc.git] / libgomp / testsuite / libgomp.oacc-c / c.exp
blob318f78e9bbf7636f44a52cfa8815809825e9f49e
1 # This whole file adapted from libgomp.c/c.exp.
3 if [info exists lang_library_path] then {
4 unset lang_library_path
5 unset lang_link_flags
7 if [info exists lang_test_file] then {
8 unset lang_test_file
10 if [info exists lang_include_flags] then {
11 unset lang_include_flags
14 load_lib libgomp-dg.exp
15 load_gcc_lib gcc-dg.exp
17 # If a testcase doesn't have special options, use these.
18 if ![info exists DEFAULT_CFLAGS] then {
19 set DEFAULT_CFLAGS "-O2"
22 # Initialize dg.
23 dg-init
25 # Turn on OpenACC.
26 # XXX (TEMPORARY): Remove the -flto once that's properly integrated.
27 lappend ALWAYS_CFLAGS "additional_flags=-fopenacc -flto"
29 # Gather a list of all tests.
30 set tests [lsort [find $srcdir/$subdir *.c]]
32 set ld_library_path $always_ld_library_path
33 append ld_library_path [gcc-set-multilib-library-path $GCC_UNDER_TEST]
34 set_ld_library_path_env_vars
36 # Todo: get list of accelerators from configure options --enable-accelerator.
37 set accels { "nvidia" "host_nonshm" }
39 # Run on host (or fallback) accelerator.
40 lappend accels "host"
42 # Test OpenACC with available accelerators.
43 set SAVE_ALWAYS_CFLAGS "$ALWAYS_CFLAGS"
44 foreach accel $accels {
45 set ALWAYS_CFLAGS "$SAVE_ALWAYS_CFLAGS"
46 set tagopt "-DACC_DEVICE_TYPE_$accel=1"
48 # Todo: Determine shared memory or not using run-time test.
49 switch $accel {
50 host {
51 set acc_mem_shared 1
53 host_nonshm {
54 set acc_mem_shared 0
56 nvidia {
57 # Copy ptx file (TEMPORARY)
58 remote_download host $srcdir/libgomp.oacc-c/subr.ptx
60 # Where timer.h lives
61 lappend ALWAYS_CFLAGS "additional_flags=-I${srcdir}"
62 set acc_mem_shared 0
64 default {
65 set acc_mem_shared 0
68 set tagopt "$tagopt -DACC_MEM_SHARED=$acc_mem_shared"
70 # Todo: Verify that this works for both local and remote testing.
71 setenv ACC_DEVICE_TYPE $accel
73 dg-runtest $tests "$tagopt" $DEFAULT_CFLAGS
76 # All done.
77 dg-finish