can';t为推力::cuda min_element()函数构建比较谓词

can';t为推力::cuda min_element()函数构建比较谓词,cuda,thrust,Cuda,Thrust,我收到了一条恼人的信息,我不太确定我做错了什么 float4 *IntsOnHost = new float4[ MAXX * (MAXY - 1) ]; //copy possible intersection points from device to host CU_SAFE_CALL(cudaMemcpy(IntsOnHost,IntsOnDevToCpyToHost,(MAXX*(MAXY - 1)-1)*sizeof(float4),cudaMemcpyDeviceToHost));

我收到了一条恼人的信息,我不太确定我做错了什么

float4 *IntsOnHost = new float4[ MAXX * (MAXY - 1) ];
//copy possible intersection points from device to host
CU_SAFE_CALL(cudaMemcpy(IntsOnHost,IntsOnDevToCpyToHost,(MAXX*(MAXY - 1)-1)*sizeof(float4),cudaMemcpyDeviceToHost));
thrust::device_vector<float4> IntsOnDev (IntsOnHost,IntsOnHost + (MAXX * (MAXY - 1)-1)*sizeof(float4)); 
//find the index of the smallest intersection point
thrust::device_vector<float4>::iterator it =  thrust::min_element(IntsOnDev.begin(),IntsOnDev.end(),equalOperator());   
错误消息:

1> c:\program files\nvidia gpu computing toolkit\cuda\v4.0\include\推力\detail\device\generic\extrema.inl(104): 错误:无法使用调用函数“equalOperator::operator()” 给定参数列表


谢谢

在这个案子上花了几个小时后,我设法解决了这个问题。 经过长时间的检查,我输入了执行
min\u element()
函数的.inl文件,并调用了我提供的适当的
操作符()
,我注意到我缺少了一些

常数

答案是:

struct equalOperator
{
  __host__ __device__
    bool operator()(const float4 x, const float4 y) const
    {
        return ( x.w > y.w );
    }
};  

花了我几天的时间…

你能添加编译器认为给定参数列表是什么吗?请注意,官方的推力文档的示例不包括“const”,但我观察到的结果与你相同。
struct equalOperator
{
  __host__ __device__
    bool operator()(const float4 x, const float4 y) const
    {
        return ( x.w > y.w );
    }
};