Commit f4fefe4 1 parent 43ed450 commit f4fefe4 Copy full SHA for f4fefe4
File tree 2 files changed +5
-42
lines changed
2 files changed +5
-42
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,11 @@ add_library(context ${context_srcs})
92
92
target_compile_definitions (context PUBLIC K2_TORCH_VERSION_MAJOR=${K2_TORCH_VERSION_MAJOR} )
93
93
target_compile_definitions (context PUBLIC K2_TORCH_VERSION_MINOR=${K2_TORCH_VERSION_MINOR} )
94
94
95
+ # see https://github.com/NVIDIA/thrust/issues/1401
96
+ # and https://github.com/k2-fsa/k2/pull/917
97
+ target_compile_definitions (context PUBLIC CUB_WRAPPED_NAMESPACE=k2)
98
+ target_compile_definitions (context PUBLIC THRUST_NS_QUALIFIER=thrust)
99
+
95
100
set_target_properties (context PROPERTIES CUDA_SEPARABLE_COMPILATION ON )
96
101
set_target_properties (context PROPERTIES OUTPUT_NAME "k2context" )
97
102
Original file line number Diff line number Diff line change 20
20
#ifndef K2_CSRC_CUB_H_
21
21
#define K2_CSRC_CUB_H_
22
22
23
- // See
24
- // https://github.com/k2-fsa/k2/issues/698
25
- // and
26
- // https://github.com/pytorch/pytorch/issues/54245#issuecomment-805707551
27
- // for why we need the following two macros
28
- //
29
- // NOTE: We define the following two macros so
30
- // that k2 and PyTorch use a different copy
31
- // of CUB.
32
-
33
- #ifdef CUB_NS_PREFIX
34
- #undef CUB_NS_PREFIX
35
- #endif
36
-
37
- #ifdef CUB_NS_POSTFIX
38
- #undef CUB_NS_POSTFIX
39
- #endif
40
-
41
- #ifdef CUB_NS_QUALIFIER
42
- #undef CUB_NS_QUALIFIER
43
- #endif
44
-
45
- // see
46
- // https://github.com/NVIDIA/cub/commit/6631c72630f10e370d93814a59146b12f7620d85
47
- // The above commit replaced "thrust" with "THRUST_NS_QUALIFIER"
48
- #ifndef THRUST_NS_QUALIFIER
49
- #define THRUST_NS_QUALIFIER thrust
50
- #endif
51
-
52
- #define CUB_NS_PREFIX namespace k2 {
53
- #define CUB_NS_POSTFIX }
54
-
55
- // See
56
- // https://github.com/NVIDIA/cub/commit/6631c72630f10e370d93814a59146b12f7620d85
57
- // and
58
- // https://github.com/NVIDIA/cub/pull/350
59
- #define CUB_NS_QUALIFIER ::k2::cub
60
-
61
23
#ifdef K2_WITH_CUDA
62
24
#include "cub/cub.cuh" // NOLINT
63
25
#endif
64
26
65
- #undef CUB_NS_PREFIX
66
- #undef CUB_NS_POSTFIX
67
- #undef CUB_NS_QUALIFIER
68
-
69
27
#endif // K2_CSRC_CUB_H_
You can’t perform that action at this time.
0 commit comments