Threads inside cores

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Threads inside cores

Postby Nightingale » Thu Oct 02, 2014 12:32 pm

Hello. I have a source code for that I need to load into a core, but that code needs threading support.
When I try to compile the threaded code with e-gcc command it tells me that pthread_t does not denote a type. Is there a way to compile it without removing threads from the code?
Nightingale
 
Posts: 11
Joined: Fri Sep 19, 2014 11:38 am

Re: Threads inside cores

Postby sebraa » Mon Oct 06, 2014 12:53 pm

Epiphany currently does not support multi-threading inside each core. Is there a reason you need real multi-threading? Each thread needs a stack, and memory is extremely limited. You might take a look at Coroutines or other ways to interleave code, but that will definitely need changes in your code.
sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: Threads inside cores

Postby jeremybennett » Mon Oct 06, 2014 6:38 pm

Nightingale,

I'd strongly recommend restructuring the code so you put one thread on each core. I'm not sure that you could get a useful pthreads library onto an Epiphany core.

Sebraa's suggestion for coroutines is a good one if you don't need pre-emption. They can be implemented very efficiently, although you still have the challenge of managing multiple stacks.

Jeremy
User avatar
jeremybennett
 
Posts: 61
Joined: Mon Dec 17, 2012 9:06 am

Re: Threads inside cores

Postby Nightingale » Tue Oct 07, 2014 8:05 am

Ok, thnx. Ended up doing just that.
It's not that I needed threads, I just hoped I didn't have to modify the code, since the library I'm parallelising is slightly convoluted.
Nightingale
 
Posts: 11
Joined: Fri Sep 19, 2014 11:38 am


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 10 guests

cron