Skip to content

Commit ac8b6e7

Browse files
authored
Fix build and update to CUDA 12.4 (#1925)
Changes: - Update Windows image to 2022 (2019 deprecated and no longer available) - Update from Python 3.9 (which reach end of live 2025-10-31) to Python 3.10 - Update Windows and Linux from CUDA 12.2 to CUDA 12.4 - Updated OneAPI to 2024.0 (previous older SDK was given 404) - Fixes to compile in MacOS
1 parent 617405f commit ac8b6e7

File tree

4 files changed

+64
-27
lines changed

4 files changed

+64
-27
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 11 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,13 +183,13 @@ 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:
189-
- name: Set up Python 3.9
189+
- name: Set up Python 3.10.11
190190
uses: actions/setup-python@v5
191191
with:
192-
python-version: 3.9
192+
python-version: "3.10.11"
193193

194194
- uses: actions/checkout@v4
195195

@@ -208,13 +208,13 @@ jobs:
208208
- name: Install wheel
209209
if: startsWith(matrix.os, 'ubuntu')
210210
run: |
211-
pip install *cp39*manylinux*x86_64.whl
211+
pip install *cp310*manylinux*x86_64.whl
212212
213213
- name: Install wheel
214214
if: startsWith(matrix.os, 'windows')
215215
shell: bash
216216
run: |
217-
pip install *cp39*win*.whl
217+
pip install *cp310*win*.whl
218218
219219
- name: Run tests
220220
shell: bash
@@ -228,10 +228,10 @@ jobs:
228228
steps:
229229
- uses: actions/checkout@v4
230230

231-
- name: Set up Python 3.9
231+
- name: Set up Python 3.10.11
232232
uses: actions/setup-python@v5
233233
with:
234-
python-version: 3.9
234+
python-version: "3.10.11"
235235

236236
- name: Install dependencies
237237
run: |
@@ -307,10 +307,10 @@ jobs:
307307
steps:
308308
- uses: actions/checkout@v4
309309

310-
- name: Set up Python 3.9
310+
- name: Set up Python 3.10.11
311311
uses: actions/setup-python@v5
312312
with:
313-
python-version: 3.9
313+
python-version: "3.10.11"
314314

315315
- name: Download CTranslate2 wheels
316316
uses: actions/download-artifact@v4
@@ -321,7 +321,7 @@ jobs:
321321

322322
- name: Install CTranslate2 wheel
323323
run: |
324-
pip install *cp39*manylinux*x86_64.whl
324+
pip install *cp310*manylinux*x86_64.whl
325325
326326
- name: Install dependencies to build docs
327327
working-directory: docs

python/tools/prepare_build_environment_linux.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,21 @@ if [ "$CIBW_ARCHS" == "aarch64" ]; then
1919
rm -r OpenBLAS-*
2020

2121
else
22-
# Install CUDA 12.2:
22+
# Install CUDA 12.4:
2323
yum-config-manager --add-repo https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.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
2727
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
2828
yum install --setopt=obsoletes=0 -y \
29-
cuda-nvcc-12-2-12.2.140-1 \
30-
cuda-cudart-devel-12-2-12.2.140-1 \
31-
libcurand-devel-12-2-10.3.3.141-1 \
29+
cuda-nvcc-12-4-12.4.99-1 \
30+
cuda-cudart-devel-12-4-12.4.99-1 \
31+
libcurand-devel-12-4-10.3.5.119-1 \
3232
libcudnn9-devel-cuda-12-9.1.0.70-1 \
33-
libcublas-devel-12-2-12.2.5.6-1 \
34-
libnccl-devel-2.19.3-1+cuda12.2
35-
ln -s cuda-12.2 /usr/local/cuda
33+
libcublas-devel-12-4-12.4.2.65-1 \
34+
libnccl-2.20.5-1+cuda12.4 \
35+
libnccl-devel-2.20.5-1+cuda12.4
36+
ln -s cuda-12.4 /usr/local/cuda
3637

3738
ONEAPI_VERSION=2023.2.0
3839
yum-config-manager --add-repo https://yum.repos.intel.com/oneapi

python/tools/prepare_build_environment_macos.sh

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
1-
#! /bin/bash
2-
1+
#!/bin/bash
32
set -e
43
set -x
54

65
pip install "cmake==3.18.4"
6+
brew install libomp
7+
8+
# Get the actual libomp path
9+
LIBOMP_PREFIX=$(brew --prefix libomp)
10+
11+
# Set environment variables
12+
export LDFLAGS="-L${LIBOMP_PREFIX}/lib"
13+
export CPPFLAGS="-I${LIBOMP_PREFIX}/include"
14+
export CMAKE_PREFIX_PATH="${LIBOMP_PREFIX}"
15+
16+
# Critical: Set OpenMP flags explicitly for CMake
17+
export OpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I${LIBOMP_PREFIX}/include"
18+
export OpenMP_C_LIB_NAMES="omp"
19+
export OpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I${LIBOMP_PREFIX}/include"
20+
export OpenMP_CXX_LIB_NAMES="omp"
21+
export OpenMP_omp_LIBRARY="${LIBOMP_PREFIX}/lib/libomp.dylib"
722

823
mkdir build-release && cd build-release
924

@@ -26,7 +41,19 @@ else
2641
wget -q https://github.com/oneapi-src/oneDNN/archive/refs/tags/v${ONEDNN_VERSION}.tar.gz
2742
tar xf *.tar.gz && rm *.tar.gz
2843
cd oneDNN-*
29-
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 .
44+
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
45+
-DCMAKE_BUILD_TYPE=Release \
46+
-DONEDNN_LIBRARY_TYPE=STATIC \
47+
-DONEDNN_BUILD_EXAMPLES=OFF \
48+
-DONEDNN_BUILD_TESTS=OFF \
49+
-DONEDNN_ENABLE_WORKLOAD=INFERENCE \
50+
-DONEDNN_ENABLE_PRIMITIVE="CONVOLUTION;REORDER" \
51+
-DONEDNN_BUILD_GRAPH=OFF \
52+
-DOpenMP_C_FLAGS="${OpenMP_C_FLAGS}" \
53+
-DOpenMP_CXX_FLAGS="${OpenMP_CXX_FLAGS}" \
54+
-DOpenMP_omp_LIBRARY="${OpenMP_omp_LIBRARY}" \
55+
-DCMAKE_C_FLAGS="${CPPFLAGS}" \
56+
-DCMAKE_CXX_FLAGS="${CPPFLAGS}" .
3057
make -j$(sysctl -n hw.physicalcpu_max) install
3158
cd ..
3259
rm -r oneDNN-*
@@ -35,7 +62,15 @@ else
3562

3663
fi
3764

38-
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_CLI=OFF -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON $CMAKE_EXTRA_OPTIONS ..
65+
cmake -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
66+
-DCMAKE_BUILD_TYPE=Release \
67+
-DBUILD_CLI=OFF \
68+
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \
69+
-DOpenMP_C_FLAGS="${OpenMP_C_FLAGS}" \
70+
-DOpenMP_CXX_FLAGS="${OpenMP_CXX_FLAGS}" \
71+
-DOpenMP_omp_LIBRARY="${OpenMP_omp_LIBRARY}" \
72+
$CMAKE_EXTRA_OPTIONS ..
73+
3974
VERBOSE=1 make -j$(sysctl -n hw.physicalcpu_max) install
4075
cd ..
4176
rm -r build-release

python/tools/prepare_build_environment_windows.sh

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
set -e
44
set -x
55

6-
CUDA_ROOT="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.2"
7-
curl --netrc-optional -L -nv -o cuda.exe https://developer.download.nvidia.com/compute/cuda/12.2.2/local_installers/cuda_12.2.2_537.13_windows.exe
8-
./cuda.exe -s nvcc_12.2 cudart_12.2 cublas_dev_12.2 curand_dev_12.2
6+
CUDA_ROOT="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v12.4"
7+
curl --netrc-optional -L -nv -o cuda.exe https://developer.download.nvidia.com/compute/cuda/12.4.0/local_installers/cuda_12.4.0_551.61_windows.exe
8+
./cuda.exe -s nvcc_12.4 cudart_12.4 cublas_dev_12.4 curand_dev_12.4
9+
910
rm cuda.exe
1011

1112
CUDNN_ROOT="C:/Program Files/NVIDIA/CUDNN/v9.1"
@@ -30,7 +31,7 @@ cp -r "$CUDNN_ROOT"/* "$CUDA_ROOT"
3031
rm cudnn.exe
3132

3233
# 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
34+
curl --netrc-optional -L -nv -o webimage.exe https://registrationcenter-download.intel.com/akdlm/IRC_NAS/62641e01-1e8d-4ace-91d6-ae03f7f8a71f/w_BaseKit_p_2024.0.0.49563_offline.exe
3435
./webimage.exe -s -x -f webimage_extracted --log extract.log
3536
rm webimage.exe
3637
./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=.
@@ -53,5 +54,5 @@ rm -r build
5354

5455
cp README.md python/
5556
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/
57+
cp "C:/Program Files (x86)/Intel/oneAPI/compiler/2024.0/bin/libiomp5md.dll" python/ctranslate2/
5758
cp "$CUDA_ROOT/bin/cudnn64_9.dll" python/ctranslate2/

0 commit comments

Comments
 (0)