I have the following environment variable set in my machine with an i7-4790K (4 cores, 8 threads):
export OMP_NUM_THREADS=4
When I run the program compiled using ifort, a total of 5 processes are spawned, one 'master'& four 'slaves' with master at 400% CPU, 3 slaves at 100% CPU each and one of the slaves at 0% (CPU & time both 0). This is as seen below.
On the other hand, when I use gfortran, it only spawns 4 processes: 1 'master' and 3 'slave', with each slave at 100% CPU and master at 400%
Does anyone know why?
Also, a slightly related question; I've heard that for well written (properly parallelized) code, utilizing hyper-threads is pointless and sometimes detrimental. This is why I set it to spawn 4 processes. But does it matter which thread of a core is used? i.e., is one thread of a core the main one and the other auxiliary?
So should I set the KMP_AFFINITY or GOMP_CPU_AFFINITY environment variables?