Skip to content

Commit a6a80b5

Browse files
committed
Update Dockerfile and build.py (#6281)
* Update configuration for Windows Dockerfile (#6256) * Adding installation of docker and docker-buildx * Enable '--expt-relaxed-constexpr' flag for custom ops models * Upate Dockerfile version * Disable unit tests for Jetson
1 parent 35ab206 commit a6a80b5

File tree

3 files changed

+50
-41
lines changed

3 files changed

+50
-41
lines changed

Dockerfile.win10.min

+40-37
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,23 @@ RUN powershell.exe Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope Loca
3939
RUN powershell.exe [Net.ServicePointManager]::Expect100Continue=$true;[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls,[Net.SecurityProtocolType]::Tls11,[Net.SecurityProtocolType]::Tls12,[Net.SecurityProtocolType]::Ssl3;Invoke-Expression( New-Object System.Net.WebClient ).DownloadString('https://chocolatey.org/install.ps1')
4040
RUN choco install git docker unzip -y
4141

42+
#
43+
# Installing CMake
44+
#
45+
ARG CMAKE_VERSION=3.27.1
46+
ARG CMAKE_FILE=cmake-${CMAKE_VERSION}-windows-x86_64
47+
ARG CMAKE_SOURCE=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}.zip
48+
49+
ADD ${CMAKE_SOURCE} ${CMAKE_FILE}.zip
50+
RUN unzip %CMAKE_FILE%.zip
51+
RUN move %CMAKE_FILE% "c:\CMake"
52+
RUN setx PATH "c:\CMake\bin;%PATH%"
53+
54+
ENV CMAKE_TOOLCHAIN_FILE /vcpkg/scripts/buildsystems/vcpkg.cmake
55+
ENV VCPKG_TARGET_TRIPLET x64-windows
56+
57+
LABEL CMAKE_VERSION=${CMAKE_VERSION}
58+
4259
# Be aware that pip can interact badly with VS cmd shell so need to pip install before
4360
# vsdevcmd.bat (see https://bugs.python.org/issue38989)
4461
ARG PYTHON_VERSION=3.8.10
@@ -51,44 +68,31 @@ RUN pip install grpcio-tools
5168

5269
LABEL PYTHON_VERSION=${PYTHON_VERSION}
5370

54-
# Download and install Build Tools for Visual Studio. The use of
55-
# powershell for the install seems to be required to make the command
56-
# wait for the install to complete before continuing. To avoid failures
57-
# caused by VS regressions we want to stick with a working
58-
# compiler. Currently this is 16.11.21. This page contains download
59-
# links for buildtools.
60-
# https://docs.microsoft.com/en-us/visualstudio/releases/2019/history#release-dates-and-build-numbers
61-
ARG BUILDTOOLS_VERSION=16.11.21
62-
ARG BUILDTOOLS_SOURCE=https://download.visualstudio.microsoft.com/download/pr/8f1eb024-006a-43f6-a372-0721f71058b3/cc5cc690ac094fbfa78dfb8e40089ba52056026579e8d8dc31e95e8ea5466df5/vs_BuildTools.exe
63-
ADD ${BUILDTOOLS_SOURCE} vs_buildtools.exe
71+
#
72+
# Installing Visual Studio BuildTools: VS17 2022
73+
#
74+
ARG BUILDTOOLS_VERSION
75+
# Download collect.exe in case of an install failure.
76+
ADD https://aka.ms/vscollect.exe "C:\tmp\collect.exe"
77+
78+
# Use the latest release channel. For more control, specify the location of an internal layout.
79+
ARG CHANNEL_URL=https://aka.ms/vs/17/release/channel
80+
ADD ${CHANNEL_URL} "C:\tmp\VisualStudio.chman"
81+
# Download the Build Tools bootstrapper.
82+
ARG BUILD_TOOLS_SOURCE=https://aka.ms/vs/17/release/vs_buildtools.exe
83+
ADD ${BUILD_TOOLS_SOURCE} vs_buildtools.exe
84+
# Install Build Tools with the Microsoft.VisualStudio.Workload.VCTools workload, including recommended.
6485
ARG VS_INSTALL_PATH_WP="C:\BuildTools"
65-
RUN powershell.exe Start-Process -FilePath vs_buildtools.exe -ArgumentList "--wait","--quiet","--norestart","--nocache","--installPath","%VS_INSTALL_PATH_WP%","--channelUri","C:\tmp\doesnotexist.chman","--addProductLang","En-us","--add","Microsoft.VisualStudio.Workload.VCTools`;includeRecommended","--add","Microsoft.Component.MSBuild" -Wait -PassThru
86+
RUN vs_buildtools.exe --quiet --wait --norestart --nocache install --installPath %VS_INSTALL_PATH_WP% --channelUri "C:\tmp\VisualStudio.chman" --installChannelUri "C:\tmp\VisualStudio.chman" --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --locale "En-us"
6687

6788
LABEL BUILDTOOLS_VERSION=${BUILDTOOLS_VERSION}
6889

6990
WORKDIR /
7091

7192
#
72-
# Installing CMake
73-
#
74-
ARG CMAKE_VERSION=3.26.1
75-
ARG CMAKE_FILE=cmake-${CMAKE_VERSION}-windows-x86_64
76-
ARG CMAKE_SOURCE=https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/${CMAKE_FILE}.zip
77-
78-
ADD ${CMAKE_SOURCE} ${CMAKE_FILE}.zip
79-
RUN unzip %CMAKE_FILE%.zip
80-
RUN move %CMAKE_FILE% CMake
81-
RUN setx PATH "c:\CMake\bin;%PATH%"
82-
83-
ENV CMAKE_TOOLCHAIN_FILE /vcpkg/scripts/buildsystems/vcpkg.cmake
84-
ENV VCPKG_TARGET_TRIPLET x64-windows
85-
86-
LABEL CMAKE_VERSION=${CMAKE_VERSION}
87-
93+
# Installing Vcpkg
8894
#
89-
# Installing Vcpkg
90-
#
91-
ARG VCPGK_VERSION=2022.11.14
95+
ARG VCPGK_VERSION=2023.07.21
9296
RUN git clone --single-branch --depth=1 -b %VCPGK_VERSION% https://github.com/microsoft/vcpkg.git
9397
WORKDIR /vcpkg
9498
RUN bootstrap-vcpkg.bat
@@ -100,13 +104,12 @@ LABEL VCPGK_VERSION=${VCPGK_VERSION}
100104

101105
WORKDIR /
102106

103-
104107
#
105-
# Installing CUDA
108+
# Installing CUDA
106109
#
107110
ARG CUDA_MAJOR=12
108111
ARG CUDA_MINOR=2
109-
ARG CUDA_PATCH=0
112+
ARG CUDA_PATCH=1
110113
ARG CUDA_VERSION=${CUDA_MAJOR}.${CUDA_MINOR}.${CUDA_PATCH}
111114
ARG CUDA_PACKAGES="nvcc_${CUDA_MAJOR}.${CUDA_MINOR} \
112115
cudart_${CUDA_MAJOR}.${CUDA_MINOR} \
@@ -127,14 +130,14 @@ ADD ${CUDA_SOURCE} cuda_${CUDA_VERSION}_windows_network.exe
127130
RUN cuda_%CUDA_VERSION%_windows_network.exe -s %CUDA_PACKAGES%
128131
# Copy the CUDA visualstudio integration from where it was installed
129132
# into the appropriate place in BuildTools
130-
RUN copy "%CUDA_INSTALL_ROOT_WP%\extras\visual_studio_integration\MSBuildExtensions\*" "%VS_INSTALL_PATH_WP%\MSBuild\Microsoft\VC\v160\BuildCustomizations"
133+
RUN copy "%CUDA_INSTALL_ROOT_WP%\extras\visual_studio_integration\MSBuildExtensions\*" "%VS_INSTALL_PATH_WP%\MSBuild\Microsoft\VC\v170\BuildCustomizations"
131134

132135
RUN setx PATH "%CUDA_INSTALL_ROOT_WP%\bin;%PATH%"
133136

134137
LABEL CUDA_VERSION="${CUDA_VERSION}"
135138

136139
#
137-
# Installing Tensorrt
140+
# Installing TensorRT
138141
#
139142
ARG TENSORRT_VERSION=8.6.1.6
140143
ARG TENSORRT_ZIP="TensorRT-${TENSORRT_VERSION}.Windows10.x86_64.cuda-12.0.zip"
@@ -152,9 +155,9 @@ LABEL TENSORRT_VERSION="${TENSORRT_VERSION}"
152155

153156

154157
#
155-
# Installing CUDNN
158+
# Installing cuDNN
156159
#
157-
ARG CUDNN_VERSION=8.9.4.25
160+
ARG CUDNN_VERSION=8.9.5.27
158161
ARG CUDNN_ZIP=cudnn-windows-x86_64-${CUDNN_VERSION}_cuda12-archive.zip
159162
ARG CUDNN_SOURCE=${CUDNN_ZIP}
160163

qa/common/gen_qa_custom_ops

+6-2
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ nvidia-smi -L || true
7676
nvidia-smi || true
7777
set -e
7878
79+
# Segmentation fault with protobuf 4.24.0 (https://github.com/tensorflow/tensorflow/issues/61551)
80+
# Upgrade protobuf version to fix the issue.
81+
pip3 install "protobuf>4.24.0"
82+
7983
TF_CFLAGS=\$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))')
8084
TF_LFLAGS=\$(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))')
8185
@@ -88,12 +92,12 @@ g++ -std=${STD_FLAG} -O2 -shared -fPIC zero_out_op_kernel_1.cc -o $DESTDIR/libze
8892
cp /opt/tensorflow/tensorflow-source/tensorflow/examples/adding_an_op/cuda_op_kernel.cc .
8993
cp /opt/tensorflow/tensorflow-source/tensorflow/examples/adding_an_op/cuda_op_kernel.cu.cc .
9094
patch -i $SRCDIR/cuda_op_kernel.cu.cc.patch cuda_op_kernel.cu.cc
91-
nvcc -std=${STD_FLAG} -O2 -c -arch=all -o cuda_op_kernel.cu.o cuda_op_kernel.cu.cc \${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
95+
nvcc --expt-relaxed-constexpr -std=${STD_FLAG} -O2 -c -arch=all -o cuda_op_kernel.cu.o cuda_op_kernel.cu.cc \${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
9296
g++ -std=${STD_FLAG} -shared -o $DESTDIR/libcudaop.so cuda_op_kernel.cc cuda_op_kernel.cu.o \${TF_CFLAGS[@]} -fPIC -L/usr/local/cuda/lib64 -lcudart \${TF_LFLAGS[@]}
9397
9498
cp $SRCDIR/busy_op_kernel.cc .
9599
cp $SRCDIR/busy_op_kernel.cu.cc .
96-
nvcc -std=${STD_FLAG} -O2 -c -arch=all -o busy_op_kernel.cu.o busy_op_kernel.cu.cc \${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
100+
nvcc --expt-relaxed-constexpr -std=${STD_FLAG} -O2 -c -arch=all -o busy_op_kernel.cu.o busy_op_kernel.cu.cc \${TF_CFLAGS[@]} -D GOOGLE_CUDA=1 -x cu -Xcompiler -fPIC
97101
g++ -std=${STD_FLAG} -shared -o $DESTDIR/libbusyop.so busy_op_kernel.cc busy_op_kernel.cu.o \${TF_CFLAGS[@]} -fPIC -L/usr/local/cuda/lib64 -lcudart \${TF_LFLAGS[@]}
98102
99103
python3 $SRCDIR/gen_qa_custom_ops_models.py --graphdef --savedmodel \

src/CMakeLists.txt

+4-2
Original file line numberDiff line numberDiff line change
@@ -773,6 +773,8 @@ if (NOT WIN32)
773773
endif() # NOT WIN32
774774

775775
# Currently unit tests do not build for windows...
776-
if (NOT WIN32)
777-
add_subdirectory(test test)
776+
if ( NOT WIN32)
777+
if ( NOT EXISTS "/usr/lib/aarch64-linux-gnu/tegra/" )
778+
add_subdirectory(test test)
779+
endif()
778780
endif() # NOT WIN32

0 commit comments

Comments
 (0)