dot product

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Re: dot product

Postby aihaike » Tue Sep 16, 2014 10:21 pm

I thought this path was relative to where the binaries are located, but it seem to be relative to where you actually execute the code.
Thank you for pointing out.
User avatar
aihaike
 
Posts: 31
Joined: Wed Aug 06, 2014 5:41 am
Location: Shanghai, China

Re: dot product

Postby bayalievu » Wed Dec 03, 2014 7:02 am

I was trying to run dotproduct example bu encountered error below:
Code: Select all
linaro-nano:~/epiphany-examples/apps/dotproduct/bin> ../run.sh
e-reset: e_init(): EPIPHANY_DEV file open failure.
e-reset: e_init(): Failed to initialize the Epiphany Shared Memory Manager.
e-reset: ee_write_esys(): EPIPHANY_DEV file open failure.
e-reset: e_open(): Platform was not initialized. Use e_init().
e-reset: e_reset_system(): e_open() failure.
e-reset: e_finalize(): Platform was not initiated.
Calculating sum of products of two integer vectors of length 4096 initalized to all 0x1's using 16 Ccores.
........
main.elf: e_init(): EPIPHANY_DEV file open failure.
main.elf: e_init(): Failed to initialize the Epiphany Shared Memory Manager.
main.elf: ee_write_esys(): EPIPHANY_DEV file open failure.
main.elf: e_open(): Platform was not initialized. Use e_init().
main.elf: e_reset_system(): e_open() failure.
main.elf: e_get_platform_info(): Platform was not initialized. Use e_init().
main.elf: e_open(): Platform was not initialized. Use e_init().
main.elf: e_alloc(): Platform was not initialized. Use e_init().
main.elf:
ERROR: Can't allocate external memory buffer!


Does anyone have idea about this error?
bayalievu
 
Posts: 1
Joined: Mon Nov 24, 2014 7:15 am

Re: dot product

Postby 9600 » Wed Dec 03, 2014 12:25 pm

bayalievu wrote:
Code: Select all
linaro-nano:~/epiphany-examples/apps/dotproduct/bin> ../run.sh
e-reset: e_init(): EPIPHANY_DEV file open failure.


This sounds like it's trying to access /dev/epiphany and it cannot due to either permissions or the device not existing. The latter being a symptom of not running a more recent kernel that includes the Epiphany driver.

Regards,

Andrew
Andrew Back (a.k.a. 9600 / carrierdetect)
User avatar
9600
 
Posts: 997
Joined: Mon Dec 17, 2012 3:25 am

Re: dot product

Postby Urhixidur » Fri Feb 13, 2015 4:47 pm

There are two other latent bugs in the code.

It checks for task completion with:
Code: Select all
if (all_done == 16) {

instead of
Code: Select all
if (all_done == CORES) {


It checks for task success with:
Code: Select all
if (sop == 4096) {

instead of
Code: Select all
if (sop == N) {
User avatar
Urhixidur
 
Posts: 16
Joined: Mon Jan 19, 2015 7:19 pm
Location: Québec, QC, Canada

Re: dot product

Postby Urhixidur » Fri Feb 13, 2015 7:18 pm

manklee wrote:You HAVE to run it in the bin directory because of this line of code:

e_load_group("e_task.srec", &dev, 0, 0, platform.rows, platform.cols, E_TRUE);

What is astounding here is that the build script does cd to its EXEPATH, so why is it the run script doesn't do the same? All that is needed to make it runnable everywhere is to add:
Code: Select all
cd $EXEPATH/bin

just before the
Code: Select all
sudo -E LD_LIBRARY_PATH=${ELIBS} EPIPHANY_HDF=${EHDF} $EXEPATH/bin/main.elf 0 0 4 4 0x12345678

line. Which can then be simplified to:
Code: Select all
sudo -E LD_LIBRARY_PATH=${ELIBS} EPIPHANY_HDF=${EHDF} ./main.elf 0 0 4 4 0x12345678
User avatar
Urhixidur
 
Posts: 16
Joined: Mon Jan 19, 2015 7:19 pm
Location: Québec, QC, Canada

Re: dot product

Postby smatthews » Wed Jul 08, 2015 1:43 pm

I've updated the dot-product program that generalizes the example to sop of i = 0 .. N-1
This better illustrates how to achieve task-based parallelism on the Epiphany architecture. The new code is now accessible from the repo.

If you modify this example, please recognize that you will need to update RESULT in main.c to correspond with the N that you use in common.h. Currently N=64 and RESULT=85344.
The equation to use is
RESULT = ( N(N-1)(2N-1) )/6

I've run into troubles with N > 1024. Still looking for a way to fix this.

Best,
Suzanne
smatthews
 
Posts: 13
Joined: Fri Mar 13, 2015 7:04 pm

Re: dot product

Postby MiguelTasende » Thu Jul 16, 2015 6:58 pm

Hi Suzanne,

I read your tutorial, and made my own modifications to the dotproduct code... (tried to do so before reading your answers :) ).
I fixed all the bugs almost the same way as you did, and finally could work with a=b=1:2048 (or 0:2047 whatever...), but couldn't solve the 4096 problem.

I still don't quite get it. I am working with "unsigned long" now, instead of "unsigned int". I see that some of the results go beyond what is manageable with 32 bits and I assume there is the problem...
But, I am working with "unsigned long" (host and device side), and Epiphany supports it, so I assume it correctly multiplies two unsigned long. Maybe my lack of C experience with large integers has something to do with it...
Well, the result is clearly less than 2^64, so if all long operations are working ok, I can't see where the problem is...

I'll try to see it later, now I will follow other paths in my "research", but will keep the problem in mind, and if anyone could generously help with a tip... I would be most grateful :)
MiguelTasende
 
Posts: 51
Joined: Tue Jun 30, 2015 12:44 pm

Re: dot product

Postby MiguelTasende » Thu Aug 06, 2015 2:05 pm

Thinking about another problem now I may have an idea of where the problem may be.
It's not the capacity of the single "long", but the amount of them...

4 bytes (at least) per long
2048 longs
-----------------------------------
= 8192 = 8KB = the size of a memory bank

Above that it doesn't work correctly.

I think the problem is with memory management (should look at the linker script to see the memory allocation).
MiguelTasende
 
Posts: 51
Joined: Tue Jun 30, 2015 12:44 pm

Re: dot product

Postby smatthews » Mon Aug 24, 2015 6:45 pm

Hi Miguel,

I think your last post gets to the heart of what I suspect to be the case as well.

The individual memory banks are 8KB. If we exceed the capacity of the memory banks, I believe the answer is to fetch from main memory. However, operations like this on the DMA channel is expensive. I think that one thing this example illustrates is that the Parallella exceeds at pure task parallelism. There are some limitations to data parallelism.

-Suzanne
smatthews
 
Posts: 13
Joined: Fri Mar 13, 2015 7:04 pm

Re: dot product

Postby sebraa » Tue Aug 25, 2015 6:20 pm

smatthews wrote:The individual memory banks are 8KB. If we exceed the capacity of the memory banks, I believe the answer is to fetch from main memory.
The memory banks do not matter at all, unless you want to maximize performance. Since all banks are contiguous, you can treat the whole memory as a single bank of 32 KB; the linker knows about this.

If you try to statically allocate (that is, as a global variable outside a function) more memory than is available, the linker will fail to link the executable. Also you should think about your stack usage to rule out overflowing memory.

smatthews wrote:However, operations like this on the DMA channel is expensive.
Between cores, DMA is slower if you transmit less than a (few) hundred bytes.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

PreviousNext

Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 15 guests

cron