how to distinguish if memcpy works with 1,2,4 B

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

how to distinguish if memcpy works with 1,2,4 B

Postby grzeskob » Wed Feb 18, 2015 10:24 am

grzeskob
 
Posts: 12
Joined: Mon Nov 17, 2014 8:36 pm

Re: how to distinguish if memcpy works with 1,2,4 B

Postby aolofsson » Sun Feb 22, 2015 7:02 pm

Why do you want to use memcpy() inside the Epiphany?
User avatar
aolofsson
 
Posts: 1005
Joined: Tue Dec 11, 2012 6:59 pm
Location: Lexington, Massachusetts,USA

Re: how to distinguish if memcpy works with 1,2,4 B

Postby sebraa » Mon Feb 23, 2015 2:29 pm

Because memcpy() is the easiest way to copy blocks around in memory.
I used it to copy big blocks from local to shared memory, since I couldn't continue computations anyway. Please don't tell me that memcpy() is not optimized. :-(
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: how to distinguish if memcpy works with 1,2,4 B

Postby grzeskob » Thu Feb 26, 2015 6:08 pm

grzeskob
 
Posts: 12
Joined: Mon Nov 17, 2014 8:36 pm

Re: how to distinguish if memcpy works with 1,2,4 B

Postby mikebell » Thu Feb 26, 2015 9:33 pm

Beware that the implementation for memcpy will by default be located in shared memory, rather than on local core memory (unless you mess with the linker definition file).

I'd generally try to avoid copying memory on core, but if you do need to then just use a for loop. But make sure you have -fno-tree-loop-distribute-patterns specified to the compiler, else it will replace the loop with a memcpy, which will be slower because that executes from shared memory.
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 14 guests