Skip to content
This repository was archived by the owner on Jan 15, 2026. It is now read-only.

Remove -march=native from default flags - #403

Merged
Luthaf merged 2 commits into
lab-cosmo:masterfrom
Luthaf:remove-march
Apr 6, 2022
Merged

Remove -march=native from default flags#403
Luthaf merged 2 commits into
lab-cosmo:masterfrom
Luthaf:remove-march

Conversation

@Luthaf

@Luthaf Luthaf commented Apr 4, 2022

Copy link
Copy Markdown
Contributor

This is broken in multiple ways right now: #383, #335. I also got a different error when trying to build librascal on a fresh M1 install (macOS Monterey):

-- The C compiler identification is AppleClang 13.1.6.13160021
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/guillaume/code/librascal/_cmake_test_compile/build
-- Build type is: Release
-- The CXX compiler identification is AppleClang 13.1.6.13160021
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Downloading wigxjpf
-- Downloading Eigen3
-- Eigen3 3.3.4
-- Found PythonInterp: /Users/guillaume/code/librascal/virtualenv/bin/python (found suitable version "3.10", minimum required is "3")
-- Found PythonLibs: /opt/miniforge3/lib/libpython3.10.dylib
-- Downloading pybind11
-- pybind11 v2.3.0
-- Installation ROOT: /Users/guillaume/code/librascal/_skbuild/macosx-12.0-arm64-3.10/cmake-install
-- The project is built using scikit-build
-- The optional cpplint parser has not been found. For more information see https://pypi.python.org/pypi/cpplint
-- clang-format not found, so the pretty-cpp target is unavailable
-- BLACK auto formatter: /opt/miniforge3/bin/black
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/guillaume/code/librascal/_skbuild/macosx-12.0-arm64-3.10/cmake-build
[1/20] Building CXX object src/CMakeFiles/rascal.dir/rascal/utils/json_io.cc.o
FAILED: src/CMakeFiles/rascal.dir/rascal/utils/json_io.cc.o
/Library/Developer/CommandLineTools/usr/bin/c++ -Drascal_EXPORTS -I/Users/guillaume/code/librascal/src -isystem /Users/guillaume/code/librascal/_skbuild/macosx-12.0-arm64-3.10/cmake-build/external/Eigen3 -isystem /Users/guillaume/code/librascal/_skbuild/macosx-12.0-arm64-3.10/cmake-build/external/wigxjpf/inc -isystem /Users/guillaume/code/librascal/_skbuild/macosx-12.0-arm64-3.10/cmake-build/external/wigxjpf/cfg -Wall -Wextra -Weffc++ -Wno-non-virtual-dtor -O3 -DNDEBUG -march=native -arch arm64 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX12.3.sdk -mmacosx-version-min=12.0 -fPIC -Werror -std=gnu++14 -MD -MT src/CMakeFiles/rascal.dir/rascal/utils/json_io.cc.o -MF src/CMakeFiles/rascal.dir/rascal/utils/json_io.cc.o.d -o src/CMakeFiles/rascal.dir/rascal/utils/json_io.cc.o -c /Users/guillaume/code/librascal/src/rascal/utils/json_io.cc
clang: error: the clang compiler does not support '-march=native'

Users who want to use -march=native can still specify it in CMAKE_CXX_FLAGS and get any corresponding benefits.

Users can still specify it if they need it, but this is broken in
multiple ways right now.
@Luthaf
Luthaf requested a review from agoscinski April 4, 2022 13:50
black 20 was broken by one of its dependency updating
@agoscinski

Copy link
Copy Markdown
Contributor

Should we add march at least to the default pip installation?

cmake_args=[

Since march seems to potentially give speed ups for numerical code by enabling SSE 2 > instructions.
https://stackoverflow.com/a/52660117

@Luthaf

Luthaf commented Apr 5, 2022

Copy link
Copy Markdown
Contributor Author

No, because this would also fail when compiling the python binding on M1 CPU.

If someone wants to put in the time to figure out a robust way to add back -march=native without breaking some platforms, we can do it later, but I would rather have something which works for now.

@agoscinski agoscinski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

fair enough

@Luthaf
Luthaf merged commit fed28b9 into lab-cosmo:master Apr 6, 2022
@Luthaf
Luthaf deleted the remove-march branch April 6, 2022 09:03
@Luthaf Luthaf mentioned this pull request May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants