标签:io 使用 ar 问题 sp on c amp line
在opencl开发中,有时需要保证精度,需要支持double类型,但是double类型在opencl标准里面不是要求强制实现的,有些设备支持,有些不支持,如果你的设备支持的话,就需要在所有出现在double的最前面声明如下:
#pragma OPENCL EXTENSION cl_khr_fp64: enable
但是这也有一个问题,就是不能保证程序的可移植性,之前在编写地形因子提取算法时,在某些AMD的显卡就不支持。
另外有时候需要支持结构体的话,就只需要定义和主机端一模一样的结构体,然后在CPU传进来就可以了,比如,我上一篇博客中的RPC结构体的信息如下:
typedef struct
{
//偏移量
double dfLINE_OFF;
double dfSAMP_OFF;
double dfLAT_OFF;
double dfLONG_OFF;
double dfHEIGHT_OFF;
//缩放比例
double dfLINE_SCALE;
double dfSAMP_SCALE;
double dfLAT_SCALE;
double dfLONG_SCALE;
double dfHEIGHT_SCALE;
//系数
double adfLINE_NUM_COEFF[20];
double adfLINE_DEN_COEFF[20];
double adfSAMP_NUM_COEFF[20];
double adfSAMP_DEN_COEFF[20];
//最大最小经纬度范围
double dfMIN_LONG;
double dfMIN_LAT;
double dfMAX_LONG;
double dfMAX_LAT;
} stRPCInfo;status = clSetKernelArg(ckKernel,0,sizeof(stRPCInfo),&stInfo);
__kernel void RPCWarpKernel( struct stRPCInfo RpcInfo, __global double *dbGeoTrans, __global unsigned short* poDataIn, int nWidthIn, int nHeightIn, int nMinRowIn, int nSrcHeight, __global unsigned short* poDataOut, int nWidthOut, int nHeightOut, int nMinRowOut, int nBandCount)
标签:io 使用 ar 问题 sp on c amp line
原文地址:http://blog.csdn.net/zhouxuguang236/article/details/39270775