Skip to content

Commit 9ba6224

Browse files
added the code Fernando Amat generated, can be compiled using nsight (shared library)
0 parents  commit 9ba6224

File tree

3 files changed

+682
-0
lines changed

3 files changed

+682
-0
lines changed

src/book.h

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 1993-2010 NVIDIA Corporation. All rights reserved.
3+
*
4+
* NVIDIA Corporation and its licensors retain all intellectual property and
5+
* proprietary rights in and to this software and related documentation.
6+
* Any use, reproduction, disclosure, or distribution of this software
7+
* and related documentation without an express license agreement from
8+
* NVIDIA Corporation is strictly prohibited.
9+
*
10+
* Please refer to the applicable NVIDIA end user license agreement (EULA)
11+
* associated with this source code for terms and conditions that govern
12+
* your use of this NVIDIA software.
13+
*
14+
*/
15+
16+
17+
#ifndef __BOOK_H__
18+
#define __BOOK_H__
19+
#include <stdio.h>
20+
21+
static void HandleError( cudaError_t err,
22+
const char *file,
23+
int line ) {
24+
if (err != cudaSuccess) {
25+
printf( "%s in %s at line %d\n", cudaGetErrorString( err ),
26+
file, line );
27+
exit( EXIT_FAILURE );
28+
}
29+
}
30+
31+
#define HANDLE_ERROR_KERNEL HandleError(cudaPeekAtLastError(),__FILE__, __LINE__ )
32+
33+
#define HANDLE_ERROR( err ) (HandleError( err, __FILE__, __LINE__ ))
34+
35+
#define HANDLE_NULL( a ) {if (a == NULL) { \
36+
printf( "Host memory failed in %s at line %d\n", \
37+
__FILE__, __LINE__ ); \
38+
exit( EXIT_FAILURE );}}
39+
40+
41+
#endif // __BOOK_H__

0 commit comments

Comments
 (0)