aboutsummaryrefslogtreecommitdiff
path: root/libgomp/testsuite/libgomp.c/alloc-pinned-5.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgomp/testsuite/libgomp.c/alloc-pinned-5.c')
-rw-r--r--libgomp/testsuite/libgomp.c/alloc-pinned-5.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libgomp/testsuite/libgomp.c/alloc-pinned-5.c b/libgomp/testsuite/libgomp.c/alloc-pinned-5.c
index 0ba2feb..cc77764 100644
--- a/libgomp/testsuite/libgomp.c/alloc-pinned-5.c
+++ b/libgomp/testsuite/libgomp.c/alloc-pinned-5.c
@@ -2,6 +2,8 @@
/* { dg-skip-if "Pinning not implemented on this host" { ! *-*-linux-gnu* } } */
+/* { dg-additional-options -DOFFLOAD_DEVICE_NVPTX { target offload_device_nvptx } } */
+
/* Test that ompx_gnu_pinned_mem_alloc works. */
#include <stdio.h>
@@ -63,10 +65,16 @@ verify0 (char *p, size_t s)
int
main ()
{
+#ifdef OFFLOAD_DEVICE_NVPTX
+ /* Go big or go home.
+ The OS ulimit does not affect memory locked via CUDA for NVPTX devices. */
+ const int SIZE = 40 * 1024 * 1024;
+#else
/* Allocate at least a page each time, allowing space for overhead,
but stay within the ulimit. */
const int SIZE = PAGE_SIZE - 128;
CHECK_SIZE (SIZE * 5);
+#endif
// Sanity check
if (get_pinned_mem () != 0)
@@ -77,22 +85,40 @@ main ()
abort ();
int amount = get_pinned_mem ();
+#ifdef OFFLOAD_DEVICE_NVPTX
+ /* This doesn't show up as process 'VmLck'ed memory. */
+ if (amount != 0)
+ abort ();
+#else
if (amount == 0)
abort ();
+#endif
p = omp_realloc (p, SIZE * 2, ompx_gnu_pinned_mem_alloc,
ompx_gnu_pinned_mem_alloc);
int amount2 = get_pinned_mem ();
+#ifdef OFFLOAD_DEVICE_NVPTX
+ /* This doesn't show up as process 'VmLck'ed memory. */
+ if (amount2 != 0)
+ abort ();
+#else
if (amount2 <= amount)
abort ();
+#endif
/* SIZE*2 ensures that it doesn't slot into the space possibly
vacated by realloc. */
p = omp_calloc (1, SIZE * 2, ompx_gnu_pinned_mem_alloc);
+#ifdef OFFLOAD_DEVICE_NVPTX
+ /* This doesn't show up as process 'VmLck'ed memory. */
+ if (get_pinned_mem () != 0)
+ abort ();
+#else
if (get_pinned_mem () <= amount2)
abort ();
+#endif
verify0 (p, SIZE * 2);