mirror of
https://review.haiku-os.org/buildtools
synced 2025-02-19 04:07:46 +01:00
Updated dependencies: * GMP 6.2.1 * ISL 0.24 * MPL 1.2.1 * MPFR 4.1.0 The dependencies were pulled in by running the ./contrib/download_prerequisites script and then manually removing the symbolic links and archives, and renaming the directories (i.e mv isl-0.24 to isl)
100 lines
1.6 KiB
C
100 lines
1.6 KiB
C
/* Verify back to back 'async' operations, two data mappings.
|
|
|
|
Make sure that despite two data mappings, this isn't using the libgomp
|
|
'cbuf' buffering.
|
|
*/
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
|
#define N 128
|
|
|
|
|
|
static void
|
|
t1 (void)
|
|
{
|
|
unsigned int *a, *b;
|
|
int i;
|
|
int nbytes;
|
|
|
|
nbytes = N * sizeof (unsigned int);
|
|
|
|
a = (unsigned int *) malloc (nbytes);
|
|
b = (unsigned int *) malloc (nbytes);
|
|
|
|
for (i = 0; i < N; i++)
|
|
b[i] = a[i] = 3;
|
|
|
|
#pragma acc parallel async copy (a[0:N], b[0:N])
|
|
for (int ii = 0; ii < N; ii++)
|
|
b[ii] += (a[ii] += 1);
|
|
|
|
#pragma acc parallel async copy (a[0:N], b[0:N])
|
|
for (int ii = 0; ii < N; ii++)
|
|
b[ii] += (a[ii] += 1);
|
|
|
|
#pragma acc wait
|
|
|
|
for (i = 0; i < N; i++)
|
|
{
|
|
if (a[i] != 5)
|
|
abort ();
|
|
if (b[i] != 12)
|
|
abort ();
|
|
}
|
|
}
|
|
|
|
|
|
static void
|
|
t2 (void)
|
|
{
|
|
unsigned int *a, *b;
|
|
int i;
|
|
int nbytes;
|
|
|
|
nbytes = N * sizeof (unsigned int);
|
|
|
|
a = (unsigned int *) malloc (nbytes);
|
|
b = (unsigned int *) malloc (nbytes);
|
|
|
|
#pragma acc data copyin (a[0:N], b[0:N])
|
|
{
|
|
for (i = 0; i < N; i++)
|
|
b[i] = a[i] = 3;
|
|
|
|
#pragma acc update async device (a[0:N], b[0:N])
|
|
#pragma acc parallel async present (a[0:N], b[0:N])
|
|
for (int ii = 0; ii < N; ii++)
|
|
b[ii] += (a[ii] += 1);
|
|
#pragma acc update async host (a[0:N], b[0:N])
|
|
|
|
#pragma acc update async device (a[0:N], b[0:N])
|
|
#pragma acc parallel async present (a[0:N], b[0:N])
|
|
for (int ii = 0; ii < N; ii++)
|
|
b[ii] += (a[ii] += 1);
|
|
#pragma acc update async host (a[0:N], b[0:N])
|
|
|
|
#pragma acc wait
|
|
}
|
|
|
|
for (i = 0; i < N; i++)
|
|
{
|
|
if (a[i] != 5)
|
|
abort ();
|
|
if (b[i] != 12)
|
|
abort ();
|
|
}
|
|
}
|
|
|
|
|
|
int
|
|
main (void)
|
|
{
|
|
t1 ();
|
|
|
|
t2 ();
|
|
|
|
return 0;
|
|
}
|