Skip to content

Commit c3db49f

Browse files
committed
Preliminary steps to include ffmpeg in build
1 parent 3b31de4 commit c3db49f

File tree

2 files changed

+33
-19
lines changed

2 files changed

+33
-19
lines changed

Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ SHELL := /bin/bash
33
.PHONY: all build_all actual_build build_prep
44

55
# Release to match data of Dockerfile and follow YYYYMMDD pattern
6-
CTO_RELEASE=20220530
6+
CTO_RELEASE=20220815
77

88
# The default is not to build OpenCV non-free or build FFmpeg with libnpp, as those would make the images unredistributable
99
# Replace "" by "unredistributable" if you need to use those for a personal build
@@ -44,11 +44,11 @@ DNN_ARCH_CUDA11=6.0,6.1,7.0,7.5,8.0,8.6
4444

4545
# According to https://opencv.org/releases/
4646
STABLE_OPENCV3=3.4.16
47-
STABLE_OPENCV4=4.5.5
47+
STABLE_OPENCV4=4.6.0
4848

4949
# FFmpeg
5050
# Release list: https://ffmpeg.org/download.html
51-
# Note: FFmpeg < 5 because https://github.com/pytorch/vision/issues/5928
51+
# Note: FFmpeg < 5 because https://github.com/opencv/opencv/issues/20147
5252
# Note: GPU extensions are added directly in the Dockerfile
5353
CTO_FFMPEG_VERSION=4.4.2
5454
# https://github.com/FFmpeg/nv-codec-headers/releases
@@ -74,14 +74,14 @@ TF2_NUMPY='numpy'
7474
# Note: GPU targets (ie ARCH) are directly added in Dockerfile
7575
CTO_MAGMA="2.6.2"
7676

77-
## PyTorch (with FFmpeg + OpenCV & Magma if available)
77+
## PyTorch (with FFmpeg + OpenCV & Magma if available) https://pytorch.org/
7878
# Note: same as FFmpeg and Magma, GPU specific selection (including ARCH) are in the Dockerfile
7979
# Use release branch https://github.com/pytorch/pytorch
80-
CTO_TORCH="1.11"
80+
CTO_TORCH="1.12.1"
8181
# Use release branch https://github.com/pytorch/vision
82-
CTO_TORCHVISION="0.12"
82+
CTO_TORCHVISION="0.13.1"
8383
# Use release branch https://github.com/pytorch/audio
84-
CTO_TORCHAUDIO="0.11"
84+
CTO_TORCHAUDIO="0.12.1"
8585

8686
##########
8787

ubuntu20.04/Dockerfile

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ RUN if [ -f /tmp/.GPU_build ]; \
335335
ARG CTO_TORCH=1.11
336336
RUN mkdir -p /usr/local/src \
337337
&& cd /usr/local/src \
338-
&& git clone --depth 1 --branch release/${CTO_TORCH} https://github.com/pytorch/pytorch.git \
338+
&& git clone --depth 1 --branch v${CTO_TORCH} https://github.com/pytorch/pytorch.git \
339339
&& cd /usr/local/src/pytorch \
340+
&& git submodule sync && git submodule update --init --recursive \
340341
&& if [ -f /tmp/.GPU_build ]; \
341342
then \
342343
time env USE_CUDA=ON USE_CUDNN=ON TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" USE_MKLDNN=ON USE_FFMPEG=ON USE_OPENCV=ON python3 ./setup.py bdist_wheel | tee /tmp/torch_config.txt; \
@@ -351,12 +352,23 @@ RUN mkdir -p /usr/local/src \
351352
&& rm -rf /root/.cache/pip /usr/local/src/pytorch
352353
RUN python3 -c "import torch"
353354

355+
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
356+
ENV NVIDIA_VISIBLE_DEVICES all
357+
ENV NVIDIA_DRIVER_CAPABILITIES video,compute,utility
358+
354359
ARG CTO_TORCHVISION=0.12
355360
RUN mkdir -p /usr/local/src \
356361
&& cd /usr/local/src \
357-
&& git clone --depth 1 --branch release/${CTO_TORCHVISION} https://github.com/pytorch/vision.git \
362+
&& git clone --depth 1 --branch v${CTO_TORCHVISION} https://github.com/pytorch/vision.git \
358363
&& cd /usr/local/src/vision \
359-
&& time sh -c "python3 ./setup.py bdist_wheel | tee /tmp/torchvision_config.txt" \
364+
&& git submodule sync && git submodule update --init --recursive \
365+
&& if [ -f /tmp/.GPU_build ]; \
366+
then \
367+
time env FORCE_CUDA=ON CUDA_HOME=/usr/local/nvidia USE_CUDNN=ON TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" USE_MKLDNN=ON USE_FFMPEG=ON USE_OPENCV=ON python3 ./setup.py bdist_wheel | tee /tmp/torchvision_config.txt; \
368+
else \
369+
time env FORCE_CUDA=OFF USE_CUDNN=OFF USE_MKLDNN=ON USE_FFMPEG=ON USE_OPENCV=ON python3 ./setup.py bdist_wheel | tee /tmp/torchvision_config.txt; \
370+
fi \
371+
# && time sh -c "python3 ./setup.py bdist_wheel | tee /tmp/torchvision_config.txt" \
360372
&& time pip3 install /usr/local/src/vision/dist/*.whl \
361373
&& cd /tmp \
362374
&& perl -i.bak -pe 'exit if m%^running bdist_wheel%' torchvision_config.txt \
@@ -366,17 +378,24 @@ RUN mkdir -p /usr/local/src \
366378
RUN python3 -c "import torchvision"
367379

368380
ARG CTO_TORCHAUDIO=0.11
369-
RUN mkdir -p /usr/local/src/builder \
381+
RUN mkdir -p /usr/local/src \
370382
&& cd /usr/local/src \
371-
&& git clone --depth 1 --branch release/${CTO_TORCHAUDIO} https://github.com/pytorch/audio.git \
383+
&& git clone --depth 1 --branch v${CTO_TORCHAUDIO} https://github.com/pytorch/audio.git \
372384
&& cd /usr/local/src/audio \
373-
&& time sh -c "python3 ./setup.py bdist_wheel | tee /tmp/torchaudio_config.txt" \
385+
&& git submodule sync && git submodule update --init --recursive \
386+
&& if [ -f /tmp/.GPU_build ]; \
387+
then \
388+
time env USE_CUDA=ON USE_CUDNN=ON TORCH_CUDA_ARCH_LIST="6.0 6.1 7.0 7.5 8.0 8.6+PTX" USE_MKLDNN=ON USE_FFMPEG=ON USE_OPENCV=ON python3 ./setup.py bdist_wheel | tee /tmp/torchaudio_config.txt; \
389+
else \
390+
time env USE_CUDA=OFF USE_CUDNN=OFF USE_MKLDNN=ON USE_FFMPEG=ON USE_OPENCV=ON python3 ./setup.py bdist_wheel | tee /tmp/torchaudio_config.txt; \
391+
fi \
392+
# && time sh -c "python3 ./setup.py bdist_wheel | tee /tmp/torchaudio_config.txt" \
374393
&& time pip3 install /usr/local/src/audio/dist/*.whl \
375394
&& cd /tmp \
376395
&& perl -i.bak -pe 'exit if m%^-- Configuring done%' torchaudio_config.txt \
377396
&& sh -c "cmp --silent torchaudio_config.txt torchaudio_config.txt.bak && exit 1 || rm torchaudio_config.txt.bak" \
378397
&& ldconfig \
379-
&& rm -rf /root/.cache/pip /usr/local/src/builder
398+
&& rm -rf /root/.cache/pip /usr/local/src/audio
380399
RUN python3 -c "import torchaudio"
381400

382401

@@ -390,11 +409,6 @@ COPY tools/tf_info.sh /tmp/
390409
RUN chmod +x /tmp/tf_info.sh \
391410
&& touch /.within_container
392411

393-
#ENV NVIDIA_VISIBLE_DEVICES all
394-
#ENV NVIDIA_DRIVER_CAPABILITIES all
395-
396-
ENV LD_LIBRARY_PATH /usr/local/lib:$LD_LIBRARY_PATH
397-
398412
# Setting up working directory
399413
RUN mkdir /dmc
400414
WORKDIR /dmc

0 commit comments

Comments
 (0)