Announcement

Collapse
No announcement yet.

How to set $NUM_CPU_CORES

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to set $NUM_CPU_CORES

    How to I set $NUM_CPU_CORES to control the number of threads started for a multi-threaded benchmark? I thought the following would work but it doesn't:

    $ env NUM_CPU_CORES=2 phoronix-test-suite diagnostics | grep NUM_CPU_CORES
    NUM_CPU_CORES = 4

  • #2
    Originally posted by JohnNeil View Post
    How to I set $NUM_CPU_CORES to control the number of threads started for a multi-threaded benchmark? I thought the following would work but it doesn't:

    $ env NUM_CPU_CORES=2 phoronix-test-suite diagnostics | grep NUM_CPU_CORES
    NUM_CPU_CORES = 4
    Hi JohnNeil and welcome. At the moment, NUM_CPU_CORES isn't checked by the environment outside of PTS, but I may end up offering it seeing as a few others have expected similar behavior when wanting to toggle the number of CPU cores/threads exposed for testing. But anyhow, with all current versions of PTS you can use either the PTS_NPROC environment variable or NUMBER_OF_PROCESSORS environment variable to influence the value of NUM_CPU_CORES set by PTS for test scripts. Either of those variables should work without any difference between then (PTS_NPROC just being our custom one and NUMBER_OF_PROCESSORS checked anyhow as a fallback since that is exported on Windows).
    Michael Larabel
    http://www.michaellarabel.com/

    Comment


    • #3
      Quick follow-up... To PTS Git (8.4.1 next week) I did add support for NUM_CPU_CORES similar to PTS_NPROC / NUMBER_OF_PROCESSORS, so moving forward for those that naturally expected to be able to use that env var for overriding the count can do so.

      https://github.com/phoronix-test-sui...6934defc66abfd
      Michael Larabel
      http://www.michaellarabel.com/

      Comment


      • #4
        Thanks for the quick follow up. I'm not seeing $NUMBER_OF_PROCESSORS or $PTS_NPROC affect the core count in the compress-7zip benchmark I am testing in PTS 8.4.0:

        $ NUMBER_OF_PROCESSORS=1 phoronix-test-suite benchmark compress-7zip
        ...
        Core Count: 4

        Do tests have to have explicit support for these env vars for this to work to control the number of parallel threads?

        Comment


        • #5
          Originally posted by JohnNeil View Post
          Thanks for the quick follow up. I'm not seeing $NUMBER_OF_PROCESSORS or $PTS_NPROC affect the core count in the compress-7zip benchmark I am testing in PTS 8.4.0:

          $ NUMBER_OF_PROCESSORS=1 phoronix-test-suite benchmark compress-7zip
          ...
          Core Count: 4

          Do tests have to have explicit support for these env vars for this to work to control the number of parallel threads?
          Have you tried other tests besides compress-7zip? Looking at the test profile source [https://openbenchmarking.org/innhold...bfb0fc1bea389] it isn't passing any NUM_CPU_CORES to PTS. Normally PTS will use any --threads/-T argument etc for explicitly passing NUM_CPU_CORES to the upstream program where relevant. When checking the 7za man page [https://linux.die.net/man/1/7za] I am not seeing any argument for passing the threads to use to the program. If there is some argument, happy to update compress-7zip to use the explicit NUM_CPU_CORES.

          But yeah if you are able to try with a test profile that does use NUM_CPU_CORES to verify the workflow is working out for you, that would be great. Thanks.
          Michael Larabel
          http://www.michaellarabel.com/

          Comment

          Working...
          X