Skip to content

Commit 7314692

Browse files
authored
Adding warmup steps to coarsening.cu (#46)
1 parent 32d3664 commit 7314692

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lecture_008/coarsening.cu

+7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ int main()
5353
cudaMemcpy(d_a, a, size, cudaMemcpyHostToDevice);
5454
cudaMemcpy(d_b, b, size, cudaMemcpyHostToDevice);
5555

56+
// warmup
57+
VecAdd<<<(N + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK, THREADS_PER_BLOCK>>>(d_a, d_b, d_c);
58+
cudaDeviceSynchronize();
59+
60+
VecAddCoarsened<<<(N + 2*THREADS_PER_BLOCK - 1) / (2*THREADS_PER_BLOCK), THREADS_PER_BLOCK>>>(d_a, d_b, d_c);
61+
cudaDeviceSynchronize();
62+
5663
// Start timer for VecAdd kernel
5764
cudaEventRecord(start);
5865
VecAdd<<<(N + THREADS_PER_BLOCK - 1) / THREADS_PER_BLOCK, THREADS_PER_BLOCK>>>(d_a, d_b, d_c);

0 commit comments

Comments
 (0)