create threads from thread in hierarical fashion

General OpenMP discussion

create threads from thread in hierarical fashion

Postby open_coder » Sun Dec 30, 2018 10:00 pm

I want to create thread as follow
Initially single thread will run, as a whole, further this threads spitted into two threads say thread_0 and thread_1, now further threads_1 spitted in to multiple threads i.e, thread_2, thread_3 ...,
and further based on condition kill some threads while rest allow to run. as depicted in figure below.

|---------> thread_0------------------------------------------------------------------------------------->|
(process starts here) thread_0 ---->| |----------> thread_1----------| |
|----------> thread_1 --------->|----------> thread_2----------| (killed here) |
|----------> thread_3----------| | -------------> (process terminates here)
|----------> thread_4---------------------------------------------->|
|----------> thread_5---------------------------------------------->|

Is it possible to create threads and terminated above manner using openmp. 8-)
figure represented flow of threads creation and cancellation
Uu.jpg (33.88 KiB) Viewed 52 times
Posts: 8
Joined: Mon Oct 29, 2018 9:42 pm

Re: create threads from thread in hierarical fashion

Postby MarkB » Mon Jan 07, 2019 9:12 am

The short answer is no: you can create threads in a hierarchy of teams using nested parallel regions, but once a team of threads has been created you cannot kill off a subset of them before the end of that parallel region. What is your use case? There may be other ways of handling it using OpenMP.
Posts: 771
Joined: Thu Jan 08, 2009 10:12 am
Location: EPCC, University of Edinburgh

Return to Using OpenMP

Who is online

Users browsing this forum: No registered users and 6 guests