So I was wondering if one could do something as follows: instead of compiling the code with QxHost on the machine it is to be run, get some sort of "instructions" that could be executed on another system (using visual studio, perhaps) to build for that particular system. On GCC I believe the march=native flags can be viewed and used to do such a compilation---is something similar possible on ICL or ICC?
- Development Tools
- Intel® C++ Compiler
- Intel® Parallel Studio XE
- Intel® System Studio
- Parallel Computing
Does specifying a specific CPU option equate to setting -xHost/QxHost? (Q)xHost might have more/different flags set, right? At least that's how it is for -march=native flags vs march=<cpu> on GCC.
A typical build method is to choose an architecture option suitable for all the CPUs you support. This isn't conducive to an automatic choice by the compiler. Together with a /Qimf option to choose a single architecture math library path, this would enable QA to be run on a single platform, rather than on the range of platforms you support. If you call MKL, you would also use one of their reproducibilty options for such QA purpose.
Your question about internal flags isn't clear, but I will expound on what it brings to mind:
/QxHost (by itself) is similar to -march=native. The compiler picks an architecture option suitable for the CPU present during compilation. If you used the oldest CPU you support as a build machine, you would avoid trouble with this option. With options such as /QaxHost /arch:SSE3 it will generate 2 execution paths (one suitable for the CPU of compilation, and one suitable for SSE. If the compiler sees SSE3 as satisfactory for the compilation CPU, it should generate just the one path.
An internal flag is set at run time according to the CPU of execution. You could find out which of your options is chosen by the manual dispatch scheme. With /Qax, this flag is checked at run time to select among the multiple code paths.
You can select among code paths at compile time from /QxHost or -march=native by the use of the pre-defined pre-processor flags e.g.
code for AVX or newer CPU
code for non-AVX CPU
Then just one path will be built, according to the CPU of compilation.
That will not control the choice of math library paths, as the /Qimf options would (by calling separately built library functions). There is likely to be a separate run-time architecture flag set for math library calls from the one used by /Qax generated code.
Just a note -- by internal flags I'm referring to the flags asked for by the question here: https://stackoverflow.com/questions/5470257/how-to-see-which-flags-march-native-will-activate
Something I found to be fairly interesting is that you can see the flags activated by noting the `mcpcom` command executed with `-watch=all`. However I have no idea of how those flags could be transferrable/utilized in any degree
Another thing I found rather peculiar is that `-march=native` works for icc/icpc...but it surprisingly generates different `mcpcom` command flags (at least from what I can tell based on the output of `-watch=all`). I can't tell if it's also adding redundant flags or not, as -march=native certainly generates more flags. It also seems to detect a different cpu (I think, for icc at least) -- namely, I get a pentium4 macro defined under -xHost and a pentiumpro macro defined under -march=native