Skip to content

Commit 4b6fd4d

Browse files
authored
Update Dockerfile generation script (#311)
1 parent 5072363 commit 4b6fd4d

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def dockerfile_for_linux(output_file):
196196
df += """
197197
# Install OpenVINO
198198
ARG ONNXRUNTIME_OPENVINO_VERSION
199-
ENV INTEL_OPENVINO_DIR /opt/intel/openvino_${ONNXRUNTIME_OPENVINO_VERSION}
199+
ENV INTEL_OPENVINO_DIR=/opt/intel/openvino_${ONNXRUNTIME_OPENVINO_VERSION}
200200
"""
201201
df += """
202202
ARG OPENVINO_SHORT_VERSION={}
@@ -322,9 +322,31 @@ def dockerfile_for_linux(output_file):
322322
ep_flags += (
323323
" --skip_tests --cmake_extra_defines 'onnxruntime_BUILD_UNIT_TESTS=OFF'"
324324
)
325-
cuda_archs = "87;101"
325+
if os.getenv("CUDA_ARCH_LIST") is not None:
326+
print(f"[INFO] Defined CUDA_ARCH_LIST: {os.getenv('CUDA_ARCH_LIST')}")
327+
cuda_archs = (
328+
os.getenv("CUDA_ARCH_LIST")
329+
.replace("PTX", "")
330+
.replace(" ", "-real;")
331+
.replace(".", "")
332+
)
333+
cuda_archs = re.sub(r"-real;$", "", cuda_archs)
334+
print(f"[INFO] Set ONNX Runtime to use CUDA architectures to: {cuda_archs}")
335+
else:
336+
cuda_archs = "87"
326337
else:
327-
cuda_archs = "75;80;86;89;90;100;120"
338+
if os.getenv("CUDA_ARCH_LIST") is not None:
339+
print(f"[INFO] Defined CUDA_ARCH_LIST: {os.getenv('CUDA_ARCH_LIST')}")
340+
cuda_archs = (
341+
os.getenv("CUDA_ARCH_LIST")
342+
.replace("PTX", "")
343+
.replace(" ", "-real;")
344+
.replace(".", "")
345+
)
346+
cuda_archs = re.sub(r"-real;$", "", cuda_archs)
347+
print(f"[INFO] Set ONNX Runtime to use CUDA architectures to: {cuda_archs}")
348+
else:
349+
cuda_archs = "75;80;86;90;100;120"
328350

329351
df += """
330352
WORKDIR /workspace/onnxruntime

0 commit comments

Comments
 (0)