summaryrefslogtreecommitdiffstats
path: root/Tests/CudaOnly
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-02-01 14:07:50 (GMT)
committerBrad King <brad.king@kitware.com>2018-02-01 14:07:50 (GMT)
commit8285aa9e4e2df09b35f4faa930da6577979d4d2a (patch)
tree30a5d6b29cf78ec3608f039fe87b26aa507849af /Tests/CudaOnly
parent5a16e762e21e22e7a212acc7e2bc7bd027d66166 (diff)
downloadCMake-8285aa9e4e2df09b35f4faa930da6577979d4d2a.zip
CMake-8285aa9e4e2df09b35f4faa930da6577979d4d2a.tar.gz
CMake-8285aa9e4e2df09b35f4faa930da6577979d4d2a.tar.bz2
Tests: Add missing error check in CudaOnly.GPUDebugFlag
If `cudaMallocManaged` fails then later use of `has_debug` is not valid.
Diffstat (limited to 'Tests/CudaOnly')
-rw-r--r--Tests/CudaOnly/GPUDebugFlag/main.cu5
1 files changed, 5 insertions, 0 deletions
diff --git a/Tests/CudaOnly/GPUDebugFlag/main.cu b/Tests/CudaOnly/GPUDebugFlag/main.cu
index 8b97a3f..1f3fc12 100644
--- a/Tests/CudaOnly/GPUDebugFlag/main.cu
+++ b/Tests/CudaOnly/GPUDebugFlag/main.cu
@@ -49,6 +49,11 @@ int main(int argc, char** argv)
{
bool* has_debug;
cudaError_t err = cudaMallocManaged(&has_debug, sizeof(bool));
+ if (err != cudaSuccess) {
+ std::cerr << "cudaMallocManaged failed:\n"
+ << " " << cudaGetErrorString(err) << std::endl;
+ return 1;
+ }
debug_kernel<<<1, 1>>>(has_debug);
err = cudaDeviceSynchronize();