From 304424764d1943436802cb647d225a4b613b4aed Mon Sep 17 00:00:00 2001 From: Dmitry Mikushin Date: Thu, 18 Sep 2025 17:34:36 +0200 Subject: [PATCH 1/2] Fix shared memory Table size and accesses reporting in GUPS benchmark MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on feedback from rkarim2 in issue #56: - For shared memory tests, Table size now shows the actual total shared memory used - Display shared memory allocation details (bytes per block × number of blocks) - Use correct accesses_per_elem_sh for shared memory tests - Report size in MB for shared memory vs GB for global memory This fixes the misleading Table size output that showed irrelevant global memory sizes (e.g., 4.2 GB) when running shared memory tests. --- posts/gups/gups.cu | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-) diff --git a/posts/gups/gups.cu b/posts/gups/gups.cu index fb96f5e..97fa365 100644 --- a/posts/gups/gups.cu +++ b/posts/gups/gups.cu @@ -484,14 +484,30 @@ int main(int argc, char* argv[]) } size_t total_num_thread = thread * grid; - printf( - "Table size = %zu (%lf GB.)\nTotal number of threads %zu\nEach thread " - "access %d locations.\nNumber of iterations = %d\n", - working_set, - working_set * sizeof(benchtype) / 1e9, - total_num_thread, - accesses_per_elem, - repeats); + if (!shared_mem) { + printf( + "Table size = %zu (%lf GB.)\nTotal number of threads %zu\nEach thread " + "access %d locations.\nNumber of iterations = %d\n", + working_set, + working_set * sizeof(benchtype) / 1e9, + total_num_thread, + accesses_per_elem, + repeats); + } else { + // For shared memory tests, report the actual shared memory used + size_t total_shmem = grid * n_shmem * sizeof(benchtype); + printf( + "Table size = %zu (%lf MB.) [shared memory: %zu bytes per block x %zu blocks]\n" + "Total number of threads %zu\nEach thread " + "access %d locations.\nNumber of iterations = %d\n", + total_shmem / sizeof(benchtype), + total_shmem / 1e6, + n_shmem * sizeof(benchtype), + grid, + total_num_thread, + accesses_per_elem_sh, + repeats); + } benchtype* d_t; if (!shared_mem) From e72bacb66956a704cd672e307d06dd7e38e28d6e Mon Sep 17 00:00:00 2001 From: Dmitry Mikushin Date: Tue, 23 Sep 2025 15:18:30 +0200 Subject: [PATCH 2/2] Remove comment per reviewer feedback Removed the comment on line 497 as requested by rkarim2 in PR review. --- posts/gups/gups.cu | 1 - 1 file changed, 1 deletion(-) diff --git a/posts/gups/gups.cu b/posts/gups/gups.cu index 97fa365..58fc847 100644 --- a/posts/gups/gups.cu +++ b/posts/gups/gups.cu @@ -494,7 +494,6 @@ int main(int argc, char* argv[]) accesses_per_elem, repeats); } else { - // For shared memory tests, report the actual shared memory used size_t total_shmem = grid * n_shmem * sizeof(benchtype); printf( "Table size = %zu (%lf MB.) [shared memory: %zu bytes per block x %zu blocks]\n"