从CUDA 4.0升级到8.0的推力错误

时间:2016-12-20 14:46:03

标签: cuda thrust

我正在尝试升级此项目(https://github.com/ashwin/gStar4D),该项目是用CUDA 4.0编写的8.0。但是我在Thrust上得到了大量的编译错误:

    thrust::sort_by_key(    orderVec.begin(), orderVec.end(),
                            thrust::make_zip_iterator( make_tuple( _pointVec->begin(), _scaledVec->begin() ) ) );

错误通常是'错误:类“推力:: tuple_size<>”没有成员“value”','错误:不允许不完整的类型'或'错误:名称后跟“::”必须是类或命名空间名称'

1>E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/tuple.h(90): error : name followed by "::" must be a class or namespace name
1>                   detected during:
1>                     instantiation of class "thrust::tuple_size<T> [with T=<error-type>]"
1>         (90): here
1>                     instantiation of class "thrust::tuple_size<T> [with T=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/tuple_meta_transform.h(29): here
1>                     processing of template argument list for "thrust::detail::tuple_meta_transform" based on template arguments <std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>, thrust::iterator_reference>
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/detail/zip_iterator_base.h(329): here
1>                     instantiation of class "thrust::detail::zip_iterator_base_ns::tuple_of_iterator_references<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/detail/zip_iterator_base.h(365): here
1>                     instantiation of class "thrust::detail::zip_iterator_base<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/zip_iterator.h(141): here
1>                     instantiation of class "thrust::zip_iterator<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:/testcode/gStar4D-master/GDelaunay/GDelaunay/GDelData.cu(119): here
1>
1>     1>
1>E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/tuple.h(90): error : class "thrust::tuple_size<<error-type>>" has no member "value"
1>                   detected during:
1>                     instantiation of class "thrust::tuple_size<T> [with T=<error-type>]"
1>         (90): here
1>                     instantiation of class "thrust::tuple_size<T> [with T=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/detail/tuple_meta_transform.h(29): here
1>                     processing of template argument list for "thrust::detail::tuple_meta_transform" based on template arguments <std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>, thrust::iterator_reference>
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/detail/zip_iterator_base.h(329): here
1>                     instantiation of class "thrust::detail::zip_iterator_base_ns::tuple_of_iterator_references<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/detail/zip_iterator_base.h(365): here
1>                     instantiation of class "thrust::detail::zip_iterator_base<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/zip_iterator.h(141): here
1>                     instantiation of class "thrust::zip_iterator<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:/testcode/gStar4D-master/GDelaunay/GDelaunay/GDelData.cu(119): here
1>
1>     1>
1>E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/detail/zip_iterator_base.h(326): error : incomplete type is not allowed
1>                   detected during:
1>                     instantiation of class "thrust::detail::zip_iterator_base_ns::tuple_of_iterator_references<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         (365): here
1>                     instantiation of class "thrust::detail::zip_iterator_base<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:\programs\Nvidia GPU Computing Toolkit\CUDA\v8.0\include\thrust/iterator/zip_iterator.h(141): here
1>                     instantiation of class "thrust::zip_iterator<IteratorTuple> [with IteratorTuple=std::tuple<thrust::detail::normal_iterator<thrust::device_ptr<Point3>>, thrust::detail::normal_iterator<thrust::device_ptr<Point3>>>]"
1>         E:/testcode/gStar4D-master/GDelaunay/GDelaunay/GDelData.cu(119): here
1>

关于问题可能是什么想法?

1 个答案:

答案 0 :(得分:2)

如上所述,只需要将push ::添加到make_tuple:

{{1}}

刚刚提交了一份PR,其中包含在Cuda 8.0上运行所需的所有更改: Robert