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

Extend setup cmake ability #3349

Closed
wants to merge 4 commits into from
Closed

Extend setup cmake ability #3349

wants to merge 4 commits into from

Conversation

larryliu0820
Copy link
Contributor

Summary:

For executorch users, we see a common pattern that they have to:

bash install_requirements.sh --pybind xnnpack

cmake -S . -Bcmake-out ...

cmake --build ...

This is repeating cmake build twice, the first one is inside setup.py.

Here I'm adding a way to allow setup.py to install the libraries seperately, by passing CMAKE_ARGS and CMAKE_BUILD_ARGS into setup.py, through install_requirements.sh.

After this change, user can do:

export CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX=<install dir> \
  -DEXECUTORCH_BUILD_OPTIMIZED=ON \
  ..."

export CMAKE_BUILD_ARGS="--target install"

bash install_requirements.sh --pybind xnnpack

Then we should be able to find libxnnpack.a liboptimized_ops_lib.a etc under install dir.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:

Summary:

For executorch users, we see a common pattern that they have to:

```bash
bash install_requirements.sh --pybind xnnpack

cmake -S . -Bcmake-out ...

cmake --build ...
```

This is repeating cmake build twice, the first one is inside setup.py.

Here I'm adding a way to allow setup.py to install the libraries
seperately, by passing `CMAKE_ARGS` and `CMAKE_BUILD_ARGS` into
setup.py, through `install_requirements.sh`.

After this change, user can do:

```bash
export CMAKE_ARGS="-DCMAKE_INSTALL_PREFIX=<install dir> \
  -DEXECUTORCH_BUILD_OPTIMIZED=ON \
  ..."

export CMAKE_BUILD_ARGS="--target install"

bash install_requirements.sh --pybind xnnpack
```

Then we should be able to find `libxnnpack.a` `liboptimized_ops_lib.a`
etc under install dir.

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@larryliu0820 larryliu0820 requested a review from dbort April 25, 2024 06:32
Copy link

pytorch-bot bot commented Apr 25, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/3349

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit b9500e2 with merge base 590cbce (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Apr 25, 2024
@facebook-github-bot
Copy link
Contributor

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

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

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

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
Copy link
Contributor

@mikekgfb mikekgfb left a comment

Choose a reason for hiding this comment

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

Thank you!

@dbort
Copy link
Contributor

dbort commented Apr 25, 2024

It seems ok to add the BUILD_ARGS to setup.py, but setup.oy should only be used to build the pip package. The comments in the PR seem to use it as a driver for installing files in other locations

We should not depend on setup.py for that

Summary:

Test Plan:

Reviewers:

Subscribers:

Tasks:

Tags:
@facebook-github-bot
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

@larryliu0820 merged this pull request in 8ec0af9.

@mergennachin mergennachin mentioned this pull request Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants