Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.
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
2 changes: 1 addition & 1 deletion common/install_mnist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ mkdir -p /usr/local/mnist/
cd /usr/local/mnist

for img in train-images-idx3-ubyte.gz train-labels-idx1-ubyte.gz t10k-images-idx3-ubyte.gz t10k-labels-idx1-ubyte.gz; do
wget -q http://yann.lecun.com/exdb/mnist/$img
wget -q https://ossci-datasets.s3.amazonaws.com/mnist/$img
gzip -d $img
done
5 changes: 3 additions & 2 deletions common/install_openssl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ OPENSSL=openssl-1.1.1k
wget -q -O ${OPENSSL}.tar.gz https://www.openssl.org/source/${OPENSSL}.tar.gz
tar xf ${OPENSSL}.tar.gz
cd ${OPENSSL}
./config -d '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)'
make install
./config --prefix=/opt/openssl -d '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)'
# NOTE: opensl errors out when built with the -j option
make install_sw
cd ..
rm -rf ${OPENSSL}
14 changes: 7 additions & 7 deletions conda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ COPY --from=cuda11.0 /usr/local/cuda-11.0 /usr/local/cuda-11.0
COPY --from=cuda11.1 /usr/local/cuda-11.1 /usr/local/cuda-11.1
COPY --from=cuda11.2 /usr/local/cuda-11.2 /usr/local/cuda-11.2

# Install LLVM
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx_abi /opt/llvm_no_cxx_abi

FROM ${BASE_TARGET} as final
COPY --from=patchelf /patchelf /usr/local/bin/patchelf
COPY --from=conda /opt/conda /opt/conda
ADD ./java/jni.h /usr/local/include/jni.h
# Install LLVM
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx11_abi /opt/llvm_no_cxx11_abi
COPY --from=openssl /opt/openssl /opt/openssl
COPY --from=patchelf /patchelf /usr/local/bin/patchelf
COPY --from=conda /opt/conda /opt/conda
ADD ./java/jni.h /usr/local/include/jni.h
ENV PATH /opt/conda/bin:$PATH
COPY --from=mnist /usr/local/mnist /usr/local/mnist
RUN rm -rf /usr/local/cuda
Expand Down
2 changes: 1 addition & 1 deletion conda/build_all_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -eou pipefail

TOPDIR=$(git rev-parse --show-toplevel)

for CUDA_VERSION in 11.2 11.1 11.0 10.2 10.1 cpu; do
for CUDA_VERSION in 11.1 10.2 cpu; do
CUDA_VERSION="${CUDA_VERSION}" conda/build_docker.sh
done
16 changes: 14 additions & 2 deletions conda/build_docker.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#!/usr/bin/env bash

set -eou pipefail

export DOCKER_BUILDKIT=1
TOPDIR=$(git rev-parse --show-toplevel)

Expand Down Expand Up @@ -31,11 +33,21 @@ esac
${TOPDIR}
)

if [[ ${DOCKER_TAG} =~ ^cuda* ]]; then
if [[ "${DOCKER_TAG}" =~ ^cuda* ]]; then
# Meant for legacy scripts since they only do the version without the "."
# TODO: Eventually remove this
(
set -x
docker tag "pytorch/conda-builder:${DOCKER_TAG}" pytorch/conda-builder:cuda${CUDA_VERSION/./}
docker tag "pytorch/conda-builder:${DOCKER_TAG}" "pytorch/conda-builder:cuda${CUDA_VERSION/./}"
)
fi

if [[ -n "${WITH_PUSH:-}" ]]; then
(
set -x
docker push "pytorch/conda-builder:${DOCKER_TAG}"
if [[ "${DOCKER_TAG}" =~ ^cuda* ]]; then
docker push "pytorch/conda-builder:cuda${CUDA_VERSION/./}"
fi
)
fi
4 changes: 2 additions & 2 deletions libtorch/build_all_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ set -eou pipefail

TOPDIR=$(git rev-parse --show-toplevel)

for CUDA_VERSION in 11.2 11.1 11.0 10.2 10.1 cpu; do
CUDA_VERSION="${CUDA_VERSION}" conda/build_docker.sh
for CUDA_VERSION in 11.1 10.2 cpu; do
CUDA_VERSION="${CUDA_VERSION}" libtorch/build_docker.sh
done
7 changes: 7 additions & 0 deletions libtorch/build_docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,10 @@ esac
-f "${TOPDIR}/libtorch/ubuntu16.04/Dockerfile" \
${TOPDIR}
)

if [[ -n "${WITH_PUSH:-}" ]]; then
(
set -x
docker push pytorch/libtorch-cxx11-builder:${DOCKER_TAG}
)
fi
9 changes: 5 additions & 4 deletions libtorch/ubuntu16.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ ENV LANG en_US.UTF-8
ENV LANGUAGE en_US.UTF-8

# Install openssl
FROM base as openssl
ADD ./common/install_openssl.sh install_openssl.sh
RUN bash ./install_openssl.sh && rm install_openssl.sh

Expand Down Expand Up @@ -53,11 +54,11 @@ FROM cuda as cuda11.2
RUN bash ./install_cuda.sh 11.2
RUN bash ./install_magma.sh 11.2

# Install LLVM
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx_abi /opt/llvm_no_cxx_abi

FROM ${BASE_TARGET} as final
# Install LLVM
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx11_abi /opt/llvm_no_cxx11_abi
COPY --from=openssl /opt/openssl /opt/openssl
# Install patchelf
ADD ./common/install_patchelf.sh install_patchelf.sh
RUN bash ./install_patchelf.sh && rm install_patchelf.sh
Expand Down
2 changes: 1 addition & 1 deletion llvm/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ RUN cmake -G "Unix Makefiles" \
RUN make -j"$(nproc --ignore=2)" && make install


FROM scratch as final
FROM alpine as final
Copy link
Member Author

Choose a reason for hiding this comment

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

This adds some bulk to the builds, but makes it easier to debug if needing to inspect the image itself

COPY --from=dev /opt/llvm /opt/llvm
COPY --from=dev /opt/llvm_no_cxx11_abi /opt/llvm_no_cxx11_abi
32 changes: 16 additions & 16 deletions manywheel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,22 @@ RUN yum install -y \
RUN yum swap -y git git224-core

ENV SSL_CERT_FILE=/opt/_internal/certs.pem
COPY --from=python /opt/python /opt/python
COPY --from=python /opt/_internal /opt/_internal
COPY --from=python /opt/python/cp36-cp36m/bin/auditwheel /usr/local/bin/auditwheel
COPY --from=intel /opt/intel /opt/intel
COPY --from=patchelf /usr/local/bin/patchelf /usr/local/bin/patchelf
COPY --from=jni /usr/local/include/jni.h /usr/local/include/jni.h
COPY --from=libpng /usr/local/bin/png* /usr/local/bin/
COPY --from=libpng /usr/local/bin/libpng* /usr/local/bin/
COPY --from=libpng /usr/local/include/png* /usr/local/include/
COPY --from=libpng /usr/local/include/libpng* /usr/local/include/
COPY --from=libpng /usr/local/lib/libpng* /usr/local/lib/
COPY --from=libpng /usr/local/lib/pkgconfig /usr/local/lib/pkgconfig
# Install LLVM version
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx11_abi /opt/llvm_no_cxx11_abi
COPY --from=openssl /opt/openssl /opt/openssl
COPY --from=python /opt/python /opt/python
COPY --from=python /opt/_internal /opt/_internal
COPY --from=python /opt/python/cp36-cp36m/bin/auditwheel /usr/local/bin/auditwheel
COPY --from=intel /opt/intel /opt/intel
COPY --from=patchelf /usr/local/bin/patchelf /usr/local/bin/patchelf
COPY --from=jni /usr/local/include/jni.h /usr/local/include/jni.h
COPY --from=libpng /usr/local/bin/png* /usr/local/bin/
COPY --from=libpng /usr/local/bin/libpng* /usr/local/bin/
COPY --from=libpng /usr/local/include/png* /usr/local/include/
COPY --from=libpng /usr/local/include/libpng* /usr/local/include/
COPY --from=libpng /usr/local/lib/libpng* /usr/local/lib/
COPY --from=libpng /usr/local/lib/pkgconfig /usr/local/lib/pkgconfig

FROM common as cpu_final
ARG BASE_CUDA_VERSION=10.1
Expand All @@ -138,10 +142,6 @@ RUN rm -rf /usr/local/cuda-${BASE_CUDA_VERSION}
COPY --from=cuda /usr/local/cuda-${BASE_CUDA_VERSION} /usr/local/cuda-${BASE_CUDA_VERSION}
COPY --from=magma /usr/local/cuda-${BASE_CUDA_VERSION} /usr/local/cuda-${BASE_CUDA_VERSION}

# Install LLVM version
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
COPY --from=pytorch/llvm:9.0.1 /opt/llvm_no_cxx11_abi /opt/llvm_no_cxx11_abi

FROM common as rocm_final
ARG ROCM_VERSION=3.7
# Install ROCm
Expand Down
8 changes: 8 additions & 0 deletions manywheel/build_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ set -ex
# Python versions to be installed in /opt/$VERSION_NO
CPYTHON_VERSIONS=${CPYTHON_VERSIONS:-"3.6.6 3.7.5 3.8.1 3.9.0"}

# openssl version to build, with expected sha256 hash of .tar.gz
# archive
OPENSSL_ROOT=openssl-1.0.2k
OPENSSL_HASH=6b3977c61f2aedf0f96367dcfb5c6e578cf37e7b8d913b4ecb6643c3cb88d8c0
DEVTOOLS_HASH=a8ebeb4bed624700f727179e6ef771dafe47651131a00a78b342251415646acc
PATCHELF_HASH=d9afdff4baeacfbc64861454f368b7f2c15c44d245293f7587bbf726bfe722fb
CURL_ROOT=curl-7.49.1
Expand Down Expand Up @@ -36,6 +40,10 @@ build_autoconf $AUTOCONF_ROOT $AUTOCONF_HASH
autoconf --version

# Compile the latest Python releases.
# (In order to have a proper SSL module, Python is compiled
# against a recent openssl [see env vars above], which is linked
# statically. We delete openssl afterwards.)
build_openssl $OPENSSL_ROOT $OPENSSL_HASH
mkdir -p /opt/python
build_cpythons $CPYTHON_VERSIONS

Expand Down
7 changes: 6 additions & 1 deletion manywheel/build_scripts/build_utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
# Helper utilities for build

PYTHON_DOWNLOAD_URL=https://www.python.org/ftp/python
# XXX: the official https server at www.openssl.org cannot be reached
# with the old versions of openssl and curl in Centos 5.11 hence the fallback
# to the ftp mirror:
OPENSSL_DOWNLOAD_URL=ftp://ftp.openssl.org/source/old/1.0.2/
# Ditto the curl sources
CURL_DOWNLOAD_URL=http://curl.askapache.com/download

Expand Down Expand Up @@ -90,7 +94,8 @@ function build_cpythons {


function do_openssl_build {
./config -d '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)' > /dev/null
./config no-ssl2 no-shared -fPIC --prefix=/usr/local/ssl > /dev/null
make > /dev/null
make install > /dev/null
}

Expand Down
38 changes: 21 additions & 17 deletions manywheel/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,35 @@

set -eou pipefail

for rocm_version in 3.7 3.8 3.9 3.10 4.0 4.0.1 4.1; do
(
set -x
DOCKER_BUILDKIT=1 docker build \
-t "pytorch/manylinux-rocm:${rocm_version}" \
--build-arg "ROCM_VERSION=${rocm_version}" \
--build-arg "GPU_IMAGE=rocm/dev-centos-7:${rocm_version}" \
--target rocm_final \
-f manywheel/Dockerfile \
.
docker push "pytorch/manylinux-rocm:${rocm_version}"
)
done
DOCKER_REGISTRY="${DOCKER_REGISTRY:-docker.io}"

# for rocm_version in 4.0.1 4.1; do
# DOCKER_IMAGE="${DOCKER_REGISTRY}/pytorch/manylinux-rocm:${rocm_version}"
# (
# set -x
# DOCKER_BUILDKIT=1 docker build \
# -t "${DOCKER_IMAGE}" \
# --build-arg "ROCM_VERSION=${rocm_version}" \
# --build-arg "GPU_IMAGE=rocm/dev-centos-7:${rocm_version}" \
# --target rocm_final \
# -f manywheel/Dockerfile \
# .
# docker push "${DOCKER_IMAGE}"
# )
# done

for cuda_version in 9.2 10.1 10.2 11.0 11.1 11.2; do
for cuda_version in 10.2 11.1; do
DOCKER_IMAGE="${DOCKER_REGISTRY}/pytorch/manylinux-cuda${cuda_version//./}"
(
set -x
DOCKER_BUILDKIT=1 docker build \
-t "pytorch/manylinux-cuda${cuda_version//./}" \
-t "${DOCKER_IMAGE}" \
--build-arg "BASE_CUDA_VERSION=${cuda_version}" \
--build-arg "GPU_IMAGE=nvidia/cuda:${cuda_version}-devel-centos7" \
--target cuda_final \
-f manywheel/Dockerfile \
.
docker push "pytorch/manylinux-cuda${cuda_version//./}"
docker push ${DOCKER_IMAGE}
)
done

Expand All @@ -38,5 +42,5 @@ done
--target cpu_final \
-f manywheel/Dockerfile \
.
docker push "pytorch/manylinux-cpu"
docker push "${DOCKER_REGISTRY}/pytorch/manylinux-cpu"
)