From: Bruno Turcksin Date: Sun, 26 Apr 2020 22:25:49 +0000 (-0400) Subject: Use cudaPeekAtLastError() instead of cudaGetLastError() in AssertCuda X-Git-Tag: v9.2.0-rc1~173^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1cdbac71d2c0aa1eb3ecc4cfda766bcd4aa839d0;p=dealii.git Use cudaPeekAtLastError() instead of cudaGetLastError() in AssertCuda cudaGetLastError reset the error code to success after being called. Because the function is called multiple times in AssertCuda, the error message is wrong. --- diff --git a/include/deal.II/lac/affine_constraints.templates.h b/include/deal.II/lac/affine_constraints.templates.h index f6ffb99b66..d79ea8864a 100644 --- a/include/deal.II/lac/affine_constraints.templates.h +++ b/include/deal.II/lac/affine_constraints.templates.h @@ -1926,7 +1926,7 @@ namespace internal constrained_local_dofs_device, n_constraints, vec.get_values()); # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif diff --git a/include/deal.II/lac/precondition.h b/include/deal.II/lac/precondition.h index 9659ca120d..295965cd63 100644 --- a/include/deal.II/lac/precondition.h +++ b/include/deal.II/lac/precondition.h @@ -2168,7 +2168,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif diff --git a/include/deal.II/lac/vector_operations_internal.h b/include/deal.II/lac/vector_operations_internal.h index e1edb45e22..e047bb23e9 100644 --- a/include/deal.II/lac/vector_operations_internal.h +++ b/include/deal.II/lac/vector_operations_internal.h @@ -2096,7 +2096,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2121,7 +2121,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2146,7 +2146,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2167,7 +2167,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2193,7 +2193,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2224,7 +2224,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2248,7 +2248,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2273,7 +2273,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2306,7 +2306,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2327,7 +2327,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2351,7 +2351,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2377,7 +2377,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2408,7 +2408,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -2441,7 +2441,7 @@ namespace internal # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif diff --git a/source/lac/cuda_sparse_matrix.cu b/source/lac/cuda_sparse_matrix.cu index f6c8d37407..013159bfd3 100644 --- a/source/lac/cuda_sparse_matrix.cu +++ b/source/lac/cuda_sparse_matrix.cu @@ -345,7 +345,7 @@ namespace CUDAWrappers # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -367,7 +367,7 @@ namespace CUDAWrappers # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -522,7 +522,7 @@ namespace CUDAWrappers # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -547,7 +547,7 @@ namespace CUDAWrappers # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif diff --git a/source/lac/cuda_vector.cu b/source/lac/cuda_vector.cu index a0adad9280..f2f8bc05d0 100644 --- a/source/lac/cuda_vector.cu +++ b/source/lac/cuda_vector.cu @@ -161,7 +161,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -202,7 +202,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -224,7 +224,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -255,7 +255,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -286,7 +286,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -349,7 +349,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -379,7 +379,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -423,7 +423,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -456,7 +456,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -485,7 +485,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif @@ -516,7 +516,7 @@ namespace LinearAlgebra # ifdef DEBUG // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); # endif diff --git a/tests/cuda/cuda_point.cu b/tests/cuda/cuda_point.cu index e29a8f87c5..871cf72318 100644 --- a/tests/cuda/cuda_point.cu +++ b/tests/cuda/cuda_point.cu @@ -86,7 +86,7 @@ test_gpu() // Miscellaneous miscellaneous_kernel<<<1, 1>>>(check); // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize()); diff --git a/tests/cuda/matrix_free_no_index_initialize.cu b/tests/cuda/matrix_free_no_index_initialize.cu index 2720c9cf10..0adf975f14 100644 --- a/tests/cuda/matrix_free_no_index_initialize.cu +++ b/tests/cuda/matrix_free_no_index_initialize.cu @@ -77,7 +77,7 @@ public: data.cell_loop(*this, src_dummy, dst_dummy); // Check that the kernel was launched correctly - AssertCuda(cudaGetLastError()); + AssertCuda(cudaPeekAtLastError()); // Check that there was no problem during the execution of the kernel AssertCuda(cudaDeviceSynchronize());