libgomp: Thread creation failed: Invalid argument after disabling/enabling CPUs

1k Views Asked by At

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.

1

There are 1 best solutions below

0
On

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.