[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - different result from the same code

different result from the same code

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Re: different result from the same code

Postby mikebell » Thu Mar 05, 2015 9:50 am

mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm

Re: different result from the same code

Postby howardhh » Thu Mar 05, 2015 10:32 am

Dear mikebell,

Really thanks for your help~
I have tried to print the arrays, but everything is right. And I think there is no other errors except the "mailbox", because I have another version of this program, which only use the local memory, is right.

I suspect that the mistake happens when I update the value of pos and vel, since the initial values are right, but the integration part is wrong. Does that means I can't change the value of variables in the mailbox once I e_write it into the shared_memory?
howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Re: different result from the same code

Postby sebraa » Thu Mar 05, 2015 2:04 pm

The Epiphany cores can change all of shared memory when they feel like it; it is not related to any e_read or e_write calls from the host.

I do not see obvious mistakes either, but:
- try to use an optimization level of -Os or -O1
- declare your mailbox as volatile
- in the mailbox typedef, align it to at least 8

If your code works fine in local memory, but not in shared memory, you might see race conditions due to radically different timing. The Epiphany code might do RMW cycles to access shared memory, and if other cores do the same simultaneously, you will get half-written garbage there. Also, the compiler optimization might remove accesses completely, since you did not mark shared memory as volatile. Reducing the optimization level might help you there.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: different result from the same code

Postby cmcconnell » Thu Mar 05, 2015 2:31 pm

Colin.
cmcconnell
 
Posts: 99
Joined: Thu May 22, 2014 6:58 pm

Re: different result from the same code

Postby howardhh » Fri Mar 06, 2015 2:01 am

Dear all and Colin,

Thank you very much! It's the flag's mistake.
Now the problem is solved by using another kind of flag like the dotproduct.

And thank you all for giving me so much help~I have optimized the code by your suggestion.
howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Previous

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 8 guests