-
Notifications
You must be signed in to change notification settings - Fork 545
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
[REVIEW] Improve Cython Build with Custom build_ext
#2638
[REVIEW] Improve Cython Build with Custom build_ext
#2638
Conversation
…etermination of cython options
Please update the changelog in order to start CI tests. View the gpuCI docs here. |
build_ext
build_ext
(not an expert by any means and just curious) Could I ask the reason for customizing the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After testing and reviewing the code everything looks great, just comments about comments and a missing copyright header
Good question. The PR I linked in my initial comment does a good job of describing the issue so I recommend reading that for some background. I used that design as the basis for my approach. I'll do my best to summarize and add a little more context related to I customized Specifically for
All of these reasons drove the design to subclassing I'll conclude by saying that this isn't the only viable approach. The way setuptools works can be confusing at times which makes it difficult to decide on the best design. I'm sure there are different ways we could accomplish the same goal. I went this direction because it uses customizations that could be reused by the entire Rapids team and fits within the setuptools architecture (no manual command line parsing). If you have any more questions, please let me know. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the explanation! This looks great.
…ed the `gdb_debug` option for future debugging capability (untested).
rerun tests |
1 similar comment
rerun tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks good, just very small things, one copyright header, and the following files still have the #cython profile/embedsignature/languag_level
headers:
/python/cuml/cluster/kmeans_utils.pxd
/python/cuml/common/cuda.pxd
/python/cuml/common/handle.pxd
/python/cuml/common/opg_data_utils_mg.pxd
/python/cuml/dask/linear_model/elastic_net.py
/python/cuml/dask/linear_model/lasso.py
/python/cuml/dask/metrics/utils.py
/python/cuml/decomposition/utils.pxd
/python/cuml/ensemble/randomforest_shared.pxd
/python/cuml/metrics/confusion_matrix.py
/python/cuml/metrics/regression.pxd
/python/cuml/metrics/utils.py
/python/cuml/preprocessing/onehotencoder_mg.py
/python/cuml/tsa/arima.pxd
was wondering if we could remove them in the PR since the PR already removes them everywhere else?
…es that are no longer necessary
@dantegd Removed the |
I think it should be safe to remove those as well, if something goes wrong local or CI tests should reveal that |
Removed comments from *.pxd files as discussed. @dantegd PR is ready to merge after CD/CI pass. |
To support #2541, Cython needs to be built with
binding=True
to turn all cython functions intocyfunction
which we can get the source code location from. However, with the current build system, this must be done on a per file basis (adding# binding=True
at the start of each .pyx file) or removing the parallel cythonize/build.This PR beaks out the build customization from #2541 (suggested by @dantegd ) and creates a reusable, custom
build_ext
class,cython_build_ext
. This works around the above limitations by callingcythonize
late in the build process after all other options (such as--singlegpu
) have been processed. It was inspired by this comment which proposed a very similar customization.While this does add some complexity to the python build system, it has many benefits such as:
python setup.py build_ext --profile=True
setup.cfg
--singlegpu
, can be correctly handled by setuputils and will be displayed withpython setup.py --help
sys.argv.remove('--singlegpu')
enable_gdb
or cython optimizationscython_build_ext
can be used by other libraries in RAPIDS