mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
PR to remove Manywheel Scripts: https://github.com/pytorch/builder/pull/2017 Test PR : https://github.com/pytorch/pytorch/pull/138325 Pull Request resolved: https://github.com/pytorch/pytorch/pull/138103 Approved by: https://github.com/malfet
100 lines
3.0 KiB
Bash
Executable File
100 lines
3.0 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -ex
|
|
|
|
GPU_ARCH_TYPE=${GPU_ARCH_TYPE:-cpu}
|
|
|
|
export TH_BINARY_BUILD=1
|
|
export USE_CUDA=0
|
|
|
|
# Keep an array of cmake variables to add to
|
|
if [[ -z "$CMAKE_ARGS" ]]; then
|
|
# These are passed to tools/build_pytorch_libs.sh::build()
|
|
CMAKE_ARGS=()
|
|
fi
|
|
if [[ -z "$EXTRA_CAFFE2_CMAKE_FLAGS" ]]; then
|
|
# These are passed to tools/build_pytorch_libs.sh::build_caffe2()
|
|
EXTRA_CAFFE2_CMAKE_FLAGS=()
|
|
fi
|
|
|
|
DIR_SUFFIX=cpu
|
|
if [[ "$GPU_ARCH_TYPE" == "xpu" ]]; then
|
|
DIR_SUFFIX=xpu
|
|
# Refer https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpu/2-5.html
|
|
source /opt/intel/oneapi/pytorch-gpu-dev-0.5/oneapi-vars.sh
|
|
source /opt/intel/oneapi/pti/latest/env/vars.sh
|
|
export USE_STATIC_MKL=1
|
|
fi
|
|
|
|
WHEELHOUSE_DIR="wheelhouse$DIR_SUFFIX"
|
|
LIBTORCH_HOUSE_DIR="libtorch_house$DIR_SUFFIX"
|
|
if [[ -z "$PYTORCH_FINAL_PACKAGE_DIR" ]]; then
|
|
if [[ -z "$BUILD_PYTHONLESS" ]]; then
|
|
PYTORCH_FINAL_PACKAGE_DIR="/remote/wheelhouse$DIR_SUFFIX"
|
|
else
|
|
PYTORCH_FINAL_PACKAGE_DIR="/remote/libtorch_house$DIR_SUFFIX"
|
|
fi
|
|
fi
|
|
mkdir -p "$PYTORCH_FINAL_PACKAGE_DIR" || true
|
|
|
|
OS_NAME=$(awk -F= '/^NAME/{print $2}' /etc/os-release)
|
|
if [[ "$OS_NAME" == *"CentOS Linux"* ]]; then
|
|
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
|
|
elif [[ "$OS_NAME" == *"Red Hat Enterprise Linux"* ]]; then
|
|
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
|
|
elif [[ "$OS_NAME" == *"AlmaLinux"* ]]; then
|
|
LIBGOMP_PATH="/usr/lib64/libgomp.so.1"
|
|
elif [[ "$OS_NAME" == *"Ubuntu"* ]]; then
|
|
if [[ "$(uname -m)" == "s390x" ]]; then
|
|
LIBGOMP_PATH="/usr/lib/s390x-linux-gnu/libgomp.so.1"
|
|
else
|
|
LIBGOMP_PATH="/usr/lib/x86_64-linux-gnu/libgomp.so.1"
|
|
fi
|
|
fi
|
|
|
|
DEPS_LIST=(
|
|
"$LIBGOMP_PATH"
|
|
)
|
|
|
|
DEPS_SONAME=(
|
|
"libgomp.so.1"
|
|
)
|
|
|
|
if [[ "$GPU_ARCH_TYPE" == "xpu" ]]; then
|
|
echo "Bundling with xpu support package libs."
|
|
DEPS_LIST+=(
|
|
"/opt/intel/oneapi/compiler/latest/lib/libsycl-preview.so.7"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libOpenCL.so.1"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libxptifw.so"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libsvml.so"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libirng.so"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libimf.so"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libintlc.so.5"
|
|
"/opt/intel/oneapi/compiler/latest/lib/libpi_level_zero.so"
|
|
"/opt/intel/oneapi/pti/latest/lib/libpti_view.so.0.9"
|
|
"/opt/intel/oneapi/pti/latest/lib/libpti.so.0.9"
|
|
)
|
|
DEPS_SONAME+=(
|
|
"libsycl-preview.so.7"
|
|
"libOpenCL.so.1"
|
|
"libxptifw.so"
|
|
"libsvml.so"
|
|
"libirng.so"
|
|
"libimf.so"
|
|
"libintlc.so.5"
|
|
"libpi_level_zero.so"
|
|
"libpti_view.so.0.9"
|
|
"libpti.so.0.9"
|
|
)
|
|
fi
|
|
|
|
rm -rf /usr/local/cuda*
|
|
|
|
SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
|
if [[ -z "$BUILD_PYTHONLESS" ]]; then
|
|
BUILD_SCRIPT=build_common.sh
|
|
else
|
|
BUILD_SCRIPT=build_libtorch.sh
|
|
fi
|
|
source ${SOURCE_DIR}/${BUILD_SCRIPT}
|