RoshanGerard / aparapi

Automatically exported from code.google.com/p/aparapi
Other
0 stars 0 forks source link

get() only returns data the first time when using explicit mode in a loop #60

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the attached file.

What is the expected output? What do you see instead?
Expected:

GPU, auto
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2]
[3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0]

GPU, explicit
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2]
[3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0]

See:
GPU, auto
[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]
[2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2, 0, 0, 2]
[3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0, 3, 0, 0, 0]

GPU, explicit
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
[2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2]
[3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3]

What version of the product are you using? On what operating system?
aparapi-2012-05-06.zip (R#407, May 6).
Ubuntu 12.04 x64
nVidia gt540m, driver version 295.40, cuda toolkit 4.2.9

Please provide any additional information below.
When using explicit mode and using the get() method to fetch an array after 
each execution, it seems to fetch the array data after the first execution but 
not on any subsequent attempts.

Original issue reported on code.google.com by oliver.c...@gmail.com on 7 Aug 2012 at 4:28

Attachments:

GoogleCodeExporter commented 9 years ago
Actually, another possibility is that put() is only transferring data the first 
time, this would produce the same result with the attached program. I did some 
more testing to determine if this might be the case, and I think I can say that 
it's the put() method that is to blame. I replaced the line that writes to the 
neuronOutputs array in the run() method with:

neuronOutputs[neuronID] = neuronID + neuronOutputs[neuronID] + simStep[0];

and get:

GPU, auto
[0, 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120]
[1, 3, 6, 10, 15, 21, 28, 36, 45, 55, 66, 78, 91, 105, 120, 136]
[2, 5, 9, 14, 20, 27, 35, 44, 54, 65, 77, 90, 104, 119, 135, 152]

GPU, explicit
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16]
[2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32]

The get() method returns different results after every execution as expected, 
but the value of simStep[0] inside the kernel doesn't seem to change.

Original comment by oliver.c...@gmail.com on 7 Aug 2012 at 5:03

GoogleCodeExporter commented 9 years ago
Oliver thanks for reporting this. 

This looks bad. Your analysis looks  good.. It does appear that put() is not 
being honored.. 

If you have some test code can you post it for me (from the dumps above it 
looks like you mights) I want to build a junit test for this. 

Was this using Aparapi built from the trunk?  Or from a binary distribution.

Gary

Original comment by frost.g...@gmail.com on 8 Aug 2012 at 2:28

GoogleCodeExporter commented 9 years ago
Apologies Oliver.  I just saw that you attached your test code. 

Original comment by frost.g...@gmail.com on 8 Aug 2012 at 9:22

GoogleCodeExporter commented 9 years ago
So I turned your test code into a junit case and it seems to work just fine 
when I use against the trunk.   I will pull aparapi-2012-05-06.zip (R#407, May 
6) and try in a moment.  

I added aparapi/test/runtime junit tests to track this.

Original comment by frost.g...@gmail.com on 8 Aug 2012 at 9:36

GoogleCodeExporter commented 9 years ago
Gary,

This sounds similar/identical to the bug we've been tracking offline...? That 
bug was apparently fixed in the the latest trunk code as well.

Oliver,

Can you build the latest Aparapi Trunk code and verify whether it fixes this 
bug?

Original comment by ryan.lam...@gmail.com on 9 Aug 2012 at 5:40

GoogleCodeExporter commented 9 years ago
Yep, latest trunk code seems to fix it. :)

Original comment by oliver.c...@gmail.com on 9 Aug 2012 at 11:27

GoogleCodeExporter commented 9 years ago
Thanks Ryan and Oliver.

It's time to build a new binary ;)

I will keep this open until we make a new binary available. 

Gary 

Original comment by frost.g...@gmail.com on 9 Aug 2012 at 12:07