58168bbf6f
Reviewed-by: Thomas Schwinge <thomas@codesourcery.com> libgomp/ * oacc-mem.c (memcpy_tofrom_device): New function, combined from acc_memcpy_to/from_device functions, now with async parameter. (acc_memcpy_to_device): Modify to use memcpy_tofrom_device. (acc_memcpy_from_device): Likewise. (acc_memcpy_to_device_async): New API function. (acc_memcpy_from_device_async): Likewise. (present_create_copy): Add async parameter and async setting/unsetting. (acc_create): Adjust present_create_copy call. (acc_copyin): Likewise. (acc_present_or_create): Likewise. (acc_present_or_copyin): Likewise. (acc_create_async): New API function. (acc_copyin_async): New API function. (delete_copyout): Add async parameter and async setting/unsetting. (acc_delete): Adjust delete_copyout call. (acc_copyout): Likewise. (acc_delete_async): New API function. (acc_copyout_async): Likewise. (update_dev_host): Add async parameter and async setting/unsetting. (acc_update_device): Adjust update_dev_host call. (acc_update_self): Likewise. (acc_update_device_async): New API function. (acc_update_self_async): Likewise. * openacc.h (acc_copyin_async): Declare new API function. (acc_create_async): Likewise. (acc_copyout_async): Likewise. (acc_delete_async): Likewise. (acc_update_device_async): Likewise. (acc_update_self_async): Likewise. (acc_memcpy_to_device_async): Likewise. (acc_memcpy_from_device_async): Likewise. * openacc_lib.h (acc_copyin_async_32_h): New subroutine. (acc_copyin_async_64_h): New subroutine. (acc_copyin_async_array_h): New subroutine. (acc_create_async_32_h): New subroutine. (acc_create_async_64_h): New subroutine. (acc_create_async_array_h): New subroutine. (acc_copyout_async_32_h): New subroutine. (acc_copyout_async_64_h): New subroutine. (acc_copyout_async_array_h): New subroutine. (acc_delete_async_32_h): New subroutine. (acc_delete_async_64_h): New subroutine. (acc_delete_async_array_h): New subroutine. (acc_update_device_async_32_h): New subroutine. (acc_update_device_async_64_h): New subroutine. (acc_update_device_async_array_h): New subroutine. (acc_update_self_async_32_h): New subroutine. (acc_update_self_async_64_h): New subroutine. (acc_update_self_async_array_h): New subroutine. * openacc.f90 (acc_copyin_async_32_h): New subroutine. (acc_copyin_async_64_h): New subroutine. (acc_copyin_async_array_h): New subroutine. (acc_create_async_32_h): New subroutine. (acc_create_async_64_h): New subroutine. (acc_create_async_array_h): New subroutine. (acc_copyout_async_32_h): New subroutine. (acc_copyout_async_64_h): New subroutine. (acc_copyout_async_array_h): New subroutine. (acc_delete_async_32_h): New subroutine. (acc_delete_async_64_h): New subroutine. (acc_delete_async_array_h): New subroutine. (acc_update_device_async_32_h): New subroutine. (acc_update_device_async_64_h): New subroutine. (acc_update_device_async_array_h): New subroutine. (acc_update_self_async_32_h): New subroutine. (acc_update_self_async_64_h): New subroutine. (acc_update_self_async_array_h): New subroutine. * libgomp.map (OACC_2.5): Add acc_copyin_async*, acc_copyout_async*, acc_copyout_finalize_async*, acc_create_async*, acc_delete_async*, acc_delete_finalize_async*, acc_memcpy_from_device_async*, acc_memcpy_to_device_async*, acc_update_device_async*, and acc_update_self_async* entries. * testsuite/libgomp.oacc-c-c++-common/lib-94.c: New test. * testsuite/libgomp.oacc-c-c++-common/lib-95.c: New test. * testsuite/libgomp.oacc-fortran/lib-16.f90: New test. From-SVN: r265842
46 lines
722 B
C
46 lines
722 B
C
/* { dg-do run } */
|
|
/* { dg-skip-if "" { *-*-* } { "*" } { "-DACC_MEM_SHARED=0" } } */
|
|
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include <openacc.h>
|
|
|
|
int
|
|
main (int argc, char **argv)
|
|
{
|
|
const int N = 256;
|
|
int i, q = 5;
|
|
unsigned char *h, *g;
|
|
void *d;
|
|
|
|
h = (unsigned char *) malloc (N);
|
|
g = (unsigned char *) malloc (N);
|
|
for (i = 0; i < N; i++)
|
|
{
|
|
g[i] = i;
|
|
}
|
|
|
|
acc_create_async (h, N, q);
|
|
|
|
acc_memcpy_to_device_async (acc_deviceptr (h), g, N, q);
|
|
memset (&h[0], 0, N);
|
|
|
|
acc_wait (q);
|
|
|
|
acc_update_self_async (h, N, q + 1);
|
|
acc_delete_async (h, N, q + 1);
|
|
|
|
acc_wait (q + 1);
|
|
|
|
for (i = 0; i < N; i++)
|
|
{
|
|
if (h[i] != i)
|
|
abort ();
|
|
}
|
|
|
|
free (h);
|
|
free (g);
|
|
|
|
return 0;
|
|
}
|