Tests: Add missing error check in CudaOnly.GPUDebugFlag

If `cudaMallocManaged` fails then later use of `has_debug` is not valid.
This commit is contained in:
Brad King 2018-02-01 09:07:50 -05:00
parent 5a16e762e2
commit 8285aa9e4e

View File

@ -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();