Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.

Building "/QxHost" for a different system (i.e. on a different host)?

Yang__Richard
Beginner
453 Views

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?

0 Kudos
5 Replies
Viet_H_Intel
Moderator
453 Views

Have you looked into /Qax<code> option?

0 Kudos
Yang__Richard
Beginner
453 Views

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.

0 Kudos
Yang__Richard
Beginner
453 Views

And from what I can tell, Intel doesn't provide a way of getting the internal flags set for xHost (right?)

0 Kudos
TimP
Honored Contributor III
453 Views

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.

#if AVX

code for AVX or newer CPU

#else

code for non-AVX CPU

#endif

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.

0 Kudos
Yang__Richard
Beginner
453 Views

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

0 Kudos
Reply