Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 10bd9b5

Browse files
authored
Merge pull request PacktPublishing#16 from PacktPublishing/reduction-fix
fixed reduction's wrong argument reference
2 parents 2d0abbe + 7f34bf7 commit 10bd9b5

File tree

7 files changed

+9
-9
lines changed

7 files changed

+9
-9
lines changed

Chapter03/03_cuda_thread_programming/06_limiter_balancing/reduction_kernel.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ int reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
4545
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
4646

4747
reduction_kernel<<<n_blocks, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_inPtr, size);
48-
reduction_kernel<<<1, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_inPtr, n_blocks);
48+
reduction_kernel<<<1, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_outPtr, n_blocks);
4949

5050
return 1;
51-
}
51+
}

Chapter03/03_cuda_thread_programming/06_limiter_balancing/reduction_kernel_opt.cu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ int reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
5252
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
5353

5454
reduction_kernel<<<n_blocks, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_inPtr, size);
55-
reduction_kernel<<<1, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_inPtr, n_blocks);
55+
reduction_kernel<<<1, n_threads, n_threads * sizeof(float), 0>>>(g_outPtr, g_outPtr, n_blocks);
5656

5757
return 1;
58-
}
58+
}

Chapter03/03_cuda_thread_programming/07_warp_synchronous_programming/reduction_wp_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,5 +79,5 @@ void reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
7979
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
8080

8181
reduction_kernel<<<n_blocks, n_threads>>>(g_outPtr, g_inPtr, size);
82-
reduction_kernel<<< 1, n_threads, n_threads * sizeof(float), 0 >>>(g_outPtr, g_inPtr, n_blocks);
82+
reduction_kernel<<< 1, n_threads, n_threads * sizeof(float), 0 >>>(g_outPtr, g_outPtr, n_blocks);
8383
}

Chapter03/03_cuda_thread_programming/08_cooperative_group/reduction_cg_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,5 +63,5 @@ void reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
6363
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
6464

6565
reduction_kernel<<< n_blocks, n_threads, n_threads * sizeof(float), 0 >>>(g_outPtr, g_inPtr, size);
66-
reduction_kernel<<< 1, n_threads, n_threads * sizeof(float), 0 >>>(g_outPtr, g_inPtr, n_blocks);
66+
reduction_kernel<<< 1, n_threads, n_threads * sizeof(float), 0 >>>(g_outPtr, g_outPtr, n_blocks);
6767
}

Chapter03/03_cuda_thread_programming/08_cooperative_group/reduction_cg_shift_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@ void reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
8585
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
8686

8787
reduction_kernel<<<n_blocks, n_threads>>>(g_outPtr, g_inPtr, size);
88-
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_inPtr, n_blocks);
88+
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_outPtr, n_blocks);
8989
}

Chapter03/03_cuda_thread_programming/09_loop_unrolling/reduction_cg_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,5 @@ void reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
8080
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
8181

8282
reduction_kernel<<< n_blocks, n_threads>>>(g_outPtr, g_inPtr, size);
83-
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_inPtr, n_blocks);
83+
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_outPtr, n_blocks);
8484
}

Chapter03/03_cuda_thread_programming/09_loop_unrolling/reduction_wp_kernel.cu

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,5 +85,5 @@ void reduction(float *g_outPtr, float *g_inPtr, int size, int n_threads)
8585
int n_blocks = min(num_blocks_per_sm * num_sms, (size + n_threads - 1) / n_threads);
8686

8787
reduction_kernel<<< n_blocks, n_threads>>>(g_outPtr, g_inPtr, size);
88-
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_inPtr, n_blocks);
88+
reduction_kernel<<< 1, n_threads >>>(g_outPtr, g_outPtr, n_blocks);
8989
}

0 commit comments

Comments
 (0)