Skip to content

Parallelized Build / CI #30214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 12, 2019
Merged

Parallelized Build / CI #30214

merged 6 commits into from
Dec 12, 2019

Conversation

WillAyd
Copy link
Member

@WillAyd WillAyd commented Dec 11, 2019

Modeled after cython/cython#3187 which in 0.29.14 added parallel support

A very slight boost to timing from a clean directory (bottleneck is in the Cythonize calls in both cases)

# Master
$ time python setup.py build_ext --inplace -j 4 : 
62.93s user 3.18s system 97% cpu 1:07.77 total

# this branch
$ time python setup.py build_ext --inplace -j 4:
58.87s user 3.32s system 105% cpu 59.030 total

@jbrockmendel
Copy link
Member

LGTM

@WillAyd
Copy link
Member Author

WillAyd commented Dec 11, 2019

I think could also reduce the cythonize bottleneck if using the nthreads argument:

https://cython.readthedocs.io/en/latest/src/userguide/source_files_and_compilation.html#Cython.Build.cythonize

Locally that yielded this for a clean build:

69.07s user 3.75s system 334% cpu 21.783 total

So 21 seconds from scratch isn't bad; might help a lot to reduce time to run ASVs

@jbrockmendel
Copy link
Member

that would be a nice speedup. im not clear on what the difference is between nthreads vs "-j"

@jbrockmendel
Copy link
Member

ok, it looks like passing nthreads to cythonize affects the cython->C compilation, and the "-j 4" affects the C->so compilation

@WillAyd
Copy link
Member Author

WillAyd commented Dec 11, 2019

Open to suggestions on where to place this, but reusing the argument for parallel compliation in the calls to Cythonize helps a lot. Updated benchmarks:

$ time python setup.py build_ext --inplace --parallel=4
70.69s user 3.88s system 311% cpu 23.951 total
$ time python setup.py build_ext --inplace -j4
69.88s user 3.80s system 322% cpu 22.817 total

@jbrockmendel jbrockmendel added the Build Library building on various platforms label Dec 11, 2019
@WillAyd
Copy link
Member Author

WillAyd commented Dec 11, 2019

I'd roughly say this saves about 4-5 minutes on CI where it works. Have to see what's going on with Linux 36

Also not sure if Windows will really support this, at least not without some upstream changes. Earlier attempts throw a warning about multiprocessing freeze_support; put on the back burner for now

@WillAyd WillAyd changed the title Dispatch to Cython for build_ext Parallelized Build / CI Dec 11, 2019
@jbrockmendel
Copy link
Member

the CI errors all look unrelated, just started re-run

@jreback jreback added this to the 1.0 milestone Dec 12, 2019
@jreback jreback merged commit a89df10 into pandas-dev:master Dec 12, 2019
@jreback
Copy link
Contributor

jreback commented Dec 12, 2019

lgtm thanks @WillAyd

@WillAyd
Copy link
Member Author

WillAyd commented Dec 12, 2019

I think this might be responsible for some 36 errors on the 32 bit build with environment setup this morning. I'll revert at least the CI piece so we can get that green

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Library building on various platforms
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants