From 0fe2fcbe4c340e0b93e4fff72ef66c1defa49762 Mon Sep 17 00:00:00 2001
From: I Putu Gede Wirasuta <wirasutat@gmail.com>
Date: Sat, 28 Mar 2020 01:04:27 +0700
Subject: [PATCH] Reduced heap size and added sync on host

---
 src/main.cu | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/main.cu b/src/main.cu
index 9b8ec65..361f634 100644
--- a/src/main.cu
+++ b/src/main.cu
@@ -17,12 +17,14 @@ int main(int argc, char *argv[])
     }
 
     int node_count = atoi(argv[1]);
-    cudaDeviceSetLimit(cudaLimitMallocHeapSize, node_count * node_count * 3 * sizeof(long int) + node_count * sizeof(long int));
+    cudaDeviceSetLimit(cudaLimitMallocHeapSize, node_count * node_count * 2 * sizeof(long int));
     long int *adj_matrix = create_adj_matrix(node_count, node_count);
 
     long int *sub_dist;
     cudaMallocManaged(&sub_dist, node_count * node_count * sizeof(long int));
-    calculate_sub_matrix<<<16,64>>>(adj_matrix, sub_dist, node_count);
+    calculate_sub_matrix<<<20,128>>>(adj_matrix, sub_dist, node_count);
+
+    cudaDeviceSynchronize();
 
     char print_dist;
     printf("Print distances to stdout? [y/N] ");
-- 
GitLab