LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 02-27-2014, 08:09 AM   #1
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Oprofile / Openmp strange result


I want to know whether the strange results I am seeing from Oprofile on a program using Openmp are a flaw in Oprofile (which is my best guess) or in Openmp (Intel 10 compiler) or in my program.

I am seeing wildly different numbers of Oprofile samples between threads that ought to be the same (in one function 100K samples vs. over 4 million).

The program has large sections that are single threaded and larger loops that are parallel with openmp. I set num_threads=6.

The major parallel loops each iterate at least 600K times when used and are each used at least 10K times. There is a moderate and fairly consistent amount of work in each step of each loop. So I would expect openmp to be able to very evenly distribute the work over six threads.

Across several very different loops, I see roughly the same distribution of samples across the six threads (roughly what I would expect if sampling were running at different rates on those six cores).

When I look with top, I often see the process taking 600% CPU time. If the sampling were correct, which includes two of those six threads hardly used, I would expect top to never see over 400% CPU time.

The machine has 12 actual cores, with hyperthreading enabled (I can't easily change that) so it thinks it has 24 cores. The task in question runs faster with num_threads=6 than 12 or 24. I assume that is because of cache contention.

Is hyperthreading somehow distorting the sampling? I am trying to improve the performance of this program for users who would never have hyperthreading turned on. But the machine I have available to test on does have hyperthreading on.

In functions that are entirely parallel, the first thread (the one that runs all the non parallel code) is the fourth most sampled of the six threads. It is over ten times the smallest and under a third of the largest.

My best guess is that the parallel loops are evenly distributed across the six threads and I don't need to fix that in my program or in Openmp. That means Oprofile is giving me wildly distorted info. So how do I use profiling to find the parts of the program to improve?

Other profiling tools that instrument call points and give call graph timing are useless for this project. Only random sampling based profiling has any chance of giving useful results, but only if I understand whatever systematic distortions are present.

Edit: I got IT to turn off hyperthreading on an identical system and the reporting of Oprofile samples by thread is even more distorted on that system (still using num_threads=6).

Last edited by johnsfine; 02-27-2014 at 12:35 PM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
C/C++ Hybrid[MPI + OpenMP] Programming in Linux: mpicc -openmp bdboy Programming 0 03-20-2013 04:44 AM
Using oprofile on Centos Linux Unable to complete dump of oprofile data Frank36 Linux - Newbie 0 04-26-2011 12:42 PM
OpenMP & C/C++: Parallel loop w/shared total result Pearlseattle Programming 0 08-26-2009 11:57 AM
strange traceroute result yongitz Linux - Networking 0 06-05-2006 10:23 PM
Strange CD Burning Result liaohaohui Linux - Hardware 6 08-28-2003 02:58 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration