4e2a5450e9
That is, verify that we're actually reaching the expected checkpoint before terminating. libgomp/ * testsuite/libgomp.oacc-c-c++-common/abort-1.c: Add checkpoint. * testsuite/libgomp.oacc-c-c++-common/abort-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/clauses-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-5.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-6.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-7.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/data-already-8.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-1.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-11.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-16.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-17.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-18.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-2.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-20.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-21.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-22.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-23.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-25.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-26.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-27.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-28.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-29.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-3.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-30.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-34.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-35.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-36.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-39.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-4.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-40.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-42.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-43.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-44.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-47.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-48.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-52.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-53.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-54.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-57.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-58.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-62.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-63.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-64.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-65.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-67.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-68.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-71.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-77.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/lib-80.c: Likewise. * testsuite/libgomp.oacc-c-c++-common/present-1.c: Likewise. * testsuite/libgomp.oacc-fortran/abort-1.f90: Likewise. * testsuite/libgomp.oacc-fortran/data-already-1.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-2.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-3.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-4.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-5.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-6.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-7.f: Likewise. * testsuite/libgomp.oacc-fortran/data-already-8.f: Likewise. From-SVN: r228282
136 lines
2.6 KiB
C
136 lines
2.6 KiB
C
/* { dg-do run { target openacc_nvidia_accel_selected } } */
|
|
/* { dg-additional-options "-lcuda" } */
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <unistd.h>
|
|
#include <openacc.h>
|
|
#include <cuda.h>
|
|
#include "timer.h"
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
CUdevice dev;
|
|
CUfunction delay;
|
|
CUmodule module;
|
|
CUresult r;
|
|
CUstream stream;
|
|
int N;
|
|
int i;
|
|
unsigned long *a, *d_a, dticks;
|
|
int nbytes;
|
|
float atime, dtime;
|
|
void *kargs[2];
|
|
int clkrate;
|
|
int devnum, nprocs;
|
|
|
|
acc_init (acc_device_nvidia);
|
|
|
|
devnum = acc_get_device_num (acc_device_nvidia);
|
|
|
|
r = cuDeviceGet (&dev, devnum);
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuDeviceGet failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
r =
|
|
cuDeviceGetAttribute (&nprocs, CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT,
|
|
dev);
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuDeviceGetAttribute failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
r = cuDeviceGetAttribute (&clkrate, CU_DEVICE_ATTRIBUTE_CLOCK_RATE, dev);
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuDeviceGetAttribute failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
r = cuModuleLoad (&module, "subr.ptx");
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuModuleLoad failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
r = cuModuleGetFunction (&delay, module, "delay");
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuModuleGetFunction failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
nbytes = nprocs * sizeof (unsigned long);
|
|
|
|
dtime = 200.0;
|
|
|
|
dticks = (unsigned long) (dtime * clkrate);
|
|
|
|
N = nprocs;
|
|
|
|
a = (unsigned long *) malloc (nbytes);
|
|
d_a = (unsigned long *) acc_malloc (nbytes);
|
|
|
|
acc_map_data (a, d_a, nbytes);
|
|
|
|
r = cuStreamCreate (&stream, CU_STREAM_DEFAULT);
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuStreamCreate failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
|
|
acc_set_cuda_stream (1, stream);
|
|
|
|
init_timers (1);
|
|
|
|
kargs[0] = (void *) &d_a;
|
|
kargs[1] = (void *) &dticks;
|
|
|
|
start_timer (0);
|
|
|
|
for (i = 0; i < N; i++)
|
|
{
|
|
r = cuLaunchKernel (delay, 1, 1, 1, 1, 1, 1, 0, stream, kargs, 0);
|
|
if (r != CUDA_SUCCESS)
|
|
{
|
|
fprintf (stderr, "cuLaunchKernel failed: %d\n", r);
|
|
abort ();
|
|
}
|
|
}
|
|
|
|
fprintf (stderr, "CheCKpOInT\n");
|
|
acc_wait_async (1, 1);
|
|
|
|
acc_wait (1);
|
|
|
|
atime = stop_timer (0);
|
|
|
|
if (atime < dtime)
|
|
{
|
|
fprintf (stderr, "actual time < delay time\n");
|
|
abort ();
|
|
}
|
|
|
|
acc_unmap_data (a);
|
|
|
|
fini_timers ();
|
|
|
|
free (a);
|
|
acc_free (d_a);
|
|
|
|
acc_shutdown (acc_device_nvidia);
|
|
|
|
return 0;
|
|
}
|
|
|
|
/* { dg-output "CheCKpOInT(\n|\r\n|\r).*" } */
|
|
/* { dg-output "identical parameters" } */
|
|
/* { dg-shouldfail "" } */
|