Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)
4974 Discussions

Multithreading on multicore, profiling with VTune

Student
Beginner
433 Views

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
433 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) 

0 Kudos
Bernard
Valued Contributor I
433 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.

0 Kudos
Bernard
Valued Contributor I
433 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.

0 Kudos
David_A_Intel1
Employee
433 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. :\

0 Kudos
Bernard
Valued Contributor I
433 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.

0 Kudos
Peter_W_Intel
Employee
433 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:-)

0 Kudos
Bernard
Valued Contributor I
433 Views

Completely agree.

0 Kudos
Reply