Dear Joe, On Wed, Nov 14, 2012 at 6:59 PM, Joseph Kopacz <[email protected]> wrote: > > Hi Everyone, > > I am new to this style of mailing list so if I miss anything please let me > know. > > I am trying to create a opencl program that will calculate the sum of the > prime numbers below a given integer. I have gotten the code to function on > my computer, ie it no longer crashes the driver when it runs; however, it > does not return the correct result. > > The code I have attached preforms the process in a serial fashion then tries > to utilize pyopencl to do this in a parallel manner. > > There are a number of issues with your example.
You define your variables a and c as pointers to long int, but the buffers you pass are filled with 32 bit integers. In this case, there's no cast to the larger type but the bis are reinterpreted: the representation of the first 64 bits following the pointer address is interpreted as a 64 bit integer. In your kernel function you make the assumption that temp2 is initialized to zero but this is not necessarily true. You can get rid of the loop. OpenCL takes care of it. The attached code works for me. Hope that helps, Jan
Sumofprimes.py
Description: Binary data
_______________________________________________ PyOpenCL mailing list [email protected] http://lists.tiker.net/listinfo/pyopencl
