[libgomp/testsuite] Fix libgomp.fortran/examples-4/declare_target-1.f90 --- .../examples-4/declare_target-1.f90 | 31 +++++++++++++--------- .../libgomp.fortran/examples-4/on_device_arch.c | 3 +++ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 index 03c5c53ed67..acded20f756 100644 --- a/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 +++ b/libgomp/testsuite/libgomp.fortran/examples-4/declare_target-1.f90 @@ -1,16 +1,6 @@ ! { dg-do run } -! { dg-additional-options "-cpp" } -! Reduced from 25 to 23, otherwise execution runs out of thread stack on -! Nvidia Titan V. -! Reduced from 23 to 22, otherwise execution runs out of thread stack on -! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=-O0. -! Reduced from 22 to 20, otherwise execution runs out of thread stack on -! Nvidia RTX A2000 (6GB variant), when run with GOMP_NVPTX_JIT=-O0. -! { dg-additional-options "-DREC_DEPTH=20" { target { offload_target_nvptx } } } */ - -#ifndef REC_DEPTH -#define REC_DEPTH 25 -#endif +! { dg-additional-sources on_device_arch.c } +! { dg-prune-output "command-line option '-fintrinsic-modules-path=.*' is valid for Fortran but not for C" } module e_53_1_mod integer :: THRESHOLD = 20 @@ -38,6 +28,23 @@ end module program e_53_1 use e_53_1_mod, only : fib, fib_wrapper + integer :: REC_DEPTH = 25 + + interface + integer function on_device_arch_nvptx() bind(C) + end function on_device_arch_nvptx + end interface + + if (on_device_arch_nvptx () /= 0) then + ! Reduced from 25 to 23, otherwise execution runs out of thread stack on + ! Nvidia Titan V. + ! Reduced from 23 to 22, otherwise execution runs out of thread stack on + ! Nvidia T400 (2GB variant), when run with GOMP_NVPTX_JIT=-O0. + ! Reduced from 22 to 20, otherwise execution runs out of thread stack on + ! Nvidia RTX A2000 (6GB variant), when run with GOMP_NVPTX_JIT=-O0. + REC_DEPTH = 20 + end if + if (fib (15) /= fib_wrapper (15)) stop 1 if (fib (REC_DEPTH) /= fib_wrapper (REC_DEPTH)) stop 2 end program diff --git a/libgomp/testsuite/libgomp.fortran/examples-4/on_device_arch.c b/libgomp/testsuite/libgomp.fortran/examples-4/on_device_arch.c new file mode 100644 index 00000000000..f8bef19e021 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/examples-4/on_device_arch.c @@ -0,0 +1,3 @@ +/* Auxiliar file. */ +/* { dg-do compile { target skip-all-targets } } */ +#include "../../libgomp.c-c++-common/on_device_arch.h"