本人 CUDA小白一枚,要是有什么不对,还望各位大佬指点。
本文及后面的几篇将分别从几个方面来大概阐述一下Thrust的一些接口。原来的网址在这里
PS:里面有一些暂时也没看懂,这边就主要介绍一些比较常用的。
4.Function Objects
4.1 Arithmetic Operations
4.1.1 plus
求和
template <typename T = void>
struct thrust::plus;
struct thrust::plus< void >;
4.1.2 minus
求差
template <typename T = void>
struct thrust::minus;
struct thrust::minus< void >;
4.1.3 multiplies
乘
template <typename T = void>
struct thrust::multiplies;
struct thrust::multiplies< void >;
4.1.4 devides
除法
template <typename T = void>
struct thrust::divides;
struct thrust::divides< void >;
4.1.5 modulus
求模
template <typename T = void>
struct thrust::modulus;
struct thrust::modulus< void >;
4.1.6 negate
取反
template <typename T = void>
struct thrust::negate;
struct thrust::negate< void >;
4.1.7 squre
求平方
template <typename T = void>
struct thrust::square;
struct thrust::square< void >;
4.2 Bitwise Operations
4.2.1 bit_and
位与
template <typename T = void>
struct thrust::bit_and;
struct thrust::bit_and< void >;
4.2.2 bit_or
位或
template <typename T = void>
struct thrust::bit_or;
struct thrust::bit_or< void >;
4.2.3 bit_xor
位异或
template <typename T = void>
struct thrust::bit_xor;
struct thrust::bit_xor< void >;
4.3 Comparision Operations
4.3.1 equal_to
相等
template <typename T = void>
struct thrust::equal_to;
struct thrust::equal_to< void >;
4.3.2 not_equal_to
不等
template <typename T = void>
struct thrust::not_equal_to;
struct thrust::not_equal_to< void >;
4.3.3 greater
大于
template <typename T = void>
struct thrust::greater;
struct thrust::greater< void >;
4.3.4 less
小于
template <typename T = void>
struct thrust::less;
struct thrust::less< void >;
4.3.5 greater_equal
大于等于
template <typename T = void>
struct thrust::greater_equal;
struct thrust::greater_equal< void >;
4.3.6 less_equal
小于等于
template <typename T = void>
struct thrust::less_equal;
struct thrust::less_equal< void >;
4.4 Generalized Identity Operations
4.4.1 identity
输入一个x,返回x ?
template <typename T = void>
struct thrust::identity;
struct thrust::identity< void >;
4.4.2 maximum
最大值
template <typename T = void>
struct thrust::maximum;
struct thrust::maximum< void >;
4.4.3 minimum
最小值
template <typename T = void>
struct thrust::minimum;
struct thrust::minimum< void >;
4.4.4 project1st
输入两个值,返回第一个值
template <typename T1 = void,
typename T2 = void>
struct thrust::project1st;
struct thrust::project1st< void, void >;
4.4.5 project2nd
输入两个值,返回第二个值
template <typename T1 = void,
typename T2 = void>
struct thrust::project2nd;
struct thrust::project2nd< void, void >;
4.5 Logical Operators
4.5.1 logical_and
逻辑与
template <typename T = void>
struct thrust::logical_and;
struct thrust::logical_and< void >;
4.5.2 logical_or
逻辑或
template <typename T = void>
struct thrust::logical_or;
struct thrust::logical_or< void >;
4.5.3 logical_not
逻辑非
template <typename T = void>
struct thrust::logical_not;
struct thrust::logical_not< void >;