Debian Codegraph @

test cases/cuda/4 shared/shared/kernels.h

raw
1 /* Include Guard */
2 #ifndef SHARED_KERNELS_H
3 #define SHARED_KERNELS_H
4
5 /**
6 * Includes
7 */
8
9 #include <cuda_runtime.h>
10
11
12 /**
13 * Defines
14 */
15
16 /**
17 * When building a library, it is a good idea to expose as few as possible
18 * internal symbols (functions, objects, data structures). Not only does it
19 * prevent users from relying on private portions of the library that are
20 * subject to change without any notice, but it can have performance
21 * advantages:
22 *
23 * - It can make shared libraries link faster at dynamic-load time.
24 * - It can make internal function calls faster by bypassing the PLT.
25 *
26 * Thus, the compilation should by default hide all symbols, while the API
27 * headers will explicitly mark public the few symbols the users are permitted
28 * to use with a PUBLIC tag. We also define a HIDDEN tag, since it may be
29 * required to explicitly tag certain C++ types as visible in order for
30 * exceptions to function correctly.
31 *
32 * Additional complexity comes from non-POSIX-compliant systems, which
33 * artificially impose a requirement on knowing whether we are building or
34 * using a DLL.
35 *
36 * The above commentary and below code is inspired from
37 * 'https://gcc.gnu.org/wiki/Visibility'
38 */
39
40 #if defined(_WIN32) || defined(__CYGWIN__)
41 # define TAG_ATTRIBUTE_EXPORT __declspec(dllexport)
42 # define TAG_ATTRIBUTE_IMPORT __declspec(dllimport)
43 # define TAG_ATTRIBUTE_HIDDEN
44 #elif __GNUC__ >= 4
45 # define TAG_ATTRIBUTE_EXPORT __attribute__((visibility("default")))
46 # define TAG_ATTRIBUTE_IMPORT __attribute__((visibility("default")))
47 # define TAG_ATTRIBUTE_HIDDEN __attribute__((visibility("hidden")))
48 #else
49 # define TAG_ATTRIBUTE_EXPORT
50 # define TAG_ATTRIBUTE_IMPORT
51 # define TAG_ATTRIBUTE_HIDDEN
52 #endif
53
54 #if TAG_IS_SHARED
55 # if TAG_IS_BUILDING
56 # define TAG_PUBLIC TAG_ATTRIBUTE_EXPORT
57 # else
58 # define TAG_PUBLIC TAG_ATTRIBUTE_IMPORT
59 # endif
60 # define TAG_HIDDEN TAG_ATTRIBUTE_HIDDEN
61 #else
62 # define TAG_PUBLIC
63 # define TAG_HIDDEN
64 #endif
65 #define TAG_STATIC static
66
67
68
69
70 /* Extern "C" Guard */
71 #ifdef __cplusplus
72 extern "C" {
73 #endif
74
75
76
77 /* Function Prototypes */
78 TAG_PUBLIC int run_tests(void);
79
80
81
82 /* End Extern "C" and Include Guard */
83 #ifdef __cplusplus
84 }
85 #endif
86 #endif