linux_manywheel.sh 1.63 KB
Newer Older
1
2
3
#!/bin/bash
set -ex

4
5
if [ "$#" -ne 1 ]; then
    echo "Illegal number of parameters. Pass cuda version"
6
    echo "CUDA version should be cu92, cu100 or cpu"
7
8
    exit 1
fi
9
export CUVER="$1" # cu[0-9]* cpu
10

11
if [[ "$CUVER" == "cu102" ]]; then
12
13
14
15
  cu_suffix=""
else
  cu_suffix="+$CUVER"
fi
16
17
18
19
20
21
22
23
24
25
26

export OUT_DIR="/remote/$CUVER"

pushd /opt/python
DESIRED_PYTHON=(*/)
popd
for desired_py in "${DESIRED_PYTHON[@]}"; do
    python_installations+=("/opt/python/$desired_py")
done

OLD_PATH=$PATH
27
28
29
30
31
32
cd /tmp
rm -rf vision
git clone https://github.com/pytorch/vision

cd /tmp/vision

33
34
for PYDIR in "${python_installations[@]}"; do
    export PATH=$PYDIR/bin:$OLD_PATH
35
    pip install --upgrade pip
36
    pip install numpy pyyaml future
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

    pip uninstall -y torch || true
    pip uninstall -y torch_nightly || true

    export TORCHVISION_PYTORCH_DEPENDENCY_NAME=torch_nightly
    pip install torch_nightly -f https://download.pytorch.org/whl/nightly/$CUVER/torch_nightly.html
    # CPU/CUDA variants of PyTorch have ABI compatible PyTorch for
    # the CPU only bits.  Therefore, we
    # strip off the local package qualifier, but ONLY if we're
    # doing a CPU build.
    if [[ "$CUVER" == "cpu" ]]; then
        export TORCHVISION_PYTORCH_DEPENDENCY_VERSION="$(pip show torch_nightly | grep ^Version: | sed 's/Version: \+//' | sed 's/+.\+//')"
    else
        export TORCHVISION_PYTORCH_DEPENDENCY_VERSION="$(pip show torch_nightly | grep ^Version: | sed 's/Version: \+//')"
    fi
    echo "Building against ${TORCHVISION_PYTORCH_DEPENDENCY_VERSION}"

54
55
56
57
58
59
    pip install ninja
    python setup.py clean
    python setup.py bdist_wheel
    mkdir -p $OUT_DIR
    cp dist/*.whl $OUT_DIR/
done