简体   繁体   English

有类似推力推力计算功能?

[英]Is there analogy of boost compute function in Thrust?

我想知道是否有一个模拟可以增强计算功能( http://www.boost.org/doc/libs/1_61_0/libs/compute/doc/html/boost_compute/advanced_topics.html#boost_compute.advanced_topics.custom_functions )进入内核并可以创建为嵌入式内联代码而变成内核?

In thrust, you can use function/functor with __device__ qualifier. 在推力方面,可以将函数/功能与__device__限定符一起使用。 An example of vector operation saxpy is shown in the link, where you could find the functor saxpy_functor 链接中显示了矢量运算saxpy的示例,您可以在其中找到函子saxpy_functor

http://docs.nvidia.com/cuda/thrust/#transformations http://docs.nvidia.com/cuda/thrust/#transformations

Similar to boost::compute , you could also use thrust lambda expression as boost::compute类似,您也可以使用推力lambda表达式作为

thrust::transform(X.begin(), X.end(), Y.begin(), Y.begin(), A * _1 + _2);

or more standard C++ lambda expression as shown by @RobertCrovella. 或更多@RobertCrovella所示的标准C ++ lambda表达式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM