Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PyTorch wheel and libtorch build scripts for ROCm #1232

Merged
merged 2 commits into from Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions manywheel/build_common.sh
Expand Up @@ -279,9 +279,9 @@ replace_needed_sofiles() {
find $1 -name '*.so*' | while read sofile; do
origname=$2
patchedname=$3
if [[ "$origname" != "$patchedname" ]]; then
if [[ "$origname" != "$patchedname" ]] || [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
set +e
$PATCHELF_BIN --print-needed $sofile | grep $origname 2>&1 >/dev/null
origname=$($PATCHELF_BIN --print-needed $sofile | grep "$origname*")
jithunnair-amd marked this conversation as resolved.
Show resolved Hide resolved
ERRCODE=$?
set -e
if [ "$ERRCODE" -eq "0" ]; then
Expand Down
17 changes: 13 additions & 4 deletions manywheel/build_libtorch.sh
Expand Up @@ -228,6 +228,11 @@ fname_with_sha256() {
fi
}

fname_without_so_number() {
LINKNAME=$(echo $1 | sed -e 's/\.so.*/.so/g')
echo "$LINKNAME"
}

make_wheel_record() {
FPATH=$1
if echo $FPATH | grep RECORD >/dev/null 2>&1; then
Expand Down Expand Up @@ -277,8 +282,12 @@ for pkg in /$LIBTORCH_HOUSE_DIR/libtorch*.zip; do
if [[ "$filepath" != "$destpath" ]]; then
cp $filepath $destpath
fi

patchedpath=$(fname_with_sha256 $destpath)

if [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
patchedpath=$(fname_without_so_number $destpath)
else
patchedpath=$(fname_with_sha256 $destpath)
fi
patchedname=$(basename $patchedpath)
if [[ "$destpath" != "$patchedpath" ]]; then
mv $destpath $patchedpath
Expand All @@ -292,9 +301,9 @@ for pkg in /$LIBTORCH_HOUSE_DIR/libtorch*.zip; do
find $PREFIX -name '*.so*' | while read sofile; do
origname=${DEPS_SONAME[i]}
patchedname=${patched[i]}
if [[ "$origname" != "$patchedname" ]]; then
if [[ "$origname" != "$patchedname" ]] || [[ "$DESIRED_CUDA" == *"rocm"* ]]; then
set +e
$PATCHELF_BIN --print-needed $sofile | grep $origname 2>&1 >/dev/null
origname=$($PATCHELF_BIN --print-needed $sofile | grep "$origname*")
ERRCODE=$?
set -e
if [ "$ERRCODE" -eq "0" ]; then
Expand Down