|
Sierra Toolkit
Version of the Day
|
00001 /*------------------------------------------------------------------------*/ 00002 /* Copyright 2010 Sandia Corporation. */ 00003 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */ 00004 /* license for use of this work by or on behalf of the U.S. Government. */ 00005 /* Export of this program may require a license from the */ 00006 /* United States Government. */ 00007 /*------------------------------------------------------------------------*/ 00008 00009 #ifndef stk_algsup_CudaCall_hpp 00010 #define stk_algsup_CudaCall_hpp 00011 00012 #ifdef STK_HAVE_CUDA 00013 00014 #include <cuda.h> 00015 #include <cuda_runtime.h> 00016 00017 //---------------------------------------------------------------- 00018 inline 00019 void stk_cuda_call(cudaError err , const char* name ) 00020 { 00021 if ( err != cudaSuccess ) { 00022 fprintf(stderr, "%s error: %s\n",name, cudaGetErrorString(err) ); 00023 exit(-1); 00024 } 00025 } 00026 00027 #define CUDA_CALL( cuda_fn ) stk_cuda_call( cuda_fn , #cuda_fn ) 00028 00029 #endif 00030 00031 #endif 00032