Page 1 of 1

Threads inside cores

PostPosted: Thu Oct 02, 2014 12:32 pm
by Nightingale
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?

Re: Threads inside cores

PostPosted: Mon Oct 06, 2014 12:53 pm
by sebraa
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.

Re: Threads inside cores

PostPosted: Mon Oct 06, 2014 6:38 pm
by jeremybennett
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

Re: Threads inside cores

PostPosted: Tue Oct 07, 2014 8:05 am
by Nightingale
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.