Different results from same code between Epiphany and ARM

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Different results from same code between Epiphany and ARM

Postby mikebell » Wed Jan 21, 2015 9:33 am

Hi all,

I'm attempting to use the Epiphany to calculate n mod p, where n is a large number (up to 2048 bits) and p is a small prime.

I've stripped down the code from mini-gmp to perform the calculation, and have it compiling OK for Epiphany.

However, when I run the test I get the wrong result from Epiphany, when the same code gives the right result when compiled and executed on the ARM side.

I haven't tracked down exactly where this is going wrong yet, though after my previous finding that integer multiplication sometimes doesn't work if you mess with the arithmode, I'm suspicious of the integer divide implementation as that uses a floating point subtract which causes a mode switch. I'll try and find time to track it down further later.

The attached project demos the problem - ./build.sh compiles the same C source file (e_modp.c) both host and epiphany side, and then ./run.sh runs them both and prints the different answers.

Anyone have any insight?

Cheers, Mike
Attachments
modptest.tgz
(3.69 KiB) Downloaded 1137 times
mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm

Re: Different results from same code between Epiphany and AR

Postby mikebell » Wed Jan 21, 2015 10:17 pm

Ah hah - actually I was a victim of larger than expected default array alignment on the Epiphany, so my data transfer from host to the Epiphany was wrong (see viewtopic.php?f=13&t=950) - it appears the maths is all working fine (hooray!)

It's a shame that the default alignment isn't the same between the ARM and Epiphany to make data transfer simpler. At least I know to be aware of that now!
mikebell
 
Posts: 41
Joined: Thu Jan 08, 2015 9:46 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 16 guests