Starting multiple tasks

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Starting multiple tasks

Postby Krisania » Thu Sep 14, 2017 2:33 pm

Hi,
what I'm trying to do is run two seperate tasks (with two srec files) on the epiphany cores divided (half for each task).
Both tasks run fine when run on their own on all cores however when I try to run them silmutaneously half the cores (I think always the first half) never finish the execution.

Here is my project: https://github.com/Krisania/parallellanokiss

and here is the part of the code that loads and runs the cores (perhaps the problem is here?):
Code: Select all
  e_open(&dev, 0, 0, platform.rows, platform.cols); //open workgroup

  e_load_group("e_fft_task.elf", &dev, 0, 0, 4, 4, E_FALSE);

  //e_load_group("e_huf_task.elf", &dev, 0, 0, 2, 4, E_FALSE);
  //e_load_group("e_fft_task.elf", &dev, 2, 0, 2, 4, E_FALSE);

  // start cores
  e_start_group(&dev);


Now, the first load is working fine with either task, but if I erase it and uncomment the next ones the execution never finishes. Any ideas as to what I'm doing wrong?
Krisania
 
Posts: 6
Joined: Tue Jul 25, 2017 2:36 pm

Re: Starting multiple tasks

Postby claudio4parallella » Fri Sep 15, 2017 1:57 am

from my experience, your code looks to me with 2 issues:

- you are waiting for all 16 cores done even if you would start only two of them: check its individual done flag;

- I use e_load(...) for single core task upload, even if I upload a different task but to all the 16 cores. I've to check how to work only with a subset of cores

do these statements work for you?
claudio4parallella
 
Posts: 68
Joined: Thu Aug 10, 2017 3:48 pm

Re: Starting multiple tasks

Postby olajep » Sat Sep 16, 2017 4:18 pm

I don't think anything is wrong with the libraries since we have a couple of examples that does exactly this.
One example:
https://github.com/adapteva/epiphany-ex ... .c#L60-L68


The mailbox must be volatile since it's shared among Epiphany cores and/or the host
https://github.com/Krisania/parallellan ... ask.cpp#L6

You should use explicit primitive data types and padding for structs shared between the host and epiphany

E.g.:
Code: Select all
#include <cstdint>
typedef struct
{
    int32_t inputnum[NUM_OF_DIFS];
    double result[NUM_OF_DIFS];
    int32_t flag[CORES];
} Mailbox __attribute__((packed)) __attribute__((align(8)));


Debugging tips:
1. Compile with debugging symbols (-g)
2. Disable compiler optimizations (-O0)
3. print the done flags to see which cores are not done
4. Run e-dump-regs from a different console to check where the program counter points
5. Use e-objdump -d e-binary.elf | less to find out in which function that is
6. Use gdb. See https://github.com/parallella/parallell ... b-tutorial

HTH,
Ola
_start = 266470723;
olajep
 
Posts: 139
Joined: Mon Dec 17, 2012 3:24 am
Location: Sweden

Re: Starting multiple tasks

Postby Krisania » Tue Sep 19, 2017 2:53 pm

Thanks a lot for the help. Now prepare to be amazed of how little I know yet ;)

olajep wrote:I don't think anything is wrong with the libraries since we have a couple of examples that does exactly this.
One example:
https://github.com/adapteva/epiphany-ex ... .c#L60-L68


The mailbox must be volatile since it's shared among Epiphany cores and/or the host
https://github.com/Krisania/parallellan ... ask.cpp#L6

You should use explicit primitive data types and padding for structs shared between the host and epiphany

E.g.:
Code: Select all
#include <cstdint>
typedef struct
{
    int32_t inputnum[NUM_OF_DIFS];
    double result[NUM_OF_DIFS];
    int32_t flag[CORES];
} Mailbox __attribute__((packed)) __attribute__((align(8)));



Ok, I changed my types to be explicit primitive data types as you stated, and made the mailbox volatile in the device task files. My two problems with this are: First, the align attribute is giving me a warning that it is ignored. Second, should the volatile part only apply to the core files and not the host one? Cause if I change the host mailbox I'm getting errors for invalid conversion (from const to volatile).

olajep wrote:Debugging tips:
1. Compile with debugging symbols (-g)
2. Disable compiler optimizations (-O0)
3. print the done flags to see which cores are not done
4. Run e-dump-regs from a different console to check where the program counter points
5. Use e-objdump -d e-binary.elf | less to find out in which function that is
6. Use gdb. See https://github.com/parallella/parallell ... b-tutorial

HTH,
Ola


1,2,3 done and what really baffles me is that the first 8 cores are the ones that never end, no matter what their task is (I exchanged the 2 tasks between the first and second group and only the first ones don't complete)
Now, as far as the rest go you got me a bit out-of-depth.
When I run #4 and check the pc reg I get 0x00000194. Running the obj-dump next what should I be checking?
If I assume correct this is the part we want?
Code: Select all
00000178 <bss_done>:
 178:   510b 0012       mov r2,0x188
 17c:   400b 18e2       movt r2,0x8e00
 180:   4844            ldr r2,[r2]
 182:   3c0b 0042       mov r1,0x4e0
 186:   200b 1002       movt r1,0x0
 18a:   681b 002a       add r3,r2,336
 18e:   081b 0029       add r0,r2,328
 192:   6054            str r3,[r0]
 194:   0023            mov r0,0x1
 196:   4ce2            mov r2,r3
 198:   6a1b 0000       add r3,r2,4
 19c:   0c54            str r0,[r3]
 19e:   681b 0001       add r3,r2,8
 1a2:   2c54            str r1,[r3]
 1a4:   1fcb 0ff2       mov r0,0xfffe
 1a8:   050f 0402       movts imask,r0
 1ac:   174b 0012       mov r0,0x1ba
 1b0:   000b 1002       movt r0,0x0
 1b4:   010f 0402       movts iret,r0
 1b8:   01d2            rti

I'm currently trying to figure out the gdb so no progress in that yet.
Krisania
 
Posts: 6
Joined: Tue Jul 25, 2017 2:36 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 1 guest

cron