# HPC Platform for Railway Safety-Critical Functionalities Based on Artificial Intelligence
## 6 Test Results
### Distance Calculus Performance Results  
The results represented in Table 2 show that the actual inference time in the SELENE platform (two cores RISC-V CPU) is much higher than in the AGX Xavier (eight cores ARM CPU) but a direct comparison is not representative. Cumulative processing time over all cores must be calculated to obtain the computing time for all processes. In the full process time, the results show that the RISC-V CPU performance is 6.66% of the ARM performance, however operation frequency is not the same in both platforms, so frequency normalization shall be applied to obtain the actual performance for the CPU. SELENE platform CPUs run at 100 MHz and the ARM CPU runs at 2.2 GHz. The results normalizing the frequency show that the RISC-V CPU performance is actually greater than the ARM CPU.  
This test has also been used to check OpenCV compatibility and performance of an algorithm to estimate the distance from the train cabin to a stop signal on the platform. After compiling and installing OpenCV for RISC-V 64-bit architecture, a performance test consisting of the execution of the Semi-Global Block Matching (SGBM) function of OpenCV was carried out. As shown in Figure 5, the OpenCV SGBM function takes two stereo images (taken with a stereo camera, producing a left and right image) and tries to match the images creating, as a result, a disparity map which represents the distance between the detected landmarks or people to the cameras on the train.  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & & & & & **VCU118 w.r.t AGX Xavier** \\ \hline \multicolumn{5}{c}{**VCU118 (2 Core) SELENE**} & \multicolumn{2}{c}{**AGX Xavier (ARM 8 Core)**} & \multicolumn{2}{c}{**Raw Comp.**} & \multicolumn{1}{c}{**F.A. Comp.**} \\ \hline OpenCV & \multirow{2}{*}{Total time} & Time & \multirow{2}{*}{Total time} & Time & \multirow{2}{*}{Time Using Single Core} & \multirow{2}{*}{\%} & \multirow{2}{*}{\%} \\ SGBM & & & Single & & & Single \\ \hline Matching & \multirow{2}{*}{48} & \multirow{2}{*}{96} & \multirow{2}{*}{0.8} & \multirow{2}{*}{6.4} & \multirow{2}{*}{6.66} & \multirow{2}{*}{146.67} \\ Time & & & & & & \\ Filtering & \multirow{2}{*}{20} & \multirow{2}{*}{40} & \multirow{2}{*}{0.3} & \multirow{2}{*}{2.4} & \multirow{2}{*}{6} & \multirow{2}{*}{132} \\ Time & & & & & & \\ \hline \hline \end{tabular}
\end{table}
Table 2: Depth map calculus execution times (OpenCV SGBM function in CPU). SELENE’s VCU118 and AGX Xavier. The last two columns show the comparison between both platform: Raw core number normalization and Frequency Agnostic (F.A.) (100 MHz vs. 2.2 GHz) downscaled. All measurements are given in seconds (s).  
Because OpenCV acceleration was not implemented in SELENE platform (it is planned as future work), the SGBM algorithm is just executed in CPU. Table 2 shows the execution times of the SGBM function (divided in Matching Time and Filtering Time) and the comparison with AGX Xavier board execution in its ARM CPU cores.  
As expected, the Nvidia AGX Xavier with its eight cores at 2.2 GHz is much faster than the two core SELENE VCU118 at 100 MHz, however, as previously mentioned in this work, this direct comparison is not valid as the SELENE platform is an evaluation HW FPGA board with a frequency much lower than an ASIC implementation. Therefore, the comparison must be normalized to be agnostic of the frequency and the number of cores. After normalizing the cores, the SELENE platform reaches just 6.66% of the performance of the Nvidia AGX Xavier. However, after normalizing the frequencies, the RSIC-V CPU in the SELENE outperforms the ARM, demonstrating that FPGAs can be a valid option from the performance point of view.