Skip to content

Commit f140ad5

Browse files
authored
Update compute_cuda.cu
Replace deprecated cudaThreadSynchronize() with cudaDeviceSynchronize()
1 parent 4a6a2d6 commit f140ad5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

cscs-checks/mch/src/compute_cuda.cu

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@ void cuda_kernel_no_copy(float* a, float* b, int n)
2828
const int THREADS_PER_BLOCK = 1;
2929
const int NUMBER_OF_BLOCKS = 10;
3030

31-
cudaThreadSynchronize();
31+
cudaDeviceSynchronize();
3232
simple_add<<<NUMBER_OF_BLOCKS, THREADS_PER_BLOCK>>>(a, b, n);
33-
cudaThreadSynchronize();
33+
cudaDeviceSynchronize();
3434

3535
cudaCheckErrors("cuda error");
3636
}
@@ -47,9 +47,9 @@ void cuda_kernel_with_copy(float* a, float* b, int n)
4747
cudaMemcpy(d_a, a, n*sizeof(float), cudaMemcpyHostToDevice);
4848
cudaMemcpy(d_b, b, n*sizeof(float), cudaMemcpyHostToDevice);
4949

50-
cudaThreadSynchronize();
50+
cudaDeviceSynchronize();
5151
simple_add<<<NUMBER_OF_BLOCKS, THREADS_PER_BLOCK>>>(d_a, d_b, n);
52-
cudaThreadSynchronize();
52+
cudaDeviceSynchronize();
5353

5454
cudaMemcpy(a, d_a, n*sizeof(float), cudaMemcpyDeviceToHost);
5555

0 commit comments

Comments
 (0)