@@ -157,8 +157,16 @@ def dockerfile_for_linux(output_file):
157157    && apt-get install -y --no-install-recommends cmake=3.28.3* cmake-data=3.28.3* \\  
158158    && cmake --version 
159159
160- RUN python3 -m pip install psutil 
161- 
160+ """ 
161+     if  FLAGS .enable_gpu :
162+         df  +=  """ 
163+ # Allow configure to pick up cuDNN where it expects it. 
164+ # (Note: $CUDNN_VERSION is defined by base image) 
165+ RUN _CUDNN_VERSION=$(echo $CUDNN_VERSION | cut -d. -f1-2) && \  
166+      mkdir -p /usr/local/cudnn-$_CUDNN_VERSION/cuda/include && \ 
167+      ln -s /usr/include/cudnn.h /usr/local/cudnn-$_CUDNN_VERSION/cuda/include/cudnn.h && \ 
168+      mkdir -p /usr/local/cudnn-$_CUDNN_VERSION/cuda/lib64 && \ 
169+      ln -s /etc/alternatives/libcudnn_so /usr/local/cudnn-$_CUDNN_VERSION/cuda/lib64/libcudnn.so
162170""" 
163171
164172    if  FLAGS .ort_openvino  is  not   None :
@@ -387,7 +395,7 @@ def dockerfile_for_linux(output_file):
387395""" 
388396    df  +=  """ 
389397RUN cd /opt/onnxruntime/lib && \  
390-      for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\\  .so*'`; do \ 
398+      for i in `find . -mindepth 1 -maxdepth 1 -type f -name '*\.so*'`; do \ 
391399         patchelf --set-rpath '$ORIGIN' $i; \ 
392400     done
393401
@@ -468,7 +476,7 @@ def dockerfile_for_windows(output_file):
468476
469477    df  +=  """ 
470478WORKDIR /workspace/onnxruntime 
471- ARG VS_DEVCMD_BAT="\\  BuildTools\\  VC\\  Auxiliary\\  Build\ \ vcvars64.bat" 
479+ ARG VS_DEVCMD_BAT="\BuildTools\VC\Auxiliary\Build\v cvars64.bat" 
472480RUN powershell Set-Content 'build.bat' -value 'call %VS_DEVCMD_BAT%',(Get-Content 'build.bat') 
473481RUN build.bat --cmake_generator "Visual Studio 17 2022" --config Release --cmake_extra_defines "CMAKE_CUDA_ARCHITECTURES=75;80;86;90" --skip_submodule_sync --parallel --build_shared_lib --compile_no_warning_as_error --skip_tests --update --build --build_dir /workspace/build {} 
474482""" .format (
@@ -551,8 +559,12 @@ def preprocess_gpu_flags():
551559            FLAGS .tensorrt_home  =  "/tensorrt" 
552560    else :
553561        if  "CUDNN_VERSION"  in  os .environ :
562+             version  =  None 
563+             m  =  re .match (r"([0-9]\.[0-9])\.[0-9]\.[0-9]" , os .environ ["CUDNN_VERSION" ])
564+             if  m :
565+                 version  =  m .group (1 )
554566            if  FLAGS .cudnn_home  is  None :
555-                 FLAGS .cudnn_home  =  "/usr"  
567+                 FLAGS .cudnn_home  =  "/usr/local/cudnn-{}/cuda"  . format ( version ) 
556568
557569        if  FLAGS .cuda_home  is  None :
558570            FLAGS .cuda_home  =  "/usr/local/cuda" 
0 commit comments