|
9 | 9 |
|
10 | 10 | #include <thrust/copy.h> |
11 | 11 | #include <thrust/device_ptr.h> |
| 12 | +#ifdef CCTAG_NO_THRUST_COPY_IF |
| 13 | +#include <thrust/host_vector.h> |
| 14 | +#endif |
12 | 15 |
|
13 | 16 | #include <iostream> |
14 | 17 | #include <algorithm> |
@@ -60,21 +63,21 @@ bool Frame::applyVoteIf( ) |
60 | 63 | NumVotersIsGreaterEqual select_op( _voters.dev ); |
61 | 64 |
|
62 | 65 | #ifdef CCTAG_NO_THRUST_COPY_IF |
63 | | - # |
64 | | - # There are reports that the Thrust::copy_if fails when you generated code with CUDA 7.0 and run it only |
65 | | - # a 2nd gen Maxwell card (e.g. GTX 980 and GTX 980 Ti). Also, the GTX 1080 seems to be quite similar to |
66 | | - # the GTX 980 and may be affected as well. |
67 | | - # The following code moves everything to host before copy_if, which circumvents the problem but is much |
68 | | - # slower. Make sure that the condition for activating it is very strict. |
69 | | - # |
| 66 | + // |
| 67 | + // There are reports that the Thrust::copy_if fails when you generated code with CUDA 7.0 and run it only |
| 68 | + // a 2nd gen Maxwell card (e.g. GTX 980 and GTX 980 Ti). Also, the GTX 1080 seems to be quite similar to |
| 69 | + // the GTX 980 and may be affected as well. |
| 70 | + // The following code moves everything to host before copy_if, which circumvents the problem but is much |
| 71 | + // slower. Make sure that the condition for activating it is very strict. |
| 72 | + // |
70 | 73 | thrust::host_vector<int> input_host(sz); |
71 | 74 | thrust::host_vector<int> output_host(sz); |
72 | 75 | thrust::host_vector<int>::iterator output_host_end; |
73 | 76 |
|
74 | 77 | thrust::copy( input_begin, input_end, input_host.begin() ); |
75 | 78 | output_host_end = thrust::copy_if( input_host.begin(), input_host.end(), output_host.begin(), select_op ); |
76 | 79 | thrust::copy( output_host.begin(), output_host_end, output_begin ); |
77 | | - sz = output_host_end = output_host.begin(); |
| 80 | + sz = output_host_end - output_host.begin(); |
78 | 81 | output_end = output_begin + sz; |
79 | 82 | #else |
80 | 83 | output_end = thrust::copy_if( input_begin, input_end, output_begin, select_op ); |
|
0 commit comments