From 5ed97165dd50a06bf2d3b3d62db7358f38d6310f Mon Sep 17 00:00:00 2001 From: Stuti Ravikiran Wali Date: Wed, 8 Oct 2025 19:56:30 +0530 Subject: [PATCH] Update torchvision_ubi_9.6.sh --- t/torchvision/torchvision_ubi_9.6.sh | 114 ++++++++++++++------------- 1 file changed, 60 insertions(+), 54 deletions(-) diff --git a/t/torchvision/torchvision_ubi_9.6.sh b/t/torchvision/torchvision_ubi_9.6.sh index 35ffca1..b4b9867 100644 --- a/t/torchvision/torchvision_ubi_9.6.sh +++ b/t/torchvision/torchvision_ubi_9.6.sh @@ -111,9 +111,49 @@ python3.12 -m pip install . echo "------------ libprotobuf,protobuf installed--------------" -# echo "----Installing rust------" -#curl https://sh.rustup.rs -sSf | sh -s -- -y -#source "$HOME/.cargo/env" +#installing openblas +cd $CURRENT_DIR +git clone https://github.com/OpenMathLib/OpenBLAS +cd OpenBLAS +git checkout v0.3.29 +git submodule update --init +mkdir prefix +# Set build options +declare -a build_opts +# Fix ctest not automatically discovering tests +LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,--gc-sections//g") +export CF="${CFLAGS} -Wno-unused-parameter -Wno-old-style-declaration" +unset CFLAGS +export USE_OPENMP=1 +build_opts+=(USE_OPENMP=${USE_OPENMP}) +# Handle Fortran flags +if [ ! -z "$FFLAGS" ]; then + export FFLAGS="${FFLAGS/-fopenmp/ }" + export FFLAGS="${FFLAGS} -frecursive" + export LAPACK_FFLAGS="${FFLAGS}" +fi +export PLATFORM=$(uname -m) +build_opts+=(BINARY="64") +build_opts+=(DYNAMIC_ARCH=1) +BUILD_BFLOAT16=1 +# Placeholder for future builds that may include ILP64 variants. +build_opts+=(INTERFACE64=0) +build_opts+=(SYMBOLSUFFIX="") +# Build LAPACK +build_opts+=(NO_LAPACK=0) +# Enable threading and set the number of threads +build_opts+=(USE_THREAD=1) +build_opts+=(NUM_THREADS=120) +# Disable CPU/memory affinity handling to avoid problems with NumPy and R +build_opts+=(NO_AFFINITY=1) +# Build OpenBLAS +make ${build_opts[@]} CFLAGS="${CF}" FFLAGS="${FFLAGS}" prefix=${OPENBLAS_PREFIX} +# Install OpenBLAS +CFLAGS="${CF}" FFLAGS="${FFLAGS}" make install PREFIX="${OPENBLAS_PREFIX}" ${build_opts[@]} +export LD_LIBRARY_PATH=${OPENBLAS_PREFIX}/lib:$LD_LIBRARY_PATH +export PKG_CONFIG_PATH=${OPENBLAS_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH +pkg-config --modversion openblas +echo "-----------------------------------------------------Installed openblas-----------------------------------------------------" # echo "------------cloning pytorch----------------" cd $CURRENT_DIR @@ -156,11 +196,9 @@ export USE_LEVELDB=1 export USE_NINJA=0 export USE_MPI=0 export USE_OPENMP=1 -export USE_TBB= -export USE_LAPACK=1 export BUILD_CUSTOM_PROTOBUF=OFF export BUILD_CAFFE2=1 -export PYTORCH_BUILD_VERSION=${PACKAGE_VERSION} +export PYTORCH_BUILD_VERSION=2.6.0 export PYTORCH_BUILD_NUMBER=${BUILD_NUM} export CMAKE_PREFIX_PATH="${SITE_PACKAGE_PATH}" export Protobuf_LIBRARY=${LIBPROTO_INSTALL}/lib64/libprotobuf.so @@ -169,53 +207,17 @@ export Protobuf_INCLUDE_DIR=${LIBPROTO_INSTALL}/include export Protobuf_LIBRARIES=${LIBPROTO_INSTALL}/lib64 export Protobuf_PROTOC_EXECUTABLE=${LIBPROTO_INSTALL}/bin/protoc export USE_TENSORRT=0 -MAX_JOBS=$(nproc) python3.12 setup.py install -cd $CURRENT_DIR +export BLAS=OpenBLAS +export LAPACK=OpenBLAS +export USE_OPENBLAS=1 +export USE_LAPACK=1 +export OpenBLAS_HOME=${OPENBLAS_PREFIX} +export CMAKE_PREFIX_PATH="${OPENBLAS_PREFIX}:${CMAKE_PREFIX_PATH}" -#installing openblas +MAX_JOBS=$(nproc) python3.12 setup.py install +python3.12 setup.py develop +python3.12 setup.py bdist_wheel cd $CURRENT_DIR -git clone https://github.com/OpenMathLib/OpenBLAS -cd OpenBLAS -git checkout v0.3.29 -git submodule update --init -mkdir prefix -# Set build options -declare -a build_opts -# Fix ctest not automatically discovering tests -LDFLAGS=$(echo "${LDFLAGS}" | sed "s/-Wl,--gc-sections//g") -export CF="${CFLAGS} -Wno-unused-parameter -Wno-old-style-declaration" -unset CFLAGS -export USE_OPENMP=1 -build_opts+=(USE_OPENMP=${USE_OPENMP}) -# Handle Fortran flags -if [ ! -z "$FFLAGS" ]; then - export FFLAGS="${FFLAGS/-fopenmp/ }" - export FFLAGS="${FFLAGS} -frecursive" - export LAPACK_FFLAGS="${FFLAGS}" -fi -export PLATFORM=$(uname -m) -build_opts+=(BINARY="64") -build_opts+=(DYNAMIC_ARCH=1) -build_opts+=(TARGET="POWER9") -BUILD_BFLOAT16=1 -# Placeholder for future builds that may include ILP64 variants. -build_opts+=(INTERFACE64=0) -build_opts+=(SYMBOLSUFFIX="") -# Build LAPACK -build_opts+=(NO_LAPACK=0) -# Enable threading and set the number of threads -build_opts+=(USE_THREAD=1) -build_opts+=(NUM_THREADS=120) -# Disable CPU/memory affinity handling to avoid problems with NumPy and R -build_opts+=(NO_AFFINITY=1) -# Build OpenBLAS -make ${build_opts[@]} CFLAGS="${CF}" FFLAGS="${FFLAGS}" prefix=${OPENBLAS_PREFIX} -# Install OpenBLAS -CFLAGS="${CF}" FFLAGS="${FFLAGS}" make install PREFIX="${OPENBLAS_PREFIX}" ${build_opts[@]} -export LD_LIBRARY_PATH=${OPENBLAS_PREFIX}/lib:$LD_LIBRARY_PATH -export PKG_CONFIG_PATH=${OPENBLAS_PREFIX}/lib/pkgconfig:$PKG_CONFIG_PATH -pkg-config --modversion openblas -echo "-----------------------------------------------------Installed openblas-----------------------------------------------------" curl -LO https://www.nasm.us/pub/nasm/releasebuilds/2.16.01/nasm-2.16.01.tar.gz tar -xzf nasm-2.16.01.tar.gz @@ -381,6 +383,7 @@ export CFLAGS="${CFLAGS} -I/${FFMPEG_PREFIX}/include" export LDFLAGS="${LDFLAGS} -L/${FFMPEG_PREFIX}/lib" export TORCHVISION_USE_VIDEO_CODEC=0 export TORCHVISION_INCLUDE="${SITE_PACKAGE_PATH}/av/include" +python3.12 -m pip install torchvision-extra-decoders #Build package @@ -392,12 +395,15 @@ if ! (python3.12 -m pip install .) ; then fi #Build wheel -python3.12 setup.py bdist_wheel --dist-dir=$CURRENT_DIR -python3.12 -m pip install $CURRENT_DIR/torchvision*.whl +python3.12 setup.py bdist_wheel +cp dist/*.whl $CURRENT_DIR +python3.12 -m pip install $CURRENT_DIR/torchvision*.whl --force-reinstall +python3.12 -m pip install $CURRENT_DIR/pytorch/dist/*.whl +python3.12 -m pip install triton==3.2.0 # Run test # Skipping tests related to video and legacy image formats due to unsupported or missing runtime dependencies causing failures. -if ! pytest -v --durations=25 --ignore-glob="*test_video*" --ignore-glob="*test_image*" --ignore-glob="*test_io*" --ignore-glob="*test_internet*" --ignore-glob="*test_datasets*" --ignore-glob="*test_models*" --ignore-glob="*test_extended_models*" --ignore-glob="*test_transforms_v2*"; then +if ! pytest -v --durations=25 --ignore-glob="*test_video*" --ignore-glob="*test_image*" --ignore-glob="*test_io*" --ignore-glob="*test_internet*" --ignore-glob="*test_datasets*" --ignore-glob="*test_models*" --ignore-glob="*test_extended_models*" --ignore-glob="*test_transforms_v2*" --ignore="test/test_transforms_tensor.py"; then echo "------------------$PACKAGE_NAME:install_success_but_test_fails---------------------" echo "$PACKAGE_URL $PACKAGE_NAME" echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_success_but_test_Fails"