Skip to content

Commit 9f30fd9

Browse files
committed
Fix incompatibility among manylinux2014 and rhel8, deprecated windows-2019, MSVC compatibility
1 parent 617405f commit 9f30fd9

4 files changed

Lines changed: 60 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ jobs:
132132
runs-on: ${{ matrix.os }}
133133
strategy:
134134
matrix:
135-
os: [ubuntu-22.04, windows-2019]
135+
os: [ubuntu-22.04, windows-2022]
136136
arch: [auto64]
137137
include:
138138
- os: ubuntu-22.04
@@ -183,7 +183,7 @@ jobs:
183183
runs-on: ${{ matrix.os }}
184184
strategy:
185185
matrix:
186-
os: [ubuntu-22.04, windows-2019]
186+
os: [ubuntu-22.04, windows-2022]
187187

188188
steps:
189189
- name: Set up Python 3.9

CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,8 @@ endif()
688688
if(BUILD_TESTS)
689689
add_subdirectory(tests)
690690
endif()
691-
691+
MESSAGE(STATUS "XXXCompiler Id: ${CMAKE_CXX_COMPILER_ID}")
692+
MESSAGE(STATUS "XXXCompiler Version: ${CMAKE_CXX_COMPILER_VERSION}")
692693
include(GNUInstallDirs)
693694

694695
if (BUILD_CLI)

python/tools/prepare_build_environment_linux.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ "$CIBW_ARCHS" == "aarch64" ]; then
2020

2121
else
2222
# Install CUDA 12.2:
23-
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo
23+
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel7/x86_64/cuda-rhel7.repo
2424
# error mirrorlist.centos.org doesn't exists anymore.
2525
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
2626
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
@@ -29,7 +29,7 @@ else
2929
cuda-nvcc-12-2-12.2.140-1 \
3030
cuda-cudart-devel-12-2-12.2.140-1 \
3131
libcurand-devel-12-2-10.3.3.141-1 \
32-
libcudnn9-devel-cuda-12-9.1.0.70-1 \
32+
libcudnn9-devel-cuda-12-9.0.0.312-1 \
3333
libcublas-devel-12-2-12.2.5.6-1 \
3434
libnccl-devel-2.19.3-1+cuda12.2
3535
ln -s cuda-12.2 /usr/local/cuda

python/tools/prepare_build_environment_windows.sh

Lines changed: 54 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,42 @@ rmdir "$CUDNN_ROOT/include/12.4"
2929
cp -r "$CUDNN_ROOT"/* "$CUDA_ROOT"
3030
rm cudnn.exe
3131

32+
echo "Installing MSVC 14.29.30133 in Windows Server 2022 Docker container..."
33+
34+
# Download Visual Studio Build Tools installer
35+
echo "Downloading Visual Studio Build Tools installer..."
36+
curl -L -o vs_buildtools.exe "https://aka.ms/vs/16/release/vs_buildtools.exe"
37+
38+
# Install Visual Studio Build Tools with MSVC v142 toolset (14.29)
39+
echo "Installing Visual Studio Build Tools with MSVC 14.29..."
40+
./vs_buildtools.exe --quiet --wait --add Microsoft.VisualStudio.Workload.VCTools \
41+
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 \
42+
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 \
43+
--add Microsoft.VisualStudio.Component.VC.14.29.16.11.x86.x64 \
44+
--add Microsoft.VisualStudio.Component.Windows10SDK.19041 \
45+
--add Microsoft.VisualStudio.Component.VC.CMake.Project \
46+
--includeRecommended
47+
48+
# Verify installation
49+
echo "Verifying MSVC installation..."
50+
if [ -f "/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" ]; then
51+
echo "MSVC 14.29.30133 installed successfully!"
52+
53+
# Display compiler version
54+
"/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" 2>&1 | head -1
55+
else
56+
echo "Installation verification failed. Checking available versions..."
57+
ls -la "/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/" || echo "MSVC directory not found"
58+
exit 1
59+
fi
60+
3261
# See https://github.com/oneapi-src/oneapi-ci for installer URLs
33-
curl --netrc-optional -L -nv -o webimage.exe https://registrationcenter-download.intel.com/akdlm/irc_nas/19078/w_BaseKit_p_2023.0.0.25940_offline.exe
62+
curl --netrc-optional -L -nv -o webimage.exe \
63+
--retry 5 \
64+
--retry-delay 10 \
65+
--retry-max-time 300 \
66+
--continue-at - \
67+
https://registrationcenter-download.intel.com/akdlm/IRC_NAS/2cbb02eb-dd4c-4058-a4ac-2e38729a8409/intel-oneapi-base-toolkit-2025.1.2.7_offline.exe
3468
./webimage.exe -s -x -f webimage_extracted --log extract.log
3569
rm webimage.exe
3670
./webimage_extracted/bootstrapper.exe -s --action install --components="intel.oneapi.win.mkl.devel" --eula=accept -p=NEED_VS2017_INTEGRATION=0 -p=NEED_VS2019_INTEGRATION=0 --log-dir=.
@@ -39,19 +73,35 @@ ONEDNN_VERSION=3.1.1
3973
curl --netrc-optional -L -O https://github.com/oneapi-src/oneDNN/archive/refs/tags/v${ONEDNN_VERSION}.tar.gz
4074
tar xf *.tar.gz && rm *.tar.gz
4175
cd oneDNN-*
42-
cmake -DCMAKE_BUILD_TYPE=Release -DONEDNN_LIBRARY_TYPE=STATIC -DONEDNN_BUILD_EXAMPLES=OFF -DONEDNN_BUILD_TESTS=OFF -DONEDNN_ENABLE_WORKLOAD=INFERENCE -DONEDNN_ENABLE_PRIMITIVE="CONVOLUTION;REORDER" -DONEDNN_BUILD_GRAPH=OFF .
76+
cmake -G "Visual Studio 16 2019" -DCMAKE_CXX_COMPILER="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_C_COMPILER="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_BUILD_TYPE=Release -DONEDNN_LIBRARY_TYPE=STATIC -DONEDNN_BUILD_EXAMPLES=OFF -DONEDNN_BUILD_TESTS=OFF -DONEDNN_ENABLE_WORKLOAD=INFERENCE -DONEDNN_ENABLE_PRIMITIVE="CONVOLUTION;REORDER" -DONEDNN_BUILD_GRAPH=OFF .
4377
cmake --build . --config Release --target install --parallel 6
4478
cd ..
4579
rm -r oneDNN-*
4680

4781
mkdir build
4882
cd build
49-
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CTRANSLATE2_ROOT -DCMAKE_PREFIX_PATH="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/compiler/lib/intel64_win;C:/Program Files (x86)/oneDNN" -DBUILD_CLI=OFF -DWITH_DNNL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -DCUDA_TOOLKIT_ROOT_DIR="$CUDA_ROOT" -DCUDA_DYNAMIC_LOADING=ON -DCUDA_NVCC_FLAGS="-Xfatbin=-compress-all" -DCUDA_ARCH_LIST="Common" ..
83+
cmake -G "Visual Studio 16 2019" -DCMAKE_CXX_COMPILER="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_C_COMPILER="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$CTRANSLATE2_ROOT -DCMAKE_PREFIX_PATH="C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/compiler/lib/intel64_win;C:/Program Files (x86)/oneDNN" -DBUILD_CLI=OFF -DWITH_DNNL=ON -DWITH_CUDA=ON -DWITH_CUDNN=ON -DCUDA_TOOLKIT_ROOT_DIR="$CUDA_ROOT" -DCUDA_DYNAMIC_LOADING=ON -DCUDA_NVCC_FLAGS="-Xfatbin=-compress-all" -DCUDA_ARCH_LIST="Common" ..
5084
cmake --build . --config Release --target install --parallel 6 --verbose
5185
cd ..
5286
rm -r build
5387

5488
cp README.md python/
5589
cp $CTRANSLATE2_ROOT/bin/ctranslate2.dll python/ctranslate2/
56-
cp "C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/redist/intel64_win/compiler/libiomp5md.dll" python/ctranslate2/
90+
91+
# Find the libiomp5md.dll file
92+
LIBIOMP5_PATH=$(find "C:/Program Files (x86)/Intel/oneAPI" -name "libiomp5md.dll" -type f 2>/dev/null | head -1)
93+
94+
# Check if file was found
95+
if [ -z "$LIBIOMP5_PATH" ]; then
96+
echo "Error: libiomp5md.dll not found in Intel oneAPI installation."
97+
echo "Please ensure Intel oneAPI HPC Toolkit (with compiler) is installed."
98+
echo ""
99+
echo "Alternative locations to check manually:"
100+
echo "- C:/Program Files/Intel/oneAPI/compiler/*/windows/redist/intel64_win/compiler/"
101+
echo "- C:/Program Files (x86)/Intel/oneAPI/compiler/*/windows/redist/intel64_win/compiler/"
102+
exit 1
103+
fi
104+
echo "Found libiomp5md.dll at: $LIBIOMP5_PATH"
105+
106+
cp "$LIBIOMP5_PATH" python/ctranslate2/
57107
cp "$CUDA_ROOT/bin/cudnn64_9.dll" python/ctranslate2/

0 commit comments

Comments
 (0)