Device-side launch of thrust::lower_bound is creating wrong results
Open
thrust
- Dominant language
- C++
- Stars
- 2.5k
- Forks
- 486
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 295
Description
```C++
#include
#include
#include
__global__ void lowerbound(float inp_val) {
constexpr int size = 6;
float a[size] = {0.1, 0.2, 0.4, 0.6, 0.8, 1.};
auto result = thrust::lower_bound(
thrust::device, a, a + size, inp_val);
printf("%ld\n", result - a);
}
int main() {
lowerbound<<<1,1>>>(0.0);
lowerbound<<<1,1>>>(0.1);
lowerbound<<<1,1>>>(0.2);
lowerbound<<<1,1>>>(0.3);
lowerbound<<<1,1>>>(0.4);
lowerbound<<<1,1>>>(0.5);
cudaDeviceSynchronize();
}
```
I get
```
0
0
0
0
0
0
```
on CUDA 11.7 with the latest thrust
Contributor guide
Assessment
This issue has not been assessed yet.