mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
[Split Build] Fix libtorch_python RPATH (#129088)
In the split build we end up with an incorrect RPATH for `libtorch_python.so`. This PR fixes said RPATH. What the rpath should look like: ``` sahanp@devgpu086 ~/pytorch ((636de71c…))> objdump -p ~/main_so_files/libtorch_python.so | grep "RPATH" (pytorch-3.10) RPATH /lib/intel64:/lib/intel64_win:/lib/win-x64:/home/sahanp/pytorch/build/lib:/home/sahanp/.conda/envs/pytorch-3.10/lib: ``` Before ``` sahanp@devgpu086 ~/pytorch ((636de71c…))> objdump -p ~/split_so_files/libtorch_python.so | grep "RPATH" (pytorch-3.10) RPATH /home/sahanp/pytorch/torch/lib:/home/sahanp/pytorch/build/lib: ``` After ``` sahanp@devgpu086 ~/pytorch ((636de71c…))> objdump -p build/lib/libtorch_python.so | grep "RPATH" (pytorch-3.10) RPATH /lib/intel64:/lib/intel64_win:/lib/win-x64:/home/sahanp/pytorch/build/lib:/home/sahanp/pytorch/torch/lib:/home/sahanp/.conda/envs/pytorch-3.10/lib: ``` Testing that this works is in the above PR. Similarly, after running ciflow/binaries the output of objdump -p should not change https://www.diffchecker.com/14PRmCNz/ (checked manywheel py 3.10 cuda 12.1) Pull Request resolved: https://github.com/pytorch/pytorch/pull/129088 Approved by: https://github.com/malfet
This commit is contained in:
parent
c008488b9c
commit
2b1b055a96
26
.github/workflows/pull.yml
vendored
26
.github/workflows/pull.yml
vendored
|
|
@ -515,3 +515,29 @@ jobs:
|
||||||
build-environment: linux-focal-cuda12.1-py3.10-gcc9-experimental-split-build
|
build-environment: linux-focal-cuda12.1-py3.10-gcc9-experimental-split-build
|
||||||
docker-image: ${{ needs.linux-focal-cuda12_1-py3_10-gcc9-experimental-split-build.outputs.docker-image }}
|
docker-image: ${{ needs.linux-focal-cuda12_1-py3_10-gcc9-experimental-split-build.outputs.docker-image }}
|
||||||
test-matrix: ${{ needs.linux-focal-cuda12_1-py3_10-gcc9-experimental-split-build.outputs.test-matrix }}
|
test-matrix: ${{ needs.linux-focal-cuda12_1-py3_10-gcc9-experimental-split-build.outputs.test-matrix }}
|
||||||
|
|
||||||
|
linux-focal-py3_12-clang10-experimental-split-build:
|
||||||
|
name: linux-focal-py3.12-clang10-experimental-split-build
|
||||||
|
uses: ./.github/workflows/_linux-build-label.yml
|
||||||
|
with:
|
||||||
|
use_split_build: True
|
||||||
|
build-environment: linux-focal-py3.12-clang10
|
||||||
|
docker-image-name: pytorch-linux-focal-py3.12-clang10
|
||||||
|
test-matrix: |
|
||||||
|
{ include: [
|
||||||
|
{ config: "default", shard: 1, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
{ config: "default", shard: 2, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
{ config: "default", shard: 3, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
{ config: "dynamo", shard: 1, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
{ config: "dynamo", shard: 2, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
{ config: "dynamo", shard: 3, num_shards: 3, runner: "linux.2xlarge" },
|
||||||
|
]}
|
||||||
|
linux-focal-py3_12-clang10-experimental-split-build-test:
|
||||||
|
name: linux-focal-py3.12-clang10-experimental-split-build
|
||||||
|
uses: ./.github/workflows/_linux-test.yml
|
||||||
|
needs: linux-focal-py3_12-clang10-experimental-split-build
|
||||||
|
with:
|
||||||
|
build-environment: linux-focal-py3.12-clang10-experimental-split-build
|
||||||
|
docker-image: ${{ needs.linux-focal-py3_12-clang10-experimental-split-build.outputs.docker-image }}
|
||||||
|
test-matrix: ${{ needs.linux-focal-py3_12-clang10-experimental-split-build.outputs.test-matrix }}
|
||||||
|
timeout-minutes: 600
|
||||||
|
|
|
||||||
|
|
@ -298,6 +298,16 @@ endif()
|
||||||
|
|
||||||
|
|
||||||
add_library(torch_python SHARED ${TORCH_PYTHON_SRCS})
|
add_library(torch_python SHARED ${TORCH_PYTHON_SRCS})
|
||||||
|
|
||||||
|
if(CAFFE2_USE_MKL AND BUILD_LIBTORCHLESS)
|
||||||
|
|
||||||
|
# Use the RPATH of the linked libraries
|
||||||
|
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
|
||||||
|
# we need to explicitly link caffe2::mkl in order to have the
|
||||||
|
# correct RPATH in torch_python for the split build
|
||||||
|
target_link_libraries(torch_python PRIVATE caffe2::mkl)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_dependencies(torch_python onnx_proto)
|
add_dependencies(torch_python onnx_proto)
|
||||||
# Avoid numpy for the DEPLOY build
|
# Avoid numpy for the DEPLOY build
|
||||||
if(USE_NUMPY)
|
if(USE_NUMPY)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user