Multithreaded RCC workers

TM
Travis Murphy
Fri, Mar 15, 2019 5:55 PM

I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker?

Thanks,

Travis Murphy

I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker? Thanks, Travis Murphy
CH
Chris Hinkey
Fri, Mar 15, 2019 6:06 PM

Each RCC container is its own thread.  But using ocpirun you can spawn multiple RCC Containers using the -n  option where you can specify how many RCC containers to create on the physical CPU.  This would mean if you have 10 RCC workers you could run them on 3 different containers by using -n 3.


From: discuss discuss-bounces@lists.opencpi.org on behalf of Travis Murphy via discuss discuss@lists.opencpi.org
Sent: Friday, March 15, 2019 1:55 PM
To: discuss@lists.opencpi.org
Subject: [Discuss OpenCPI] Multithreaded RCC workers

I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker?

Thanks,

Travis Murphy

Each RCC container is its own thread. But using ocpirun you can spawn multiple RCC Containers using the -n option where you can specify how many RCC containers to create on the physical CPU. This would mean if you have 10 RCC workers you could run them on 3 different containers by using -n 3. ________________________________ From: discuss <discuss-bounces@lists.opencpi.org> on behalf of Travis Murphy via discuss <discuss@lists.opencpi.org> Sent: Friday, March 15, 2019 1:55 PM To: discuss@lists.opencpi.org Subject: [Discuss OpenCPI] Multithreaded RCC workers I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker? Thanks, Travis Murphy
JK
James Kulp
Fri, Mar 15, 2019 7:18 PM

Chris's solution is what is available today.
Each container "has" a thread which it uses to run its workers.

Workers can be implicitly or explicitly placed in containers, which
means they share that container's thread.

There is an enhancement that is very preliminary (done in a separate
research project) and neither documented nor recently tested, which
provides a container with a thread pool and allows workers to be written
in the "work queue" style of CILK or Apple Grand Central dispatch.  This
allows each worker to have internal parallelism.  If you are interested
and adventuresome I could give you pointers.  Guaranteed to be somewhat
incomplete and for experimentation only (no guarantee of stability or
future support).

There is another more obvious enhancement (no implementation that I am
aware of) that allocates a thread pool to a container and allows
multiple normal workers to be executed across this pool of threads. 
This has been repeated discussed, but never was one of the most
important things to attack.  It would exploit the current architecture
so that no code changes would be necessary, but would add another option
like what Chris mentioned, but instead of the number of containers to
run, it would be the number of threads to provide in a given container.

The single threaded container model allowed us to run a container and
its workers on a bare processor (DSP or microcontroller?) that did not
have OS or threading support.

Probably more than you wanted to know.....

On 3/15/19 2:06 PM, Chris Hinkey wrote:

Each RCC container is its own thread.  But using ocpirun you can spawn multiple RCC Containers using the -n  option where you can specify how many RCC containers to create on the physical CPU.  This would mean if you have 10 RCC workers you could run them on 3 different containers by using -n 3.


From: discuss discuss-bounces@lists.opencpi.org on behalf of Travis Murphy via discuss discuss@lists.opencpi.org
Sent: Friday, March 15, 2019 1:55 PM
To: discuss@lists.opencpi.org
Subject: [Discuss OpenCPI] Multithreaded RCC workers

I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker?

Thanks,

Travis Murphy

Chris's solution is what is available today. Each container "has" a thread which it uses to run its workers. Workers can be implicitly or explicitly placed in containers, which means they share that container's thread. There is an enhancement that is very preliminary (done in a separate research project) and neither documented nor recently tested, which provides a container with a thread pool and allows workers to be written in the "work queue" style of CILK or Apple Grand Central dispatch.  This allows each worker to have internal parallelism.  If you are interested and adventuresome I could give you pointers.  Guaranteed to be somewhat incomplete and for experimentation only (no guarantee of stability or future support). There is another more obvious enhancement (no implementation that I am aware of) that allocates a thread pool to a container and allows multiple normal workers to be executed across this pool of threads.  This has been repeated discussed, but never was one of the most important things to attack.  It would exploit the current architecture so that no code changes would be necessary, but would add another option like what Chris mentioned, but instead of the number of containers to run, it would be the number of threads to provide in a given container. The single threaded container model allowed us to run a container and its workers on a bare processor (DSP or microcontroller?) that did not have OS or threading support. Probably more than you wanted to know..... On 3/15/19 2:06 PM, Chris Hinkey wrote: > Each RCC container is its own thread. But using ocpirun you can spawn multiple RCC Containers using the -n option where you can specify how many RCC containers to create on the physical CPU. This would mean if you have 10 RCC workers you could run them on 3 different containers by using -n 3. > > > ________________________________ > From: discuss <discuss-bounces@lists.opencpi.org> on behalf of Travis Murphy via discuss <discuss@lists.opencpi.org> > Sent: Friday, March 15, 2019 1:55 PM > To: discuss@lists.opencpi.org > Subject: [Discuss OpenCPI] Multithreaded RCC workers > > > I was noticing that my RCC workers are all running as a single thread. I looked at the OpenCPI RCC Development guide and it suggests that the Container is in charge of handing out threads and threads should not be made in the worker itself. Looking through RccComponent.cc though I could not find anything other than the dispatch routine which runs the RCC workers one at a time. Is there currently support for multi-threading RCC workers in the RCC container in the current 1.4 release of the framework? If so, how is it enabled in a worker? > > > > Thanks, > > Travis Murphy >