Unable to set the OpenMP threads affinity in a forked process

view full story

http://stackoverflow.com – I am trying to run two processes on separate CPUs using openMP. In this case each CPU has 6 cores with hyper-threading (so 12 hardware threads). They need to do some synchronization which seems some what easier if they know each other's PID. So I am starting a process sigC from sigS using a fork() and execve() called with a different value for the GOMP_CPU_AFFINITY environment variable. After the fork()/execve() call, sigS has the correct affinity still but sigC prints libgomp: no cpus left for affinity setting and all threads are on the same core. The code of sigS: #define _GNU_SOURCE #i (HowTos)