2016-11-15 10 views
1

私は述語が正の数をチェックして、アレイを圧縮する copy_if 推力を::使用しようとしている:推力:不完全な型が許可されていない

ヘッダファイル:ファイル.h:

struct is_positive 
{ 
    __host__ __device__ 
    bool operator()(const int x) 
    { 
    return (x >= 0); 
    } 
}; 

とfile.cu

#include "../headers/file.h" 
#include <thrust/device_ptr.h> 
#include <thrust/device_vector.h> 
#include <thrust/copy.h> 


void compact(int* d_inputArray, int* d_outputArray, const int size) 
{ 
    thrust::device_ptr<int> t_inputArray(d_inputArray); 
    thrust::device_ptr<int> t_outputArray(d_outputArray); 
    thrust::copy_if(t_inputArray, t_inputArray + size, d_outputArray, is_positive()); 
} 

私が始まるエラーメッセージを取得しています:

/usr/local/cuda/include/thrust/system/detail/generic/memory.inl(40): error: incomplete type is not allowed

full errormsg here

私はちょうどコピー代わりの copy_if を使用している場合、コードは罰金コンパイルので、私は述語is_positive()アウト以外のすべてを支配しました。

このような推力エラーをデバッグする方法についてのヘルプや一般的なヒントについては、事前にお問い合わせいただきありがとうございます。

E:私はあなただけのタイプミスを持っているように見える私に

答えて

3

クーダ7.5を使用しています。この:

thrust::copy_if(t_inputArray, t_inputArray + size, d_outputArray, is_positive()); 
               ^

はこれを次のようになります。

thrust::copy_if(t_inputArray, t_inputArray + size, t_outputArray, is_positive()); 

あなたは適切な推力デバイスポインタと生のポインタを混合しましたが、これはトラブルを引き起こしています。

+0

これは恥ずかしいです。ありがとう、ありがとう、魅力のように働く! – mimre

関連する問題