Skip to content

Commit 7e4c6f6

Browse files
authored
[OpenMP] Reduce the size of heap memory required by the test malloc_parallel.c (#75885)
This patch reduces the size of heap memory required by the test `malloc_parallel.c` and `malloc.c`. The original size is too large such that `malloc` returns `nullptr` on many threads, causing illegal memory access.
1 parent 39f09ec commit 7e4c6f6

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

openmp/libomptarget/test/offloading/malloc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66

77
int main() {
88
long unsigned *DP = 0;
9-
int N = 128;
10-
int Threads = 128;
11-
int Teams = 440;
9+
int N = 32;
10+
int Threads = 64;
11+
int Teams = 10;
1212

1313
// Allocate ~55MB on the device.
1414
#pragma omp target map(from : DP)
@@ -31,7 +31,7 @@ int main() {
3131
}
3232
}
3333

34-
// CHECK: Sum: 203458478080
34+
// CHECK: Sum: 6860800
3535
printf("Sum: %li\n", s);
3636
return 0;
3737
}

openmp/libomptarget/test/offloading/malloc_parallel.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77

88
int main() {
99
long unsigned **DP = 0;
10-
int N = 128;
11-
int Threads = 128;
12-
int Teams = 440;
10+
int N = 32;
11+
int Threads = 64;
12+
int Teams = 10;
1313

1414
#pragma omp target map(from : DP)
1515
DP = (long unsigned **)malloc(sizeof(long unsigned *) * Threads * Teams);
@@ -36,7 +36,7 @@ int main() {
3636
}
3737
}
3838

39-
// CHECK: Sum: 203458478080
39+
// CHECK: Sum: 6860800
4040
printf("Sum: %li\n", s);
4141
return 0;
4242
}

0 commit comments

Comments
 (0)