Skip to content
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

Introduce DPCTL_WITH_REDIST cmake option to fix gh-1892 #1893

Merged
merged 14 commits into from
Nov 18, 2024

Conversation

oleksandr-pavlyk
Copy link
Collaborator

Closes gh-1892

This PR introduced DPCTL_WITH_REDIST cmake options, defaulting to OFF.

If set, cmake script add to RUNPATH an entry relative to $ORIGIN that would point to $PREFIX/lib, hence allowing native extensions to find DPC++ redistributable libraries.

conda-recipe/build.sh is modified to set DPCTL_WITH_REDIST=TRUE.

  • Have you provided a meaningful PR description?
  • Have you added a test, reproducer or referred to an issue with a reproducer?
  • Have you tested your changes locally for CPU and GPU devices?
  • Have you made sure that new changes do not introduce compiler warnings?
  • Have you checked performance impact of proposed changes?
  • Have you added documentation for your changes, if necessary?
  • Have you added your changes to the changelog?
  • If this PR is a work in progress, are you opening the PR as a draft?

Copy link

github-actions bot commented Nov 14, 2024

Deleted rendered PR docs from intelpython.github.com/dpctl, latest should be updated shortly. 🤞

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_212 ran successfully.
Passed: 893
Failed: 2
Skipped: 119

@coveralls
Copy link
Collaborator

coveralls commented Nov 14, 2024

Coverage Status

coverage: 87.725%. remained the same
when pulling e4f3964 on support-redist-runpath
into 34ae129 on master.

@oleksandr-pavlyk
Copy link
Collaborator Author

I can see that RUNPATH is set as expected in conda package:

(test_fix) (py312) opavlyk@opavlyk-mobl:~/tmp/tmp$ readelf -d lib/python3.12/site-packages/dpctl/_sycl_device.cpython-312-x86_64-linux-gnu.so

Dynamic section at offset 0x335e0 contains 29 entries:
  Tag        Type                         Name/Value
 0x000000000000000f (RPATH)              Library rpath: [$ORIGIN/../../..:$ORIGIN]
 0x0000000000000001 (NEEDED)             Shared library: [libDPCTLSyclInterface.so]
 0x0000000000000001 (NEEDED)             Shared library: [libintlc.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

but it is not set correctly in the wheels built by our CI (wheel is built in build.sh as part of conda build command execution.

(test_fix) (py312) opavlyk@opavlyk-mobl:~/tmp/tmp$ readelf -d $VIRTUAL_ENV/lib/python3.12/site-packages/dpctl/utils/_compute_follows_data.cpython-312-x86_64-linux-gnu.so | head

Dynamic section at offset 0x2c6a0 contains 29 entries:
  Tag        Type                         Name/Value
 0x000000000000000f (RPATH)              Library rpath: [/usr/share/miniconda/conda-bld/dpctl_1731606427598/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib:$ORIGIN]
 0x0000000000000001 (NEEDED)             Shared library: [libstdc++.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libintlc.so.5]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000001e (FLAGS)              BIND_NOW
 0x000000006ffffffb (FLAGS_1)            Flags: NOW
 0x0000000000000007 (RELA)               0x2508

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_214 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_218 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_219 ran successfully.
Passed: 894
Failed: 1
Skipped: 119

@oleksandr-pavlyk
Copy link
Collaborator Author

This PR has fixed the issue now:

(test_wheel) (py312) opavlyk@sprpvcbenchlin01:/localdisk/work/opavlyk/cmplrllvm-62975/tmp/wd$ readelf -d ${VIRTUAL_ENV}/lib/python3.12/site-packages/dpctl/_sycl_device.cpython-312-x86_64-linux-gnu.so  | grep RPATH
 0x000000000000000f (RPATH)              Library rpath: [/localdisk/work/opavlyk/mamba/conda-bld/dpctl_1731702185792/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehol/lib:$ORIGIN:$ORIGIN/../../..]

Both $ORIGIN (to be able to find libDPCTLSyclInterface.so) and $ORIGIN/../../.. to be able to find libraries from intel-cmplr-lib-rt are present.

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_234 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

@oleksandr-pavlyk oleksandr-pavlyk changed the title Introduce DPCTL_WITH_REDIST cmake option to fix Introduce DPCTL_WITH_REDIST cmake option to fix gh-1892 Nov 16, 2024
@oleksandr-pavlyk
Copy link
Collaborator Author

Debugging output added in the last commit shows that in GitHub public CI the readelf -d on _sycl_device.cpython*.so shows RPATH to be as follows:

Dynamic section at offset 0x335e0 contains 29 entries:
  Tag        Type                         Name/Value
 0x000000000000000f (RPATH)              Library rpath: [$PREFIX/lib:$ORIGIN:$ORIGIN/../../..]

in the internal CI it is:

[2024-11-16T00:27:50.023Z]   Tag        Type                         Name/Value
[2024-11-16T00:27:50.023Z]  0x000000000000000f (RPATH)              Library rpath: [/../..:/../../..:$PREFIX/lib:/../..:/../../..:$ORIGIN:$ORIGIN/../../..]

The necessary components are there, but it would be nice to get rid of extraneous and invalid paths like /../..

@oleksandr-pavlyk
Copy link
Collaborator Author

The root-cause that introduced "invalid paths like /../.." into RPATH field was identified. A commit that added debugging prints removed.

I confirmed that with both wheels generated by Github Actions CI and by internal CI, the issues filed in gh-1892 is resolved.

@ndgrigorian

Copy link
Collaborator

@ndgrigorian ndgrigorian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have also verified the fix and it works correctly on Linux.

LGTM!

Copy link

Array API standard conformance tests for dpctl=0.19.0dev0=py310hdf72452_233 ran successfully.
Passed: 895
Failed: 0
Skipped: 119

@oleksandr-pavlyk oleksandr-pavlyk merged commit 29ee329 into master Nov 18, 2024
83 checks passed
@oleksandr-pavlyk oleksandr-pavlyk deleted the support-redist-runpath branch November 18, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dpctl installed into virtual env fails to import
3 participants