Search code examples
tensorflowipu

Running a Tensorflow program on an IPU Model throws an "Illegal instruction (core dumped)" error


I’m trying to run a TensorFlow2 example from the Graphcore public examples (MNIST). I’m using the IPU model instead of IPU hardware because my machine doesn’t have access to IPU hardware, so I’ve followed the documentation (Running on the IPU Model simulator) and added the following to my model:

# Using IPU model instead of IPU hardware 

if self.base_dictionary['ipu_model']: 

    os.environ['TF_POPLAR_FLAGS'] = '--use_ipu_model' 

When I run the model, it fails with: Illegal instruction (core dumped). I don’t see where this comes from as I used an existing example. What is this error and how do I solve it?


Solution

  • Illegal instruction means that your program is generating instructions that your CPU can’t handle. The Graphcore TensorFlow wheel is compiled for Skylake class CPUs with the AVX-512 instruction set available, so processors that do not fit the requirements (i.e. a Skylake class CPU with AVX-512 capabilities) will not be able to run Graphcore Tensorflow code. (You can see the requirements in the “Requirements” section of the SDK Overview documentation here).

    To see if your processors have AVX-512 capabilities, run cat /proc/cpuinfo and look at the flags field of any of the processors - they should all have the same flags. Here If you don’t see avx512f, your processors don’t fit the Graphcore requirements for running Tensorflow code. Here is an example of what the cat command returns on a machine that fits the requirements (result truncated to one processor):

    processor       : 95 
    
    vendor_id       : GenuineIntel 
    
    cpu family      : 6 
    
    model           : 85 
    
    model name      : Intel(R) Xeon(R) Platinum 8168 CPU @ 2.70GHz 
    
    stepping        : 4 
    
    microcode       : 0x2000064 
    
    cpu MHz         : 1200.703 
    
    cache size      : 33792 KB 
    
    physical id     : 1 
    
    siblings        : 48 
    
    core id         : 27 
    
    cpu cores       : 24 
    
    apicid          : 119 
    
    initial apicid  : 119 
    
    fpu             : yes 
    
    fpu_exception   : yes 
    
    cpuid level     : 22 
    
    wp              : yes 
    
    flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid dca sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb cat_l3 cdp_l3 invpcid_single pti intel_ppin ssbd mba ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm cqm mpx rdt_a avx512f avx512dq rdseed adx smap clflushopt clwb intel_pt avx512cd avx512bw avx512vl xsaveopt xsavec xgetbv1 xsaves cqm_llc cqm_occup_llc cqm_mbm_total cqm_mbm_local dtherm ida arat pln pts pku ospke md_clear flush_l1d 
    
    bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs taa itlb_multihit 
    
    bogomips        : 5401.49 
    
    clflush size    : 64 
    
    cache_alignment : 64 
    
    address sizes   : 46 bits physical, 48 bits virtual 
    
    power management: 
    
    

    Machines provided by Graphcore or their partners will always fit these requirements, so it’s best to use them. They’ll also have enough cores and memory, which might not be the case on e.g. a personal laptop.