0

I would like to optimize the binary for a remote machine. On the local machine I can just pass the

g++ -mtune=native

flag and (in the ideal case) the compiler selects the available instruction sets.

How can we do this for the remote machine? The ideal case would be to pass the remote machine's

/proc/cpuinfo

to gcc. Is there a way of doing this automatically?

user1396055
  • 295
  • 1
  • 12
  • 2
    If it's possible to run gcc on the remote machine for a quick test there are a couple of usable techniques here: https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate – fvu Jun 05 '18 at 09:38
  • Is cross-compiling an option? You may build (on the local) a binary as optimised as you wish, and pass it to the remote machine. – Jose Jun 05 '18 at 10:19
  • My problem is with the "as you wish" part. Because I do not know which optimization flags are valid. If I enable an unsupported instruction set, then the remote machine will abort with illegal instruction. I do not want to go instruction set by instruction set the pass dozens of flags manually. – user1396055 Jun 05 '18 at 10:35

0 Answers0