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

Various Fixes #1138

Merged
merged 3 commits into from
Mar 20, 2022
Merged

Various Fixes #1138

merged 3 commits into from
Mar 20, 2022

Conversation

varunagrawal
Copy link
Collaborator

  1. Added a second test for DecisionTree::apply to show it doesn't enumerate all leaf options (so pruning actually works as expected).
  2. Check for Apple Silicon before setting -march=native. If Apple system and architecture is arm64, then we don't set -march=native. Fixes Clang -march=native fails on Apple M1  #1057.
  3. Remove spurious using statement so that the corresponding warning is resolved.

@varunagrawal varunagrawal added the bugfix Fixes an issue or bug label Mar 19, 2022
@varunagrawal varunagrawal self-assigned this Mar 19, 2022
@varunagrawal varunagrawal added the quick-review Quick and easy PR to review label Mar 20, 2022
@varunagrawal
Copy link
Collaborator Author

Added a fix for 1057 because I got annoyed at that on the Macbook

@varunagrawal varunagrawal merged commit 4acbaa2 into develop Mar 20, 2022
@varunagrawal varunagrawal deleted the various-fixes branch March 20, 2022 15:47
Copy link
Contributor

@stefangachter stefangachter left a comment

Choose a reason for hiding this comment

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

Hi Varun, is this change not too strict? Actually, it limits the GTSAM_BUILD_WITH_MARCH_NATIVE flag to Apple architecture only. I was running into the issue under Ubuntu 18.04 (WSL2, Intel CPU). I expected to compile gtsam with -march=native when setting GTSAM_BUILD_WITH_MARCH_NATIVE=ON, but it did not add this compiler option. Thus, I got a segmentation fault when using GTSAM together in VIO package which was compiled with -march=native . To compile GTSAM properly, I set CMAKE_CXX_FLAGS="-march=native" and my issue was solved.

@varunagrawal
Copy link
Collaborator Author

The flag is by default off now but I see your point.

Can you please make a PR for the fix? I don't have cycles at the moment, but I'll gladly help land the fix.

@stefangachter
Copy link
Contributor

stefangachter commented Sep 15, 2022

I am not an expert here, but to my understanding, a general solution would be to add:

include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE)
if(GTSAM_BUILD_WITH_MARCH_NATIVE AND COMPILER_SUPPORTS_MARCH_NATIVE)
    list_append_cache(GTSAM_COMPILE_OPTIONS_PUBLIC "-march=native")
endif()

And this should probably work with the most recent version of LLVM clang:
https://reviews.llvm.org/D119788
https://www.phoronix.com/news/LLVM-Clang-march-native-M1
Question to me is, what GTSAM should support.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Fixes an issue or bug quick-review Quick and easy PR to review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Clang -march=native fails on Apple M1
3 participants