Cuda = 推力:变换减少( 推力::计数迭代器(0) ,推力::计数迭代器(objectCount) ,AFunctor(),0,推力::加号(); #恩迪夫

Cuda = 推力:变换减少( 推力::计数迭代器(0) ,推力::计数迭代器(objectCount) ,AFunctor(),0,推力::加号(); #恩迪夫,cuda,gpgpu,nvidia,thrust,Cuda,Gpgpu,Nvidia,Thrust,@另请参见“我不明白我要使用哪些后端”是什么意思?@Alex:您的查找代码有一些问题,这些问题与原始问题无关。我会发布一个新的。另外,“我不明白我想使用哪些后端”是什么意思?@Alex:你的查找代码有一些问题,这些问题与原来的问题无关。我会发布一个新的。谢谢!对于推力::减少()这很好,但是对于推力::查找()我得到一个错误-我把它添加到我的问题中。谢谢!对于推力::减少()这很好,但是对于推力::查找()我得到一个错误-我把它添加到我的问题中。谢谢!对于asch::reduce()这很好,但是

@另请参见

“我不明白我要使用哪些后端”是什么意思?@Alex:您的
查找
代码有一些问题,这些问题与原始问题无关。我会发布一个新的。另外,“我不明白我想使用哪些后端”是什么意思?@Alex:你的
查找
代码有一些问题,这些问题与原来的问题无关。我会发布一个新的。谢谢!对于
推力::减少()
这很好,但是对于
推力::查找()
我得到一个错误-我把它添加到我的问题中。谢谢!对于
推力::减少()
这很好,但是对于
推力::查找()
我得到一个错误-我把它添加到我的问题中。谢谢!对于
asch::reduce()
这很好,但是对于
asch::find()
我得到一个错误-与我在问题中添加的错误相同。谢谢!对于
asch::reduce()
这很有效,但是对于
asch::find()
我得到了一个错误,与我在问题中添加的错误相同。
thrust::counting_iterator<uint64_t> first(i);
thrust::counting_iterator<uint64_t> last = first + step_size;

auto iter = thrust::find( 
            thrust::make_transform_iterator(first, functor),
            thrust::make_transform_iterator(last, functor),
            true);
#include <iostream>
#include <thrust/iterator/counting_iterator.h>
#include <thrust/iterator/transform_iterator.h>
#include <thrust/find.h>
#include <thrust/functional.h>

#include <thrust/execution_policy.h>

struct is_odd : public thrust::unary_function<uint64_t, bool> {
  __host__ __device__ bool operator()(uint64_t const& x) {
    return x & 1;
  }
};

int main() {
    thrust::counting_iterator<uint64_t> first(0);
    thrust::counting_iterator<uint64_t> last = first + 100;

    auto iter = thrust::find(thrust::device,
                thrust::make_transform_iterator(first, is_odd()),
                thrust::make_transform_iterator(last, is_odd()),
                true);

    int bbb; std::cin >> bbb;
    return 0;
}
 typedef thrust::device_system_tag  System;
 thrust::counting_iterator<uint64_t,System> first(i)
#include <thrust/execution_policy.h>
...
thrust::counting_iterator<uint64_t> first(i);
thrust::counting_iterator<uint64_t> last = first + step_size;

auto iter = thrust::find(thrust::device,
                         thrust::make_transform_iterator(first, functor),
                         thrust::make_transform_iterator(last, functor),
                         true);
#include <thrust/version.h>

#if THRUST_MINOR_VERSION > 6
    #include <thrust/execution_policy.h>
#elif THRUST_MINOR_VERSION == 6
    #include <thrust/iterator/retag.h>
#else
#endif

...

#if THRUST_MINOR_VERSION > 6
  total = 
    thrust::transform_reduce(
      thrust::host
      , thrust::counting_iterator<unsigned int>(0)
      , thrust::counting_iterator<unsigned int>(N)
      , AFunctor(), 0, thrust::plus<unsigned int>());
#elif THRUST_MINOR_VERSION == 6
  total = 
    thrust::transform_reduce(
      thrust::retag<thrust::host_system_tag>(thrust::counting_iterator<unsigned int>(0)) 
      , thrust::retag<thrust::host_system_tag>(thrust::counting_iterator<unsigned int>(N))
      , AFunctor(), 0, thrust::plus<unsigned int>());
#else
  total = 
    thrust::transform_reduce(
      thrust::counting_iterator<unsigned int, thrust::host_space_tag>(0)
      , thrust::counting_iterator<unsigned int, thrust::host_space_tag>(objectCount)
      , AFunctor(), 0, thrust::plus<unsigned int>());
#endif