`cub::DeviceRunLengthEncode::Encode` does not accept `thrust::discard_iterator` for unique output
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 487
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 296
Description
One can use a discard iterator for runlength encoding when only the lengths of runs are required. The following code does accept `cub::DiscardOutputIterator` but not `thrust::discard_iterator` .
```
#include
#include
int main(){
std::size_t tempbytes = 0;
#if 0
cub::DeviceRunLengthEncode::Encode(
nullptr,
tempbytes,
(int*)nullptr, //data
cub::DiscardOutputIterator<>{}, //unique data
(int*)nullptr, // run lengths
(int*)nullptr, //num runs
0 //num data
);
#else
cub::DeviceRunLengthEncode::Encode(
nullptr,
tempbytes,
(int*)nullptr, //data
thrust::make_discard_iterator(), //unique data
(int*)nullptr, // run lengths
(int*)nullptr, //num runs
0 //num data
);
#endif
}
```
https://cuda.godbolt.org/z/cvasqxrbo
```
/opt/compiler-explorer/libs/thrustcub/trunk/cub/block/specializations/../../block/../thread/../thread/thread_operators.cuh(64): error: no operator "==" matches these operands
operand types are: const thrust::detail::any_assign == const thrust::detail::any_assign
detected during:
instantiation of "__nv_bool cub::Equality::operator()(const T &, const T &) const [with T=thrust::detail::any_assign]"
```
Contributor guide
Assessment
This issue has not been assessed yet.