/*======================================================================================

	Program:		Range Imaging Toolkit (RITK)
	Module:			ritkCudaMacros.h
	Version:		$Revision: 883 $
	Date:			$Date: 2011-04-28 11:38:06 +0200 (Do, 28 Apr 2011) $

	Copyright (c) 2010-2011
	Pattern Recognition Lab, 
    University Erlangen-Nuremberg, Germany
    All rights reserved.

	This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
	See RITKCopyright.txt for more information.

	http://www5.informatik.uni-erlangen.de/research/software/ritk

========================================================================================*/

#ifndef CUDAMACROS_H__
#define CUDAMACROS_H__

#include <stdio.h>


#define ritkritkCudaSafeCall()																			\
{																										\
	cudaError_t err = cudaGetLastError();																\
	if ( cudaSuccess != err )																			\
	{																									\
		fprintf(stderr, "%s %i: CUDA error: %s.\n",  __FILE__, __LINE__, cudaGetErrorString( err) );	\
		exit(EXIT_FAILURE);																				\
	}																									\
}

 
#define ritkCudaSafeCall(err)																			\
{																										\
	if ( err != 0 )																						\
	{																									\
		fprintf(stderr, "%s %i: CUDA error: %s.\n",  __FILE__, __LINE__, cudaGetErrorString( err) );	\
	}																									\
}


#endif // CUDAMACROS_H__
