From 68811768317ae0a1bf3f04e66841939b39c709c2 Mon Sep 17 00:00:00 2001 From: Madan Ram Date: Tue, 28 Apr 2015 17:06:22 +0530 Subject: [PATCH] Update student_func.cu code will give wrong result for if d is divisible by n then you don't need to add 1 are else 1 more block is required. --- Problem Sets/Problem Set 3/student_func.cu | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Problem Sets/Problem Set 3/student_func.cu b/Problem Sets/Problem Set 3/student_func.cu index dd76ff71..108790a0 100755 --- a/Problem Sets/Problem Set 3/student_func.cu +++ b/Problem Sets/Problem Set 3/student_func.cu @@ -168,6 +168,9 @@ void reduce_minmax_kernel(const float* const d_in, float* d_out, const size_t si } int get_max_size(int n, int d) { + if(n%d == 0) { + return (int)ceil( (float)n/(float)d ); + } return (int)ceil( (float)n/(float)d ) + 1; }