You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ nvc++ -stdpar=multicore --c++20 -c thrust-ranges.cc
"thrust-ranges.cc", line 15: error: no instance of functiontemplate"thrust::distance" matches the argument list
argument types are: (std::ranges::iota_view<Index_type, Index_type>::_Iterator, std::ranges::iota_view<Index_type, Index_type>::_Iterator)
auto d = thrust::distance(begin,end);
^
1 error detected in the compilation of "thrust-ranges.cc".
thrust-ranges.cc
#include<ranges>
#include<thrust/distance.h>typedef std::ptrdiff_t Index_type;
voidfoo(void)
{
const Index_type ibegin = 0;
const Index_type iend = 100;
auto range = std::views::iota(ibegin, iend);
auto begin = std::begin(range);
auto end = std::end(range);
auto d = thrust::distance(begin,end);
}
Note that the type of Index_type doesn't matter. The same error occurs if I #define it to int.
The text was updated successfully, but these errors were encountered:
NVIDIA/thrust#1491 updated thrust::iterator_traits to support more types, this may address the issue since thrust::distance requires a valid specialization of those traits.
However, from your slack message, this also fails with std::distance so there may be more at play.
I believe this is a bug in totally fine by libstdc++
They are differentiating their implementation based on iterator_category which does not make sense for iota_view with ptrdiff_t as input type (This is because we need __int128 as a difference type there and that breaks some of the usual machinery)
Long story short. Both thrust and libstc++ are perfectly conforming in their implementation. It is just a bad user experience that old machinery does not support new iterator types.
Is it unreasonable for me to expect this to work?
error
thrust-ranges.cc
Note that the type of
Index_type
doesn't matter. The same error occurs if I#define
it toint
.The text was updated successfully, but these errors were encountered: