2013-02-04 47 views
0

您好我正在學習OpenCL和下面的一本書的例子,並嘗試做以下的OpenCL的VisualStudio 2012錯誤設置

//Obtain the GPU data (platform, device and context) 
PlatformDevice gpu = retrieveDevice(CL_DEVICE_TYPE_GPU); 
assert(gpu.allDat![enter image description here][1]aPresent()); 
const char * kernalSource = "__kernel void multiplication(__global float* GridA, __global float* GridB,__global float* val){int igrid = get_global_id(0);float a = GridA[igrid];float b = GridB[igrid];val[igrid] = a * b;}"; 

//Create Program 
cl_program program = clCreateProgramWithSource(gpu.context,1, (const char**) kernalSource,NULL,&err); 

當我到最後一行它產生以下錯誤

Unhandled exception at 0x53349301 (nvopencl.dll) in OpenCLPracticeSetup.exe: 0xC0000005: Access violation reading location 0x656B5F5F. 

我猜它的設置問題,爲Visual Studio 2012,但在網上爲沒有見過的錯誤與nvopencl.dll 這裏是我改變的屬性找不到任何

c/C++ 一般 - 我的其他包括目錄是:\ NVIDIA GPU計算工具包\ CUDA \ v4.2 \ include \ CL 鏈接器 一般 - 我的其他庫目錄是:\ NVIDIA GPU Computing Toolkit \ CUDA \ v4.2 \ lib \ Win32 輸入 - OpenCL.lib; kernel32.lib; user32.lib; gdi32.lib; winspool.lib; comdlg32.lib; advapi32.lib; shell32.lib; ole32.lib; oleaut32.lib; uuid.lib ; odbc32.lib; odbccp32.lib;%(AdditionalDependencies)

感謝

+0

你能檢查'gpu'的內容嗎?上下文是否爲非NULL? –

+0

上下文不爲空 – bubblebath

回答

0

我找到了答案,我的問題,我應該已經引用源。

謝謝