vermaseren / form

The FORM project for symbolic manipulation of very big expressions
GNU General Public License v3.0
982 stars 118 forks source link

A question regarding --disable-native #457

Closed vsht closed 10 months ago

vsht commented 10 months ago

Dear developers,

while doing some tests on cluster machines, I noticed that a FORM binary that was compiled on a Kaby Lake machine (i5-7500 with avx and avx2) using the --disable-native flag will not run on Xeon-X5650-nodes that feature just cpu_intel but no avx/avx2 instructions. To be more precise, in this case I'm getting the usual illegal instruction error message.

The obvious workaround is to compile FORM on the Xeon node so that no avx/avx2 instructions are activated and then use the binary on all other nodes. This works without any issues.

This might be a misunderstanding on my side, but somehow I thought that compiling with --disable-native should protect me from such issues by using only the bare minimum of instructions available on the build machine. However, this doesn't seem to be the case. So perhaps someone could comment on this problematics.

Cheers, Vlad

vsht commented 10 months ago

In fact that it seems that --disable-native works as expected in conjecture with --enable-static-link so perhaps I just got the meaning of the flag wrong.

However, using --disable-native without --enable-static-link seems to lead to the issues I mentioned originally.

tueda commented 10 months ago

What --enable-native does is basically just adding the -march=native option to the compiler options (if available): https://github.com/vermaseren/form/blob/8a37a42d449f19ad152783ca687d16b1a5864e36/configure.ac#L831-L845 When --disable-native is used, nothing is added to the options.

Probably in your build (https://github.com/vermaseren/form/issues/456#issuecomment-1674887019) GMP is not universal, and without --enable-static-link the non-universal GMP may be dynamically linked (depending on LD_LIBRARY_PATH etc.). You can check which dynamic-link libraries are being used by:

ldd /path/to/form
vsht commented 10 months ago

Understood, many thanks for the kind explanation.