0

I've a 2 socket machine, each with 14 cores and hyper-threading enabled - thereby total 14*2*2 = 56 processing units or logical CPUs.

I disabled all odd numbered CPUs(1, 3, 5, 7, ..., 53, 55) by doing:

  for i in {1..55..2}; do echo 0 > /sys/devices/system/cpu/cpu$i/online; done

  /sys/devices/system/cpu/online shows 0 2 4 6 ... 52 54

Now, whenever I'm trying to create multiple threads(=28) using OpenMP I'm getting following error:

  libgomp: Thread creation failed: Invalid argument

I revert it back by doing:

  for i in {1..55..2}; do echo 1 > /sys/devices/system/cpu/cpu$i/online; done

  /sys/devices/system/cpu/online shows 0-55

Still, I'm getting the same error.

Any thoughts?

Edit: Code was working fine for any number of threads before I did the above experiments.

MrA
  • 1
  • 2
  • If you are trying to run 1 thread per core, it seems that thread placement is only advisory, and that it is better simply to set GOMP_CPU_AFFINITY mask, if your target is one for which libgomp supports affinity. If not, you must be prepared to accept any thread to logical cpu assignment. – tim18 Aug 19 '17 at 21:15
  • I believe it's not about affinity. It's just unable to run at all for more than 1 thread. Possibly it couldn't see any other CPU apart from CPU0 (which can't be disabled at all). I don't know if disabling/enabling CPUs have any impact on or wipe out any OpenMP environment variables. couldn't find any article either. – MrA Aug 19 '17 at 22:06

1 Answers1

0

Even after enabling the CPUs again, the number of OMP threads was just half (since I disabled odd ones).

Solution: I had to restart the servers at the end. After this, everything works fine.

MrA
  • 1
  • 2