-
Notifications
You must be signed in to change notification settings - Fork 583
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
base: main
Are you sure you want to change the base?
Conversation
mac: $(sysctl -n hw.ncpu) - 1 linux: $(nproc) - 1
Hi @MichaelIspas! Thank you for your pull request and welcome to our community. Action RequiredIn 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. ProcessIn 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 If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
This PR needs a
|
There was a problem hiding this 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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
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" |
There was a problem hiding this comment.
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))
}
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 |
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.