-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Fix pre-build checks to handle compilers from build_ext options #16193
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
[MRG] Fix pre-build checks to handle compilers from build_ext options #16193
Conversation
…learn + support icc linux openmp flag
The doc test of |
We use The Using ICC implies that numpy.distutils's compiler options are going to be used, and it likely uses |
this command |
I don't think it's related to this PR since it also occurred in #16175 |
Thanks for the info. I wonder if it occurs more often than with gcc because it's like in 2 out of 3 runs. |
actually it's also -O3 with gcc |
@@ -40,6 +40,8 @@ def get_openmp_flag(compiler): | |||
# export LDFLAGS="$LDFLAGS -Wl,-rpath,/usr/local/opt/libomp/lib | |||
# -L/usr/local/opt/libomp/lib -lomp" | |||
return [] | |||
elif sys.platform == "linux" and "icc" in compiler: |
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.
I think this applies to sys.platform == "darwin"
as well.
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.
For darwin we set -openmp
. Is it outdated or preferable to use -qopenmp
?
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.
also is icl
something ? I remember putting icc or icl
because I had the feeling that it could be a name of the icc executable but I actually never see that anywhere.
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.
Yes, it is icl
on Windows.
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.
Some comments below.
Why would be the motivation to extend our CI to build with another compiler? To "shake" our test suite further to reveal more potential numerical stability issues?
The ICC installation overhead seems minimal when using the APT repo as done in this PR. However I am not sure what will be the long term maintenance overhead.
Following the discussion in the meeting, I added a travis cron job where sklearn is built with icc instead of a regular azure job. I think it's ready to merge now. |
.travis.yml
Outdated
env: | ||
- CHECK_WARNING="true" | ||
- BUILD_WITH_ICC="true" | ||
if: type = cron OR commit_message =~ /\[scipy-dev\]/ |
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.
Do we want to use the same scipy-dev tag for this?
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.
I put the same name to avoid having options that we will not remember :)
But I'm ok to put a different name. icc-build
?
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.
icc
or icc-build
both are fine to me.
When I try to run the build command, I get:
So it is reporting that GCC is being used to test openmp flags. This is unexpected. The only way I found to work around this is to set Edit: I realized I built master branch, let me try with your branch. |
It behaves as advertised in the branch, however I found that
which used to execute in master (albeit using
|
@oleksandr-pavlyk Thanks for testing it and for the feedback.
I fixed that. But I don't think you need |
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.
LGTM. Could you please add a short section at the end of the advanced installation page in the doc to summarize the main commands to build with ICC (under Linux with the oneapi repo).
Thanks for the doc. LGTM again. |
BTW, please be advised that oneAPI is currently governed by a beta license, which precludes distribution of produced binaries. The license will change once oneAPI is released. |
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.
I think it's very valuable to test with ICC and document how to build sklearn with it.
thx @jeremiedbb
There are (at least ?) 2 ways to specify the compiler to build the project:
In the second option, <compiler> must be one of the predefined compilers in distutils or in numpy.distutils. For example, to build with icc, it's
--compiler=intelem
.Currently the checks before building sklearn (compile a test program and compile a test program using openmp) ignore the compiler specified through the second option.
I also updated
get_openmp_flag
to better handle icc on linux (although it accepts-fopenmp
, it's recommended to use-qopenmp
).I temporarily modified a ci job,
Linux_Runs_pylatest_conda_mkl
, to build sklearn with icc (installed through intel oneAPI) to check it works as expected. The install of icc is actually pretty fast and the job is not longer than the other ones. We could keep a job where we build with icc, not necessarily this one. wdyt ?@oleksandr-pavlyk I'd like your feedback on this. Especially, do you use the same command to build sklearn with icc ?