File tree Expand file tree Collapse file tree 5 files changed +88
-0
lines changed Expand file tree Collapse file tree 5 files changed +88
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM ubuntu:xenial as dev
2
+ ARG LLVM_VERSION=9.0.1
3
+ ENV LLVM_URL https://github.com/llvm/llvm-project/releases/download/llvmorg-${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz
4
+ ENV DEBIAN_FRONTEND noninteractive
5
+ RUN apt-get update && apt-get install -y \
6
+ build-essential \
7
+ curl \
8
+ cmake \
9
+ make \
10
+ python3 \
11
+ python3-dev \
12
+ xz-utils
13
+
14
+ RUN mkdir -p /opt/llvm /tmp/llvm/build
15
+ WORKDIR /tmp/llvm
16
+ RUN curl -fL -o llvm.tar.xz "${LLVM_URL}" && \
17
+ tar -xf llvm.tar.xz --strip-components=1
18
+ WORKDIR /tmp/llvm/build
19
+ RUN cmake -G "Unix Makefiles" \
20
+ -DCMAKE_BUILD_TYPE=MinSizeRel \
21
+ -DLLVM_ENABLE_ASSERTIONS=ON \
22
+ -DCMAKE_INSTALL_PREFIX=/opt/llvm \
23
+ -DLLVM_TARGETS_TO_BUILD="host" \
24
+ -DLLVM_BUILD_TOOLS=OFF \
25
+ -DLLVM_BUILD_UTILS=OFF \
26
+ -DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
27
+ ../
28
+ RUN make -j"$(nproc --ignore=2)" && make install
29
+
30
+ FROM scratch as final
31
+ COPY --from=dev /opt/llvm /opt/llvm
Original file line number Diff line number Diff line change
1
+ # llvm
2
+
3
+ This contains the dockerfile used to build LLVM from source with assertions enabled.
4
+
5
+ This is ultimately used by the main ` pytorch/pytorch ` 's base Docker images
6
+
7
+ ## How to build:
8
+
9
+ ``` bash
10
+ ./build.sh
11
+ ```
12
+
13
+ ## How to deploy:
14
+
15
+ ```
16
+ ./deploy.sh
17
+ ```
18
+
19
+ ## Updating LLVM
20
+
21
+ Edit the LLVM_VERSION in ` env_vars.sh `
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -eou pipefail
4
+
5
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
6
+ source " ${DIR} /env_vars.sh"
7
+
8
+ (
9
+ set -x
10
+ cat Dockerfile | DOCKER_BUILDKIT=1 docker build --build-arg " LLVM_VERSION=${LLVM_VERSION} " -t " pytorch/llvm:${LLVM_VERSION} " -
11
+ )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ set -eou pipefail
4
+
5
+ DIR=" $( cd " $( dirname " ${BASH_SOURCE[0]} " ) " > /dev/null 2>&1 && pwd ) "
6
+ source " ${DIR} /env_vars.sh"
7
+
8
+ FORCE_PUSH=${FORCE_PUSH:- no}
9
+ IMAGE=" pytorch/llvm:${LLVM_VERSION} "
10
+
11
+ if DOCKER_CLI_EXPERIMENTAL=enabled docker manifest inspect " ${IMAGE} " > /dev/null 2> /dev/null; then
12
+ if [[ ${FORCE_PUSH} = " no" ]]; then
13
+ echo " ERROR: ${IMAGE} already exists, run script with FORCE_PUSH=yes to forcefully push over the tag"
14
+ exit 1
15
+ else
16
+ echo " WARNING: Overwriting existing ${IMAGE} "
17
+ fi
18
+ fi
19
+ (
20
+ set -x
21
+ docker push " pytorch/llvm:${LLVM_VERSION} "
22
+ )
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+
3
+ LLVM_VERSION=" 9.0.1"
You can’t perform that action at this time.
0 commit comments