Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Student
Beginner
25 Views

Multithreading on multicore, profiling with VTune

Hi guys,

I am trying to run 8 different threads on 8 different cores. So my CPU time is greater than my elapsed time. One of the threads is taking a very long time when compared to the other 7. These 7 threads are taking up almost the same time with a very minute difference. I have attached a screenshot of this. Can someone please tell me why this one particular thread is taking this extra time? 

Thanks!

0 Kudos
7 Replies
Peter_W_Intel
Employee
25 Views

"One particular thread" you side is responsible for creating 7 other threads by using OpenMP* library, before running parallel task on 8 threads/cores. It will take some time to initialize - I call it "main thread". Main thread also is responsible for fork-join, then exit program.

Because whole program only ran a few minutes, it seemed that main thread was particular long. However if you use big task set, the time of main thread's will not seem long. Note that main thread also will run parallel-work, the role is same 7 other threads (beside initialize & fork-join, or threads' communication/control, maybe) 

Bernard
Black Belt
25 Views

It seems that _start thread is the main thread and as Peter hinted it is performing thread spawning work.Usually on Windows creating new thread is time consuming activity.Probably creating new thread in Linux is also time consuming operation.

Bernard
Black Belt
25 Views

@Peter

Could OpenMP multithreading contribute to the thread creation overhead?.As far as I understand OpenMP library  threads are using at the runtime native OS threads to perform their work.

David_A_Intel1
Employee
25 Views

There's no reason to assume there is any overhead in these results.  The main thread simply didn't execute the multi-threaded code until the 1.8s mark.  I see nothing wrong with this picture. :\

Bernard
Black Belt
25 Views

 

I meant overhead of creating the threads,but I do not think that this operation could consume <=1.8 second.So probably _start thread was performing different tasks after spawning the threads.

Peter_W_Intel
Employee
25 Views

> Could OpenMP multithreading contribute to the thread creation overhead?.

Absolutely, there is overhead but I think it is not high. The best performance is to access OS thread via Win Thread API or pthread directly - but OpenMP is good at programming, you know:-)

Bernard
Black Belt
25 Views

Completely agree.