Skip to content

Parallel Cythonization for spawned Processes #30862

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 5 commits into from
Jan 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 49 additions & 50 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import argparse
from distutils.sysconfig import get_config_vars
from distutils.version import LooseVersion
import multiprocessing
import os
from os.path import join as pjoin
import platform
Expand All @@ -35,17 +36,6 @@ def is_platform_mac():
min_numpy_ver = "1.13.3"
min_cython_ver = "0.29.13" # note: sync with pyproject.toml

setuptools_kwargs = {
"install_requires": [
"python-dateutil >= 2.6.1",
"pytz >= 2017.2",
f"numpy >= {min_numpy_ver}",
],
"setup_requires": [f"numpy >= {min_numpy_ver}"],
"zip_safe": False,
}


try:
import Cython

Expand Down Expand Up @@ -531,11 +521,6 @@ def maybe_cythonize(extensions, *args, **kwargs):
elif parsed.j:
nthreads = parsed.j

# GH#30356 Cythonize doesn't support parallel on Windows
if is_platform_windows() and nthreads > 0:
print("Parallel build for cythonize ignored on Windows")
nthreads = 0

kwargs["nthreads"] = nthreads
build_ext.render_templates(_pxifiles)
return cythonize(extensions, *args, **kwargs)
Expand Down Expand Up @@ -744,37 +729,51 @@ def srcpath(name=None, suffix=".pyx", subdir="src"):
# ----------------------------------------------------------------------


# The build cache system does string matching below this point.
# if you change something, be careful.

setup(
name=DISTNAME,
maintainer=AUTHOR,
version=versioneer.get_version(),
packages=find_packages(include=["pandas", "pandas.*"]),
package_data={"": ["templates/*", "_libs/*.dll"]},
ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
maintainer_email=EMAIL,
description=DESCRIPTION,
license=LICENSE,
cmdclass=cmdclass,
url=URL,
download_url=DOWNLOAD_URL,
project_urls=PROJECT_URLS,
long_description=LONG_DESCRIPTION,
classifiers=CLASSIFIERS,
platforms="any",
python_requires=">=3.6.1",
extras_require={
"test": [
# sync with setup.cfg minversion & install.rst
"pytest>=4.0.2",
"pytest-xdist",
"hypothesis>=3.58",
]
},
entry_points={
"pandas_plotting_backends": ["matplotlib = pandas:plotting._matplotlib"]
},
**setuptools_kwargs,
)
def setup_package():
setuptools_kwargs = {
"install_requires": [
"python-dateutil >= 2.6.1",
"pytz >= 2017.2",
f"numpy >= {min_numpy_ver}",
],
"setup_requires": [f"numpy >= {min_numpy_ver}"],
"zip_safe": False,
}

setup(
name=DISTNAME,
maintainer=AUTHOR,
version=versioneer.get_version(),
packages=find_packages(include=["pandas", "pandas.*"]),
package_data={"": ["templates/*", "_libs/*.dll"]},
ext_modules=maybe_cythonize(extensions, compiler_directives=directives),
maintainer_email=EMAIL,
description=DESCRIPTION,
license=LICENSE,
cmdclass=cmdclass,
url=URL,
download_url=DOWNLOAD_URL,
project_urls=PROJECT_URLS,
long_description=LONG_DESCRIPTION,
classifiers=CLASSIFIERS,
platforms="any",
python_requires=">=3.6.1",
extras_require={
"test": [
# sync with setup.cfg minversion & install.rst
"pytest>=4.0.2",
"pytest-xdist",
"hypothesis>=3.58",
]
},
entry_points={
"pandas_plotting_backends": ["matplotlib = pandas:plotting._matplotlib"]
},
**setuptools_kwargs,
)


if __name__ == "__main__":
# Freeze to support parallel compilation when using spawn instead of fork
multiprocessing.freeze_support()
setup_package()