|
1 | 1 | #!/bin/bash
|
2 | 2 |
|
3 |
| -# old non-updated compute platforms: |
4 |
| -# cu75 cu80 cu90 cu91 cu92 cu100 cu101 cu102 cu110 cu111 cu113 cu115 cu116 cu117 cu117_pypi_cudnn |
5 |
| -# rocm3.10 rocm3.7 rocm3.8 rocm4.0.1 rocm4.1 rocm4.2 rocm4.3.1 rocm4.5.2 rocm5.0 rocm5.1.1 rocm5.2 rocm5.3 rocm5.4.2 rocm5.5 rocm5.6 rocm5.7 |
6 |
| -for d in . cpu cpu-cxx11-abi cpu_pypi_pkg cu118 cu121 cu124 rocm6.0 rocm6.1 |
7 |
| -do |
8 |
| - d="whl/$d" |
9 |
| - [ "$d" == "whl/." ] && d="whl" |
| 3 | +# update a PyPI index from PyTorch = https://download.pytorch.org/$d with d=whl or whl/<compute platform> |
| 4 | +# this copies the content (main url + follows links to projects) and does 2 updates: |
| 5 | +# 1. copies the content in a "simple/" sub-directory to match the convention from PEP 503 simple (that allows other APIs in parallel) |
| 6 | +# 2. updates the links to binary packages by adding "https://download.pytorch.org" prefix to PyTorch-provided "/whl/*" path to link back to PyTorch binaries in their home location |
| 7 | +function updateIndex() { |
| 8 | + local d=$1 |
| 9 | + |
| 10 | + # will copy source $d to $d/simple |
10 | 11 | mkdir -p $d/simple
|
11 |
| - dir="$(pwd)" |
| 12 | + local dir="$(pwd)" |
12 | 13 | cd $d/simple
|
| 14 | + |
| 15 | + # projects list |
13 | 16 | curl -s https://download.pytorch.org/$d/ | grep -v 'TIMESTAMP 1' > index.html
|
14 |
| - count="$(cat index.html | cut -d '>' -f 2 | cut -d '<' -f 1 | grep -cve '^\s*$')" |
| 17 | + local count="$(cat index.html | cut -d '>' -f 2 | cut -d '<' -f 1 | grep -cve '^\s*$')" |
15 | 18 |
|
16 |
| - echo "https://download.pytorch.org/$d/ $count => $d/simple/" |
17 |
| - if [ $count -lt 40 ] |
18 |
| - then |
19 |
| - echo "failing because low packages count for $d: $count (intermittent download failure?)" |
20 |
| - exit 1 |
21 |
| - fi |
| 19 | + echo "https://download.pytorch.org/$d/ => $d/simple/" |
| 20 | + checkCount $d $count 40 |
22 | 21 |
|
23 |
| - i=0 |
| 22 | + # copy also content of each project |
| 23 | + local i=0 |
24 | 24 | for p in `cat index.html | cut -d '>' -f 2 | cut -d '<' -f 1`
|
25 | 25 | do
|
26 | 26 | mkdir -p $p
|
|
31 | 31 | | grep -v 'TIMESTAMP 1' \
|
32 | 32 | > index.html
|
33 | 33 |
|
34 |
| - count="$(cat index.html | grep -c 'https://download.pytorch.org/whl/')" |
35 |
| - echo "$i $d/$p/ => $d/simple/$p/ $count" |
36 |
| - if [ $count -lt 1 ] |
37 |
| - then |
38 |
| - echo "failing because low packages count for $d/$p: $count (intermittent download failure?)" |
39 |
| - exit 1 |
40 |
| - fi |
| 34 | + local pcount="$(cat index.html | grep -c 'https://download.pytorch.org/whl/')" |
| 35 | + printf "%5d / $count $d/$p/ => $d/simple/$p/ $pcount\n" $i |
| 36 | + checkCount $d/$p $count 1 |
41 | 37 | cd ..
|
42 | 38 | done
|
43 | 39 | echo
|
44 | 40 | cd "$dir"
|
| 41 | +} |
| 42 | + |
| 43 | +function checkCount() { |
| 44 | + local content="$1" |
| 45 | + local count="$2" |
| 46 | + local minimum="$3" |
| 47 | + |
| 48 | + if [ $count -lt $minimum ] |
| 49 | + then |
| 50 | + echo "!!! failing because low packages count for $content: $count (probably intermittent download failure)" |
| 51 | + exit 1 |
| 52 | + fi |
| 53 | +} |
| 54 | + |
| 55 | +# update main PyTorch index, that contains everything, whatever the compute platform |
| 56 | +updateIndex "whl" |
| 57 | + |
| 58 | +# update compute-platform specific indexes |
| 59 | +# ignore old non-updated ones: |
| 60 | +# - cu75 cu80 cu90 cu91 cu92 cu100 cu101 cu102 cu110 cu111 cu113 cu115 cu116 cu117 cu117_pypi_cudnn |
| 61 | +# - rocm3.10 rocm3.7 rocm3.8 rocm4.0.1 rocm4.1 rocm4.2 rocm4.3.1 rocm4.5.2 rocm5.0 rocm5.1.1 rocm5.2 rocm5.3 rocm5.4.2 rocm5.5 rocm5.6 rocm5.7 |
| 62 | +for d in cpu cpu-cxx11-abi cpu_pypi_pkg cu118 cu121 cu124 rocm6.0 rocm6.1 |
| 63 | +do |
| 64 | + updateIndex "whl/$d" |
45 | 65 | done
|
46 | 66 |
|
47 | 67 | du -sh whl/*
|
48 | 68 |
|
49 |
| -for d in whl/simple whl/*/simple ; do echo "$(ls $d | wc -l) $d" ; done > summary.txt |
| 69 | +for d in whl/simple whl/*/simple ; do echo "$(ls $d | wc -l | xargs) $d" ; done > summary.txt |
50 | 70 | cat summary.txt
|
0 commit comments