Skip to content

[1/n] Update testing lib*.so path - #61960

Closed
tktrungna wants to merge 17 commits into
masterfrom
build-whl-package
Closed

tktrungna wants to merge 17 commits into
masterfrom
build-whl-package

Conversation

@tktrungna

@tktrungna tktrungna commented Jul 21, 2021 •

Copy link
Copy Markdown
Contributor

Fixes #62380

Issue

Build PyTorch wheel packages during build stage for pull requests and install during test stage.

Fix

Update all tests which call lib*.so (under ./build folder), change to call lib*.so in {ent}/pytorch/lib/python3.8/site-packages/torch

Diff

This diff starts to update test_fx, test_backend and test_torchbind first to check if current ci pass

Test plan

check of all ci workflows pass

@facebook-github-bot facebook-github-bot added oncall: jit Add this issue/PR to JIT oncall triage queue cla signed labels Jul 21, 2021
@facebook-github-bot

facebook-github-bot commented Jul 21, 2021 •

Copy link
Copy Markdown
Contributor

🔗 Helpful links

💊 CI failures summary and remediations

As of commit 2ec694f (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions to the (internal) Dr. CI Users group.

Click here to manually regenerate this comment.

@tktrungna tktrungna changed the title Update testing lib*.so path [1/n] Update testing lib*.so path Jul 21, 2021
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@janeyx99 janeyx99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this might mess with development locally as contributors expect that they won't have to python setup.py install between every Python change. Could you guard the change to only be for when IN_CI is found set in the environment?

@tktrungna

Copy link
Copy Markdown
Contributor Author

I think this might mess with development locally as contributors expect that they won't have to python setup.py install between every Python change. Could you guard the change to only be for when IN_CI is found set in the environment?

Thanks for suggesting. Updated with IS_IN_CI checking

@tktrungna
tktrungna requested a review from janeyx99 July 21, 2021 21:28
@codecov

codecov Bot commented Jul 22, 2021 •

Copy link
Copy Markdown

Codecov Report

Merging #61960 (9856dd1) into master (001ff3a) will decrease coverage by 20.51%.
The diff coverage is n/a.

❗ Current head 9856dd1 differs from pull request most recent head 2fe893e. Consider uploading reports for the commit 2fe893e to get more accurate results

@@             Coverage Diff             @@
##           master   #61960       +/-   ##
===========================================
- Coverage   80.60%   60.09%   -20.52%     
===========================================
  Files        1879      657     -1222     
  Lines      202892    85311   -117581     
===========================================
- Hits       163543    51268   -112275     
+ Misses      39349    34043     -5306     

@tktrungna
tktrungna requested a review from a team July 22, 2021 16:59
Comment thread test/jit/test_backends.py Resolved
@janeyx99
janeyx99 self-requested a review July 22, 2021 17:55

@janeyx99 janeyx99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving but please don't land if CI doesn't pass :p

@malfet malfet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR introduces small amount of code duplication. Would it be possible to avoid it by moving the logic into

def find_library_location(lib_name: str) -> Path:
   if IS_IN_CI:
     torch_root = Path(torch.__file__).resolve().parent
     return torch_root / 'lib' / name
  torch_root = Path(__file__).resolve().parent.parent.parent
  return torch_root / 'build' / 'lib' / name

@tktrungna

Copy link
Copy Markdown
Contributor Author

This PR introduces small amount of code duplication. Would it be possible to avoid it by moving the logic into

def find_library_location(lib_name: str) -> Path:
   if IS_IN_CI:
     torch_root = Path(torch.__file__).resolve().parent
     return torch_root / 'lib' / name
  torch_root = Path(__file__).resolve().parent.parent.parent
  return torch_root / 'build' / 'lib' / name

Thanks for suggestion. Updated the PR

@tktrungna
tktrungna requested a review from malfet July 23, 2021 02:50
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@malfet malfet left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, but please consider getting rid of condition and just search for the library among available list of path candidates

Comment thread torch/testing/_internal/common_utils.py Resolved
Comment thread torch/testing/_internal/common_utils.py Resolved
@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

Comment thread torch/testing/_internal/common_utils.py Resolved
def setUp(self):
if IS_SANDCASTLE or IS_WINDOWS or IS_MACOS or IS_FBCODE:
raise unittest.SkipTest("non-portable load_library call used in test")
if TEST_WITH_ROCM:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe it is okie to remote TEST_WITH_ROCM or IN_CI condition, given when shared library file is available in install folder, we could use them first, other wise ones in build folder. The logic works for both internal CI or dev local

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot

Copy link
Copy Markdown
Contributor

@tktrungna merged this pull request in 8152433.

@tktrungna
tktrungna deleted the build-whl-package branch July 24, 2021 22:30
pytorchmergebot pushed a commit that referenced this pull request Sep 30, 2026
)

Fixes issues found in intel/torch-xpu-ops#4436

Currently, `find_library_location()` for `libtorchbind_test.so` resolves to:
_pytorch/torch/build/lib/libtorchbind_test.so_
but the actual built library is here:
_pytorch/build/lib/libtorchbind_test.so_

Issue initially caused by: #129409, but it only exposed old issue introduced to `find_library_location()` here: #61960

Pull Request resolved: #194884
Approved by: https://github.com/jkosnox, https://github.com/kdrozd-dev, https://github.com/guangyey, https://github.com/Skylion007
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla signed Merged oncall: jit Add this issue/PR to JIT oncall triage queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Test PyTorch wheel packages

4 participants