Coder Social home page Coder Social logo

hartwork / resolve-march-native Goto Github PK

View Code? Open in Web Editor NEW
41.0 4.0 7.0 330 KB

:snail: Tool to determine what GCC flags -march=native would resolve into

Home Page: https://pypi.python.org/pypi/resolve-march-native

Python 75.87% Makefile 0.51% Assembly 23.62%
python cli gcc tool compilation python3 cross-compilation distcc distccflags

resolve-march-native's Introduction

pre-commit Run the test suite

About

resolve-march-native is a small command line tool to resolve -march=native into explicit GCC flags.

Example

$ resolve-march-native --vertical
-march=bonnell
-mno-cx16
--param l1-cache-line-size=64
--param l1-cache-size=24

Usage

$ COLUMNS=80 resolve-march-native --help
usage: resolve-march-native [-h] [--debug] [--gcc COMMAND] [--vertical]
                            [--keep-identical-mtune] [--keep-mno-flags]
                            [--add-recommended] [--version]

options:
  -h, --help            show this help message and exit
  --debug               enable debugging (default: disabled)
  --gcc COMMAND         gcc command (default: gcc)
  --vertical            produce vertical output (default: horizontal output)
  --keep-identical-mtune
                        keep implied -mtune=... despite architecture identical
                        to -march=... (default: stripped away)
  --keep-mno-flags      keep -mno-* parameters (default: (superfluous ones)
                        stripped away)
  --add-recommended, -a
                        add recommended flags (default: not added)
  --version             show program's version number and exit

Software libre licensed under GPL v2 or later.
Brought to you by Sebastian Pipping <[email protected]>.

Please report bugs at https://github.com/hartwork/resolve-march-native/issues — thank you!

resolve-march-native's People

Contributors

anyuta1166 avatar dependabot[bot] avatar floga avatar hartwork avatar mercuriete avatar mschiff avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

resolve-march-native's Issues

Determine --param=l?-cache-*size

grep "model name" /proc/cpuinfo |head -1
model name      : Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz

resolve-march-native --keep-identical-mtune  --vertical |grep cache
--param=l1-cache-line-size=64
--param=l1-cache-size=32
--param=l2-cache-size=8192

How are the cache sizes determined, just from gcc defaults?
I'm not sure if these values are correct.

At least here I read different values:
https://www.cpu-world.com/CPUs/Core_i7/Intel-Core%20i7-3770.html

Level 1 cache size  | 4 x 32 KB 8-way set associative instruction caches 4 x 32 KB 8-way set associative data caches
Level 2 cache size  | 4 x 256 KB 8-way set associative caches
Level 3 cache size | 8 MB 16-way set associative shared cache

Background

I need this tool to determine the explicit flags behind -march=native in order to pass them via distcc to remote servers that can't detect them.

[macOS] Needs true GCC from Homebrew, not Clang "gcc"

resolve-march-native fails on macOS 14.2 with this error:
ERROR: Command '['gcc', '-Q', '--help=target', '-mcpu=native']' returned non-zero exit status 1.

Environment:

% uname -a
Darwin jlee-mbair.local 23.2.0 Darwin Kernel Version 23.2.0: Wed Nov 15 21:59:33 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8112 arm64

% gcc --version
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

% gcc -### -E -march=native -  
Apple clang version 15.0.0 (clang-1500.1.0.2.5)
Target: arm64-apple-darwin23.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" "-cc1" "-triple" "arm64-apple-macosx14.0.0" "-Wundef-prefix=TARGET_OS_" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-Werror=implicit-function-declaration" "-E" "-disable-free" "-clear-ast-before-backend" "-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2" "-mframe-pointer=non-leaf" "-fno-strict-return" "-ffp-contract=on" "-fno-rounding-math" "-funwind-tables=1" "-fobjc-msgsend-selector-stubs" "-target-sdk-version=14.2" "-fvisibility-inlines-hidden-static-local-var" "-target-cpu" "apple-m1" "-target-feature" "+neon" "-target-feature" "+v8.5a" "-target-feature" "+zcm" "-target-feature" "+zcz" "-target-abi" "darwinpcs" "-debugger-tuning=lldb" "-target-linker-version" "1022.1" "-fcoverage-compilation-dir=/Users/jeongyun" "-resource-dir" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0" "-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-I/usr/local/include" "-internal-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include" "-internal-isystem" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/15.0.0/include" "-internal-externc-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include" "-internal-externc-isystem" "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include" "-Wno-reorder-init-list" "-Wno-implicit-int-float-conversion" "-Wno-c99-designator" "-Wno-final-dtor-non-final-class" "-Wno-extra-semi-stmt" "-Wno-misleading-indentation" "-Wno-quoted-include-in-framework-header" "-Wno-implicit-fallthrough" "-Wno-enum-enum-conversion" "-Wno-enum-float-conversion" "-Wno-elaborated-enum-base" "-Wno-reserved-identifier" "-Wno-gnu-folding-constant" "-fdebug-compilation-dir=/Users/jeongyun" "-ferror-limit" "19" "-stack-protector" "1" "-fstack-check" "-mdarwin-stkchk-strong-link" "-fblocks" "-fencode-extended-block-signature" "-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fmax-type-align=16" "-fcommon" "-fcolor-diagnostics" "-clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation" "-fno-odr-hash-protocols" "-clang-vendor-feature=+enableAggressiveVLAFolding" "-clang-vendor-feature=+revert09abecef7bbf" "-clang-vendor-feature=+thisNoAlignAttr" "-clang-vendor-feature=+thisNoNullAttr" "-mllvm" "-disable-aligned-alloc-awareness=1" "-D__GCC_HAVE_DWARF2_CFI_ASM=1" "-o" "-" "-x" "c" "-"

Debug output

$ resolve-march-native --debug
# gcc -S -fverbose-asm -o /dev/stdout /var/folders/7s/ypkmzhkm8xg2p3001s6lqcqh0000gn/T/tmp_i64nlde.c -march=native
Flags extracted: 
# gcc -Q --help=target -march=native
clang: error: unsupported option '--help=target'
clang: error: no input files
# gcc -Q --help=target -mcpu=native
clang: error: unsupported option '--help=target'
clang: error: no input files
Traceback (most recent call last):
  File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/target_help_parser.py", line 96, in get_flags_implied_by_march
    gcc_output = subprocess.check_output(cmd, env=env, stderr=stderr).decode('UTF-8')
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-Q', '--help=target', '-march=native']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    native_unrolled_flag_set = Engine(
  File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/engine.py", line 133, in run
    march_native_flag_set = self._get_march_native_flag_set()
  File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/engine.py", line 67, in _get_march_native_flag_set
    march_native_flag_set |= set(get_flags_implied_by_march('native', gcc=self._gcc_command,
  File "/Users/jeongyun/Library/Python/3.9/lib/python/site-packages/resolve_march_native/target_help_parser.py", line 101, in get_flags_implied_by_march
    gcc_output = subprocess.check_output(cmd, env=env, stderr=stderr).decode('UTF-8')
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 424, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/subprocess.py", line 528, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-Q', '--help=target', '-mcpu=native']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-Q', '--help=target', '-mcpu=native']' returned non-zero exit status 1.

-mcpu= -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 on M2

As requested downstream in https://bugs.gentoo.org/show_bug.cgi?id=924184:

➜ resolve-march-native
ERROR: No entry -m(arch|cpu)=.. found in: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu= -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -mno-big-endian -mno-bionic -mno-general-regs-only -mno-low-precision-div -mno-low-precision-recip-sqrt -mno-low-precision-sqrt -mno-musl -mno-strict-align -mno-track-speculation -mno-uclibc -mno-verbose-cost-dump -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
➜ gcc -S -fverbose-asm -o /dev/stdout "$(mktemp --suffix=.c)" -march=native
        .arch armv8-a
        .file   "tmp.X34nHLwR98.c"
// GNU C17 (Gentoo 13.2.1_p20240113-r1 p12) version 13.2.1 20240113 (aarch64-unknown-linux-gnu)
//      compiled by GNU C version 13.2.1 20240113, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none
// GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
// options passed: -mlittle-endian -mabi=lp64
        .text
        .ident  "GCC: (Gentoo 13.2.1_p20240113-r1 p12) 13.2.1 20240113"
        .section        .note.GNU-stack,"",@progbits
➜ gcc -S -fverbose-asm -o /dev/stdout "$(mktemp --suffix=.c)" -march=armv8-a
        .arch armv8-a
        .file   "tmp.bJNx0uorAh.c"
// GNU C17 (Gentoo 13.2.1_p20240113-r1 p12) version 13.2.1 20240113 (aarch64-unknown-linux-gnu)
//      compiled by GNU C version 13.2.1 20240113, GMP version 6.3.0, MPFR version 4.2.1, MPC version 1.3.1, isl version none
// GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
// options passed: -march=armv8-a -mlittle-endian -mabi=lp64
        .text
        .ident  "GCC: (Gentoo 13.2.1_p20240113-r1 p12) 13.2.1 20240113"
        .section        .note.GNU-stack,"",@progbits
➜ gcc -Q --help=target -march=native
The following options are target specific:
  -mabi=                                lp64
  -march=
  -mbig-endian                          [disabled]
  -mbionic                              [disabled]
  -mbranch-protection=
  -mcmodel=                             small
  -mcpu=
  -mfix-cortex-a53-835769               [enabled]
  -mfix-cortex-a53-843419               [enabled]
  -mgeneral-regs-only                   [disabled]
  -mglibc                               [enabled]
  -mharden-sls=
  -mlittle-endian                       [enabled]
  -mlow-precision-div                   [disabled]
  -mlow-precision-recip-sqrt            [disabled]
  -mlow-precision-sqrt                  [disabled]
  -mmusl                                [disabled]
  -momit-leaf-frame-pointer             [enabled]
  -moutline-atomics                     [enabled]
  -moverride=<string>
  -mpc-relative-literal-loads           [enabled]
  -msign-return-address=                none
  -mstack-protector-guard-offset=
  -mstack-protector-guard-reg=
  -mstack-protector-guard=              global
  -mstrict-align                        [disabled]
  -msve-vector-bits=<number>            scalable
  -mtls-dialect=                        desc
  -mtls-size=                           24
  -mtrack-speculation                   [disabled]
  -mtune=
  -muclibc                              [disabled]
  -mverbose-cost-dump                   [disabled]

  Known AArch64 ABIs (for use with the -mabi= option):
    ilp32 lp64

  Supported AArch64 return address signing scope (for use with -msign-return-address= option):
    all non-leaf none

  The code model option names for -mcmodel:
    large small tiny

  Valid arguments to -mstack-protector-guard=:
    global sysreg

  The possible SVE vector lengths:
    1024 128 2048 256 512 scalable

  The possible TLS dialects:
    desc trad
➜ gcc -Q --help=target -march=armv8-a
The following options are target specific:
  -mabi=                                lp64
  -march=                               armv8-a
  -mbig-endian                          [disabled]
  -mbionic                              [disabled]
  -mbranch-protection=
  -mcmodel=                             small
  -mcpu=
  -mfix-cortex-a53-835769               [enabled]
  -mfix-cortex-a53-843419               [enabled]
  -mgeneral-regs-only                   [disabled]
  -mglibc                               [enabled]
  -mharden-sls=
  -mlittle-endian                       [enabled]
  -mlow-precision-div                   [disabled]
  -mlow-precision-recip-sqrt            [disabled]
  -mlow-precision-sqrt                  [disabled]
  -mmusl                                [disabled]
  -momit-leaf-frame-pointer             [enabled]
  -moutline-atomics                     [enabled]
  -moverride=<string>
  -mpc-relative-literal-loads           [enabled]
  -msign-return-address=                none
  -mstack-protector-guard-offset=
  -mstack-protector-guard-reg=
  -mstack-protector-guard=              global
  -mstrict-align                        [disabled]
  -msve-vector-bits=<number>            scalable
  -mtls-dialect=                        desc
  -mtls-size=                           24
  -mtrack-speculation                   [disabled]
  -mtune=
  -muclibc                              [disabled]
  -mverbose-cost-dump                   [disabled]

  Known AArch64 ABIs (for use with the -mabi= option):
    ilp32 lp64

  Supported AArch64 return address signing scope (for use with -msign-return-address= option):
    all non-leaf none

  The code model option names for -mcmodel:
    large small tiny

  Valid arguments to -mstack-protector-guard=:
    global sysreg

  The possible SVE vector lengths:
    1024 128 2048 256 512 scalable

  The possible TLS dialects:
    desc trad

I decided "-march=armv8-a" based on the output of the first gcc command, if that's not what you wanted, please let me know and I'll update the post.

when using with rpi3: ERROR: No entry -march=.. found in:

hey there, I discovered this tiny little program recently and found it to be usefull. Testing it on an rpi3b+ with gentoo running on it I got this rather short error:

resolve-march-native
ERROR: No entry -march=.. found in: 

I'm very bad at debugging python, and even though your code base is really small I was unable to find the error on my own. Do you maybe depend on some particular kernel feature?

Support for `-mcpu`

On many architectures, -mcpu is the functional equivalent of -march, and -march is unavailable. Nope, and there's not even a good reason as to why :)

On these architectures, GCC outputs gcc: error: unrecognized command-line option '-march=native'; did you mean '-mcpu=native'?, so this would be a good way to check which flag to use.

I tried implementing this myself, but I don't know python and couldn't even figure out how to build this or run it or what to do (^: python scares me. But, I imagine it won't be tooo troublesome :D.

To test, you're welcome to have SSH access to either ppc64el or sparc64, whichever one interests you more :>

`ERROR: Line ' -mabi=ABI \t\tlp64' not understood`

Just installed on a Arm A53 board running ubuntu via pip.

orangepi@orangepizero2:~$ resolve-march-native
ERROR: Line '  -mabi=ABI                   \t\tlp64' not understood

Haven't really looked into what could be the cause but just feedback.

Missing `-mno-avx` flag in output for Sandy Bridge Celeron without AVX

Processor: Intel(R) Celeron(R) CPU 847 @ 1.10GHz (Sandy Bridge without AVX).
OS: Gentoo Linux
GCC version: 11.3.0

-mno-avx flag should be added, but it is missing in output.
distccflags script correctly shows this flag.

# resolve-march-native
-march=sandybridge --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=2048
# ./distccflags -march=native
CFLAGS="-march=sandybridge -mno-avx"
# gcc -Q -march=sandybridge --help=target
The following options are target specific:
  -m128bit-long-double                  [enabled]
  -m16                                  [disabled]
  -m32                                  [disabled]
  -m3dnow                               [disabled]
  -m3dnowa                              [disabled]
  -m64                                  [enabled]
  -m80387                               [enabled]
  -m8bit-idiv                           [disabled]
  -m96bit-long-double                   [disabled]
  -mabi=                                sysv
  -mabm                                 [disabled]
  -maccumulate-outgoing-args            [disabled]
  -maddress-mode=                       long
  -madx                                 [disabled]
  -maes                                 [disabled]
  -malign-data=                         compat
  -malign-double                        [disabled]
  -malign-functions=                    0
  -malign-jumps=                        0
  -malign-loops=                        0
  -malign-stringops                     [enabled]
  -mamx-bf16                            [disabled]
  -mamx-int8                            [disabled]
  -mamx-tile                            [disabled]
  -mandroid                             [disabled]
  -march=                               sandybridge
  -masm=                                att
  -mavx                                 [enabled]
  -mavx2                                [disabled]
  -mavx256-split-unaligned-load         [enabled]
  -mavx256-split-unaligned-store        [enabled]
  -mavx5124fmaps                        [disabled]
  -mavx5124vnniw                        [disabled]
  -mavx512bf16                          [disabled]
  -mavx512bitalg                        [disabled]
  -mavx512bw                            [disabled]
  -mavx512cd                            [disabled]
  -mavx512dq                            [disabled]
  -mavx512er                            [disabled]
  -mavx512f                             [disabled]
  -mavx512ifma                          [disabled]
  -mavx512pf                            [disabled]
  -mavx512vbmi                          [disabled]
  -mavx512vbmi2                         [disabled]
  -mavx512vl                            [disabled]
  -mavx512vnni                          [disabled]
  -mavx512vp2intersect                  [disabled]
  -mavx512vpopcntdq                     [disabled]
  -mavxvnni                             [disabled]
  -mbionic                              [disabled]
  -mbmi                                 [disabled]
  -mbmi2                                [disabled]
  -mbranch-cost=<0,5>                   3
  -mcall-ms2sysv-xlogues                [disabled]
  -mcet-switch                          [disabled]
  -mcld                                 [disabled]
  -mcldemote                            [disabled]
  -mclflushopt                          [disabled]
  -mclwb                                [disabled]
  -mclzero                              [disabled]
  -mcmodel=                             [default]
  -mcpu=
  -mcrc32                               [enabled]
  -mcx16                                [enabled]
  -mdispatch-scheduler                  [disabled]
  -mdump-tune-features                  [disabled]
  -menqcmd                              [disabled]
  -mf16c                                [disabled]
  -mfancy-math-387                      [enabled]
  -mfentry                              [disabled]
  -mfentry-name=
  -mfentry-section=
  -mfma                                 [disabled]
  -mfma4                                [disabled]
  -mforce-drap                          [disabled]
  -mforce-indirect-call                 [disabled]
  -mfp-ret-in-387                       [enabled]
  -mfpmath=                             sse
  -mfsgsbase                            [disabled]
  -mfunction-return=                    keep
  -mfused-madd                          -ffp-contract=fast
  -mfxsr                                [enabled]
  -mgeneral-regs-only                   [disabled]
  -mgfni                                [disabled]
  -mglibc                               [enabled]
  -mhard-float                          [enabled]
  -mharden-sls=                         none
  -mhle                                 [disabled]
  -mhreset                              [disabled]
  -miamcu                               [disabled]
  -mieee-fp                             [enabled]
  -mincoming-stack-boundary=            0
  -mindirect-branch-cs-prefix           [disabled]
  -mindirect-branch-register            [disabled]
  -mindirect-branch=                    keep
  -minline-all-stringops                [disabled]
  -minline-stringops-dynamically        [disabled]
  -minstrument-return=                  none
  -mintel-syntax                        -masm=intel
  -mkl                                  [disabled]
  -mlarge-data-threshold=<number>       65536
  -mlong-double-128                     [disabled]
  -mlong-double-64                      [disabled]
  -mlong-double-80                      [enabled]
  -mlwp                                 [disabled]
  -mlzcnt                               [disabled]
  -mmanual-endbr                        [disabled]
  -mmemcpy-strategy=
  -mmemset-strategy=
  -mmitigate-rop                        [disabled]
  -mmmx                                 [enabled]
  -mmovbe                               [disabled]
  -mmovdir64b                           [disabled]
  -mmovdiri                             [disabled]
  -mmpx                                 [disabled]
  -mms-bitfields                        [disabled]
  -mmusl                                [disabled]
  -mmwait                               [enabled]
  -mmwaitx                              [disabled]
  -mneeded                              [disabled]
  -mno-align-stringops                  [disabled]
  -mno-default                          [disabled]
  -mno-fancy-math-387                   [disabled]
  -mno-push-args                        [disabled]
  -mno-red-zone                         [disabled]
  -mno-sse4                             [disabled]
  -mnop-mcount                          [disabled]
  -momit-leaf-frame-pointer             [disabled]
  -mpc32                                [disabled]
  -mpc64                                [disabled]
  -mpc80                                [disabled]
  -mpclmul                              [enabled]
  -mpcommit                             [disabled]
  -mpconfig                             [disabled]
  -mpku                                 [disabled]
  -mpopcnt                              [enabled]
  -mprefer-avx128                       -mprefer-vector-width=128
  -mprefer-vector-width=                none
  -mpreferred-stack-boundary=           0
  -mprefetchwt1                         [disabled]
  -mprfchw                              [disabled]
  -mptwrite                             [disabled]
  -mpush-args                           [enabled]
  -mrdpid                               [disabled]
  -mrdrnd                               [disabled]
  -mrdseed                              [disabled]
  -mrecip                               [disabled]
  -mrecip=
  -mrecord-mcount                       [disabled]
  -mrecord-return                       [disabled]
  -mred-zone                            [enabled]
  -mregparm=                            6
  -mrtd                                 [disabled]
  -mrtm                                 [disabled]
  -msahf                                [enabled]
  -mserialize                           [disabled]
  -msgx                                 [disabled]
  -msha                                 [disabled]
  -mshstk                               [disabled]
  -mskip-rax-setup                      [disabled]
  -msoft-float                          [disabled]
  -msse                                 [enabled]
  -msse2                                [enabled]
  -msse2avx                             [disabled]
  -msse3                                [enabled]
  -msse4                                [enabled]
  -msse4.1                              [enabled]
  -msse4.2                              [enabled]
  -msse4a                               [disabled]
  -msse5                                -mavx
  -msseregparm                          [disabled]
  -mssse3                               [enabled]
  -mstack-arg-probe                     [disabled]
  -mstack-protector-guard-offset=
  -mstack-protector-guard-reg=
  -mstack-protector-guard-symbol=
  -mstack-protector-guard=              tls
  -mstackrealign                        [disabled]
  -mstringop-strategy=                  [default]
  -mstv                                 [enabled]
  -mtbm                                 [disabled]
  -mtls-dialect=                        gnu
  -mtls-direct-seg-refs                 [enabled]
  -mtsxldtrk                            [disabled]
  -mtune-ctrl=
  -mtune=                               sandybridge
  -muclibc                              [disabled]
  -muintr                               [disabled]
  -mvaes                                [disabled]
  -mveclibabi=                          [default]
  -mvect8-ret-in-mem                    [disabled]
  -mvpclmulqdq                          [disabled]
  -mvzeroupper                          [enabled]
  -mwaitpkg                             [disabled]
  -mwbnoinvd                            [disabled]
  -mwidekl                              [disabled]
  -mx32                                 [disabled]
  -mxop                                 [disabled]
  -mxsave                               [enabled]
  -mxsavec                              [disabled]
  -mxsaveopt                            [enabled]
  -mxsaves                              [disabled]

  Known assembler dialects (for use with the -masm= option):
    att intel

  Known ABIs (for use with the -mabi= option):
    ms sysv

  Known code models (for use with the -mcmodel= option):
    32 kernel large medium small

  Valid arguments to -mfpmath=:
    387 387+sse 387,sse both sse sse+387 sse,387

  Known choices for mitigation against straight line speculation with -mharden-sls=:
    all indirect-jmp none return

  Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
    keep thunk thunk-extern thunk-inline

  Known choices for return instrumentation with -minstrument-return=:
    call none nop5

  Known data alignment choices (for use with the -malign-data= option):
    abi cacheline compat

  Known vectorization library ABIs (for use with the -mveclibabi= option):
    acml svml

  Known address mode (for use with the -maddress-mode= option):
    long short

  Known preferred register vector length (to use with the -mprefer-vector-width= option):
    128 256 512 none

  Known stack protector guard (for use with the -mstack-protector-guard= option):
    global tls

  Valid arguments to -mstringop-strategy=:
    byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop vector_loop

  Known TLS dialects (for use with the -mtls-dialect= option):
    gnu gnu2

  Known valid arguments for -march= option:
    i386 i486 i586 pentium lakemont pentium-mmx winchip-c6 winchip2 c3 samuel-2 c3-2 nehemiah c7 esther i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel geode k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 btver1 btver2 generic native

  Known valid arguments for -mtune= option:
    generic i386 i486 pentium lakemont pentiumpro pentium4 nocona core2 nehalem sandybridge haswell bonnell silvermont goldmont goldmont-plus tremont knl knm skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake rocketlake intel geode k6 athlon k8 amdfam10 bdver1 bdver2 bdver3 bdver4 btver1 btver2 znver1 znver2 znver3
# gcc -Q -march=native --help=target
The following options are target specific:
  -m128bit-long-double                  [enabled]
  -m16                                  [disabled]
  -m32                                  [disabled]
  -m3dnow                               [disabled]
  -m3dnowa                              [disabled]
  -m64                                  [enabled]
  -m80387                               [enabled]
  -m8bit-idiv                           [disabled]
  -m96bit-long-double                   [disabled]
  -mabi=                                sysv
  -mabm                                 [disabled]
  -maccumulate-outgoing-args            [disabled]
  -maddress-mode=                       long
  -madx                                 [disabled]
  -maes                                 [disabled]
  -malign-data=                         compat
  -malign-double                        [disabled]
  -malign-functions=                    0
  -malign-jumps=                        0
  -malign-loops=                        0
  -malign-stringops                     [enabled]
  -mamx-bf16                            [disabled]
  -mamx-int8                            [disabled]
  -mamx-tile                            [disabled]
  -mandroid                             [disabled]
  -march=                               sandybridge
  -masm=                                att
  -mavx                                 [disabled]
  -mavx2                                [disabled]
  -mavx256-split-unaligned-load         [enabled]
  -mavx256-split-unaligned-store        [enabled]
  -mavx5124fmaps                        [disabled]
  -mavx5124vnniw                        [disabled]
  -mavx512bf16                          [disabled]
  -mavx512bitalg                        [disabled]
  -mavx512bw                            [disabled]
  -mavx512cd                            [disabled]
  -mavx512dq                            [disabled]
  -mavx512er                            [disabled]
  -mavx512f                             [disabled]
  -mavx512ifma                          [disabled]
  -mavx512pf                            [disabled]
  -mavx512vbmi                          [disabled]
  -mavx512vbmi2                         [disabled]
  -mavx512vl                            [disabled]
  -mavx512vnni                          [disabled]
  -mavx512vp2intersect                  [disabled]
  -mavx512vpopcntdq                     [disabled]
  -mavxvnni                             [disabled]
  -mbionic                              [disabled]
  -mbmi                                 [disabled]
  -mbmi2                                [disabled]
  -mbranch-cost=<0,5>                   3
  -mcall-ms2sysv-xlogues                [disabled]
  -mcet-switch                          [disabled]
  -mcld                                 [disabled]
  -mcldemote                            [disabled]
  -mclflushopt                          [disabled]
  -mclwb                                [disabled]
  -mclzero                              [disabled]
  -mcmodel=                             [default]
  -mcpu=
  -mcrc32                               [enabled]
  -mcx16                                [enabled]
  -mdispatch-scheduler                  [disabled]
  -mdump-tune-features                  [disabled]
  -menqcmd                              [disabled]
  -mf16c                                [disabled]
  -mfancy-math-387                      [enabled]
  -mfentry                              [disabled]
  -mfentry-name=
  -mfentry-section=
  -mfma                                 [disabled]
  -mfma4                                [disabled]
  -mforce-drap                          [disabled]
  -mforce-indirect-call                 [disabled]
  -mfp-ret-in-387                       [enabled]
  -mfpmath=                             sse
  -mfsgsbase                            [disabled]
  -mfunction-return=                    keep
  -mfused-madd                          -ffp-contract=fast
  -mfxsr                                [enabled]
  -mgeneral-regs-only                   [disabled]
  -mgfni                                [disabled]
  -mglibc                               [enabled]
  -mhard-float                          [enabled]
  -mharden-sls=                         none
  -mhle                                 [disabled]
  -mhreset                              [disabled]
  -miamcu                               [disabled]
  -mieee-fp                             [enabled]
  -mincoming-stack-boundary=            0
  -mindirect-branch-cs-prefix           [disabled]
  -mindirect-branch-register            [disabled]
  -mindirect-branch=                    keep
  -minline-all-stringops                [disabled]
  -minline-stringops-dynamically        [disabled]
  -minstrument-return=                  none
  -mintel-syntax                        -masm=intel
  -mkl                                  [disabled]
  -mlarge-data-threshold=<number>       65536
  -mlong-double-128                     [disabled]
  -mlong-double-64                      [disabled]
  -mlong-double-80                      [enabled]
  -mlwp                                 [disabled]
  -mlzcnt                               [disabled]
  -mmanual-endbr                        [disabled]
  -mmemcpy-strategy=
  -mmemset-strategy=
  -mmitigate-rop                        [disabled]
  -mmmx                                 [enabled]
  -mmovbe                               [disabled]
  -mmovdir64b                           [disabled]
  -mmovdiri                             [disabled]
  -mmpx                                 [disabled]
  -mms-bitfields                        [disabled]
  -mmusl                                [disabled]
  -mmwait                               [enabled]
  -mmwaitx                              [disabled]
  -mneeded                              [disabled]
  -mno-align-stringops                  [disabled]
  -mno-default                          [disabled]
  -mno-fancy-math-387                   [disabled]
  -mno-push-args                        [disabled]
  -mno-red-zone                         [disabled]
  -mno-sse4                             [disabled]
  -mnop-mcount                          [disabled]
  -momit-leaf-frame-pointer             [disabled]
  -mpc32                                [disabled]
  -mpc64                                [disabled]
  -mpc80                                [disabled]
  -mpclmul                              [enabled]
  -mpcommit                             [disabled]
  -mpconfig                             [disabled]
  -mpku                                 [disabled]
  -mpopcnt                              [enabled]
  -mprefer-avx128                       -mprefer-vector-width=128
  -mprefer-vector-width=                none
  -mpreferred-stack-boundary=           0
  -mprefetchwt1                         [disabled]
  -mprfchw                              [disabled]
  -mptwrite                             [disabled]
  -mpush-args                           [enabled]
  -mrdpid                               [disabled]
  -mrdrnd                               [disabled]
  -mrdseed                              [disabled]
  -mrecip                               [disabled]
  -mrecip=
  -mrecord-mcount                       [disabled]
  -mrecord-return                       [disabled]
  -mred-zone                            [enabled]
  -mregparm=                            6
  -mrtd                                 [disabled]
  -mrtm                                 [disabled]
  -msahf                                [enabled]
  -mserialize                           [disabled]
  -msgx                                 [disabled]
  -msha                                 [disabled]
  -mshstk                               [disabled]
  -mskip-rax-setup                      [disabled]
  -msoft-float                          [disabled]
  -msse                                 [enabled]
  -msse2                                [enabled]
  -msse2avx                             [disabled]
  -msse3                                [enabled]
  -msse4                                [enabled]
  -msse4.1                              [enabled]
  -msse4.2                              [enabled]
  -msse4a                               [disabled]
  -msse5                                -mavx
  -msseregparm                          [disabled]
  -mssse3                               [enabled]
  -mstack-arg-probe                     [disabled]
  -mstack-protector-guard-offset=
  -mstack-protector-guard-reg=
  -mstack-protector-guard-symbol=
  -mstack-protector-guard=              tls
  -mstackrealign                        [disabled]
  -mstringop-strategy=                  [default]
  -mstv                                 [enabled]
  -mtbm                                 [disabled]
  -mtls-dialect=                        gnu
  -mtls-direct-seg-refs                 [enabled]
  -mtsxldtrk                            [disabled]
  -mtune-ctrl=
  -mtune=                               sandybridge
  -muclibc                              [disabled]
  -muintr                               [disabled]
  -mvaes                                [disabled]
  -mveclibabi=                          [default]
  -mvect8-ret-in-mem                    [disabled]
  -mvpclmulqdq                          [disabled]
  -mvzeroupper                          [enabled]
  -mwaitpkg                             [disabled]
  -mwbnoinvd                            [disabled]
  -mwidekl                              [disabled]
  -mx32                                 [disabled]
  -mxop                                 [disabled]
  -mxsave                               [enabled]
  -mxsavec                              [disabled]
  -mxsaveopt                            [enabled]
  -mxsaves                              [disabled]

  Known assembler dialects (for use with the -masm= option):
    att intel

  Known ABIs (for use with the -mabi= option):
    ms sysv

  Known code models (for use with the -mcmodel= option):
    32 kernel large medium small

  Valid arguments to -mfpmath=:
    387 387+sse 387,sse both sse sse+387 sse,387

  Known choices for mitigation against straight line speculation with -mharden-sls=:
    all indirect-jmp none return

  Known indirect branch choices (for use with the -mindirect-branch=/-mfunction-return= options):
    keep thunk thunk-extern thunk-inline

  Known choices for return instrumentation with -minstrument-return=:
    call none nop5

  Known data alignment choices (for use with the -malign-data= option):
    abi cacheline compat

  Known vectorization library ABIs (for use with the -mveclibabi= option):
    acml svml

  Known address mode (for use with the -maddress-mode= option):
    long short

  Known preferred register vector length (to use with the -mprefer-vector-width= option):
    128 256 512 none

  Known stack protector guard (for use with the -mstack-protector-guard= option):
    global tls

  Valid arguments to -mstringop-strategy=:
    byte_loop libcall loop rep_4byte rep_8byte rep_byte unrolled_loop vector_loop

  Known TLS dialects (for use with the -mtls-dialect= option):
    gnu gnu2

  Known valid arguments for -march= option:
    i386 i486 i586 pentium lakemont pentium-mmx winchip-c6 winchip2 c3 samuel-2 c3-2 nehemiah c7 esther i686 pentiumpro pentium2 pentium3 pentium3m pentium-m pentium4 pentium4m prescott nocona core2 nehalem corei7 westmere sandybridge corei7-avx ivybridge core-avx-i haswell core-avx2 broadwell skylake skylake-avx512 cannonlake icelake-client rocketlake icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake bonnell atom silvermont slm goldmont goldmont-plus tremont knl knm intel geode k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp x86-64 x86-64-v2 x86-64-v3 x86-64-v4 eden-x2 nano nano-1000 nano-2000 nano-3000 nano-x2 eden-x4 nano-x4 k8 k8-sse3 opteron opteron-sse3 athlon64 athlon64-sse3 athlon-fx amdfam10 barcelona bdver1 bdver2 bdver3 bdver4 znver1 znver2 znver3 btver1 btver2 generic native

  Known valid arguments for -mtune= option:
    generic i386 i486 pentium lakemont pentiumpro pentium4 nocona core2 nehalem sandybridge haswell bonnell silvermont goldmont goldmont-plus tremont knl knm skylake skylake-avx512 cannonlake icelake-client icelake-server cascadelake tigerlake cooperlake sapphirerapids alderlake rocketlake intel geode k6 athlon k8 amdfam10 bdver1 bdver2 bdver3 bdver4 btver1 btver2 znver1 znver2 znver3

Add python3 support

In my testing, this tool seems to run fine under python3 (just tested on python3.6)

Unless there are known python3 problems, would you be able to update your pypi entry to show python3 support?

Thanks

Clang support?

Clang equivalent is:

echo | clang -E - -march=native '-###'

https://stackoverflow.com/questions/35357659/what-flags-does-march-native-activate-with-clang

All arguments are quoted and are not neatly connected like GCC. -target-feature takes an argument with a - or + prefix to disable/enable a feature.

Example output on macOS (lines split):

clang version 11.1.0
Target: x86_64-apple-darwin21.1.0
Thread model: posix
InstalledDir: /opt/local/libexec/llvm-11/bin
 (in-process)
 "/opt/local/libexec/llvm-11/bin/clang" "-cc1" "-triple" "x86_64-apple-macosx12.0.0" "-Wundef-prefix=TARGET_OS_"
"-Werror=undef-prefix" "-Wdeprecated-objc-isa-usage" "-Werror=deprecated-objc-isa-usage" "-E" "-disable-free"
"-disable-llvm-verifier" "-discard-value-names" "-main-file-name" "-" "-mrelocation-model" "pic" "-pic-level" "2"
"-mframe-pointer=all" "-fno-rounding-math" "-munwind-tables" "-target-sdk-version=12.0"
"-fcompatibility-qualified-id-block-type-checking" "-target-cpu" "skylake" "-target-feature" "+sse2"
"-target-feature" "-tsxldtrk" "-target-feature" "+cx16" "-target-feature" "+sahf" "-target-feature" "-tbm"
"-target-feature" "-avx512ifma" "-target-feature" "-sha" "-target-feature" "-gfni" "-target-feature" "-fma4"
"-target-feature" "-vpclmulqdq" "-target-feature" "+prfchw" "-target-feature" "+bmi2" "-target-feature" "-cldemote"
"-target-feature" "+fsgsbase" "-target-feature" "-ptwrite" "-target-feature" "-amx-tile" "-target-feature" "-avx512bf16"
"-target-feature" "+popcnt" "-target-feature" "+aes" "-target-feature" "-avx512bitalg" "-target-feature" "-movdiri"
"-target-feature" "+xsaves" "-target-feature" "-avx512er" "-target-feature" "+xsavec" "-target-feature" "-avx512vnni"
"-target-feature" "-amx-bf16" "-target-feature" "-avx512vpopcntdq" "-target-feature" "-pconfig"
"-target-feature" "-clwb" "-target-feature" "-avx512f" "-target-feature" "-clzero" "-target-feature" "-pku"
"-target-feature" "+mmx" "-target-feature" "-lwp" "-target-feature" "-rdpid" "-target-feature" "-xop"
"-target-feature" "+rdseed" "-target-feature" "-waitpkg" "-target-feature" "-movdir64b"
"-target-feature" "-sse4a" "-target-feature" "-avx512bw" "-target-feature" "+clflushopt"
"-target-feature" "+xsave" "-target-feature" "-avx512vbmi2" "-target-feature" "+64bit" "-target-feature" "-avx512vl"
"-target-feature" "-serialize" "-target-feature" "+invpcid" "-target-feature" "-avx512cd" "-target-feature" "+avx"
"-target-feature" "-vaes" "-target-feature" "+cx8" "-target-feature" "+fma" "-target-feature" "+rtm"
"-target-feature" "+bmi" "-target-feature" "-enqcmd" "-target-feature" "+rdrnd" "-target-feature" "-mwaitx"
"-target-feature" "+sse4.1" "-target-feature" "+sse4.2" "-target-feature" "+avx2" "-target-feature" "+fxsr"
"-target-feature" "-wbnoinvd" "-target-feature" "+sse" "-target-feature" "+lzcnt" "-target-feature" "+pclmul"
"-target-feature" "-prefetchwt1" "-target-feature" "+f16c" "-target-feature" "+ssse3" "-target-feature" "+sgx"
"-target-feature" "-shstk" "-target-feature" "+cmov" "-target-feature" "-avx512vbmi"
"-target-feature" "-amx-int8" "-target-feature" "+movbe" "-target-feature" "-avx512vp2intersect"
"-target-feature" "+xsaveopt" "-target-feature" "-avx512dq" "-target-feature" "+adx" "-target-feature" "-avx512pf"
"-target-feature" "+sse3" "-debugger-tuning=lldb" "-target-linker-version" "711" "-resource-dir" "/opt/local/libexec/llvm-11/lib/clang/11.1.0"
"-isysroot" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" "-I/usr/local/include"
"-internal-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
"-internal-isystem" "/opt/local/libexec/llvm-11/lib/clang/11.1.0/include"
"-internal-externc-isystem" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include"
"-fdebug-compilation-dir" "/var/folders/qv/gnhwyzzx2wqfxq9mm_c4pb3r0000gn/T/tmp.jO4zMCA32q"
"-ferror-limit" "19" "-stack-protector" "1" "-fblocks" "-fencode-extended-block-signature"
"-fregister-global-dtors-with-atexit" "-fgnuc-version=4.2.1" "-fmax-type-align=16" "-o" "-" "-x" "c" "-"

gcc: error: unrecognized command-line option ‘-mno-branch-cost=2’; did you mean ‘-mbranch-cost=’?

resolve-march-native 
-march=pentium-m -mtune=generic -mbranch-cost=3 -mno-accumulate-outgoing-args -mno-branch-cost=2 -mno-sahf --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=1024

then you take this flags and try to use it:

gcc -Q -march=pentium-m -mtune=generic -mbranch-cost=3 -mno-accumulate-outgoing-args -mno-branch-cost=2 -mno-sahf --param=l1-cache-line-size=64 --param=l1-cache-size=32 --param=l2-cache-size=1024 --help=target 
gcc: error: unrecognized command-line option ‘-mno-branch-cost=2’; did you mean ‘-mbranch-cost=’?

Sorry if this ticket is too vague, I will try to increase the information if you require me to do so.

Thanks :)

Raspberry Pi support?

On a Raspberry Pi 4B running Gentoo Linux:

pizero2 /home/jlpoole # date; uname -a
Wed Oct 18 04:36:37 PM PDT 2023
Linux pizero2 5.15.61-v8-

pizero2 /home/jlpoole #
pizero2 /home/jlpoole # resolve-march-native --version
resolve-march-native 2.2.0
pizero2 /home/jlpoole # resolve-march-native --debug
# gcc -S -fverbose-asm -o /tmp/tmpq6vnkz_q/march_native.s /tmp/tmpq6vnkz_q/empty.c -march=native
Flags extracted: -mabi=lp64 -mcpu=cortex-a72+crc -mlittle-endian
Flags extracted: -mabi=lp64 -march= -mbranch-protection= -mcmodel=small -mcpu=cortex-a72+crc -mfix-cortex-a53-835769 -mfix-cortex-a53-843419 -mglibc -mharden-sls= -mlittle-endian -momit-leaf-frame-pointer -moutline-atomics -moverride= -mpc-relative-literal-loads -msign-return-address=none -mstack-protector-guard-offset= -mstack-protector-guard-reg= -mstack-protector-guard=global -msve-vector-bits=scalable -mtls-dialect=desc -mtls-size=24 -mtune=
# gcc -S -fverbose-asm -o /tmp/tmpt_64q6jq/march_native.s /tmp/tmpt_64q6jq/empty.c -march=
gcc: error: missing argument to '-march='
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/resolve_march_native/__main__.py", line 50, in _inner_main
    options.gcc, options.debug).run(options)
                                ^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 122, in run
    march_explicit_flag_set = self._get_march_explicit_flag_set(
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/engine.py", line 68, in _get_march_explicit_flag_set
    run(self._gcc_command, [self._get_march_explicit(arch)], self._debug)))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/resolve_march_native/runner.py", line 44, in run
    subprocess.check_output(cmd, env=env)
  File "/usr/lib/python3.11/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpt_64q6jq/march_native.s', '/tmp/tmpt_64q6jq/empty.c', '-march=']' returned non-zero exit status 1.
ERROR: Command '['gcc', '-S', '-fverbose-asm', '-o', '/tmp/tmpt_64q6jq/march_native.s', '/tmp/tmpt_64q6jq/empty.c', '-march=']' returned non-zero exit status 1.
pizero2 /home/jlpoole #  eix resolve-march-native -I
[I] app-misc/resolve-march-native
     Available versions:  (~)1.0.0-r1^t (~)2.1.0^t (~)2.1.0-r1^t (~)2.2.0^t{gpkg} {test PYTHON_TARGETS="python3_10 python3_11"}
     Installed versions:  2.2.0^t{gpkg}(08:19:32 AM 10/18/2023)(-test PYTHON_TARGETS="python3_11 -python3_10")
     Homepage:            https://github.com/hartwork/resolve-march-native
     Description:         Resolve GCC flag -march=native

pizero2 /home/jlpoole # 

I saved the following:
script of emerge session as resolve-march-native_20231918_0815.script.txt
[resolve-march-native_20231918_0815.script.txt](https://github.com/hartwork/resolve-march-native/files/13035021/resolve-march-native_20231918_0815.sc
environment file:
environment.txt
ript.txt)
build.log.gz as
build.log.gz

Drop unnecessary flags

Is there any way to drop unnecessary flags that are implicitly set by -march anyway?

resolve-march-native --keep-identical-mtune --keep-default-params -a
-march=tigerlake -mabm -madx -maes -mavx -mavx2 -mavx512bitalg -mavx512bw -mavx512cd -mavx512dq -mavx512f -mavx512ifma -mavx512vbmi -mavx512vbmi2 -mavx512vl -mavx512vnni -mavx512vp2intersect -mavx512vpopcntdq -mbmi -mbmi2 -mclflushopt -mclwb -mcx16 -mf16c -mfma -mfsgsbase -mfxsr -mgfni -mlzcnt -mmmx -mmovbe -mmovdir64b -mmovdiri -mpclmul -mpku -mpopcnt -mprfchw -mrdpid -mrdrnd -mrdseed -msahf -msha -mshstk -msse -msse2 -msse3 -msse4.1 -msse4.2 -mssse3 -mtune=tigerlake -mvaes -mvpclmulqdq -mxsave -mxsavec -mxsaveopt -mxsaves --param=l1-cache-line-size=64 --param=l1-cache-size=48 --param=l2-cache-size=24576 -O2 -pipe

Are some of those options not already set implicity?

Background

I need this tool to determine the explicit flags behind -march=native in order to pass them via distcc to remote servers that can't detect them.
Before I used different approaches like

# gcc -v -E -x c -march=native -mtune=native - < /dev/null 2>&1 | grep cc1 | perl -pe 's/^.* - //g;'
# gcc -### -march=native -x c -

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.