如何解决Debian上的CL_INVALID_BUILD_OPTIONS问题?

时间:2018-09-15 21:24:05

标签: opencl amd-processor debian-stretch

我似乎已经成功构建了这个项目https://github.com/sowson/darknet,但是当我尝试运行它时,却得到了输出。

Device ID: 0
Device name: AMD CAICOS (DRM 2.49.0 / 4.9.0-8-amd64, LLVM 3.9.1)
Device vendor: AMD
Device opencl availability: OpenCL 1.1 Mesa 13.0.6
Device opencl used: 13.0.6
Device double precision: NO
Device max group size: 256
Device address bits: 32
opencl_load: could not compile. error: CL_INVALID_BUILD_OPTIONS
CL_PROGRAM_BUILD_LOG:

CODE:
float lhtan_activate_kernel(float x); float lhtan_gradient_kernel(float x); float hardtan_activate_kernel(float x); float linear_activate_kernel(float x); float logistic_activate_kernel(float x); float loggy_activate_kernel(float x); float relu_activate_kernel(float x); float elu_activate_kernel(float x); float selu_activate_kernel(float x); float relie_activate_kernel(float x); float ramp_activate_kernel(float x); float leaky_activate_kernel(float x); float tanh_activate_kernel(float x); float plse_activate_kernel(float x); float stair_activate_kernel(float x); float hardtan_gradient_kernel(float x); float linear_gradient_kernel(float x); float logistic_gradient_kernel(float x); float loggy_gradient_kernel(float x); float relu_gradient_kernel(float x); float elu_gradient_kernel(float x); float selu_gradient_kernel(float x); float relie_gradient_kernel(float x); float ramp_gradient_kernel(float x); float leaky_gradient_kernel(float x); float tanh_gradient_kernel(float x); float plse_gradient_kernel(float x); float stair_gradient_kernel(float x); typedef enum{ LOGISTIC, RELU, RELIE, LINEAR, RAMP, TANH, PLSE, LEAKY, ELU, LOGGY, STAIR, HARDTAN, LHTAN, SELU } ACTIVATION; float activate_kernel(float x, ACTIVATION a); float gradient_kernel(float x, ACTIVATION a); float lhtan_activate_kernel(float x) { if(x < 0) return .001f*x; if(x > 1) return .001f*(x-1.f) + 1.f; return x; } float lhtan_gradient_kernel(float x) { if(x > 0 && x < 1) return 1; return .001; } float hardtan_activate_kernel(float x) { if (x < -1) return -1; if (x > 1) return 1; return x; } float linear_activate_kernel(float x){return x;} float logistic_activate_kernel(float x){return 1.f/(1.f + exp(-x));} float loggy_activate_kernel(float x){return 2.f/(1.f + exp(-x)) - 1;} float relu_activate_kernel(float x){return x*(x>0);} float elu_activate_kernel(float x){return (x >= 0)*x + (x < 0)*(exp(x)-1);} float selu_activate_kernel(float x){return (x >= 0)*1.0507f*x + (x < 0)*1.0507f*1.6732f*(exp(x)-1);} float relie_activate_kernel(float x){return (x>0) ? x : .01f*x;} float ramp_activate_kernel(float x){return x*(x>0)+.1f*x;} float leaky_activate_kernel(float x){return (x>0) ? x : .1f*x;} float tanh_activate_kernel(float x){return (2.f/(1 + exp(-2*x)) - 1);} float plse_activate_kernel(float x) { if(x < -4) return .01f * (x + 4); if(x > 4) return .01f * (x - 4) + 1; return .125f*x + .5f; } float stair_activate_kernel(float x) { int n = floor(x); if (n%2 == 0) return floor(x/2); else return (x - n) + floor(x/2); } float hardtan_gradient_kernel(float x) { if (x > -1 && x < 1) return 1; return 0; } float linear_gradient_kernel(float x){return 1;} float logistic_gradient_kernel(float x){return (1-x)*x;} float loggy_gradient_kernel(float x) { float y = (x+1)/2; return 2*(1-y)*y; } float relu_gradient_kernel(float x){return (x>0);} float elu_gradient_kernel(float x){return (x >= 0) + (x < 0)*(x + 1);} float selu_gradient_kernel(float x){return (x >= 0)*1.0507 + (x < 0)*(x + 1.0507*1.6732);} float relie_gradient_kernel(float x){return (x>0) ? 1 : .01f;} float ramp_gradient_kernel(float x){return (x>0)+.1f;} float leaky_gradient_kernel(float x){return (x>0) ? 1 : .1f;} float tanh_gradient_kernel(float x){return 1-x*x;} float plse_gradient_kernel(float x){return (x < 0 || x > 1) ? .01f : .125f;} float stair_gradient_kernel(float x) { if (floor(x) == x) return 0; return 1; } float activate_kernel(float x, ACTIVATION a) { switch(a){ case LINEAR: return linear_activate_kernel(x); case LOGISTIC: return logistic_activate_kernel(x); case LOGGY: return loggy_activate_kernel(x); case RELU: return relu_activate_kernel(x); case ELU: return elu_activate_kernel(x); case SELU: return selu_activate_kernel(x); case RELIE: return relie_activate_kernel(x); case RAMP: return ramp_activate_kernel(x); case LEAKY: return leaky_activate_kernel(x); case TANH: return tanh_activate_kernel(x); case PLSE: return plse_activate_kernel(x); case STAIR: return stair_activate_kernel(x); case HARDTAN: return hardtan_activate_kernel(x); case LHTAN: return lhtan_activate_kernel(x); } return 0; } float gradient_kernel(float x, ACTIVATION a) { switch(a){ case LINEAR: return linear_gradient_kernel(x); case LOGISTIC: return logistic_gradient_kernel(x); case LOGGY: return loggy_gradient_kernel(x); case RELU: return relu_gradient_kernel(x); case ELU: return elu_gradient_kernel(x); case SELU: return selu_gradient_kernel(x); case RELIE: return relie_gradient_kernel(x); case RAMP: return ramp_gradient_kernel(x); case LEAKY: return leaky_gradient_kernel(x); case TANH: return tanh_gradient_kernel(x); case PLSE: return plse_gradient_kernel(x); case STAIR: return stair_gradient_kernel(x); case HARDTAN: return hardtan_gradient_kernel(x); case LHTAN: return lhtan_gradient_kernel(x); } return 0; } __kernel void activate_array_kernel(__global float *x, int offset, int n, ACTIVATION a) { int i = (get_group_id(0) + get_group_id(1)*get_num_groups(0)) * get_local_size(0) + get_local_id(0); if(i < n) x[i + offset] = activate_kernel(x[i + offset], a); } __kernel void gradient_array_kernel(__global float *x, int offset, int n, ACTIVATION a, __global float *delta) { int i = (get_group_id(0) + get_group_id(1)*get_num_groups(0)) * get_local_size(0) + get_local_id(0); if(i < n) delta[i + offset] *= gradient_kernel(x[i + offset], a); }

我不太确定如何提出问题或在哪里寻找答案。任何信息都会有所帮助。

1 个答案:

答案 0 :(得分:1)

您正在使用仅支持OpenCL 1.1的台面。如图in the source code所示,它尝试使用-cl-fp32-correctly-rounded-divide-sqrt选项构建OpenCL内核,该选项已添加到OpenCL 1.2中,解释了该错误。您应该可以通过删除该特定选项来解决此问题,但是删除该选项可能会导致副作用。

从侧面说,台面OpenCL的实现还不及标准。您确实应该使用AMDGPU-PRO(专有,还包括OpenGL和Vulkan驱动程序-从AMD的站点下载)或ROCm(具有专有组件的开源软件,比AMDGPU-PRO更新,但硬件/软件支持更有限) ,它不仅支持新的OpenCL功能(分别为1.2和2.0+版本),而且还提供了明显更好的性能。