Skip to content

Commit b87a36b

Browse files
Merge pull request #1040 from ROCmSoftwarePlatform/IFU-master-2022-07-11
IFU master 2022 07 11
2 parents df51941 + 9393520 commit b87a36b

File tree

1,310 files changed

+96488
-32284
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,310 files changed

+96488
-32284
lines changed

.bazelrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ build --copt=-isystem --copt=bazel-out/k8-fastbuild-cpu-only/bin
3131
# rules_cuda configuration
3232
build:cpu-only --@rules_cuda//cuda:enable_cuda=False
3333

34+
# Definition of --config=shell
35+
# interactive shell immediately before execution
36+
build:shell --run_under="//tools/bazel_tools:shellwrap"
37+
3438
# Disable all warnings for external repositories. We don't care about
3539
# their warnings.
3640
build --per_file_copt=^external/@-w

.buckconfig.oss

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,23 @@
33

44
[buildfile]
55
name = BUCK.oss
6+
includes = //tools/build_defs/select.bzl
67

78
[repositories]
89
bazel_skylib = third_party/bazel-skylib/
10+
ovr_config = .
911

1012
[download]
1113
in_build = true
1214

1315
[cxx]
1416
cxxflags = -std=c++17
1517
should_remap_host_platform = true
18+
cpp = /usr/bin/clang
19+
cc = /usr/bin/clang
20+
cxx = /usr/bin/clang++
21+
cxxpp = /usr/bin/clang++
22+
ld = /usr/bin/clang++
1623

1724
[project]
1825
default_flavors_mode=all

.circleci/cimodel/data/pytorch_build_data.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def child_constructor(self):
7575
"vulkan": VulkanConfigNode,
7676
"parallel_tbb": ParallelTBBConfigNode,
7777
"crossref": CrossRefConfigNode,
78+
"dynamo": DynamoConfigNode,
7879
"parallel_native": ParallelNativeConfigNode,
7980
"onnx": ONNXConfigNode,
8081
"libtorch": LibTorchConfigNode,
@@ -179,6 +180,14 @@ def child_constructor(self):
179180
return ImportantConfigNode
180181

181182

183+
class DynamoConfigNode(TreeConfigNode):
184+
def init2(self, node_name):
185+
self.props["is_dynamo"] = node_name
186+
187+
def child_constructor(self):
188+
return ImportantConfigNode
189+
190+
182191
class ParallelNativeConfigNode(TreeConfigNode):
183192
def modify_label(self, label):
184193
return "PARALLELNATIVE=" + str(label)

.circleci/cimodel/data/pytorch_build_definitions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ def instantiate_configs(only_slow_gradcheck):
240240
is_xla = fc.find_prop("is_xla") or False
241241
is_asan = fc.find_prop("is_asan") or False
242242
is_crossref = fc.find_prop("is_crossref") or False
243+
is_dynamo = fc.find_prop("is_dynamo") or False
243244
is_onnx = fc.find_prop("is_onnx") or False
244245
is_pure_torch = fc.find_prop("is_pure_torch") or False
245246
is_vulkan = fc.find_prop("is_vulkan") or False
@@ -286,6 +287,9 @@ def instantiate_configs(only_slow_gradcheck):
286287
if is_crossref:
287288
parms_list_ignored_for_docker_image.append("crossref")
288289

290+
if is_dynamo:
291+
parms_list_ignored_for_docker_image.append("dynamo")
292+
289293
if is_onnx:
290294
parms_list.append("onnx")
291295
python_version = fc.find_prop("pyver")

.circleci/docker/build.sh

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ elif [[ "$image" == *-bionic* ]]; then
5454
UBUNTU_VERSION=18.04
5555
elif [[ "$image" == *-focal* ]]; then
5656
UBUNTU_VERSION=20.04
57+
elif [[ "$image" == *-jammy* ]]; then
58+
UBUNTU_VERSION=22.04
5759
elif [[ "$image" == *ubuntu* ]]; then
5860
extract_version_from_image_name ubuntu UBUNTU_VERSION
5961
elif [[ "$image" == *centos* ]]; then
@@ -70,7 +72,8 @@ else
7072
fi
7173

7274
DOCKERFILE="${OS}/Dockerfile"
73-
if [[ "$image" == *cuda* ]]; then
75+
# When using ubuntu - 22.04, start from Ubuntu docker image, instead of nvidia/cuda docker image.
76+
if [[ "$image" == *cuda* && "$UBUNTU_VERSION" != "22.04" ]]; then
7477
DOCKERFILE="${OS}-cuda/Dockerfile"
7578
elif [[ "$image" == *rocm* ]]; then
7679
DOCKERFILE="${OS}-rocm/Dockerfile"
@@ -136,7 +139,7 @@ case "$image" in
136139
KATEX=yes
137140
;;
138141
pytorch-linux-bionic-cuda11.6-cudnn8-py3-gcc7)
139-
CUDA_VERSION=11.6.0
142+
CUDA_VERSION=11.6.2
140143
CUDNN_VERSION=8
141144
ANACONDA_PYTHON_VERSION=3.7
142145
GCC_VERSION=7
@@ -173,6 +176,13 @@ case "$image" in
173176
DB=yes
174177
VISION=yes
175178
;;
179+
pytorch-linux-focal-py3-clang10-onnx)
180+
ANACONDA_PYTHON_VERSION=3.7
181+
CLANG_VERSION=10
182+
PROTOBUF=yes
183+
DB=yes
184+
VISION=yes
185+
;;
176186
pytorch-linux-xenial-py3-clang5-android-ndk-r19c)
177187
ANACONDA_PYTHON_VERSION=3.7
178188
CLANG_VERSION=5.0
@@ -224,15 +234,15 @@ case "$image" in
224234
DB=yes
225235
VISION=yes
226236
;;
227-
pytorch-linux-bionic-rocm5.0-py3.7)
237+
pytorch-linux-focal-rocm5.0-py3.7)
228238
ANACONDA_PYTHON_VERSION=3.7
229239
GCC_VERSION=9
230240
PROTOBUF=yes
231241
DB=yes
232242
VISION=yes
233243
ROCM_VERSION=5.0
234244
;;
235-
pytorch-linux-bionic-rocm5.1-py3.7)
245+
pytorch-linux-focal-rocm5.1-py3.7)
236246
ANACONDA_PYTHON_VERSION=3.7
237247
GCC_VERSION=9
238248
PROTOBUF=yes
@@ -249,6 +259,15 @@ case "$image" in
249259
VISION=yes
250260
KATEX=yes
251261
;;
262+
pytorch-linux-jammy-cuda11.6-cudnn8-py3.8-clang12)
263+
ANACONDA_PYTHON_VERSION=3.8
264+
CUDA_VERSION=11.6
265+
CUDNN_VERSION=8
266+
CLANG_VERSION=12
267+
PROTOBUF=yes
268+
DB=yes
269+
VISION=yes
270+
;;
252271
*)
253272
# Catch-all for builds that are not hardcoded.
254273
PROTOBUF=yes

.circleci/docker/build_docker.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ tag="${DOCKER_TAG}"
1818

1919
registry="308535385114.dkr.ecr.us-east-1.amazonaws.com"
2020
image="${registry}/pytorch/${IMAGE_NAME}"
21+
ghcr_image="ghcr.io/pytorch/ci-image"
2122

2223
login() {
2324
aws ecr get-authorization-token --region us-east-1 --output text --query 'authorizationData[].authorizationToken' |
@@ -48,7 +49,19 @@ fi
4849

4950
# Only push if `DOCKER_SKIP_PUSH` = false
5051
if [ "${DOCKER_SKIP_PUSH:-true}" = "false" ]; then
51-
docker push "${image}:${tag}"
52+
# Only push if docker image doesn't exist already.
53+
# ECR image tags are immutable so this will avoid pushing if only just testing if the docker jobs work
54+
# NOTE: The only workflow that should push these images should be the docker-builds.yml workflow
55+
if ! docker manifest inspect "${image}:${tag}" >/dev/null 2>/dev/null; then
56+
docker push "${image}:${tag}"
57+
fi
58+
59+
if [ "${PUSH_GHCR_IMAGE:-}" = "true" ]; then
60+
# Push docker image to the ghcr.io
61+
echo $GHCR_PAT | docker login ghcr.io -u pytorch --password-stdin
62+
docker tag "${image}:${tag}" "${ghcr_image}:${IMAGE_NAME}-${tag}"
63+
docker push "${ghcr_image}:${IMAGE_NAME}-${tag}"
64+
fi
5265
fi
5366

5467
if [ -z "${DOCKER_SKIP_S3_UPLOAD:-}" ]; then

.circleci/docker/common/install_base.sh

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,22 @@ install_ubuntu() {
1515
elif [[ "$UBUNTU_VERSION" == "20.04"* ]]; then
1616
cmake3="cmake=3.16*"
1717
maybe_libiomp_dev=""
18+
elif [[ "$UBUNTU_VERSION" == "22.04"* ]]; then
19+
cmake3="cmake=3.22*"
20+
maybe_libiomp_dev=""
1821
else
1922
cmake3="cmake=3.5*"
2023
maybe_libiomp_dev="libiomp-dev"
2124
fi
2225

26+
if [[ "$CLANG_VERSION" == 12 ]]; then
27+
maybe_libomp_dev="libomp-12-dev"
28+
elif [[ "$CLANG_VERSION" == 10 ]]; then
29+
maybe_libomp_dev="libomp-10-dev"
30+
else
31+
maybe_libomp_dev=""
32+
fi
33+
2334
# TODO: Remove this once nvidia package repos are back online
2435
# Comment out nvidia repositories to prevent them from getting apt-get updated, see https://github.com/pytorch/pytorch/issues/74968
2536
# shellcheck disable=SC2046
@@ -51,15 +62,31 @@ install_ubuntu() {
5162
libjpeg-dev \
5263
libasound2-dev \
5364
libsndfile-dev \
65+
${maybe_libomp_dev} \
5466
software-properties-common \
5567
wget \
5668
sudo \
57-
vim
69+
vim \
70+
jq
5871

5972
# Should resolve issues related to various apt package repository cert issues
6073
# see: https://github.com/pytorch/pytorch/issues/65931
6174
apt-get install -y libgnutls30
6275

76+
# cuda-toolkit does not work with gcc-11.2.0 which is default in Ubunutu 22.04
77+
# see: https://github.com/NVlabs/instant-ngp/issues/119
78+
if [[ "$UBUNTU_VERSION" == "22.04"* ]]; then
79+
apt-get install -y g++-10
80+
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30
81+
update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30
82+
update-alternatives --install /usr/bin/gcov gcov /usr/bin/gcov-10 30
83+
84+
# https://www.spinics.net/lists/libreoffice/msg07549.html
85+
sudo rm -rf /usr/lib/gcc/x86_64-linux-gnu/11
86+
wget https://github.com/gcc-mirror/gcc/commit/2b2d97fc545635a0f6aa9c9ee3b017394bc494bf.patch -O noexecpt.patch
87+
sudo patch /usr/include/c++/10/bits/range_access.h noexecpt.patch
88+
fi
89+
6390
# Cleanup package manager
6491
apt-get autoclean && apt-get clean
6592
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

.circleci/docker/common/install_cache.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ set -ex
55
install_ubuntu() {
66
echo "Preparing to build sccache from source"
77
apt-get update
8-
apt-get install -y cargo pkg-config libssl-dev
8+
# libssl-dev will not work as it is upgraded to libssl3 in Ubuntu-22.04.
9+
# Instead use lib and headers from OpenSSL1.1 installed in `install_openssl.sh``
10+
apt-get install -y cargo
911
echo "Checking out sccache repo"
1012
git clone https://github.com/pytorch/sccache
1113
cd sccache

.circleci/docker/common/install_conda.sh

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,18 @@ if [ -n "$ANACONDA_PYTHON_VERSION" ]; then
7373
}
7474

7575
# Install PyTorch conda deps, as per https://github.com/pytorch/pytorch README
76-
# DO NOT install cmake here as it would install a version newer than 3.10, but
77-
# we want to pin to version 3.10.
76+
# DO NOT install cmake here as it would install a version newer than 3.13, but
77+
# we want to pin to version 3.13.
78+
CONDA_COMMON_DEPS="astunparse pyyaml mkl=2022.0.1 mkl-include=2022.0.1 setuptools cffi future six"
7879
if [ "$ANACONDA_PYTHON_VERSION" = "3.9" ]; then
7980
# Install llvm-8 as it is required to compile llvmlite-0.30.0 from source
80-
conda_install numpy=1.19.2 astunparse pyyaml mkl mkl-include setuptools cffi future six llvmdev=8.0.0
81+
conda_install numpy=1.19.2 ${CONDA_COMMON_DEPS} llvmdev=8.0.0
8182
elif [ "$ANACONDA_PYTHON_VERSION" = "3.8" ]; then
8283
# Install llvm-8 as it is required to compile llvmlite-0.30.0 from source
83-
conda_install numpy=1.18.5 astunparse pyyaml mkl mkl-include setuptools cffi future six llvmdev=8.0.0
84-
elif [ "$ANACONDA_PYTHON_VERSION" = "3.7" ]; then
85-
# DO NOT install dataclasses if installing python-3.7, since its part of python-3.7 core packages
86-
conda_install numpy=1.18.5 astunparse pyyaml mkl mkl-include setuptools cffi future six typing_extensions
84+
conda_install numpy=1.18.5 ${CONDA_COMMON_DEPS} llvmdev=8.0.0
8785
else
88-
conda_install numpy=1.18.5 astunparse pyyaml mkl mkl-include setuptools cffi future six dataclasses typing_extensions
86+
# Install `typing_extensions` for 3.7
87+
conda_install numpy=1.18.5 ${CONDA_COMMON_DEPS} typing_extensions
8988
fi
9089

9190
# Magma package names are concatenation of CUDA major and minor ignoring revision

.circleci/docker/common/install_openssl.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,7 @@ cd "${OPENSSL}"
1010
./config --prefix=/opt/openssl -d '-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)'
1111
# NOTE: openssl install errors out when built with the -j option
1212
make -j6; make install_sw
13+
# Link the ssl libraries to the /usr/lib folder.
14+
sudo ln -s /opt/openssl/lib/lib* /usr/lib
1315
cd ..
1416
rm -rf "${OPENSSL}"

.circleci/docker/ubuntu-cuda/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ ENV INSTALLED_VISION ${VISION}
6565
ADD ./common/install_openssl.sh install_openssl.sh
6666
ENV OPENSSL_ROOT_DIR /opt/openssl
6767
RUN bash ./install_openssl.sh
68+
ENV OPENSSL_DIR /opt/openssl
6869

6970
# (optional) Install non-default CMake version
7071
ARG CMAKE_VERSION

.circleci/docker/ubuntu/Dockerfile

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ ARG UBUNTU_VERSION
66

77
ENV DEBIAN_FRONTEND noninteractive
88

9+
ARG CLANG_VERSION
10+
911
# Install common dependencies (so that this step can be cached separately)
1012
ARG EC2
1113
ADD ./common/install_base.sh install_base.sh
1214
RUN bash ./install_base.sh && rm install_base.sh
1315

1416
# Install clang
1517
ARG LLVMDEV
16-
ARG CLANG_VERSION
1718
ADD ./common/install_clang.sh install_clang.sh
1819
RUN bash ./install_clang.sh && rm install_clang.sh
1920

@@ -50,6 +51,13 @@ RUN bash ./install_gcc.sh && rm install_gcc.sh
5051
ADD ./common/install_lcov.sh install_lcov.sh
5152
RUN bash ./install_lcov.sh && rm install_lcov.sh
5253

54+
# Install cuda and cudnn
55+
ARG CUDA_VERSION
56+
RUN wget -q https://raw.githubusercontent.com/pytorch/builder/main/common/install_cuda.sh -O install_cuda.sh
57+
RUN bash ./install_cuda.sh ${CUDA_VERSION} && rm install_cuda.sh
58+
ENV DESIRED_CUDA ${CUDA_VERSION}
59+
ENV PATH /usr/local/nvidia/bin:/usr/local/cuda/bin:$PATH
60+
5361
# (optional) Install protobuf for ONNX
5462
ARG PROTOBUF
5563
ADD ./common/install_protobuf.sh install_protobuf.sh
@@ -111,6 +119,8 @@ RUN rm install_ninja.sh
111119
ADD ./common/install_openssl.sh install_openssl.sh
112120
RUN bash ./install_openssl.sh
113121
ENV OPENSSL_ROOT_DIR /opt/openssl
122+
ENV OPENSSL_DIR /opt/openssl
123+
RUN rm install_openssl.sh
114124

115125
# Install ccache/sccache (do this last, so we get priority in PATH)
116126
ADD ./common/install_cache.sh install_cache.sh
@@ -122,12 +132,22 @@ ADD ./common/install_jni.sh install_jni.sh
122132
ADD ./java/jni.h jni.h
123133
RUN bash ./install_jni.sh && rm install_jni.sh
124134

135+
# Install Open MPI for CUDA
136+
ADD ./common/install_openmpi.sh install_openmpi.sh
137+
RUN if [ -n "${CUDA_VERSION}" ]; then bash install_openmpi.sh; fi
138+
RUN rm install_openmpi.sh
139+
125140
# Include BUILD_ENVIRONMENT environment variable in image
126141
ARG BUILD_ENVIRONMENT
127142
ENV BUILD_ENVIRONMENT ${BUILD_ENVIRONMENT}
128143

129144
# Install LLVM dev version (Defined in the pytorch/builder github repository)
130145
COPY --from=pytorch/llvm:9.0.1 /opt/llvm /opt/llvm
131146

147+
# AWS specific CUDA build guidance
148+
ENV TORCH_CUDA_ARCH_LIST Maxwell
149+
ENV TORCH_NVCC_FLAGS "-Xfatbin -compress-all"
150+
ENV CUDA_PATH /usr/local/cuda
151+
132152
USER jenkins
133153
CMD ["bash"]

.circleci/scripts/binary_linux_test.sh

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ if [[ "\$python_nodot" = *39* ]]; then
5353
NUMPY_PIN=">=1.20"
5454
fi
5555
56-
if [[ "$DESIRED_CUDA" == "cu116" ]]; then
57-
EXTRA_CONDA_FLAGS="-c=conda-forge"
58-
fi
56+
5957
6058
# Move debug wheels out of the the package dir so they don't get installed
6159
mkdir -p /tmp/debug_final_pkgs
@@ -88,13 +86,14 @@ if [[ "$PACKAGE_TYPE" == conda ]]; then
8886
if [[ "$DESIRED_CUDA" == 'cpu' ]]; then
8987
retry conda install -c pytorch -y cpuonly
9088
else
91-
# DESIRED_CUDA is in format cu90 or cu102
92-
if [[ "${#DESIRED_CUDA}" == 4 ]]; then
93-
cu_ver="${DESIRED_CUDA:2:1}.${DESIRED_CUDA:3}"
94-
else
95-
cu_ver="${DESIRED_CUDA:2:2}.${DESIRED_CUDA:4}"
89+
90+
cu_ver="${DESIRED_CUDA:2:2}.${DESIRED_CUDA:4}"
91+
CUDA_PACKAGE="cudatoolkit"
92+
if [[ "$DESIRED_CUDA" == "cu116" ]]; then
93+
CUDA_PACKAGE="cuda"
9694
fi
97-
retry conda install \${EXTRA_CONDA_FLAGS} -yq -c nvidia -c pytorch "cudatoolkit=\${cu_ver}"
95+
96+
retry conda install \${EXTRA_CONDA_FLAGS} -yq -c nvidia -c pytorch "\${CUDA_PACKAGE}=\${cu_ver}"
9897
fi
9998
conda install \${EXTRA_CONDA_FLAGS} -y "\$pkg" --offline
10099
)

.circleci/scripts/binary_windows_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ mkdir -p "$PYTORCH_FINAL_PACKAGE_DIR"
66

77
export CUDA_VERSION="${DESIRED_CUDA/cu/}"
88
export USE_SCCACHE=1
9-
export SCCACHE_BUCKET=ossci-compiler-cache-windows
9+
export SCCACHE_BUCKET=ossci-compiler-cache
1010
export SCCACHE_IGNORE_SERVER_IO_ERROR=1
1111
export VC_YEAR=2019
1212

0 commit comments

Comments
 (0)