Skip to content

Commit c7c3683

Browse files
authored
[ML] Upgrade to PyTorch 1.11 on Linux (#2238)
Together with #2233 and #2235 this completes the upgrade to PyTorch 1.11 for all platforms. A small change to the way things are done is that we now copy all MKL libraries into the Docker images, then copy the required subset into our release distribution. This means we can change the subset of MKL libraries that we redistribute without having to rebuild our Docker images. Fixes #2126
1 parent 64aa225 commit c7c3683

File tree

15 files changed

+33
-34
lines changed

15 files changed

+33
-34
lines changed

3rd_party/3rd_party.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ case `uname` in
7070
MKL_LOCATION=/usr/local/gcc103/lib
7171
MKL_EXTENSION=.so
7272
MKL_PREFIX=libmkl_
73-
MKL_LIBRARIES=`cd "$MKL_LOCATION" && ls $MKL_PREFIX*$MKL_EXTENSION`
73+
MKL_LIBRARIES='avx avx2 avx512 avx512_mic core def gnu_thread intel_lp64 mc3 vml_avx vml_avx2 vml_avx512 vml_avx512_mic vml_cmpt vml_def vml_mc3'
7474
fi
7575
BOOST_EXTENSION=mt-${BOOST_ARCH}-1_77.so.1.77.0
7676
BOOST_LIBRARIES='atomic chrono date_time filesystem iostreams log log_setup program_options regex system thread unit_test_framework'
@@ -265,11 +265,11 @@ fi
265265
if [ ! -z "$MKL_LOCATION" ] ; then
266266
if [ ! -z "$MKL_LIBRARIES" ] ; then
267267
if [ -n "$INSTALL_DIR" ] ; then
268+
rm -f $INSTALL_DIR/$MKL_PREFIX*$MKL_EXTENSION
268269
for LIBRARY in $MKL_LIBRARIES
269270
do
270-
rm -f $INSTALL_DIR/$LIBRARY
271-
cp $MKL_LOCATION/$LIBRARY $INSTALL_DIR
272-
chmod u+wx $INSTALL_DIR/$LIBRARY
271+
cp $MKL_LOCATION/$MKL_PREFIX$LIBRARY$MKL_EXTENSION $INSTALL_DIR
272+
chmod u+wx $INSTALL_DIR/$MKL_PREFIX$LIBRARY$MKL_EXTENSION
273273
done
274274
fi
275275
else

3rd_party/licenses/pytorch-INFO.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
name,version,revision,url,license,copyright,sourceURL
2-
PyTorch,1.9.0,d69c22dd61a2f006dcfe1e3ea8468a3ecaf931aa,https://pytorch.org,BSD-3-Clause,,
2+
PyTorch,1.11.0,bc2c6edaf163b1a1330e37a6e34caf8c553e4755,https://pytorch.org,BSD-3-Clause,,

build-setup/linux.md

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -274,18 +274,13 @@ sudo yum-config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-m
274274
sudo yum -y install intel-mkl-2020.4-912
275275
```
276276

277-
Then copy the required libraries to the system directory:
277+
Then copy the shared libraries to the system directory:
278278

279279
```
280-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /usr/local/gcc103/lib
281-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_core.so /usr/local/gcc103/lib
282-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_def.so /usr/local/gcc103/lib
283-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_gnu_thread.so /usr/local/gcc103/lib
284-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_avx*.so /usr/local/gcc103/lib
285-
sudo cp /opt/intel/mkl/lib/intel64/libmkl_vml*.so /usr/local/gcc103/lib
280+
sudo cp /opt/intel/mkl/lib/intel64/libmkl*.so /usr/local/gcc103/lib
286281
```
287282

288-
### PyTorch 1.9.0
283+
### PyTorch 1.11.0
289284

290285
PyTorch requires that certain Python modules are installed. Install these modules with `pip` using the same Python version you will build PyTorch with. If you followed the instructions above and built Python from source use `python3.7`:
291286

@@ -302,7 +297,7 @@ sudo /usr/local/gcc103/bin/python3.7 -m pip install install numpy pyyaml setupto
302297
Then obtain the PyTorch code:
303298

304299
```
305-
git clone --depth=1 --branch=v1.9.0 git@github.com:pytorch/pytorch.git
300+
git clone --depth=1 --branch=v1.11.0 git@github.com:pytorch/pytorch.git
306301
cd pytorch
307302
git submodule sync
308303
git submodule update --init --recursive
@@ -330,7 +325,8 @@ export USE_MKLDNN=ON
330325
export USE_QNNPACK=OFF
331326
export USE_PYTORCH_QNNPACK=OFF
332327
[ $(uname -m) = x86_64 ] && export USE_XNNPACK=OFF
333-
export PYTORCH_BUILD_VERSION=1.9.0
328+
[ $(uname -m) != x86_64 ] && export USE_BREAKPAD=OFF
329+
export PYTORCH_BUILD_VERSION=1.11.0
334330
export PYTORCH_BUILD_NUMBER=1
335331
/usr/local/gcc103/bin/python3.7 setup.py install
336332
```

dev-tools/docker/build_linux_aarch64_cross_build_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
HOST=docker.elastic.co
2323
ACCOUNT=ml-dev
2424
REPOSITORY=ml-linux-aarch64-cross-build
25-
VERSION=6
25+
VERSION=7
2626

2727
set -e
2828

dev-tools/docker/build_linux_aarch64_native_build_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ sleep 5
3434
HOST=docker.elastic.co
3535
ACCOUNT=ml-dev
3636
REPOSITORY=ml-linux-aarch64-native-build
37-
VERSION=6
37+
VERSION=7
3838

3939
set -e
4040

dev-tools/docker/build_linux_build_image.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ sleep 5
3434
HOST=docker.elastic.co
3535
ACCOUNT=ml-dev
3636
REPOSITORY=ml-linux-build
37-
VERSION=20
37+
VERSION=21
3838

3939
set -e
4040

dev-tools/docker/linux_aarch64_cross_builder/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111

1212
# Increment the version here when a new tools/3rd party components image is built
13-
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-cross-build:6
13+
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-cross-build:7
1414

1515
MAINTAINER David Roberts <dave.roberts@elastic.co>
1616

dev-tools/docker/linux_aarch64_cross_image/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ RUN \
2424
RUN \
2525
mkdir -p /usr/local/sysroot-aarch64-linux-gnu/usr && \
2626
cd /usr/local/sysroot-aarch64-linux-gnu/usr && \
27-
wget --quiet -O - https://s3-eu-west-1.amazonaws.com/prelert-artifacts/dependencies/usr-aarch64-linux-gnu-6.tar.bz2 | tar jxf - && \
27+
wget --quiet -O - https://s3-eu-west-1.amazonaws.com/prelert-artifacts/dependencies/usr-aarch64-linux-gnu-7.tar.bz2 | tar jxf - && \
2828
cd .. && \
2929
ln -s usr/lib lib && \
3030
ln -s usr/lib64 lib64

dev-tools/docker/linux_aarch64_native_builder/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111

1212
# Increment the version here when a new tools/3rd party components image is built
13-
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-native-build:6
13+
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-native-build:7
1414

1515
MAINTAINER David Roberts <dave.roberts@elastic.co>
1616

dev-tools/docker/linux_aarch64_native_image/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ENV PATH=${PATH}:/usr/local/cmake/bin
127127
# If the PyTorch branch is changed also update PYTORCH_BUILD_VERSION
128128
RUN \
129129
cd ${build_dir} && \
130-
git -c advice.detachedHead=false clone --depth=1 --branch=v1.9.0 https://github.com/pytorch/pytorch.git && \
130+
git -c advice.detachedHead=false clone --depth=1 --branch=v1.11.0 https://github.com/pytorch/pytorch.git && \
131131
cd pytorch && \
132132
git submodule sync && \
133133
git submodule update --init --recursive && \
@@ -140,7 +140,8 @@ RUN \
140140
export USE_MKLDNN=ON && \
141141
export USE_QNNPACK=OFF && \
142142
export USE_PYTORCH_QNNPACK=OFF && \
143-
export PYTORCH_BUILD_VERSION=1.9.0 && \
143+
export USE_BREAKPAD=OFF && \
144+
export PYTORCH_BUILD_VERSION=1.11.0 && \
144145
export PYTORCH_BUILD_NUMBER=1 && \
145146
/usr/local/bin/python3.7 setup.py install && \
146147
mkdir /usr/local/gcc103/include/pytorch && \

dev-tools/docker/linux_aarch64_native_tester/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111

1212
# Increment the version here when a new tools/3rd party components image is built
13-
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-native-build:6
13+
FROM docker.elastic.co/ml-dev/ml-linux-aarch64-native-build:7
1414

1515
MAINTAINER David Roberts <dave.roberts@elastic.co>
1616

dev-tools/docker/linux_builder/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111

1212
# Increment the version here when a new tools/3rd party components image is built
13-
FROM docker.elastic.co/ml-dev/ml-linux-build:20
13+
FROM docker.elastic.co/ml-dev/ml-linux-build:21
1414

1515
MAINTAINER David Roberts <dave.roberts@elastic.co>
1616

dev-tools/docker/linux_image/Dockerfile

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -128,18 +128,13 @@ ENV PATH=${PATH}:/usr/local/cmake/bin
128128
RUN \
129129
yum-config-manager --add-repo https://yum.repos.intel.com/mkl/setup/intel-mkl.repo && \
130130
yum -y install intel-mkl-2020.4-912 && \
131-
cp /opt/intel/mkl/lib/intel64/libmkl_intel_lp64.so /usr/local/gcc103/lib && \
132-
cp /opt/intel/mkl/lib/intel64/libmkl_core.so /usr/local/gcc103/lib && \
133-
cp /opt/intel/mkl/lib/intel64/libmkl_def.so /usr/local/gcc103/lib && \
134-
cp /opt/intel/mkl/lib/intel64/libmkl_gnu_thread.so /usr/local/gcc103/lib && \
135-
cp /opt/intel/mkl/lib/intel64/libmkl_avx*.so /usr/local/gcc103/lib && \
136-
cp /opt/intel/mkl/lib/intel64/libmkl_vml*.so /usr/local/gcc103/lib
131+
cp /opt/intel/mkl/lib/intel64/libmkl*.so /usr/local/gcc103/lib
137132

138133
# Clone PyTorch and build LibTorch
139134
# If the PyTorch branch is changed also update PYTORCH_BUILD_VERSION
140135
RUN \
141136
cd ${build_dir} && \
142-
git -c advice.detachedHead=false clone --depth=1 --branch=v1.9.0 https://github.com/pytorch/pytorch.git && \
137+
git -c advice.detachedHead=false clone --depth=1 --branch=v1.11.0 https://github.com/pytorch/pytorch.git && \
143138
cd pytorch && \
144139
git submodule sync && \
145140
git submodule update --init --recursive && \
@@ -153,7 +148,7 @@ RUN \
153148
export USE_QNNPACK=OFF && \
154149
export USE_PYTORCH_QNNPACK=OFF && \
155150
export USE_XNNPACK=OFF && \
156-
export PYTORCH_BUILD_VERSION=1.9.0 && \
151+
export PYTORCH_BUILD_VERSION=1.11.0 && \
157152
export PYTORCH_BUILD_NUMBER=1 && \
158153
/usr/local/bin/python3.7 setup.py install && \
159154
mkdir /usr/local/gcc103/include/pytorch && \

dev-tools/docker/linux_tester/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#
1111

1212
# Increment the version here when a new tools/3rd party components image is built
13-
FROM docker.elastic.co/ml-dev/ml-linux-build:20
13+
FROM docker.elastic.co/ml-dev/ml-linux-build:21
1414

1515
MAINTAINER David Roberts <dave.roberts@elastic.co>
1616

docs/CHANGELOG.asciidoc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,13 @@
2828

2929
//=== Regressions
3030

31+
== {es} version 8.3.0
32+
33+
=== Enhancements
34+
35+
* Upgrade PyTorch to version 1.11. (See {ml-pull}2233[#2233], {ml-pull}2235[#2235]
36+
and {ml-pull}2238[#2238].)
37+
3138
== {es} version 8.2.0
3239

3340
=== Enhancements

0 commit comments

Comments
 (0)