Skip to content

Commit 05873c0

Browse files
committed
Evaluate environmnent variable
1 parent 46002d7 commit 05873c0

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

tools/gen_ort_dockerfile.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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)