Retro68/gcc/libgomp/testsuite/libgomp.oacc-c-c++-common/present-1.c

49 lines
995 B
C
Raw Normal View History

2015-08-28 15:33:40 +00:00
/* { dg-do run } */
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
#include <openacc.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
int
main (int argc, char **argv)
{
int N = 8;
float *a, *b, *c, *d;
int i;
a = (float *) malloc (N * sizeof (float));
b = (float *) malloc (N * sizeof (float));
c = (float *) malloc (N * sizeof (float));
d = (float *) acc_malloc (N * sizeof (float));
acc_map_data (c, d, N * sizeof (float));
#pragma acc data present (a[0:N]) present (c[0:N]) present (b[0:N])
{
#pragma acc parallel
{
int ii;
for (ii = 0; ii < N; ii++)
{
c[ii] = a[ii];
b[ii] = c[ii];
}
}
}
d = (float *) acc_deviceptr (c);
acc_unmap_data (c);
acc_free (d);
free (a);
free (b);
free (c);
return 0;
}
/* { dg-shouldfail "libgomp: present clause: !acc_is_present" } */