NifTK  16.4.1 - 0798f20
CMIC's Translational Medical Imaging Platform
niftkCUDAUtils.h
Go to the documentation of this file.
1 /*=============================================================================
2 
3  NifTK: A software platform for medical image computing.
4 
5  Copyright (c) University College London (UCL). All rights reserved.
6 
7  This software is distributed WITHOUT ANY WARRANTY; without even
8  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
9  PURPOSE.
10 
11  See LICENSE.txt in the top level directory for details.
12 
13 =============================================================================*/
14 
15 #ifndef niftkCUDAUtils_h
16 #define niftkCUDAUtils_h
17 
19 #include <cuda.h>
20 #include <cstdio>
21 
22 namespace niftk
23 {
24 
33 static void HandleCUDAError( cudaError_t err,
34  const char *file,
35  int line ) {
36  if (err != cudaSuccess) {
37  printf( "HandleCUDAError: Error=%i, message=%s in %s at line %d\n", err, cudaGetErrorString( err ), file, line );
38  exit( EXIT_FAILURE );
39  }
40 }
41 
45 #define niftkCUDACall( err ) ( HandleCUDAError( err, __FILE__, __LINE__ ))
46 
47 } // end namespace
48 
49 #endif
static void HandleCUDAError(cudaError_t err, const char *file, int line)
Static method (only available to same T.U.) to print error.
Definition: niftkCUDAUtils.h:33
Definition: niftkExceptionObject.h:21