- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Is there a way to tag or identify threads from within a cilk_for loop?
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi
Without practice this lib (backend)..
I don't know is it help you ,
ps -AT giving all identifier , if i remember with my old head now...
(right is (fork (pid) repeated line) left is (sub) thread , ipc ....)
To decrease bottom level side learning:
read source utility ps and extract function just necessary for you
Strange that this function is not already existing with this lib ??
It would be possible to wrong the origin process with that you operate two side ...
regards
Without practice this lib (backend)..
I don't know is it help you ,
ps -AT giving all identifier , if i remember with my old head now...
(right is (fork (pid) repeated line) left is (sub) thread , ipc ....)
To decrease bottom level side learning:
read source utility ps and extract function just necessary for you
Strange that this function is not already existing with this lib ??
It would be possible to wrong the origin process with that you operate two side ...
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting Walter Shands (Intel)
Is there a way to tag or identify threads from within a cilk_for loop?
For tagging threads I use Thread Local Storage to contain a cardinal thread number.
Staticly initialize the variable with -1, then when you want the ID test value of TLS id variable, if .lt. 0 atomic incriment a variable used for the next ID and take the prior value (or incrimented value) and insert into the TLD id variable. Something like the following untested code.
__declspec(thread) long myThreadID = -1;
volatile long myNextThreadID = 0;
inline long getMyThreadID()
{
if(myThreadID >= 0)
return myThreadID;
myThreadID = InterlockedExchangeAdd(&myNextThreadID, 1);
return myThreadID ;
}
Jim Dempsey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page