请帮助...在 opencl 程序中,我收到这些错误。我没有“oclUtils.h”头文件。S0 我没有将它包含在我的程序中。这就是我遇到这个问题的原因。我也在发送我的内核。如果这是原因,我如何在不使用 oclUtils.h 的情况下使用原子函数?
*"__kernel void BLAS_susdot_kernel(__global float *x,__global int *index,__global float *y,const int n,__global float* dot_p) \n" \
"{ \n" \
" int block_x = get_group_id(0); \n" \
" int thread_x = get_local_id(0); \n" \
" int i = get_global_id(0); \n" \
" float dot_value, old = *dot_p; \n" \
" int warp_thread_id = i & (32-1); \n" \
" __local float tmp[512]; \n" \
" __local float share_dot_p; \n" \
" if(thread_x == 0) \n" \
" share_dot_p = 0.0; \n" \
" if (i < n) \n" \
" { \n" \
" tmp[i]= x[i]*y[index[i]]; \n" \
" if(warp_thread_id <16 && (i+16)< n) \n" \
" tmp[i]+=tmp[i+16]; \n" \
" if(warp_thread_id <8 && (i+8)< n ) \n" \
" tmp[i]+=tmp[i+8]; \n" \
" if(warp_thread_id <4 && (i+4)< n ) \n" \
" tmp[i]+=tmp[i+4]; \n" \
" if(warp_thread_id <2 && (i+2)< n) \n" \
" tmp[i]+=tmp[i+2]; \n" \
" if(warp_thread_id==0 && (i+1)< n) \n" \
" { \n" \
" tmp[i]+=tmp[i+1]; \n" \
" do \n" \
" { \n" \
" dot_value = old; \n" \
" old = convert_int( atomic_cmpxchg((volatile __global unsigned int*)&share_dot_p, convert_int(dot_value), convert_int(tmp[i] + dot_value))); \n" \
" } while (dot_value != old); \n" \
" //share_dot_p +=tmp[i]; \n" \
" } \n" \
" if(thread_x==0) \n" \
" { \n" \
" \n" \
" do \n" \
" { \n" \
" dot_value = old; \n" \
" old = convert_int(atomic_cmpxchg((volatile __global unsigned int *) dot_p, convert_int(dot_value), convert_int(share_dot_p+dot_value))); \n" \
" } while(dot_value != old); \n" \
" // *dot_p += share_dot_p; \n" \
" \n" \
" } \n" \
" } \n" \
"} \n" \
"\n";*
我得到的错误:
Build Program Info: ptxas application ptx input, line 160; error : Label expected for argument 0 of instruction 'call'
ptxas application ptx input, line 160; error : Call target not recognized
ptxas application ptx input, line 160; error : Function 'atomic_cmpxchg' not declared in this scope
ptxas application ptx input, line 160; error : Call target not recognized
ptxas application ptx input, line 185; error : Label expected for argument 0 of instruction 'call'
ptxas application ptx input, line 185; error : Call target not recognized
ptxas application ptx input, line 185; error : Function 'atomic_cmpxchg' not declared in this scope
ptxas application ptx input, line 185; error : Call target not recognized
ptxas application ptx input, line 161; error : Unknown symbol 'atomic_cmpxchg'
ptxas application ptx input, line 186; error : Unknown symbol 'atomic_cmpxchg'
ptxas fatal : Ptx assembly aborted due to errors
error : Ptx compilation failed: gpu='sm_13', device code='cuModuleLoadDataEx_4'
: Considering profile 'compute_13' for gpu='sm_13' in 'cuModuleLoadDataEx_4'
: Retrieving binary for 'cuModuleLoadDataEx_4', for gpu='sm_13', usage mode=' '
: Considering profile 'compute_13' for gpu='sm_13' in 'cuModuleLoadDataEx_4'
: Control flags for 'cuModuleLoadDataEx_4' disable search path
: Ptx binary found for 'cuModuleLoadDataEx_4', architecture='compute_13'
: Ptx compilation for 'cuModuleLoadDataEx_4', for gpu='sm_13', ocg options=' '