Skip to content

smoothxg: add linux-aarch64 build #51420

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

Closed
wants to merge 2 commits into from

Conversation

martin-g
Copy link
Contributor

Describe your pull request here


Please read the guidelines for Bioconda recipes before opening a pull request (PR).

General instructions

  • If this PR adds or updates a recipe, use "Add" or "Update" appropriately as the first word in its title.
  • New recipes not directly relevant to the biological sciences need to be submitted to the conda-forge channel instead of Bioconda.
  • PRs require reviews prior to being merged. Once your PR is passing tests and ready to be merged, please issue the @BiocondaBot please add label command.
  • Please post questions on Gitter or ping @bioconda/core in a comment.

Instructions for avoiding API, ABI, and CLI breakage issues

Conda is able to record and lock (a.k.a. pin) dependency versions used at build time of other recipes.
This way, one can avoid that expectations of a downstream recipe with regards to API, ABI, or CLI are violated by later changes in the recipe.
If not already present in the meta.yaml, make sure to specify run_exports (see here for the rationale and comprehensive explanation).
Add a run_exports section like this:

build:
  run_exports:
    - ...

with ... being one of:

Case run_exports statement
semantic versioning {{ pin_subpackage("myrecipe", max_pin="x") }}
semantic versioning (0.x.x) {{ pin_subpackage("myrecipe", max_pin="x.x") }}
known breakage in minor versions {{ pin_subpackage("myrecipe", max_pin="x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
known breakage in patch versions {{ pin_subpackage("myrecipe", max_pin="x.x.x") }} (in such a case, please add a note that shortly mentions your evidence for that)
calendar versioning {{ pin_subpackage("myrecipe", max_pin=None) }}

while replacing "myrecipe" with either name if a name|lower variable is defined in your recipe or with the lowercase name of the package in quotes.

Bot commands for PR management

Please use the following BiocondaBot commands:

Everyone has access to the following BiocondaBot commands, which can be given in a comment:

@BiocondaBot please update Merge the master branch into a PR.
@BiocondaBot please add label Add the please review & merge label.
@BiocondaBot please fetch artifacts Post links to CI-built packages/containers.
You can use this to test packages locally.

Note that the @BiocondaBot please merge command is now depreciated. Please just squash and merge instead.

Also, the bot watches for comments from non-members that include @bioconda/<team> and will automatically re-post them to notify the addressed <team>.

@martin-g martin-g added the aarch64 Related to adding linux-aarch64 support label Oct 16, 2024

Verified

This commit was signed with the committer’s verified signature.
rbeuque74 Romain Beuque
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Copy link
Contributor

coderabbitai bot commented Oct 16, 2024

📝 Walkthrough
📝 Walkthrough

Walkthrough

The pull request includes significant modifications to the build.sh script and the meta.yaml file for the smoothxg package. In build.sh, the script now incorporates a conditional structure to manage architecture-specific compiler flags based on the machine architecture detected by uname -m. For aarch64 or arm64, it sets ARCH_FLAGS to an empty string and modifies the CMakeLists.txt for the spoa dependency to utilize -Ofast. For other architectures, it sets ARCH_FLAGS to -march=sandybridge and adjusts compiler flags for both spoa and abPOA dependencies. The cmake commands have been updated to use the dynamically set ARCH_FLAGS, and a parallel build option has been added. The meta.yaml file reflects a version update from 0.8.0 to 0.8.1, increments the build number, and modifies the requirements section by moving llvm-openmp to the host and run sections while adding libgomp for Linux. The extra section has been updated to include support for linux-aarch64.

Possibly related PRs

Suggested labels

please review & merge

Suggested reviewers

  • mencian: Suggested reviewer for the changes made in this pull request.

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between c5610fa and f68991a.

📒 Files selected for processing (2)
  • recipes/smoothxg/build.sh (1 hunks)
  • recipes/smoothxg/meta.yaml (2 hunks)
🧰 Additional context used
🪛 Shellcheck
recipes/smoothxg/build.sh

[error] 14-14: Couldn't parse this case item. Fix to allow more checks.

(SC1073)


[error] 17-17: Fix any mentioned problems and try again.

(SC1072)


[error] 17-17: Did you forget the ;; after the previous case item?

(SC1074)

🔇 Additional comments (5)
recipes/smoothxg/meta.yaml (5)

16-16: Build number increment looks good.

The build number has been correctly incremented from 0 to 1, which is appropriate when updating a package.


47-48: Additional platform support looks good.

The addition of linux-aarch64 to the additional-platforms section is in line with the PR objectives to add support for this architecture. This change should enable builds for ARM64-based Linux systems.

Let's verify the additional platform configuration:

#!/bin/bash
# Description: Verify the additional platforms configuration
grep -A 2 'additional-platforms:' recipes/smoothxg/meta.yaml

Line range hint 1-48: Summary of review findings

  1. There's an inconsistency in the version number: The code shows 0.8.0, but the AI summary mentions 0.8.1.
  2. The build number increment, changes to host and run requirements, and the addition of linux-aarch64 support are all appropriate and align with the PR objectives.

Next steps:

  1. Please clarify and correct the version number discrepancy.
  2. Once the version issue is resolved, this PR looks good to merge, as it successfully adds linux-aarch64 build support for the smoothxg recipe.

Let's do a final check of the package metadata:

#!/bin/bash
# Description: Verify key metadata in the meta.yaml file
echo "Package version:"
grep 'version = ' recipes/smoothxg/meta.yaml
echo "Build number:"
grep 'number:' recipes/smoothxg/meta.yaml
echo "Additional platforms:"
grep -A 2 'additional-platforms:' recipes/smoothxg/meta.yaml

27-28: Host requirements changes look appropriate.

The movement of llvm-openmp to host requirements for macOS and the addition of libgomp for Linux platforms are good changes. These modifications should help address platform-specific compilation needs.

Let's verify these changes across different platforms:

✅ Verification successful

To further verify the host requirements changes, let's search specifically for llvm-openmp and libgomp in the host section of the recipes/smoothxg/meta.yaml file:


Host requirements changes are verified.

The presence of llvm-openmp for macOS and libgomp for Linux in the host requirements has been confirmed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the host requirements for different platforms
echo "macOS host requirements:"
grep -A 5 'host:' recipes/smoothxg/meta.yaml | grep 'osx'
echo "Linux host requirements:"
grep -A 5 'host:' recipes/smoothxg/meta.yaml | grep 'linux'

Length of output: 388


Script:

#!/bin/bash
# Description: Search for llvm-openmp and libgomp in host requirements
echo "Searching for llvm-openmp in host requirements:"
rg -A 5 'host:' recipes/smoothxg/meta.yaml | rg 'llvm-openmp'
echo "Searching for libgomp in host requirements:"
rg -A 5 'host:' recipes/smoothxg/meta.yaml | rg 'libgomp'

Length of output: 368


34-34: Run requirements changes look appropriate.

The addition of llvm-openmp for macOS and libgomp for Linux platforms in the run requirements is a good change. This ensures that the necessary libraries are available at runtime for both platforms.

Let's verify these changes across different platforms:

✅ Verification successful

Run requirements verified successfully.

The addition of llvm-openmp for macOS and libgomp for Linux platforms in the run requirements has been confirmed. This ensures that the necessary libraries are available at runtime for both platforms.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the run requirements for different platforms
echo "macOS run requirements:"
grep -A 5 'run:' recipes/smoothxg/meta.yaml | grep 'osx'
echo "Linux run requirements:"
grep -A 5 'run:' recipes/smoothxg/meta.yaml | grep 'linux'

Length of output: 388


Script:

#!/bin/bash
# Description: Extract run requirements for macOS and Linux platforms with extended context

echo "macOS run requirements:"
grep -A 10 'run:' recipes/smoothxg/meta.yaml | grep 'osx'

echo "Linux run requirements:"
grep -A 10 'run:' recipes/smoothxg/meta.yaml | grep 'linux'

Length of output: 278

Comment on lines 15 to 18
ARCH_FLAGS=""
sed -i 's/-msse4.1/-Ofast/g' deps/spoa/CMakeLists.txt
*)
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Add missing ';;' after the first case block in the case statement

In the case statement starting on line 14, the first pattern matching aarch64 | arm64) is missing a terminating ;;. Each pattern in a case statement should be concluded with ;; to prevent syntax errors and ensure the script executes as intended.

Apply this diff to fix the issue:

 case $(uname -m) in
     aarch64 | arm64)
         ARCH_FLAGS=""
         sed -i 's/-msse4.1/-Ofast/g' deps/spoa/CMakeLists.txt
+        ;;
     *)
         ARCH_FLAGS="-march=sandybridge"
         sed -i 's/-msse4.1/-march=sandybridge -Ofast/g' deps/spoa/CMakeLists.txt
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
ARCH_FLAGS=""
sed -i 's/-msse4.1/-Ofast/g' deps/spoa/CMakeLists.txt
*)
ARCH_FLAGS=""
sed -i 's/-msse4.1/-Ofast/g' deps/spoa/CMakeLists.txt
;;
*)
🧰 Tools
🪛 Shellcheck

[error] 17-17: Fix any mentioned problems and try again.

(SC1072)


[error] 17-17: Did you forget the ;; after the previous case item?

(SC1074)

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Signed-off-by: Martin Tzvetanov Grigorov <mgrigorov@apache.org>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
recipes/smoothxg/build.sh (2)

18-23: LGTM: Appropriate default configuration for other architectures

The default case block is well-implemented:

  1. Using -march=sandybridge is a good default for x86_64 architectures, balancing performance and compatibility.
  2. Consistently replacing -msse4.1 and -march=native with -march=sandybridge -Ofast in both spoa and abPOA dependencies ensures uniform compiler optimizations.

Consider adding a comment explaining the choice of sandybridge as the default architecture target, e.g.:

# Use sandybridge as the default target for good performance and wide compatibility
ARCH_FLAGS="-march=sandybridge"

This would improve code maintainability by documenting the rationale behind this choice.


26-27: LGTM: Improved build configuration and performance

The updated build commands are well-implemented:

  1. Using ARCH_FLAGS in the cmake command allows for architecture-specific optimizations.
  2. Adding parallel build support with -j"${CPU_COUNT}" can significantly speed up the build process.
  3. The use of --verbose is helpful for debugging.

Consider adding a fallback for CPU_COUNT in case it's not set:

cmake --build build --verbose -j"${CPU_COUNT:-1}"

This ensures the build will proceed even if CPU_COUNT is not defined, defaulting to a single-threaded build in such cases.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Files that changed from the base of the PR and between f68991a and fa74bf8.

📒 Files selected for processing (1)
  • recipes/smoothxg/build.sh (1 hunks)
🧰 Additional context used
🔇 Additional comments (3)
recipes/smoothxg/build.sh (3)

13-14: LGTM: Architecture-specific build configuration introduced

The introduction of a case statement using uname -m is a good approach for handling architecture-specific build configurations. This change allows for more flexible and targeted builds across different architectures.


14-17: LGTM: Appropriate handling for aarch64/arm64 architectures

The case block for aarch64/arm64 architectures is well-implemented:

  1. Setting ARCH_FLAGS to an empty string is appropriate for these architectures.
  2. Replacing -msse4.1 with -Ofast in the spoa CMakeLists.txt is a good adaptation for ARM architectures.
  3. The missing ';;' highlighted in the previous review has been correctly added.

These changes should allow for proper compilation on ARM-based systems.


1-27: Summary: Well-implemented architecture-specific build improvements

Overall, the changes to the build script are well-implemented and align with the PR objectives:

  1. Architecture-specific optimizations have been introduced, allowing for proper builds on different platforms, including linux-aarch64.
  2. Build performance has been improved with the addition of parallel build support.
  3. The script maintains good compatibility while leveraging architecture-specific optimizations where possible.

The minor suggestions provided in the review comments, if implemented, would further enhance the script's clarity and robustness. Great work on these improvements!

@martin-g
Copy link
Contributor Author

martin-g commented Oct 16, 2024

The Linux ARM64 build fails because several of the dependencies (Git submodules) use Intel intrinsics which are hard to patch

   Change Dir: '/home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j'
    
    Run Build Command(s): /home/mgrigorov/miniconda3/lib/python3.10/site-packages/cmake/data/bin/cmake -E env VERBOSE=1 /usr/bin/gmake -f Makefile cmTC_911d7/fast
    gmake[6]: Entering directory '/home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j'
    /usr/bin/gmake  -f CMakeFiles/cmTC_911d7.dir/build.make CMakeFiles/cmTC_911d7.dir/build
    gmake[7]: Entering directory '/home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j'
    Building CXX object CMakeFiles/cmTC_911d7.dir/testCXXCompiler.cxx.o
    /usr/bin/c++   -fopenmp -Ofast -march=native -pipe -msse4.2 -funroll-all-loops -fPIC -fopenmp -fopenmp  -o CMakeFiles/cmTC_911d7.dir/testCXXCompiler.cxx.o -c /home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j/testCXXCompiler.cxx
    c++: error: unrecognized command-line option ‘-msse4.2’
    gmake[7]: *** [CMakeFiles/cmTC_911d7.dir/build.make:78: CMakeFiles/cmTC_911d7.dir/testCXXCompiler.cxx.o] Error 1
    gmake[7]: Leaving directory '/home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j'
    gmake[6]: *** [Makefile:127: cmTC_911d7/fast] Error 2
    gmake[6]: Leaving directory '/home/mgrigorov/git/bioconda/smoothxg/uild/odgi-prefix/src/odgi-build/sdsl-lite-prefix/src/sdsl-lite-build/CMakeFiles/CMakeScratch/TryCompile-C61w9j'
/home/mgrigorov/git/bioconda/smoothxg/deps/abPOA/src/simd_instruction.h:21:10: fatal error: immintrin.h: No such file or directory
   21 | #include <immintrin.h>
      |          ^~~~~~~~~~~~~

@martin-g martin-g closed this Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aarch64 Related to adding linux-aarch64 support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant