[Openmp-commits] [openmp] [OpenMP] Reduce the size of heap memory required by the test `malloc_parallel.c` (PR #75885)
Shilei Tian via Openmp-commits
openmp-commits at lists.llvm.org
Tue Dec 19 18:52:29 PST 2023
https://github.com/shiltian updated https://github.com/llvm/llvm-project/pull/75885
>From d30ef2600bff7623fd1a0283a40e0116b9b3c9f0 Mon Sep 17 00:00:00 2001
From: Shilei Tian <i at tianshilei.me>
Date: Tue, 19 Dec 2023 21:52:19 -0500
Subject: [PATCH] [OpenMP] Reduce the size of heap memory required by the test
`malloc_parallel.c`
This patch reduces the size of heap memory required by the test
`malloc_parallel.c`. The original size is too large such that `malloc` returns
`nullptr` on many threads, causing illegal memory access.
---
openmp/libomptarget/test/offloading/malloc.c | 8 ++++----
openmp/libomptarget/test/offloading/malloc_parallel.c | 8 ++++----
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/openmp/libomptarget/test/offloading/malloc.c b/openmp/libomptarget/test/offloading/malloc.c
index ad49ace2006256..7b98e1f1110e5b 100644
--- a/openmp/libomptarget/test/offloading/malloc.c
+++ b/openmp/libomptarget/test/offloading/malloc.c
@@ -6,9 +6,9 @@
int main() {
long unsigned *DP = 0;
- int N = 128;
- int Threads = 128;
- int Teams = 440;
+ int N = 32;
+ int Threads = 64;
+ int Teams = 10;
// Allocate ~55MB on the device.
#pragma omp target map(from : DP)
@@ -31,7 +31,7 @@ int main() {
}
}
- // CHECK: Sum: 203458478080
+ // CHECK: Sum: 6860800
printf("Sum: %li\n", s);
return 0;
}
diff --git a/openmp/libomptarget/test/offloading/malloc_parallel.c b/openmp/libomptarget/test/offloading/malloc_parallel.c
index 4908e00694d99e..076a7ba397a3c6 100644
--- a/openmp/libomptarget/test/offloading/malloc_parallel.c
+++ b/openmp/libomptarget/test/offloading/malloc_parallel.c
@@ -7,9 +7,9 @@
int main() {
long unsigned **DP = 0;
- int N = 128;
- int Threads = 128;
- int Teams = 440;
+ int N = 32;
+ int Threads = 64;
+ int Teams = 10;
#pragma omp target map(from : DP)
DP = (long unsigned **)malloc(sizeof(long unsigned *) * Threads * Teams);
@@ -36,7 +36,7 @@ int main() {
}
}
- // CHECK: Sum: 203458478080
+ // CHECK: Sum: 6860800
printf("Sum: %li\n", s);
return 0;
}
More information about the Openmp-commits
mailing list