[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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 483: 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/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

different result from the same code

Postby howardhh » Tue Mar 03, 2015 6:55 am

Hi all,

In my program, I use e-core, shared_memory, where I put lots of arrays, but I'm sure the space is big enough.
When I run the code several times, I found that the result each time is different! Do you guys know what will cause this?
Is memory conflict the most possible reason? If so, why this happens? I allocated many arrays in a struct, and didn't use pointer.

Looking forward to your reply! Thank you!
howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Re: different result from the same code

Postby piotr5 » Tue Mar 03, 2015 8:59 am

how did you access the array without a pointer? operator[] is working indirectly with pointers too! so when you use a value that's too big (for example you write the same number as the array was defined with, or you start counting from 1 instead from 0) nobody will notice the overflow and since array-data is uninitialized at start you will use memory that's uninitialized or occupied by something else, maybe on a different core...
piotr5
 
Posts: 230
Joined: Sun Dec 23, 2012 2:48 pm

Re: different result from the same code

Postby sebraa » Tue Mar 03, 2015 2:21 pm

If you expected identical results, and you get different results, then you most likely made a mistake. Unless you explain a bit more what you were up to, all we can do is guess.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: different result from the same code

Postby howardhh » Wed Mar 04, 2015 12:27 am

howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Re: different result from the same code

Postby mikebell » Wed Mar 04, 2015 9:37 am

Is your N odd? If so, you're probably a victim of differing default alignment between the ARM gcc (4 byte alignment) and Epiphany gcc (8 byte alignment).

If it's not that then you still haven't provided much detail on how your code works - e.g. are you running one epiphany core or many? How do you determine the memory address in shared memory for each Epiphany core to work on?
mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm

Re: different result from the same code

Postby howardhh » Wed Mar 04, 2015 10:46 am

howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Re: different result from the same code

Postby piotr5 » Wed Mar 04, 2015 12:20 pm

if alignment differs, and you initialize from host while using it from e-cores, then alignment and thereby sizeof(Mailbox) don't match between host-program and e-Cores! the compilers fail to understand eachother.
piotr5
 
Posts: 230
Joined: Sun Dec 23, 2012 2:48 pm

Re: different result from the same code

Postby mikebell » Wed Mar 04, 2015 1:39 pm

Without seeing some more of your code it's difficult to know if this is the problem - but from what you just posted it seems possible you are iterating over the same data with each of the 16 cores, so you would get different results depending on timing of when they start, etc.

Maybe push your project up to github or somewhere else public, so we can see everything you're doing?
mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm

Re: different result from the same code

Postby sebraa » Wed Mar 04, 2015 2:37 pm

sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: different result from the same code

Postby howardhh » Thu Mar 05, 2015 12:34 am

Thank you all for the suggestions. Here is my code:
I'm not familiar with github, so this looks a little disorder...
howardhh
 
Posts: 28
Joined: Fri Aug 22, 2014 1:50 am

Next

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 17 guests

cron