-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
CI: Intel icc/icpc via oneAPI #2573
Conversation
c86a9ef
to
35e91db
Compare
761c316
to
5fb34c7
Compare
Have you tried running the same docker commands locally? |
Yep, can reproduce on When I am building in Debug mode, I get linker errors on the
Independent of that, when looking at the code, is it possible that Removing the Backtrace of the segfault:
|
Storing a recipe for docker for my use: apt-get update && apt install -y wget build-essential pkg-config cmake ca-certificates gnupg git && wget https://apt.repos.intel.com/intel-gpg-keys/GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && apt-key add GPG-PUB-KEY-INTEL-SW-PRODUCTS-2023.PUB && echo "deb https://apt.repos.intel.com/oneapi all main" | tee /etc/apt/sources.list.d/oneAPI.list && apt-get update && apt-get install -y intel-oneapi-dpcpp-cpp-compiler-pro cmake python3-dev python3-numpy python3-pytest python3-pip
source /opt/intel/oneapi/setvars.sh
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade pytest cmake
/usr/local/bin/cmake -S . -B build -DPYBIND11_WERROR=ON -DDOWNLOAD_CATCH=ON -DDOWNLOAD_EIGEN=ON -DCMAKE_CXX_COMPILER=$(which icpc) -DPYTHON_EXECUTABLE=$(which python3)
/usr/local/bin/cmake --build build -j 8 |
I am getting a few remarks:
And then I do get the segfault. (this is testing on the fix/intel branch, and using Ubuntu 18 docker) In fact, this segfaults: python3 -c "import pybind11_tests" But this does not: python3 -c "import pybind11_cross_module_tests"
python3 -c "import cross_module_gil_utils" |
Not having a virtual destructor in @ax3l : When you make the change to avoid linker errors, is the behavior identical in Debug/Release mode? |
Interestingly, I don't get any linker errors in default builds (MinSizeRel?), but the same segfault. Inlining limits: yes, I saw them as well... We can increase the limit and check if that mitigates it, although that would be a curious reason. Maybe the problem is stemming from IPO? Update: patched out some IPO flags - but still got the inlining/IPO remarks (but saw no IPO flags on the CLI): diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake
index 8ee22de..fb33bb5 100644
--- a/tools/pybind11Common.cmake
+++ b/tools/pybind11Common.cmake
@@ -315,8 +315,8 @@ function(_pybind11_generate_lto target prefer_thin_lto)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
# Intel equivalent to LTO is called IPO
- _pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO "-ipo" "-ipo"
- PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
+ #_pybind11_return_if_cxx_and_linker_flags_work(HAS_INTEL_IPO "-ipo" "-ipo"
+ # PYBIND11_LTO_CXX_FLAGS PYBIND11_LTO_LINKER_FLAGS)
elseif(MSVC)
# cmake only interprets libraries as linker flags when they start with a - (otherwise it
# converts /LTCG to \LTCG as if it was a Windows path). Luckily MSVC supports passing flags Same segfault persists. (Update2: changing visibility flags also did not change the segfault.) |
This was mentioned in #2679, so I had a look at the segfault. Apparently, it is a specific problem with the sm.def("accept_double_noconvert",
[](py::array_t<double, 0>) {},
py::arg("a").noconvert()); segfaults. When replacing this by auto py_arg = py::arg("a");
sm.def("accept_double_noconvert",
[](py::array_t<double, 0>) {},
py_arg.noconvert()); the segfault is gone. Same for
does not segfault anymore and only gives the output
The |
Changed upstream with the last oneAPI release.
pytest 6 does not capture the `discard_as_unraisable` stderr and just writes a warning with its content instead.
3ff528c
to
b753608
Compare
I'm not totally sure that 20e467d is better; hoping it will get cached, and that might save some setup time. I'd probably recommend saving the commit and reverting it if it's not better (unless we like it better?). |
It took 4 minutes now, the "Building docker image". How can we check if it gets cached? I don't think I like it better, though. Couldn't we do something like https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontainer, to run this job inside the container with ICC set up, but still have all the different steps individually (similar to the other jobs) ? |
Sure, but we'd need a container, and I don't want to set something up just for this. If there's a way to add a job that builds a container and uploads it to the GH registry if it doesn't exist or needs updating, then we pull from the local registry, that could work, but it would be harder to setup. I think the local action gets cached automatically if unchanged. I'm also thinking about how we expand this to C++17, but we could just do that as more steps in one job. It's not all that bad, so we can just go with what we had (though if this works, I'd want to do it for PGI too, and that might make it more reliable since pulling it fails once in a while). I can pull this commit out and make a new PR with it, probably better. |
8 mins 27 seconds total, currently, for comparison, when not caching on the docker action method. |
6m 55s for the non-docker version, 2+ mins in setup. Might investigate later, but not critical (and the job is not as long as I thought it was). |
Add testing for Intel icc/icpc via the oneAPI images.
Intel oneAPI is in a late beta stage, currently shipping oneAPI beta09 with ICC 20.2.
We are adding
// [workaround(intel)]
near the workarounds to it will be easy to search them out later, and disable them to see if they have been fixed by the Intel compiler team.Here are the workarounds here:
py::args()
->py::args{}
, in tests, regression in ICC 20+, workaround in tests= default
instead of{}
doesn’t always work (was a recent modernization, so might have been a problem before too), workaround in testsSuggested changelog entry: