Compiler errors 如何修改zip迭代器的内容
我有1000个点的XYZ位置。我需要用矩阵变换它们。从一个简单的问题开始,我试着用一个常数乘以每个点。此外,我只举三点为例。我使用推力::zip_迭代器打包XYZ,并使用函子和变换操作修改XYZ 我的代码如下,但它给出了编译错误。函子modify_元组编译得很好。但是当它被用于转换操作时,我得到了很多错误我的问题是如何修改zip迭代器的内容?或者如何使用推力将函子应用于所有点的XYZ类型元组。我还可以使用其他推力算法吗?Compiler errors 如何修改zip迭代器的内容,compiler-errors,iterator,zip,thrust,Compiler Errors,Iterator,Zip,Thrust,我有1000个点的XYZ位置。我需要用矩阵变换它们。从一个简单的问题开始,我试着用一个常数乘以每个点。此外,我只举三点为例。我使用推力::zip_迭代器打包XYZ,并使用函子和变换操作修改XYZ 我的代码如下,但它给出了编译错误。函子modify_元组编译得很好。但是当它被用于转换操作时,我得到了很多错误我的问题是如何修改zip迭代器的内容?或者如何使用推力将函子应用于所有点的XYZ类型元组。我还可以使用其他推力算法吗? #include <thrust/transform.h> #
#include <thrust/transform.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/execution_policy.h>
typedef thrust::tuple<float,float,float> Float3;
struct modify_tuple
{
int _factor;
modify_tuple(int factor) : _factor(factor) { }
__host__ __device__ Float3 operator()(Float3&a) const
{
Float3 b=thrust::make_tuple(_factor*thrust::get<0>(a), _factor*thrust::get<1>(a), _factor*thrust::get<2>(a));
return b;
}
};
int main(void)
{
thrust::device_vector<float> X(3);
thrust::device_vector<float> Y(3);
thrust::device_vector<float> Z(3);
X[0]=0, X[0]=1, X[0]=2;
Y[0]=4, Y[0]=5, Y[0]=6;
Z[0]=7, Z[0]=8, Z[0]=9;
typedef thrust::device_vector<float>::iterator FloatIterator;
typedef thrust::tuple<FloatIterator, FloatIterator, FloatIterator> FloatIteratorTuple;
typedef thrust::zip_iterator<FloatIteratorTuple> Float3Iterator;
Float3Iterator P_first = thrust::make_zip_iterator(make_tuple(X.begin(), Y.begin(), Z.begin()));
Float3Iterator P_last = thrust::make_zip_iterator(make_tuple(X.end(), Y.end(), Z.end()));
// This line gives errors
thrust::transform(thrust::device, P_first, P_last, P_first, modify_tuple(2));
return 0;
}
#包括
#包括
#包括
typedef推力::元组Float3;
结构修改元组
{
整数因子;
修改元组(int-factor):\u-factor(factor){}
__主机\uuuuuuuuuu设备\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
{
float3B=推力::生成元组(_因子*推力::get(a),_因子*推力::get(a),_因子*推力::get(a));
返回b;
}
};
内部主(空)
{
推力:装置_矢量X(3);
推力:装置_矢量Y(3);
推力:装置_矢量Z(3);
X[0]=0,X[0]=1,X[0]=2;
Y[0]=4,Y[0]=5,Y[0]=6;
Z[0]=7,Z[0]=8,Z[0]=9;
typedef推力::设备向量::迭代器浮点迭代器;
typedef推力::元组floatIterator元组;
typedef推力::zip_迭代器Float3Iterator;
Float3Iterator P_first=推力::make_zip_迭代器(make_元组(X.begin(),Y.begin(),Z.begin());
Float3Iterator P_last=推力::make_zip_迭代器(make_tuple(X.end(),Y.end(),Z.end());
//这一行给出了错误
推力::变换(推力::设备,P_优先,P_最后,P_优先,修改_元组(2));
返回0;
}
编译期间发现的错误:
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/detail/internal_functional.h(322): error: function "modify_tuple::operator()" cannot be called with the given argument list
argument types are: (thrust::detail::tuple_of_iterator_references<float &, float &, float &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>)
object type is: modify_tuple
detected during:
instantiation of "thrust::detail::enable_if_non_const_reference_or_tuple_of_iterator_references<thrust::tuple_element<1, Tuple>::type>::type thrust::detail::unary_transform_functor<UnaryFunction>::operator()(Tuple) [with UnaryFunction=modify_tuple, Tuple=thrust::detail::tuple_of_iterator_references<thrust::detail::tuple_of_iterator_references<float &, float &, float &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, thrust::detail::tuple_of_iterator_references<float &, float &, float &, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/detail/function.h(60): here
instantiation of "Result thrust::detail::wrapped_function<Function, Result>::operator()(const Argument &) const [with Function=thrust::detail::unary_transform_functor<modify_tuple>, Result=void, Argument=thrust::detail::tuple_of_iterator_references<thrust::detail::tuple_of_iterator_references<thrust::device_reference<float>, thrust::device_reference<float>, thrust::device_reference<float>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, thrust::detail::tuple_of_iterator_references<thrust::device_reference<float>, thrust::device_reference<float>, thrust::device_reference<float>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/for_each.inl(57): here
instantiation of "void thrust::system::cuda::detail::for_each_n_detail::for_each_kernel::operator()(thrust::system::cuda::detail::bulk_::parallel_group<thrust::system::cuda::detail::bulk_::concurrent_group<thrust::system::cuda::detail::bulk_::agent<1UL>, 0UL>, 0UL> &, Iterator, Function, Size) [with Iterator=thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, Function=thrust::detail::wrapped_function<thrust::detail::unary_transform_functor<modify_tuple>, void>, Size=unsigned int]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/bulk/detail/apply_from_tuple.hpp(71): here
instantiation of "void thrust::system::cuda::detail::bulk_::detail::apply_from_tuple(Function, const thrust::tuple<Arg1, Arg2, Arg3, Arg4, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type> &) [with Function=thrust::system::cuda::detail::for_each_n_detail::for_each_kernel, Arg1=thrust::system::cuda::detail::bulk_::parallel_group<thrust::system::cuda::detail::bulk_::concurrent_group<thrust::system::cuda::detail::bulk_::agent<1UL>, 0UL>, 0UL> &, Arg2=thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, Arg3=thrust::detail::wrapped_function<thrust::detail::unary_transform_functor<modify_tuple>, void>, Arg4=unsigned int]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/bulk/detail/closure.hpp(50): here
instantiation of "void thrust::system::cuda::detail::bulk_::detail::closure<Function, Tuple>::operator()() [with Function=thrust::system::cuda::detail::for_each_n_detail::for_each_kernel, Tuple=thrust::tuple<thrust::system::cuda::detail::bulk_::parallel_group<thrust::system::cuda::detail::bulk_::concurrent_group<thrust::system::cuda::detail::bulk_::agent<1UL>, 0UL>, 0UL> &, thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::detail::wrapped_function<thrust::detail::unary_transform_functor<modify_tuple>, void>, unsigned int, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/bulk/detail/cuda_task.hpp(58): here
[ 8 instantiation contexts not shown ]
instantiation of "RandomAccessIterator thrust::system::cuda::detail::for_each_n(thrust::system::cuda::detail::execution_policy<DerivedPolicy> &, RandomAccessIterator, Size, UnaryFunction) [with DerivedPolicy=thrust::system::cuda::detail::par_t, RandomAccessIterator=thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, Size=signed long, UnaryFunction=thrust::detail::unary_transform_functor<modify_tuple>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/cuda/detail/for_each.inl(173): here
instantiation of "RandomAccessIterator thrust::system::cuda::detail::for_each(thrust::system::cuda::detail::execution_policy<DerivedPolicy> &, RandomAccessIterator, RandomAccessIterator, UnaryFunction) [with DerivedPolicy=thrust::system::cuda::detail::par_t, RandomAccessIterator=thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, UnaryFunction=thrust::detail::unary_transform_functor<modify_tuple>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/detail/for_each.inl(44): here
instantiation of "InputIterator thrust::for_each(const thrust::detail::execution_policy_base<DerivedPolicy> &, InputIterator, InputIterator, UnaryFunction) [with DerivedPolicy=thrust::system::cuda::detail::par_t, InputIterator=thrust::zip_iterator<thrust::tuple<thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, UnaryFunction=thrust::detail::unary_transform_functor<modify_tuple>]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/system/detail/generic/transform.inl(57): here
instantiation of "OutputIterator thrust::system::detail::generic::transform(thrust::execution_policy<DerivedPolicy> &, InputIterator, InputIterator, OutputIterator, UnaryFunction) [with DerivedPolicy=thrust::system::cuda::detail::par_t, InputIterator=thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, OutputIterator=thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, UnaryFunction=modify_tuple]"
/usr/local/cuda/bin/../targets/x86_64-linux/include/thrust/detail/transform.inl(44): here
instantiation of "OutputIterator thrust::transform(const thrust::detail::execution_policy_base<DerivedPolicy> &, InputIterator, InputIterator, OutputIterator, UnaryFunction) [with DerivedPolicy=thrust::system::cuda::detail::par_t, InputIterator=thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, OutputIterator=thrust::zip_iterator<thrust::tuple<thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::detail::normal_iterator<thrust::device_ptr<float>>, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type, thrust::null_type>>, UnaryFunction=modify_tuple]"
modify_zip_iterator.cu(38): here
/usr/local/cuda/bin/./targets/x86_64-linux/include/推力/detail/internal_functional.h(322):错误:无法使用给定的参数列表调用函数“modify_tuple::operator()
参数类型有:(推力::细节::元组_迭代器_引用)
对象类型为:modify_tuple
在以下期间检测到:
实例化“如果迭代器的非常量引用或元组引用::类型推力::细节::一元变换函子::运算符()(元组)[使用一元函数=修改元组,元组=迭代器的推力::细节::元组引用]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/detail/function.h(60):这里
实例化“结果推力::细节::包装的_函数::运算符()(常量参数&)常量[with function=推力::细节::一元_transform_functor,Result=void,Argument=推力::细节::tuple_of_iterator_references]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/cuda/detail/for_each.inl(57):这里
实例化“void-推力::系统::cuda::细节::for_each_n_detail::for_each_kernel::operator()(推力::系统::cuda::细节::bulk::并行组&,迭代器,函数,大小)[带迭代器=推力::zip_迭代器,函数=推力::细节::wrapped_函数,大小=无符号整数]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/cuda/detail/bulk/detail/apply_from_tuple.hpp(71):这里
“无效推力::系统::cuda::细节::批量推力::细节::应用\u从\u元组(函数,常量推力::元组&)[使用函数=推力::系统::cuda::细节::对于每个\u n\u细节::对于每个\u内核,Arg1=推力::系统::cuda::细节::批量推力::并行\u组&,Arg2=推力::zip\u迭代器,Arg3=推力::细节::包装的\u函数,Arg4=无符号整数]”的实例化
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/cuda/detail/bulk/detail/closure.hpp(50):这里
实例化“void-推力::系统::cuda::细节::批量\细节::闭包::运算符()[with-Function=推力::系统::cuda::细节::for\ u each\ n \ u细节::for\ u each\内核,Tuple=推力::Tuple]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/cuda/detail/bulk/detail/cuda_task.hpp(58):这里
[8未显示实例化上下文]
实例化“RandomAccess迭代器推力::系统::cuda::细节::for_each_n(推力::系统::cuda::细节::执行策略&,RandomAccess迭代器,大小,UnaryFunction)[使用DerivedPolicy=推力::系统::cuda::细节::par_t,RandomAccess迭代器=推力::zip_迭代器,大小=有符号长,UnaryFunction=推力::细节::一元变换\u函子]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/cuda/detail/for_each.inl(173):这里
实例化“RandomAccess迭代器推力::系统::cuda::细节::for_each(推力::系统::cuda::细节::执行策略&,RandomAccess迭代器,RandomAccess迭代器,UnaryFunction)[使用DerivedPolicy=推力::系统::cuda::细节::par_t,RandomAccess迭代器=推力::zip_迭代器,UnaryFunction=推力::细节::一元变换_函子]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/detail/for_each.inl(44):这里
实例化“inputierator-thrust::for_each(const-thrust::detail::execution\u-policy\u-base&,inputierator,inputierator,UnaryFunction)[with-DerivedPolicy=thrust::system::cuda::detail::par\u t,inputierator=thrust::zip\u迭代器,UnaryFunction=thrust::detail::unary\u-transform\u-functor]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/system/detail/generic/transform.inl(57):这里
实例化“输出迭代器推力::系统::细节::通用::转换(推力::执行\策略&,输入迭代器,输入迭代器,输出迭代器,UnaryFunction)[使用DerivedPolicy=推力::系统::cuda::细节::par\U t,输入迭代器=推力::zip\迭代器,输出迭代器=推力::zip\迭代器,UnaryFunction=modify\元组]”
/usr/local/cuda/bin/。/targets/x86_64-linux/include/推力/detail/transform.inl(44):这里
实例化“输出迭代器推力::转换(常量推力::细节::执行
$ cat t334.cu
#include <thrust/transform.h>
#include <thrust/iterator/zip_iterator.h>
#include <thrust/execution_policy.h>
#include <iostream>
#include <thrust/copy.h>
struct modify_tuple
{
int _factor;
modify_tuple(int factor) : _factor(factor) { }
template <typename T>
__host__ __device__ thrust::tuple<float,float,float> operator()(const T a) const
{
thrust::tuple<float,float,float> res = a;
thrust::get<0>(res) *= _factor;
thrust::get<1>(res) *= _factor;
thrust::get<2>(res) *= _factor;
return res;
}
};
int main(void)
{
thrust::device_vector<float> X(3);
thrust::device_vector<float> Y(3);
thrust::device_vector<float> Z(3);
thrust::device_vector<float> RX(3);
thrust::device_vector<float> RY(3);
thrust::device_vector<float> RZ(3);
X[0]=0, X[1]=1, X[2]=2;
Y[0]=4, Y[1]=5, Y[2]=6;
Z[0]=7, Z[1]=8, Z[2]=9;
thrust::copy_n(X.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(Y.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(Z.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::transform(thrust::device, thrust::make_zip_iterator(thrust::make_tuple(X.begin(), Y.begin(), Z.begin())),thrust::make_zip_iterator(thrust::make_tuple(X.end(), Y.end(), Z.end())), thrust::make_zip_iterator(thrust::make_tuple(RX.begin(), RY.begin(), RZ.begin())), modify_tuple(2));
thrust::copy_n(X.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(Y.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(Z.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(RX.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(RY.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
thrust::copy_n(RZ.begin(), 3, std::ostream_iterator<float>(std::cout, ","));
std::cout << std::endl;
return 0;
}
$ nvcc -o t334 t334.cu
$ ./t334
0,1,2,
4,5,6,
7,8,9,
0,1,2,
4,5,6,
7,8,9,
0,2,4,
8,10,12,
14,16,18,
$