[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 - Using Epiphany External memory

Using Epiphany External memory

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Using Epiphany External memory

Postby dekanutepederaz » Sat Oct 15, 2016 3:21 pm

Hello, I am developing a project on the parallella board where I get some data as an input on the host and then process it in the cores multiple times. Because the input data is big - usually more than the limited 32KB on each core, I cannot send it multiple times to be processed. Thus I need that I have to use the External memory shared between the cores. And then when the data is processed by one of the cores, to send the result with message passing. Does this seem a good memory distribution?

If yes, could you please provide me with an example how to use that External memory. From the hello world example, I found out that e_read and e_write can do such things, but for example if I have a table inserted as a two dimensional array in the external memory, how can I access a particular element from that table?

Thank you in advance!!!
dekanutepederaz
 
Posts: 5
Joined: Thu Oct 13, 2016 10:20 pm

Re: Using Epiphany External memory

Postby jar » Sun Oct 16, 2016 2:57 am

Here's an example of a kernel that has multiple stages of data movement:
https://github.com/USArmyResearchLab/mp ... pi_tfunc.c

The code is rather complicated so ask questions if you don't follow at first. It performs a matrix-matrix multiplication by copying working sets (from DRAM) to the cores, performing submatrix multiplication, shifting data between the cores (more computation), and then writing the results out. If the data is large, contiguous or in 2D blocks, it would benefit you to learn how to setup and engage the DMA engines on the core. There are macros defined in that code which can help, but they actually use the complicated 2D block case rather than the easier 1D contiguous case.
User avatar
jar
 
Posts: 295
Joined: Mon Dec 17, 2012 3:27 am

Re: Using Epiphany External memory

Postby sebraa » Sun Oct 16, 2016 4:44 pm

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

Re: Using Epiphany External memory

Postby dekanutepederaz » Mon Oct 17, 2016 10:31 pm

jar, thank you for your reply, but I decided to keep on something much more simple. :)

So, I found the functions e_shm_alloc and e_shm_attach which can handle pretty well the allocation of memory into the shared memory. I even got them working. However, because I was migrating from Epiphany BSP to the plain Epiphany SDK, they got messed up all the times because Epiphany BSP was also writing in the shared memory.

So, now when I got almost everything working, I have a question: Is there something like ebsp_message or printf in the Epiphany SDK because it would be very beneficial if there was such a tool for debugging?
Also, do the problems with Epiphany BSP and e_shm_alloc seem real, or I may have errors in other part of my code?

Thank you in advance!!!
dekanutepederaz
 
Posts: 5
Joined: Thu Oct 13, 2016 10:20 pm

Re: Using Epiphany External memory

Postby jar » Tue Oct 18, 2016 2:11 am

I can't speak to EBSP, but COPRTHR-2 supports printf (host_print or phost_printf if all in parallel). The Epiphany SDK (ESDK) does not. Debugging intermediate results with the eSDK is not trivial.
User avatar
jar
 
Posts: 295
Joined: Mon Dec 17, 2012 3:27 am

Re: Using Epiphany External memory

Postby sebraa » Tue Oct 18, 2016 9:23 am

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

Re: Using Epiphany External memory

Postby dekanutepederaz » Wed Oct 19, 2016 5:09 pm

Thank you both sebra and jar!

I tried using the debugger, but it did not seem to go so well, so I just created a place in the shared memory where I write the messages from one of the cores. Thus I managed to debug some things. However, I have a new question. I create an arraru called solution[201] in each core and it contains the solution it has obtained. How can I access that array from the ARM core?

I found a way using memory addresses (like here: https://github.com/adapteva/epiphany-ex ... c/e_task.c), but with that addresses, how can I be sure that I am interfering with another variable, or array from my program?

Thank you in advance!!!
dekanutepederaz
 
Posts: 5
Joined: Thu Oct 13, 2016 10:20 pm

Re: Using Epiphany External memory

Postby sebraa » Thu Oct 20, 2016 8:40 pm

The e_read and e_write function can be used to access the shared memory or each core's memory. So if you know the address and the size of your "solution" array, you can copy it directly to the ARM with e_read.

To get the address, you have basically two options: Retrieve the address and tell the host program at runtime, or fix the address beforehand. With __attribute__((section(X)) you can put a variable (or array) into a specific section in the output file, and the linker script predefines some sections for each bank. Assuming that the linker assigns memory content from the bottom, and that your code is small enough, and assigning your array to bank 3, it will be located at address 0x6000. However, this is only slightly better than the solution from the example. It is better to add a fixed-position, fixed-size section to the linker script and assign only your array to it. Then you know the address also.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: Using Epiphany External memory

Postby jwbuurlage » Thu Nov 10, 2016 10:08 am

User avatar
jwbuurlage
 
Posts: 13
Joined: Sun Oct 26, 2014 11:41 am
Location: Utrecht, The Netherlands


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 17 guests