Dear Joe,

Try flattening the arrays before you pass them to the device:

a = a.flatten()

Jan

On Fri, Nov 16, 2012 at 5:13 AM, Joseph Kopacz <[email protected]> wrote:
> Hi Jan,
>
> Thank you for your help.  Am I having a similar problem with this program?
> The operation is preformed correctly on the first row, but the second row is
> incorrect.
>
> Thanks again,
> Joe
>
>
> On Thu, Nov 15, 2012 at 6:21 AM, Jan Meinke <[email protected]> wrote:
>>
>> 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
>
>

_______________________________________________
PyOpenCL mailing list
[email protected]
http://lists.tiker.net/listinfo/pyopencl

Reply via email to