Submit Your Ideas

We want to hear from you - vote for the features and improvements you'd most like to see, or submit your own ideas if you don't find them already listed.

Have `nproc` accurately reporter number of CPUs available to container

When spinning up multiple processes for parallel computing, it's useful to restrict the number of processes to the number of cpu cores available on a system in order to actually take advantage of those cores. However, knowing that number programmatically instead of hard-coding the value is as far as I can tell impossible.

For instance running the following code in a Node.js container will return `32`: `node -p "require('os').cpus().length"`. This is the same as Travis CI. But if we run `nproc` in Travis CI, we get the correct number (`2`) back, whilst on CIrcle we still get `32`.

 

So this is a feature request to make sure `nproc` returns the number of cores available to the container, and not the machine the container is running on.

 

---

 

An even better solution for my problem would be if the number of cores available to a build was injected as an environment variable, that way I can avoid doing a system call from my code. I can open up a separate feature request for that if you want?

  • Avatar32.5fb70cce7410889e661286fd7f1897de Guest
  • Aug 31 2018
  • Future consideration
  • Attach files
  • Avatar40.8f183f721a2c86cd98fddbbe6dc46ec9
    Guest commented
    August 31, 2018 07:13

    The environment variable might be covered by https://circleci.com/ideas/?idea=CCI-I-264