Skip to content

Commit 3ce9960

Browse files
committed
Sets RUNPATH when using cudnn and cublas wheels
1 parent 5f6b909 commit 3ce9960

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

manywheel/build_common.sh

-17
Original file line numberDiff line numberDiff line change
@@ -374,23 +374,6 @@ for pkg in /$WHEELHOUSE_DIR/torch*linux*.whl /$LIBTORCH_HOUSE_DIR/libtorch*.zip;
374374
$PATCHELF_BIN --print-rpath $sofile
375375
done
376376

377-
# add dependencies to METADATA
378-
# set WHEEL_DEPENDENCIES to be a string in your wrapper script. e.g.: set the
379-
# following in build_cuda.sh to get cuda dependencies.
380-
#
381-
# export WHEEL_DEPENDENCIES="Requires-Dist: nvidia-cublas-cu11\nRequires-Dist: nvidia-cuda-cupti-cu11"
382-
#
383-
# Notice that each dependency is prefixed 'Requires-Dist: ' and suffixed with a new line char.
384-
# The last dependency in the string doesn't have the new line char.
385-
# This formatting conforms to the METADATA file in a wheel.
386-
if [[ -n "$WHEEL_DEPENDENCIES" ]]; then
387-
metadata_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/METADATA/g')
388-
if [[ -e $metadata_file ]]; then
389-
echo "Adding dependencies to metadata file $metadata_file"
390-
sed -i "/^Requires-Dist.*/a$WHEEL_DEPENDENCIES" $metadata_file
391-
fi
392-
fi
393-
394377
# regenerate the RECORD file with new hashes
395378
record_file=$(echo $(basename $pkg) | sed -e 's/-cp.*$/.dist-info\/RECORD/g')
396379
if [[ -e $record_file ]]; then

manywheel/build_cuda.sh

+9
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)