Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions p/pytorch/pytorch_2.0.1_ubi_9.3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ export BUILD_TEST=0

echo "Installing required Python packages..."
pip install wheel "numpy<2.0" scipy==1.13.1 ninja build pytest

echo "Installing required numpy"
pip install "numpy<2.0"

Expand Down
49 changes: 29 additions & 20 deletions p/pytorch/pytorch_2.1.0_ubi_9.3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
# contact the "Maintainer" of this script.
#
# -----------------------------------------------------------------------------

# Exit immediately if a command exits with a non-zero status
set -e

set -e

# Variables
PACKAGE_NAME=pytorch
PACKAGE_VERSION=${1:-v2.1.0}
Expand All @@ -30,17 +30,27 @@ PACKAGE_DIR=pytorch
export PYTORCH_BUILD_VERSION="${PACKAGE_VERSION#v}"
export PYTORCH_BUILD_NUMBER=1
CURRENT_DIR="${PWD}"

# Install dependencies and tools
echo "Installing dependencies..."
yum install -y git wget gcc gcc-c++ python python3-devel python3 python3-pip openblas-devel cmake gcc-gfortran
yum install -y git wget python3 python3-devel python3-pip openblas-devel cmake gcc-toolset-12-gcc gcc-toolset-12-gcc-c++ gcc-toolset-12-gcc-gfortran
source /opt/rh/gcc-toolset-12/enable

# Set compiler paths to make use of right compiler
export CC=/opt/rh/gcc-toolset-12/root/usr/bin/gcc
export CXX=/opt/rh/gcc-toolset-12/root/usr/bin/g++
export LD=/opt/rh/gcc-toolset-12/root/usr/bin/ld
export CXXFLAGS="$CXXFLAGS -Wno-error=nonnull"
export CXXFLAGS="$CXXFLAGS -O2 -fPIC -Wno-error"
export CFLAGS="$CFLAGS -O2 -fPIC -Wno-error"
export NO_WERROR=1
export BUILD_TEST=0

echo "Installing required Python packages..."
pip install wheel scipy ninja build pytest

pip install wheel "numpy<2.0" scipy==1.13.1 ninja build pytest
echo "Installing required numpy"
pip install "numpy<2.0"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

numpy is installed at line #50 already.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes it is delibrately done, scipy install higher numpy version during its build. so we have to downgrade it again. Same is also done for torch 2.0.1 script.


# Check if Rust is installed
if ! command -v rustc &> /dev/null; then
echo "Rust not found. Installing Rust..."
Expand All @@ -49,38 +59,37 @@ curl https://sh.rustup.rs -sSf | sh -s -- -y
else
echo "Rust is already installed."
fi

# Clone repository
echo "Cloning PyTorch repository...."
echo "Cloning PyTorch repository..."
git clone $PACKAGE_URL
cd $PACKAGE_NAME

echo "Checking out version $PACKAGE_VERSION..."
git checkout $PACKAGE_VERSION

echo "Syncing and updating submodules..."
git submodule sync
git submodule update --init --recursive

echo "Installing package dependencies..."
pip install -r requirements.txt

export LD_LIBRARY_PATH="${CURRENT_DIR}/pytorch/torch/lib/:${LD_LIBRARY_PATH}"



# Build and install the package
echo "Starting PyTorch build and installation..."
if ! python3 setup.py install; then
if ! (MAX_JOBS=$(nproc) python3 setup.py install); then
echo "------------------$PACKAGE_NAME:install_fails-------------------------------------"
echo "$PACKAGE_URL $PACKAGE_NAME"
echo "$PACKAGE_NAME | $PACKAGE_URL | $PACKAGE_VERSION | $OS_NAME | GitHub | Fail | Install_Fails"
exit 1
fi

echo "Building wheel file..."
python setup.py bdist_wheel --dist-dir="$CURRENT_DIR/"

python3 setup.py bdist_wheel --dist-dir="$CURRENT_DIR/"
cd ..

# Basic sanity test (subset)
echo "Running basic sanity test..."
if ! pytest $PACKAGE_NAME/test/test_utils.py; then
Expand Down