Write without DMA

Any technical questions about the Epiphany chip and Parallella HW Platform.

Moderator: aolofsson

Write without DMA

Postby m_labbaf » Tue Sep 01, 2015 3:08 pm

As I know sending data between core can be done using 2 method, DMA and direct write.
If we don't use DMA we should define a pointer and set its address like 0x6000 that is pointed to core local memory. Then we can use e_get_global_address to find others core address.
in this situation I have some questions that will be appreciated if answered!
How I can find code size that placed in local memory (using internal.hdf) in order to prevent conflict between code and data pointer?
Is writing to others core is blocking? For example when core1 write in core2, how core2 know that new data is presented in its memory?
Is using volatile for pointers be mandatory? What happen if we don't use it?
when we define an array in program, where this array is placed? How we can update its value from other cores?
Is using barrier can belp to synchronize cores, while(it seems) writing to other cores memory is non-blocking and based on fire and forget?
m_labbaf
 
Posts: 20
Joined: Sun Mar 29, 2015 7:25 am

Re: Write without DMA

Postby sebraa » Tue Sep 01, 2015 8:44 pm

m_labbaf wrote:If we don't use DMA we should define a pointer and set its address like 0x6000 that is pointed to core local memory. Then we can use e_get_global_address to find others core address.
Yes. That implies that ALL cores use the SAME address for their buffers. This is not a requirement.

m_labbaf wrote:How I can find code size that placed in local memory (using internal.hdf) in order to prevent conflict between code and data pointer?
By leaving the decision on which addresses to use to the linker. The linker itself is the only tool in the toolchain which knows about the whole (local) memory map of a core. So declare your communication buffer statically and communicate its address to the neighboring core instead. If code+buffer are too large, the linker will complain.

m_labbaf wrote:Is writing to others core is blocking? For example when core1 write in core2, how core2 know that new data is presented in its memory?
It doesn't. Either it checks its memory or it gets a signal from the writing core. Writing is non-blocking (unless the mesh is congested).

m_labbaf wrote:Is using volatile for pointers be mandatory? What happen if we don't use it?
Depends on the compiler settings. The "volatile" qualifier disables some optimizations, which could otherwise interfere.

m_labbaf wrote:when we define an array in program, where this array is placed? How we can update its value from other cores?
The placement is decided by the linker. Other cores can use it, if they know the address.

m_labbaf wrote:Is using barrier can belp to synchronize cores, while(it seems) writing to other cores memory is non-blocking and based on fire and forget?
Depends on your program. I have written programs with barriers to synchronize programs, and I have written programs without barriers (using synchronization through flags). Barriers do not work for the host (which shares the shared memory with the Epiphany), and I believe barriers require that all cores run the same code.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: Write without DMA

Postby m_labbaf » Wed Sep 02, 2015 5:46 am

Thanks for your reply, it was helpful.

It is very good that ic code+buffer exceed the local memory length, linker complain. But is there any way that I can know the code size, before linked error?

As you said I can define communication buffer statically and I can define an array in any core and other cores can access to it, if they know its address. How I can find an array address?
m_labbaf
 
Posts: 20
Joined: Sun Mar 29, 2015 7:25 am

Re: Write without DMA

Postby sebraa » Wed Sep 02, 2015 1:41 pm

m_labbaf wrote:It is very good that ic code+buffer exceed the local memory length, linker complain. But is there any way that I can know the code size, before linked error?
Yes: Run e-size on the object file after compilation. But it wouldn't help, since there is more linked in than just your code (startup code, library code, etc).

m_labbaf wrote:As you said I can define communication buffer statically and I can define an array in any core and other cores can access to it, if they know its address. How I can find an array address?
The address of an array can be expressed in C as &array[0]. How you communicate it to the other cores is up to you. :-)
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: Write without DMA

Postby m_labbaf » Wed Sep 02, 2015 1:46 pm

So communicating with other cores while using array is possible only when different core code be the same, otherwise we cannot find its address using array name?
m_labbaf
 
Posts: 20
Joined: Sun Mar 29, 2015 7:25 am

Re: Write without DMA

Postby sebraa » Wed Sep 02, 2015 5:37 pm

You can't find out an address at runtime when you only know the name.

If all cores run the exact same program, the same variable ends up at the same address, which is a special case. In that case (and only in that case), you can use e_get_global_addr() to access other core's arrays. In all other cases, you have to find a solution to communicate the address of the array.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm


Return to Epiphany and Parallella Q & A

Who is online

Users browsing this forum: No registered users and 6 guests

cron