OpenMP threads and cores on OS X 10.9.3

OpenMP threads and cores on OS X 10.9.3

I have an OpenMP code that is compiled with ifort version on a quad-core Macbook Pro running OS X 10.9.3.   All the work is done in a simple parallel DO region, and I have not requested any sort of dynamic thread management; the number of threads is fixed with OMP_NUM_THREADS=4.  The program works fine, and the "top" utility shows 4 running threads when the program is executing.  However, the cpu usage shows only 50%.  Is this an artifact of top's sampling algorithm, or are only two cores actually executing all the threads?  Is this an o/s limitation or is there some environment or kernel configuration issue that I am missing?  Any suggestions appreciated.  Thanks! 


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

Is the work in the parallel DO region equal amongst threads?

Jim Dempsey

If you have HyperThreading active, 4 threads on 4 cores are expected to show 50% usage even if you may be getting the full performance of the platform.  I don't know whether any Macbook has HT; you can look up your CPU model on

If you don't set an affinity option, chances are some cores will be running 2 threads.  For example, your compiler library should support OMP_PROC_BIND = spread which would be one of the options for spreading 4 threads across 4 cores, which would usually improve performance

On a single quiad-core CPU, if you don't set affinity, disabling HT may improve performance, besides enabling you to see "100%" usage with 4 threads.

Leave a Comment

Please sign in to add a comment. Not a member? Join today