3636 - name : Install build dependencies
3737 run : |
3838 apt-get update
39- apt-get install -y --no-install-recommends build-essential curl libssl-dev pkg-config unzip
39+ apt-get install -y --no-install-recommends build-essential curl libssl-dev pkg-config unzip zip
4040 shell : bash
4141
4242 - name : Install Rust
@@ -61,26 +61,48 @@ jobs:
6161 echo "CUDA_LIB_DIR=$LIB_DIR" >> $GITHUB_ENV
6262 shell : bash
6363
64- - name : Build wheel with auditwheel exclusions
64+ - name : Build wheel
6565 env :
6666 LD_LIBRARY_PATH : ${{ env.CUDA_LIB_DIR }}:${LD_LIBRARY_PATH}
6767 CUDA_COMPUTE_CAP : ${{ matrix.variant.compute-caps }}
68- run : |
69- # Explicitly export AUDITWHEEL_EXCLUDE to ensure it's picked up by child processes.
70- # This prevents bundling large CUDA libraries into the wheel.
71- export AUDITWHEEL_EXCLUDE="libcuda.so,libnvJitLink.so,libcudart.so,libcublas.so,libcufft.so,libcurand.so,libcusolver.so,libcusparse.so,libcudnn.so"
72- echo "AUDITWHEEL_EXCLUDE is set to: $AUDITWHEEL_EXCLUDE"
73- maturin build --release --out dist
68+ run : maturin build --release --out dist
7469 shell : bash
7570
76- - name : Verify wheel contents and size
71+ - name : Strip CUDA libraries and Verify
7772 run : |
78- echo "--- Verifying wheel contents ---"
73+ set -e
74+ echo "--- Stripping CUDA libraries from the wheel ---"
7975 WHEEL_FILE=$(ls dist/*.whl)
80- # The grep command should now only show your project's .so file and system libs like libcrypto
81- unzip -l $WHEEL_FILE | grep '\.so'
82- echo "--- Verifying wheel size ---"
83- ls -lh dist
76+ echo "Original wheel size:"
77+ ls -lh "$WHEEL_FILE"
78+
79+ UNPACK_DIR=$(mktemp -d)
80+ unzip -q "$WHEEL_FILE" -d "$UNPACK_DIR"
81+
82+ echo "Deleting CUDA libraries..."
83+ find "$UNPACK_DIR" -type f \( \
84+ -name 'libcuda.so*' -o \
85+ -name 'libcublas.so*' -o \
86+ -name 'libcublasLt.so*' -o \
87+ -name 'libnvJitLink.so*' -o \
88+ -name 'libcudart.so*' -o \
89+ -name 'libcufft.so*' -o \
90+ -name 'libcurand.so*' -o \
91+ -name 'libcusolver.so*' -o \
92+ -name 'libcusparse.so*' -o \
93+ -name 'libcudnn.so*' \
94+ \) -print -delete
95+
96+ echo "Re-packing the wheel..."
97+ (cd "$UNPACK_DIR" && zip -r -q "$WHEEL_FILE" .)
98+ rm -rf "$UNPACK_DIR"
99+
100+ echo "--- Verification ---"
101+ echo "Final wheel size:"
102+ ls -lh "$WHEEL_FILE"
103+ echo "Final wheel contents:"
104+ unzip -l "$WHEEL_FILE" | grep '\.so'
105+ shell : bash
84106
85107 - name : Upload wheel artifact
86108 uses : actions/upload-artifact@v4
0 commit comments