Skip to content

Commit 4b485e0

Browse files
syed-ahmedatalman
andauthored
Integrates CUDA pip wheels (#1136)
* Refactors rpath to externally set var. Adds mechanism to add metadata * Sets RUNPATH when using cudnn and cublas wheels * Escapes dollar sign * Fix rpath for cpu builds Co-authored-by: atalman <[email protected]>
1 parent fe74295 commit 4b485e0

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

manywheel/build_common.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,15 +359,15 @@ for pkg in /$WHEELHOUSE_DIR/torch*linux*.whl /$LIBTORCH_HOUSE_DIR/libtorch*.zip;
359359

360360
# set RPATH of _C.so and similar to $ORIGIN, $ORIGIN/lib
361361
find $PREFIX -maxdepth 1 -type f -name "*.so*" | while read sofile; do
362-
echo "Setting rpath of $sofile to " '$ORIGIN:$ORIGIN/lib'
363-
$PATCHELF_BIN --set-rpath '$ORIGIN:$ORIGIN/lib' $sofile
362+
echo "Setting rpath of $sofile to ${C_SO_RPATH:-'$ORIGIN:$ORIGIN/lib'}"
363+
$PATCHELF_BIN --set-rpath ${C_SO_RPATH:-'$ORIGIN:$ORIGIN/lib'} $sofile
364364
$PATCHELF_BIN --print-rpath $sofile
365365
done
366366

367367
# set RPATH of lib/ files to $ORIGIN
368368
find $PREFIX/lib -maxdepth 1 -type f -name "*.so*" | while read sofile; do
369-
echo "Setting rpath of $sofile to " '$ORIGIN'
370-
$PATCHELF_BIN --set-rpath '$ORIGIN' $sofile
369+
echo "Setting rpath of $sofile to ${LIB_SO_RPATH:-'$ORIGIN'}"
370+
$PATCHELF_BIN --set-rpath ${LIB_SO_RPATH:-'$ORIGIN'} $sofile
371371
$PATCHELF_BIN --print-rpath $sofile
372372
done
373373

manywheel/build_cuda.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,15 @@ elif [[ $CUDA_VERSION == "11.7" ]]; then
274274
"libcublas.so.11"
275275
"libcublasLt.so.11"
276276
)
277+
else
278+
echo "Using cudnn and cublas from pypi."
279+
CUDA_RPATHS=(
280+
'$ORIGIN/../../nvidia/cublas/lib'
281+
'$ORIGIN/../../nvidia/cudnn/lib'
282+
)
283+
CUDA_RPATHS=$(IFS=: ; echo "${CUDA_RPATHS[*]}")
284+
export C_SO_RPATH=$CUDA_RPATHS':$ORIGIN:$ORIGIN/lib'
285+
export LIB_SO_RPATH=$CUDA_RPATHS':$ORIGIN'
277286
fi
278287
else
279288
echo "Unknown cuda version $CUDA_VERSION"

0 commit comments

Comments
 (0)