Skip to content

Commit

Permalink
[MacOS] Small changes to libtorch naming
Browse files Browse the repository at this point in the history
Intel x86 libtorch builds will have `x86_64` suffix and Apple Silicon ones will have `arm64` ones, but latest will point to Intel ones for now.
  • Loading branch information
malfet committed Nov 1, 2023
1 parent 617327e commit 9467b4e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions wheel/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ mkdir -p "$whl_tmp_dir"

if [[ -n "$CROSS_COMPILE_ARM64" || $(uname -m) == "arm64" ]]; then
mac_version='macosx_11_0_arm64'
libtorch_arch='-arm64-'
libtorch_arch='arm64'
else
mac_version='macosx_10_9_x86_64'
libtorch_arch=''
libtorch_arch='x86_64'
fi

# Create a consistent wheel package name to rename the wheel to
Expand Down Expand Up @@ -266,7 +266,7 @@ else
cp -r "$(pwd)/any_wheel/torch/lib/include" "$(pwd)/libtorch/"
fi
cp -r "$(pwd)/any_wheel/torch/share/cmake" "$(pwd)/libtorch/share/"
if [[ "${libtorch_arch}" != "-arm64-" ]]; then
if [[ "${libtorch_arch}" == "x86_64" ]]; then
if [[ -x "$(pwd)/any_wheel/torch/.dylibs/libiomp5.dylib" ]]; then
cp -r "$(pwd)/any_wheel/torch/.dylibs/libiomp5.dylib" "$(pwd)/libtorch/lib/"
else
Expand All @@ -278,7 +278,12 @@ else
echo $PYTORCH_BUILD_VERSION > libtorch/build-version
echo "$(pushd $pytorch_rootdir && git rev-parse HEAD)" > libtorch/build-hash

zip -rq "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" libtorch
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos${libtorch_arch}-latest.zip"
zip -rq "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" libtorch
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-latest.zip"
if [[ "${libtorch_arch}" == "x86_64" ]]; then
# For backward compatibility make unarched latest to point to x86_64
cp "$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-${libtorch_arch}-$PYTORCH_BUILD_VERSION.zip" \
"$PYTORCH_FINAL_PACKAGE_DIR/libtorch-macos-latest.zip"
fi
fi

0 comments on commit 9467b4e

Please sign in to comment.