HPMC User Guide v 1.00
© 2026 Bassem W. Jamaleddine


2-4

   Performance Programming for MIC


The performance of the MIC is dictated by the number of physical cores, the clock frequency, the number of VPUs (vector processing units) per core, and the vector width (instructions per cycle). Such performance is measured in GFLOPS, where the FLOPs is a measurement dictated by the VPUs, with each core containing one 512-bit VPU (supporting Fused Multiply-Add or FMA instructions), resulting in FLOPs per cycle per core. As for the G in GFLOPS is a linear multiplier for the number of cores multiplied by the clock frequency. In summary, one can use the the equation GFLOPS = number of cores x clock frequency in GHz x FLOPs per cycle per core to measure the performance of the MIC.

In this section, first, we will take a look at the MIC cores from the uos kernel perspective, then we will derive its performance practically by executing some benchmarking programs.

The /sys/devices/system/cpu directory contains details about how the MIC many cores in the system are incrementally mapped and managed by the uos Linux kernel. The 61 physical cores of the MIC represents 244 threads each of which is represented in its own directory relative to /sys/devices/system/cpu/. The 244 threads are represented as 244 CPUs.

Since all cores are identical, we can select the 43rd CPU to print its frequency in /sys/devices/system/cpu/cpu43/cpufreq/.

(uos/HPMC) 19:45 root@mic0: /tmp #  ls -1 /sys/devices/system/cpu/cpu43/cpufreq/cpuinfo*freq

/sys/devices/system/cpu/cpu43/cpufreq/cpuinfo_cur_freq
/sys/devices/system/cpu/cpu43/cpufreq/cpuinfo_max_freq
/sys/devices/system/cpu/cpu43/cpufreq/cpuinfo_min_freq
This section is not included in the SAMPLE PREVIEW.
Let's display the interrupts used by each core. We use the dint (display-interrupts) that is explained in the appendices of this guide.

(uos/HPMC) 19:45 root@mic0: /tmp #  dint -info

(HPMC) 19:45 root@mic0: /tmp #  dint -info
  CPU COUNT 244

  INTERRUPTS MNEMONICS: 4 5 6 7 13 17 26 27 28 30 NMI LOC SPU PMI IWI RES CAL TLB TRM THR MCE MCP

     4    IO-APIC-edge      dma channel
     5    IO-APIC-edge      dma channel
     6    IO-APIC-edge      dma channel
     7    IO-APIC-edge      dma channel
    13    IO-APIC-edge      TMU
    17    IO-APIC-edge      SCIF INTR 0
    26    SBOX-ICR-edge      vnet intr
    27    SBOX-ICR-edge      Shutdown
    28    SBOX-ICR-edge      hvc intr
    30    SBOX-ICR-edge      PC35_Wakeup
   NMI    Non-maskable interrupts
   LOC    Local timer interrupts
   SPU    Spurious interrupts
   PMI    Performance monitoring interrupts
   IWI    IRQ work interrupts
   RES    Rescheduling interrupts
   CAL    Function call interrupts
   TLB    TLB shootdowns
   TRM    Thermal event interrupts
   THR    Threshold APIC interrupts
   MCE    Machine check exceptions
   MCP    Machine check polls

  THE CACHEDIR IS /tmp/cached_sysints
The first column represents the short name of the interrupts, and the second column represents their descriptions.

■ Measuring Practical Gigaflops to the MIC Specification Gigaflops


The program mic-gigaflops.cpp measures performance of the MIC for double precision (DP) floating numbers and single precision (SP) floating numbers. The fused-muliply-add operations are done on arrays of data initialized on the MIC.

 -LIS- Listing. 2.4.1   [Program to Measure Performace of the MIC in Gigaflops]
(raw text)
1.     // measure Intel Xeon Phi MIC performance in Gigaflops
2.     
3.     #include <stdio.h>
4.     #include <stdlib.h>
5.     #include <omp.h>
6.     
7.     unsigned int const SIZEd=16;
8.     unsigned int const SIZEf=32;
9.     unsigned int const ITER=50000000;
10.    
11.    extern double elapsedTime(void);
12.    
13.    int main() {
14.        double startTime1, duration1;
15.        double startTime2, duration2;
16.        int i;
17.    
18.        __declspec(aligned(64)) float Af[SIZEf],Bf[SIZEf],Cf[SIZEf];
19.        // initialize floats arrays
20.        for (i=0;i<SIZEf;i++) {
21.            Cf[i]=Bf[i]=Af[i] = (float)rand();
22.        }
23.        // warm up cache
24.        #pragma omp parallel for
25.        for(i=0;i<ITER;i++) {
26.            #pragma vector aligned(Af,Bf,Cf)
27.            Af[0:SIZEf]=Bf[0:SIZEf]*Cf[0:SIZEf]+Af[0:SIZEf];
28.        }
29.        startTime1 = elapsedTime();
30.        // parallel fused operations on floats 
31.        #pragma omp parallel for
32.        for(i=0;i<ITER;i++) {
33.            #pragma vector aligned(Af,Bf,Cf)
34.            Af[0:SIZEf]=Bf[0:SIZEf]*Cf[0:SIZEf]+Af[0:SIZEf];
35.        }
36.        duration1 = elapsedTime() - startTime1;
37.    
38.        __declspec(aligned(64)) double Ad[SIZEd],Bd[SIZEd],Cd[SIZEd];
39.        // initialize double arrays 
40.        for (i=0;i<SIZEd;i++) {
41.            Cd[i]=Bd[i]=Ad[i] = (double)rand();
42.        }
43.        // warm up cache in parallel 
44.        #pragma omp parallel for
45.        for(i=0;i<ITER;i++) {
46.            #pragma vector aligned(Ad,Bd,Cd)
47.            Ad[0:SIZEd]=Bd[0:SIZEd]*Cd[0:SIZEd]+Ad[0:SIZEd];
48.        }
49.        startTime2 = elapsedTime();
50.        // parallel fused operations on doubles 
51.        #pragma omp parallel for
52.        for(i=0;i<ITER;i++) {
53.            #pragma vector aligned(Ad,Bd,Cd)
54.            Ad[0:SIZEd]=Bd[0:SIZEd]*Cd[0:SIZEd]+Ad[0:SIZEd];
55.        }
56.        duration2 = elapsedTime() - startTime2;
57.    
58.        double Gflop1 = 2*SIZEf*ITER/1e+9;
59.        double Gflops1 = (2*SIZEf*ITER/1e+9)/duration1;
60.    
61.        double Gflop2 = 2*SIZEd*ITER/1e+9;
62.        double Gflops2 = (2*SIZEd*ITER/1e+9)/duration2;
63.    
64.        printf("Running %d openmp threads \n", omp_get_max_threads());
65.        printf("SP floats %g gigaflops in  %g elapsed seconds\n", Gflop1, 
      duration1); 
66.        printf("DP floats %g gigaflops in  %g elapsed seconds\n", Gflop2, 
      duration2); 
67.        printf("SP GFlops = %f\n", Gflops1);
68.        printf("DP GFlops = %f\n", Gflops2);
69.        return 0;
70.    }
71.    

HPMC 2026
This section is not included in the SAMPLE PREVIEW.
Running the loop script on the mic0. Notice that the double precision achieved close to the 1000 GFlops, and the single precision (SP) achieved close to 2000 GFlops.

(uos/HPMC) 07:20 root@mic0: /tmp #  perl loop

(HPMC) 07:20 root@mic0: /tmp #  perl loop
Running 24 openmp threads 
SP floats 3.2 gigaflops in  0.00776601 elapsed seconds
DP floats 1.6 gigaflops in  0.00777102 elapsed seconds
SP GFlops = 412.052092
DP GFlops = 205.893306
Running 44 openmp threads 
SP floats 3.2 gigaflops in  0.00405216 elapsed seconds
DP floats 1.6 gigaflops in  0.00443697 elapsed seconds
SP GFlops = 789.701859
DP GFlops = 360.606470
Running 64 openmp threads 
SP floats 3.2 gigaflops in  0.00313306 elapsed seconds
DP floats 1.6 gigaflops in  0.00345397 elapsed seconds
SP GFlops = 1021.366167
DP GFlops = 463.235066
Running 84 openmp threads 
SP floats 3.2 gigaflops in  0.00238299 elapsed seconds
DP floats 1.6 gigaflops in  0.00238299 elapsed seconds
SP GFlops = 1342.848704
DP GFlops = 671.424352
Running 104 openmp threads 
SP floats 3.2 gigaflops in  0.00191712 elapsed seconds
DP floats 1.6 gigaflops in  0.00193191 elapsed seconds
SP GFlops = 1669.167119
DP GFlops = 828.197754
Running 124 openmp threads 
SP floats 3.2 gigaflops in  0.00198984 elapsed seconds
DP floats 1.6 gigaflops in  0.00198102 elapsed seconds
SP GFlops = 1608.168320
DP GFlops = 807.664749
Running 144 openmp threads 
SP floats 3.2 gigaflops in  0.00172806 elapsed seconds
DP floats 1.6 gigaflops in  0.00195122 elapsed seconds
SP GFlops = 1851.789845
DP GFlops = 820.000782
Running 164 openmp threads 
SP floats 3.2 gigaflops in  0.00171995 elapsed seconds
DP floats 1.6 gigaflops in  0.00152993 elapsed seconds
SP GFlops = 1860.517438
DP GFlops = 1045.798099
Running 184 openmp threads 
SP floats 3.2 gigaflops in  0.0017941 elapsed seconds
DP floats 1.6 gigaflops in  0.0017879 elapsed seconds
SP GFlops = 1783.624292
DP GFlops = 894.904174
Running 204 openmp threads 
SP floats 3.2 gigaflops in  0.00163198 elapsed seconds
DP floats 1.6 gigaflops in  0.00197506 elapsed seconds
SP GFlops = 1960.814142
DP GFlops = 810.102173
Running 224 openmp threads              
SP floats 3.2 gigaflops in  0.00149202 elapsed seconds
DP floats 1.6 gigaflops in  0.00181508 elapsed seconds
SP GFlops = 2144.738383
DP GFlops = 881.503533
Running 244 openmp threads 
SP floats 3.2 gigaflops in  0.00159907 elapsed seconds
DP floats 1.6 gigaflops in  0.00168014 elapsed seconds
SP GFlops = 2001.158909
DP GFlops = 952.304016


Notice that we are close to the theoretical performance. Consider using only 60 cores or 224 threads for the peak performance, as one core is used to manage the service interrupt requests.

Calculating the theoretical performance of Intel Xeon Phi cores assuming running 60 cores at 1.1 GHz, is shown below for double-precision DP and single-precision SP respectively:
  • 1056 GFLOP/sec = 8 DP SIMD Lane x 2 FMA x 1.1 GHz x 60 cores
  • 2112 GFLOP/sec = 16 SP SIMD Lane x 2 FMA x 1.1 GHz x 60 cores


  •