Skip to content

Commit 242fe08

Browse files
authored
Produce ONNX wheel package as part of the build (#320)
* Updateing commn properties * Removing skip tests * Adding missed packages. Sort installed packages. * Keep existing set of codes for Win32 * Set parallel count. * Update gen script * Stick to CPU count * Remove double bracers * Set max thread count to 64 to prevent OOM in CI * Add extra curtly bracers to adress Python syntax * Removing psutil * Make CMake output verbose for image
1 parent 2594aa3 commit 242fe08

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -134,16 +134,16 @@ def dockerfile_for_linux(output_file):
134134
ENV PYTHON_BIN_PATH=${PYBIN}/python${PYVER} \
135135
PATH=${PYBIN}:${PATH}
136136
137-
RUN yum install -y \
138-
wget \
139-
zip \
140-
ca-certificates \
141-
curl \
142-
python3-pip \
143-
git \
144-
gnupg \
137+
RUN yum install -y \\
138+
ca-certificates \\
139+
curl \\
140+
git \\
141+
gnupg \\
145142
gnupg1 \
146-
openssl-devel
143+
openssl-devel \\
144+
python3-pip \
145+
wget \\
146+
zip
147147
148148
RUN pip3 install patchelf==0.17.2
149149
"""
@@ -166,22 +166,29 @@ def dockerfile_for_linux(output_file):
166166

167167
df += """
168168
169-
RUN apt-get update && apt-get install -y --no-install-recommends \
170-
software-properties-common \
171-
wget \
172-
zip \
173-
ca-certificates \
174-
build-essential \
175-
curl \
176-
libcurl4-openssl-dev \
177-
libssl-dev \
178-
python3-dev \
179-
python3-pip \
180-
git \
181-
gnupg \
182-
gnupg1
183-
184-
RUN pip3 install patchelf==0.17.2 cmake==4.0.3
169+
RUN apt-get update && apt-get install -y --no-install-recommends \\
170+
build-essential \\
171+
ca-certificates \\
172+
curl \\
173+
git \\
174+
gnupg \\
175+
gnupg1 \\
176+
libcurl4-openssl-dev \\
177+
libssl-dev \\
178+
python3-dev \\
179+
python3-pip \\
180+
software-properties-common \\
181+
wget \\
182+
zip
183+
184+
RUN pip3 install \\
185+
cmake==4.0.3 \\
186+
numpy \\
187+
packaging \\
188+
patchelf==0.17.2 \\
189+
wheel>=0.35.1
190+
191+
ENV VERBOSE=1
185192
"""
186193

187194
if FLAGS.ort_openvino is not None:
@@ -340,8 +347,8 @@ def dockerfile_for_linux(output_file):
340347

341348
df += """
342349
WORKDIR /workspace/onnxruntime
343-
ARG COMMON_BUILD_ARGS="--config ${{ONNXRUNTIME_BUILD_CONFIG}} --skip_submodule_sync --parallel --build_shared_lib \
344-
--compile_no_warning_as_error --build_dir /workspace/build --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES='{}' --cmake_extra_defines CMAKE_POLICY_VERSION_MINIMUM=3.5 "
350+
ARG COMMON_BUILD_ARGS="--config ${{ONNXRUNTIME_BUILD_CONFIG}} --parallel --skip_submodule_sync --build_shared_lib \
351+
--compile_no_warning_as_error --build_dir /workspace/build --cmake_extra_defines CMAKE_CUDA_ARCHITECTURES='{}' --cmake_extra_defines CMAKE_POLICY_VERSION_MINIMUM=3.5 --build_wheel"
345352
""".format(
346353
cuda_archs
347354
)
@@ -523,7 +530,7 @@ def dockerfile_for_windows(output_file):
523530
WORKDIR /workspace/onnxruntime
524531
ARG VS_DEVCMD_BAT="\\BuildTools\\VC\\Auxiliary\\Build\\vcvars64.bat"
525532
RUN powershell Set-Content 'build.bat' -value 'call %VS_DEVCMD_BAT%',(Get-Content 'build.bat')
526-
RUN build.bat --cmake_generator "Visual Studio 17 2022" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=75;80;86;90;100;120" --skip_submodule_sync --parallel --build_shared_lib --compile_no_warning_as_error --skip_tests --update --build --build_dir /workspace/build {}
533+
RUN build.bat --cmake_generator "Visual Studio 17 2022" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=75;80;86;90;100;120" --skip_submodule_sync --parallel --build_shared_lib --compile_no_warning_as_error --skip_tests --build_wheel --update --build --build_dir /workspace/build {}
527534
""".format(
528535
ep_flags
529536
)

0 commit comments

Comments
 (0)