Fake number of CPUs

Would it be possible to create imaginary high number to CPUs (lets say 4X the hardware CPUs) so that my parallel programs are faster?
Thanks.

It’s not something we’re likely to allow in LXD/LXCFS as it’d contain invalid cpu ids that’d then fail when processes attempt to pin on those.

But if your problem is some buggy piece of software which looks at /proc/cpuinfo and then spawns a thread per CPU, you could just do something like:

  • cat /proc/cpuinfo > /root/my-cpuinfo
  • vim /root/my-cpuinfo
  • mount --bind /root/my-cpuinfo /proc/cpuinfo

Which would let you put whatever you want in there.