Skip to content

Replace fixed number cmake --build -j in sh and docs #10887 #11351

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

MichaelIspas
Copy link

Summary

Replaces fixed number of cmake --build -j entries with:

mac: -j$(($(sysctl -n hw.ncpu) - 1))
linux: -j$(($(nproc) - 1))

Changes

Implemented changes to the best of my ability to .sh, .md, and .yml, could you kindly review if any changes were unnecessary or not relevant? I am a CS student learning how to work with FLOSS communities so I am happy to make any adjustments if needed, thank you.

mac: $(sysctl -n hw.ncpu) - 1
linux: $(nproc) - 1
Copy link

pytorch-bot bot commented Jun 4, 2025

🔗 Helpful Links

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

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

❌ 29 New Failures, 45 Cancelled Jobs

As of commit a5b15d3 with merge base b5a6362 (image):

NEW FAILURES - The following jobs have failed:

CANCELLED JOBS - The following jobs were cancelled. Please retry:

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

@facebook-github-bot
Copy link
Contributor

Hi @MichaelIspas!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

Copy link

github-actions bot commented Jun 4, 2025

This PR needs a release notes: label

If your change should be included in the release notes (i.e. would users of this library care about this change?), please use a label starting with release notes:. This helps us keep track and include your important work in the next release notes.

To add a label, you can comment to pytorchbot, for example
@pytorchbot label "release notes: none"

For more information, see
https://github.com/pytorch/pytorch/wiki/PyTorch-AutoLabel-Bot#why-categorize-for-release-notes-and-how-does-it-work.

@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 Jun 4, 2025
Copy link
Contributor

@larryliu0820 larryliu0820 left a comment

Choose a reason for hiding this comment

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

Looks good, thanks for your contribution! Please get rid of the additional file.

@@ -0,0 +1,110 @@
Microsoft Visual Studio Solution File, Format Version 12.00
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove this file?

@@ -17,7 +17,7 @@ tar xf "${OPENSSL}.tar.gz"
pushd "${OPENSSL}" || true
./config --prefix=/opt/openssl -d "-Wl,--enable-new-dtags,-rpath,$(LIBRPATH)"
# NOTE: openssl install errors out when built with the -j option
make -j6; make install_sw
make -j$((nproc) - 1); make install_sw
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think this is valid syntax is it? You need an additional parentheses

Suggested change
make -j$((nproc) - 1); make install_sw
make -j$(($(nproc) - 1)); make install_sw

@@ -158,7 +158,7 @@ cmake_install_executorch_libraries() {
-DEXECUTORCH_BUILD_QNN="$QNN" \
-DQNN_SDK_ROOT="$QNN_SDK_ROOT" \
-Bcmake-out .
cmake --build cmake-out -j9 --target install --config "$CMAKE_BUILD_TYPE"
cmake --build cmake-out -j$(($(nproc) - 1)) --target install --config "$CMAKE_BUILD_TYPE"
Copy link
Contributor

@jathu jathu Jun 4, 2025

Choose a reason for hiding this comment

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

This script is also used to test locally on macOS, so we cannot just use nproc.

Overall what I would suggest is abstracting out this logic into a common script, and perhaps sharing the logic. For example, create ./tools/common_build.sh

core_count() {
  if [[ "$(uname)" == "Darwin" ]]; then
    num_cores=$(sysctl -n hw.ncpu)
  else
    num_cores=$(nproc)
  fi
  echo $((num_cores - 1))
}

@jathu
Copy link
Contributor

jathu commented Jun 4, 2025

Thanks for the contribution @MichaelIspas! I have some feedback, mainly that most of these scripts are used on macOS and Linux (and also Windows in bash), so we need to support both systems

@zingo zingo added ciflow/trunk module: arm Issues related to arm backend labels Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ciflow/trunk CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: arm Issues related to arm backend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants