I have some program, a daemon with multiple threads written in c++. I want to build it (using g++) on my development machine with some optimization for production servers. To optimize for local machine I can use -march=native
, but what about optimization for production servers? I have ssh
access to servers, but I have no right to upload whole program code there. Is there any command effectively gives me optimization flags for remote machine as I build there with -march=native
?
Asked
Active
Viewed 38 times
0

user2807083
- 2,962
- 4
- 29
- 37
-
Specify the processor used on the target system? It's actually not unlikely that it will be the same as you have in your own system (unless you're cross-compiling to another architecture). Most of the time you won't need to specify target architecture anyway. – Some programmer dude Aug 25 '16 at 09:27
-
Generally you *don't* add any target-specific flags. Instead you use just plain `-O2` and let the compiler handle all target-specific optimizations. If more is needed then *try* with `-O3`, and if it doesn't work well then go back to `-O2` and experiment with other optimization flags (but still not use any target specific flags, because your host and target is actually the same!). – Some programmer dude Aug 25 '16 at 09:47