[Beowulf] Detecting binaries that are limited to an architecture?

Christopher Samuel samuel at unimelb.edu.au
Thu May 5 21:25:36 PDT 2016


Hi Paul!

On 06/05/16 11:53, Paul McIntosh wrote:

> So I am guessing that things like freetype are built to support multiple
> architectures and contain opcodes that never get hit.

This is probably quite likely, so I'm afraid I suspect you'll run into
a sort of halting problem with this where the only way to know whether
it will work will be to run it.

Certainly Intel compilers seem to incorporate code to detect whether
the current architecture matches what it was compiled for.  For example
compiling on Haswell with -xHOST and running on Nehalem provokes:

[samuel at merri-m cpu]$ ./cpu

Please verify that both the operating system and the processor support Intel(R) MOVBE, F16C, AVX, FMA, BMI, LZCNT and AVX2 instructions.

Intel explains it thus:

https://software.intel.com/en-us/articles/how-to-detect-new-instruction-support-in-the-4th-generation-intel-core-processor-family

# In order to correctly use the new instructions and avoid
# runtime crashes, applications must properly detect hardware
# support for the new instructions using CPUID checks. It is
# important to understand that a new instruction is supported
# on a particular processor only if the corresponding CPUID
# feature flag is set. Applications must not assume support
# of any instruction set extension simply based on, for example,
# checking a CPU model or family and must instead always check
# for _all_ the feature CPUID bits of the instructions being
# used.
[...]
# Below is the complete list of CPUID flags that generally must
# be checked:
#
# CPUID.(EAX=01H, ECX=0H):ECX.FMA[bit 12]==1 &&
# CPUID.(EAX=07H, ECX=0H):EBX.AVX2[bit 5]==1 &&
# CPUID.(EAX=07H, ECX=0H):EBX.BMI1[bit 3]==1 &&
# CPUID.(EAX=07H, ECX=0H):EBX.BMI2[bit 8]==1 &&
# CPUID.(EAX=80000001H):ECX.LZCNT[bit 5]==1 &&
# CPUID.(EAX=01H, ECX=0H):ECX.MOVBE[bit 22]==1

That'll be just half the problem though, it tells you what
the architecture provides but not what the program requires. :-(

I suspect the simplest way to do that might be to have a
Slurm partition per hardware architecture and then (based
on the module loaded) set the SBATCH_PARTITION variable to
direct things appropriately (be nicer to use the Slurm
constraint mechanism but that doesn't appear to be available
via environment variables).

That may solve the issue for things you've built, but I don't
see a solution for user code other than education. :-/

Best of luck!
Chris
-- 
 Christopher Samuel        Senior Systems Administrator
 VLSCI - Victorian Life Sciences Computation Initiative
 Email: samuel at unimelb.edu.au Phone: +61 (0)3 903 55545
 http://www.vlsci.org.au/      http://twitter.com/vlsci



More information about the Beowulf mailing list