Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29276 Discussions

Forcing paralelization on same phisical processor

casso__pau
Beginner
701 Views
Hi

We have a scenario where an aplication runs in a single thread in serial mode (no paralelization at all). In a Xeon 2 x quad processors we have 8 of this applications running simultaneously, one in each core. now, as this Xeon processors have hyperthreading we would like to see if we can improve speed by paralelizing this application in 2 threads (either by using compiler automatic loop paralelization or openmp) and take advantage of the 8 "hyperthreaded" remaining cores. The problem is that we would like to ensure that each application uses only the two virtual processors of the same phisical core and does not use other phisical cores. We are using Debian runnin kernel 2.6.30-1-amd64 SMP and applications are attached to cores using sched_setaffinity

Is that something that can only be handled at OS level or can be forced someway while compiling ?
0 Kudos
4 Replies
TimP
Honored Contributor III
701 Views
I don't see the problem in using sched_setaffinity or OpenMP/KMP_AFFINITY to make 2 threads run on the same core. If you view the 2 logicals on one core as having the effect of multiple cores, you may be disappointed.
0 Kudos
mriedman
Novice
701 Views
David,

thread affinity does not require specific compilation. You either do it in you program as you did with sched_setaffinity, or you use KMP_AFFINITY=compact which will place your threads as close together as possible.

With a well parallelized programI have measured around 7% speedupby hyperthreading. This can only be achieved as long as the threads are placed on the same core (as you intend) which lets them share all the caches. If that is not the case you'll observe significant slowdowns.

Michael
0 Kudos
casso__pau
Beginner
701 Views
Is then possible using compiler PGO automatically have the loops that are slower when paralellized not being paralellized ?
0 Kudos
TimP
Honored Contributor III
701 Views
That looks like a loaded question. If PGO doesn't help you, you needn't use it. There are many reasons why parallelization might not help, not limited to insufficient parallel work, inadvisable affinity or lack of, race conditions which you may be hoping to deal with by affinity, ....
0 Kudos
Reply