BAPCtools icon indicating copy to clipboard operation
BAPCtools copied to clipboard

Pin runs to core

Open RagnarGrootKoerkamp opened this issue 1 year ago • 1 comments

java and kotlin can use more cpu time than user time because they seem to do JIT in separate threads.

Pinning them to a single core would prevent that, probably using https://docs.python.org/3.7/library/os.html?highlight=affinity#os.sched_setaffinity.

Not super trivial because only testcase runs should be pinned, and not compilation. And we must make sure to never pin two runs to the same cpu. Also it's not clear to me yet whether we can pin processes directly on creation

RagnarGrootKoerkamp avatar Sep 20 '22 10:09 RagnarGrootKoerkamp

Simply putting the following in limit_setter works, but we need to only pin test cases, not compilations.

        # Pin everything to CPU 0 when only running 1 job in parallel.
        if pin and config.args.jobs == 1:
            os.sched_setaffinity(0, [0])

RagnarGrootKoerkamp avatar Sep 20 '22 10:09 RagnarGrootKoerkamp