Skip to content

Optionally parallelize the testsuite#729

Merged
tannewt merged 9 commits into
adafruit:masterfrom
jepler:tests-parallel-circuitpython
Mar 31, 2018
Merged

Optionally parallelize the testsuite#729
tannewt merged 9 commits into
adafruit:masterfrom
jepler:tests-parallel-circuitpython

Conversation

@jepler
Copy link
Copy Markdown

@jepler jepler commented Mar 31, 2018

On my laptop with a 4-thread, 2-core CPU, this reduces the elapsed time taken to run the tests by about 50%. Here are some timings, though they're actually of micropython, not circuitpython:

Elapsed time, seconds, best of 3 runs with each -j value:

before patchset: 18.1
            -j1: 18.1
            -j2: 11.3  (-37%)
            -j4:  8.7  (-52%)
            -j6:  8.4  (-54%)

This is the CircuitPython version of micropython#3694

jepler added 9 commits March 31, 2018 10:38
.. otherwise the line which reports tests skipped and failed can come in
different orders when -j values above 1 are used.
When requested via 'run-tests -j', more than one test will be run
at a time.  On my system, (i5-3320m with 4 threads / 2 cores), this
reduces elapsed time by over 50% when testing pots/unix/micropython.

Elapsed time, seconds, best of 3 runs with each -j value:

before patchset: 18.1
            -j1: 18.1
            -j2: 11.3  (-37%)
            -j4:  8.7  (-52%)
            -j6:  8.4  (-54%)

In all cases the final output is identical:
    651 tests performed (18932 individual testcases)
    651 tests passed
    23 tests skipped: buffered_writer...
though the individual pass/fail messages can be different/interleaved.
Notably, "--via-mpy" spews failures when threaded, possibly indicating
that micropython is not creating mpy files in threadsafe manner.
Copy link
Copy Markdown
Member

@tannewt tannewt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Brilliant! Thank you!

@tannewt tannewt merged commit d65ea99 into adafruit:master Mar 31, 2018
@jepler
Copy link
Copy Markdown
Author

jepler commented Apr 1, 2018

Sooooo this appears to actually slow down travis builds down in elapsed time. 😦

@tannewt
Copy link
Copy Markdown
Member

tannewt commented Apr 2, 2018

I see it ~30 seconds longer for the unix part of the test. I'm willing to pay that price because it speeds it up for you locally. :-)

@dhalbert
Copy link
Copy Markdown
Collaborator

dhalbert commented Apr 2, 2018

We could put in a check for travis vs local.

@jepler
Copy link
Copy Markdown
Author

jepler commented Apr 2, 2018

@dhalbert just change each --auto-jobs to -j1 in .travis.yml, I think.

jepler added a commit to jepler/circuitpython that referenced this pull request Apr 2, 2018
.. so explicitly set them to run serially with -j1.

(as discussed on adafruit#729)
@jepler jepler deleted the tests-parallel-circuitpython branch November 3, 2021 21:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants