mplapack icon indicating copy to clipboard operation
mplapack copied to clipboard

how do I add a -march=generic flag to build?

Open MacroUniverse opened this issue 2 years ago • 7 comments

Hi, I tried to build on 22.04 with my laptop with x86_64 11th generation intel cpu, but the library won't work on older machiens (Illegal Instruction error). After some research, I found that I need to add -march=x86-64 to the compiler options (is this correct?) I'm wondering how do I do that for MPLAPACK?

MacroUniverse avatar Jan 16 '23 15:01 MacroUniverse

I've tried to add ARG CFLAGS=-march=x86-64 and ARG CXXFLAGS=-march=x86-64 and ARG FFLAGS=-march=x86-64, but it seems that not all the rules are using these.

MacroUniverse avatar Jan 16 '23 20:01 MacroUniverse

You're right. Unfortunately, you have to patch by hand. see l.833-l.851 of https://github.com/nakatamaho/mplapack/blob/master/configure.ac . You may remove "-xHost" and "-march=native" from configure file (not configure.ac). However, I don't know if the binaries still work on other platforms. Since GMP also detects CPU architecture and sets appropriate flags independent from MPLAPACK configure.

nakatamaho avatar Jan 16 '23 23:01 nakatamaho

BTW: on which architecture do you want to install MPLAPACK?

nakatamaho avatar Jan 16 '23 23:01 nakatamaho

BTW: on which architecture do you want to install MPLAPACK?

I just hope that it will work on all x86-64 systems. Do you think I can just compile it on a really old machine and it will work on all the newer machines?

MacroUniverse avatar Jan 17 '23 02:01 MacroUniverse

This is a difficult question. It would be greatly appreciated if you could provide me with a report.

nakatamaho avatar Jan 17 '23 07:01 nakatamaho

Hi, I just compiled with Intel Celeron-1007U for Ubuntu18.04, then statically linked to my program. And it works on all of the servers with Intel Xeon (the oldest one purchased on 2010).

MacroUniverse avatar Jan 17 '23 21:01 MacroUniverse

Great and appreciated!

nakatamaho avatar Jan 17 '23 23:01 nakatamaho