running on GPU but not on CPU

whenever i am running my program on GPU it works fine but when i change it to CPU
via CL_DEVICE_TYPE_CPU it says
unhandled exception at 0x00215007 in program.exe 0xC00000005
Access violation reading location 0x00000001 a0acad10

plspls help

There isn’t enough information there to be able to help. At the very least you’ll need a stack trace plus information about your OpenCL driver, some code, your compilation options and so on… but realistically it’s not possible to debug a problem like this without actually sitting at your computer.

I don’t see how that can compile given that pLocal is never defined. I also don’t see how it can be computing a dot product, given that it outputs an array rather than a single value

Are you using the Intel OpenCL SDK on an AMD CPU? In my experience, this combination doesn’t work, while the reverse (AMD APP with Intel CPU) works.