我在座谈了许多类似问题,但有一些小小小改动。 我试图将价值与一种焦炭_化器混为一谈,将其作为复合钥匙。
Specifically, I have the following function:
void thrustSort( unsigned int * primaryKey, float * secondaryKey, unsigned int * values, unsigned int numberOfPoints) { thrust::device_ptr dev_ptr_pkey = thrust::device_pointer_cast(primaryKey); thrust::device_ptr dev_ptr_skey = thrust::device_pointer_cast(secondaryKey); thrust::device_ptr dev_ptr_values = thrust::device_pointer_cast(values); thrust::tuple,thrust::device_ptr> keytup_begin = thrust::make_tuple,thrust::device_ptr>(dev_ptr_pkey, dev_ptr_skey); thrust::zip_iterator, thrust::device_ptr > > first = thrust::make_zip_iterator, thrust::device_ptr > >(keytup_begin); thrust::sort_by_key(first, first + numberOfPoints, dev_ptr_values, ZipComparator()); }
以及这一习俗:
typedef thrust::device_ptr<unsigned int> tdp_uint ;
typedef thrust::device_ptr<float> tdp_float ;
typedef thrust::tuple<tdp_uint, tdp_float> tdp_uif_tuple ;
struct ZipComparator
{
__host__ __device__
inline bool operator() (const tdp_uif_tuple &a, const tdp_uif_tuple &b)
{
if(a.head < b.head) return true;
if(a.head == b.head) return a.tail < b.tail;
return false;
}
};
错误是:
Error 1 error : no instance of constructor "thrust::device_ptr::device_ptr [with T=unsigned int]" matches the argument list C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.0include hrustdetail uple.inl 309 1 --- Error 2 error : no instance of constructor "thrust::device_ptr::device_ptr [with T=float]" matches the argument list C:Program FilesNVIDIA GPU Computing ToolkitCUDAv4.0include hrustdetail uple.inl 401 1 ---
任何可能产生这种结果的想法,我如何写出确实行之有效的前提?
Thanks in Advance, Nathan