summaryrefslogtreecommitdiff
path: root/Microbenchmarks
diff options
context:
space:
mode:
authorBirte Kristina Friesel <birte.friesel@uos.de>2024-06-07 15:54:24 +0200
committerBirte Kristina Friesel <birte.friesel@uos.de>2024-06-07 15:54:24 +0200
commit657789faa7b7d56c61265bacd7998673fc6314fb (patch)
treeee6c83ce800bfb87f33b28d0145c18fed43224d3 /Microbenchmarks
parent2e02e35ada76c2f5054d9d217009fd9482b242a9 (diff)
CPU-DPU: use numa_alloc to ensure correct data placement
Diffstat (limited to 'Microbenchmarks')
-rw-r--r--Microbenchmarks/CPU-DPU/host/app.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Microbenchmarks/CPU-DPU/host/app.c b/Microbenchmarks/CPU-DPU/host/app.c
index 3ba59da..be71ff5 100644
--- a/Microbenchmarks/CPU-DPU/host/app.c
+++ b/Microbenchmarks/CPU-DPU/host/app.c
@@ -122,19 +122,23 @@ int main(int argc, char **argv) {
numa_set_membind(p.bitmask_in);
numa_free_nodemask(p.bitmask_in);
}
-#endif
-
+ A = numa_alloc(input_size * sizeof(T));
+ B = numa_alloc(input_size * sizeof(T));
+#else
A = malloc(input_size * sizeof(T));
B = malloc(input_size * sizeof(T));
+#endif
#if NUMA
if (p.bitmask_out) {
numa_set_membind(p.bitmask_out);
numa_free_nodemask(p.bitmask_out);
}
+ C = numa_alloc(input_size * sizeof(T));
+#else
+ C = malloc(input_size * sizeof(T));
#endif
- C = malloc(input_size * sizeof(T));
T *bufferA = A;
T *bufferC = C;
@@ -330,9 +334,15 @@ int main(int argc, char **argv) {
}
// Deallocation
+#if NUMA
+ numa_free(A, input_size * sizeof(T));
+ numa_free(B, input_size * sizeof(T));
+ numa_free(C, input_size * sizeof(T));
+#else
free(A);
free(B);
free(C);
+#endif
DPU_ASSERT(dpu_free(dpu_set));
return 0;