gcc/libgomp/testsuite/libgomp.c/examples-4/async_target-1.c

70 lines
1.0 KiB
C
Raw Normal View History

[PATCH 7/7] OpenMP 4.0 offloading infrastructure: testsuite. libgomp/ * testsuite/lib/libgomp.exp (check_effective_target_offload_device): New. * testsuite/libgomp.c++/c++.exp: Include tests from subdirectories. * testsuite/libgomp.c++/examples-4/e.51.5.C: New test. * testsuite/libgomp.c++/examples-4/e.53.2.C: Ditto. * testsuite/libgomp.c/examples-4/e.50.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.7.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.3.c: Ditto. * testsuite/libgomp.c/target-7.c: Fix test. * testsuite/libgomp.fortran/examples-4/e.50.1.f90: New test. * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Ditto. Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com> Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com> Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com> From-SVN: r217494
2014-11-13 14:56:22 +01:00
/* { dg-do run } */
/* { dg-additional-options "-DCHUNKSZ=5000" { target { ! run_expensive_tests } } } */
/* { dg-additional-options "-DCHUNKSZ=1000" { target run_expensive_tests } } */
[PATCH 7/7] OpenMP 4.0 offloading infrastructure: testsuite. libgomp/ * testsuite/lib/libgomp.exp (check_effective_target_offload_device): New. * testsuite/libgomp.c++/c++.exp: Include tests from subdirectories. * testsuite/libgomp.c++/examples-4/e.51.5.C: New test. * testsuite/libgomp.c++/examples-4/e.53.2.C: Ditto. * testsuite/libgomp.c/examples-4/e.50.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.50.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.51.7.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.52.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.53.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.5.c: Ditto. * testsuite/libgomp.c/examples-4/e.54.6.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.55.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.3.c: Ditto. * testsuite/libgomp.c/examples-4/e.56.4.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.1.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.2.c: Ditto. * testsuite/libgomp.c/examples-4/e.57.3.c: Ditto. * testsuite/libgomp.c/target-7.c: Fix test. * testsuite/libgomp.fortran/examples-4/e.50.1.f90: New test. * testsuite/libgomp.fortran/examples-4/e.50.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.50.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.51.7.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.52.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.53.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.5.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.54.6.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.55.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.3.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.56.4.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.1.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.2.f90: Ditto. * testsuite/libgomp.fortran/examples-4/e.57.3.f90: Ditto. Co-Authored-By: Ilya Tocar <ilya.tocar@intel.com> Co-Authored-By: Ilya Verbin <ilya.verbin@intel.com> Co-Authored-By: Kirill Yukhin <kirill.yukhin@intel.com> From-SVN: r217494
2014-11-13 14:56:22 +01:00
#include <stdlib.h>
#define EPS 0.00001
#define N 100000
float Y[N];
float Z[N];
#pragma omp declare target
float F (float a)
{
return -a;
}
#pragma omp end declare target
void pipedF_ref ()
{
int i;
for (i = 0; i < N; i++)
Y[i] = F (Y[i]);
}
void pipedF ()
{
int i, C;
for (C = 0; C < N; C += CHUNKSZ)
{
#pragma omp task
#pragma omp target map(Z[C:CHUNKSZ])
#pragma omp parallel for
for (i = C; i < C + CHUNKSZ; i++)
Z[i] = F (Z[i]);
}
#pragma omp taskwait
}
void init ()
{
int i;
for (i = 0; i < N; i++)
Y[i] = Z[i] = 0.1 * i;
}
void check ()
{
int i;
for (i = 0; i < N; i++)
{
float err = (Z[i] == 0.0) ? Y[i] : (Y[i] - Z[i]) / Z[i];
if (((err > 0) ? err : -err) > EPS)
abort ();
}
}
int main ()
{
init ();
pipedF_ref ();
pipedF ();
check ();
return 0;
}