Thrust ライブラリを使い始めたばかりです。デバイスで長さ 5 のベクトルを作成しようとしています。彼女は最初の要素のメンバーを設定していますvec[0]
#include<thrust/device_vector.h>
#include<iostream>
.
.
.
thrust::device_vector<uint2> vec(5);
vec[0]=make_uint2(4,5);
std::cout<<vec[0].x<<std::endl;
ただし、上記のコードではエラーが発生します
error: class "thrust::device_reference<uint2>" has no member "x"
1 error detected in the compilation of "/tmp/tmpxft_000020dc_00000000-4_test.cpp1.ii".
どこが間違っていますか?uint2
with.x
やなどのネイティブ CUDA ベクトル データ型のメンバーにアクセスするの.y
が正しい方法だと思いました。