2

CUDA 4.0 ツールキットの一部として提供される NVidia Thrust ライブラリの使用を開始し、深く掘り下げる前に何かを検証したいと考えました。以下を実行でき、ビルド中に問題はありません。

thrust::host_vector <int> iVec;
thrust::device_vector <int> iVec2;
thrust::host_vector <std::string> sVec;

次のことを試みると、コンパイル エラーが発生します。

    thrust::device_vector <std::string> sVec2;

私が知りたいのは、デバイスまたはホストに関係なく、STL ベクトルで使用できる任意のデータ型を推力ベクトルで使用できると仮定できるかどうかです。または、ここに制限があり、これが機能することを期待すべきではありませんか?

私が得るエラーは次のとおりです。

c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\device\cuda\for_each.inl(93): エラー C2027: 未定義の型 'thrust::detail::STATIC_ASSERTION_FAILURE' の使用1> with 1> [ 1> x=false 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\device\dispatch\for_each.h(56) : 1> [ 1> RandomAccessIterator=thrust::detail::normal_iterator>、 1> Size=__w64 int, 1> UnaryFunction=thrust::detail::device_destroy_functor 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\device\for_each.inl(43) : 関数テンプレートのインスタンス化への参照を参照 'RandomAccessIterator throw::detail::device::dispatch:: for_each_n(RandomAccessIterator,Size,UnaryFunction,thrust::detail::cuda_device_space_tag)' は 1> [ 1> RandomAccessIterator=thrust::detail::normal_iterator>, 1> OutputIterator=thrust::detail::normal_iterator> でコンパイルされています。 , 1> Size=__w64 int, 1> UnaryFunction=thrust::detail::device_destroy_functor 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\device\for_each .inl(54) : 関数テンプレートのインスタンス化への参照 'OutputIterator 推力::詳細::デバイス::for_each_n(OutputIterator,Size,UnaryFunction)' は 1> [ 1> OutputIterator=thrust::detail::normal_iterator>, 1> InputIterator=thrust::detail::normal_iterator>, 1> UnaryFunction=thrust:: でコンパイルされています。 detail::device_destroy_functor, 1> Size=__w64 int 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\dispatch\for_each.h(72) : リファレンスを参照1> [ 1> InputIterator=thrust::detail::normal_iterator>, 1> UnaryFunction=thrust で 1> コンパイルされている関数テンプレートのインスタンス化 'InputIterator throw::detail::device::for_each(InputIterator,InputIterator,UnaryFunction)' ::detail::device_destroy_functor 1> ] 1>c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\for_each.inl(51) : 関数テンプレートのインスタンス化への参照を参照してください,InputIterator,UnaryFunction,thrust::device_space_tag)' がコンパイルされている 1> [ 1> InputIterator=thrust::detail::normal_iterator>, 1> UnaryFunction=thrust::detail::device_destroy_functor 1> ] 1> c: \program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\for_each.inl(67) : 関数テンプレートのインスタンス化への参照を参照' コンパイル中 1> 1> [ 1> InputIterator=thrust::detail::normal_iterator>, 1> UnaryFunction=thrust::detail::device_destroy_functor 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\dispatch\destroy.h(59) : 1> [ 1> ForwardIterator=thrust::detail::normal_iterator>, 1> T=value_type, 1 でコンパイルされている関数テンプレートのインスタンス化 'void Thrust::for_each>(InputIterator,InputIterator,UnaryFunction)' への参照を参照してください。 > InputIterator=thrust::detail::normal_iterator>, 1> UnaryFunction=thrust::detail::device_destroy_functor 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\detail \destroy.h(42) : 関数テンプレートのインスタンス化への参照を参照してください 'ボイド スラスト::詳細::dispatch::destroy(ForwardIterator,ForwardIterator,thrust::detail::false_type)' は 1> [ 1> ForwardIterator=thrust::detail::normal_iterator> 1> ] 1> c:\program files\nvidia でコンパイルされていますgpu コンピューティング ツールキット\cuda\v4.0\include\thrust\detail\vector_base.inl(442) : 関数テンプレートのインスタンス化への参照を参照してください。 1> [ 1> Pointer=thrust::device_ptr, 1> ForwardIterator=thrust::detail::normal_iterator> 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\ detail\vector_base.inl(440) : クラス テンプレート メンバ関数 'thrust::detail::vector_base:: のコンパイル中~vector_base(void)' 1> with 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0 \include\thrust\device_vector.h(55) : 1> [ 1> T=std::string, 1> Alloc=thrust: でコンパイルされているクラス テンプレートのインスタンス化 'thrust::detail::vector_base' への参照を参照してください: :device_malloc_allocator 1> ] 1> c:\users\fsquared\mydata\idata\main.cpp(119) : クラス テンプレートのインスタンス化 'thrust::device_vector' が 1> [ 1> T=std でコンパイルされている参照を参照してください。 ::string 1> ] ========== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h (55) : 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c でコンパイルされているクラス テンプレートのインスタンス化 'thrust::detail::vector_base' への参照を参照してください:\users\fsquared\mydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] == でコンパイルされているクラス テンプレートのインスタンス化 'thrust::device_vector' への参照を参照してください======== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h (55) : 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c でコンパイルされているクラス テンプレートのインスタンス化 'thrust::detail::vector_base' への参照を参照してください:\users\fsquared\mydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] == でコンパイルされているクラス テンプレートのインスタンス化 'thrust::device_vector' への参照を参照してください======== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h(55) : リファレンスを参照クラス テンプレートのインスタンス化 'thrust::detail::vector_base' は 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\users\fsquared\ でコンパイルされますmydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] ======== でコンパイルされているクラス テンプレートのインスタンス化 'thrust::device_vector' への参照を参照してください== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h(55) : リファレンスを参照クラス テンプレートのインスタンス化 'thrust::detail::vector_base' は 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\users\fsquared\ でコンパイルされますmydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] ======== でコンパイルされているクラス テンプレートのインスタンス化 'thrust::device_vector' への参照を参照してください== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h(55) : クラス テンプレートのインスタンス化 'thrust::detail::vector_base' がコンパイルされている参照を参照してください 1> with 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\users\fsquared\mydata\idata\main.cpp(119) : クラス テンプレートのインスタンス化への参照を参照してください'thrust::device_vector' がコンパイルされています 1> with 1> [ 1> T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0 最新、 0 スキップ ==========] 1> c:\program files\nvidia GPU コンピューティング ツールキット\cuda\v4.0\include\thrust\device_vector.h(55) : クラス テンプレートのインスタンス化 'thrust::detail::vector_base' がコンパイルされている参照を参照してください 1> with 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] 1> c:\users\fsquared\mydata\idata\main.cpp(119) : クラス テンプレートのインスタンス化への参照を参照してください'thrust::device_vector' がコンパイルされています 1> with 1> [ 1> T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0 最新、 0 スキップ ==========vector_base' は 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] でコンパイルされています 1> c:\users\fsquared\mydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0最新、0 スキップ ==========vector_base' は 1> [ 1> T=std::string, 1> Alloc=thrust::device_malloc_allocator 1> ] でコンパイルされています 1> c:\users\fsquared\mydata\idata\main.cpp(119) : 1> [ 1> T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0最新、0 スキップ ==========T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========T=std::string 1> ] ========== ビルド: 0 成功、1 失敗、0 最新、0 スキップ ==========

ここでは MSCV 2010 を使用しています。

4

1 に答える 1