## 4 Discussion  
The initial goal was achieved by speeding up the algorithm's execution by a factor of ten (\(\times 10\)), porting a MATLAB application of \(\sim\)6000 lines of code to an optimized standalone C++ application of \(\sim\)4000 lines of code. As can be expected, the execution times obtained do not allow a real-time operation, but open the possibility of implementing other strategies or solutions that could achieve it. For example, the possibility of examining which parts of the code could be ported to other hardware platforms based on FPGA could also be analyzed to improve the execution time of specific parts. This is a good approach providing that software platforms are used that do not involve much effort in redoing all the code, as would be the case with OpenCL [26]. Although the desired speed had not been achieved, the speed-up obtained thanks to this first version is already approximately a factor of 10. While it is not yet fast enough for a real-time application of the ITER experiment, this work brings improved performance for the use of the code in inter-shot analysis on JET. Usually, discharges follow at 30 min intervals, the first \(\sim\)5-7 min comprises the discharge itself and the data storage, the remaining interval of \(\sim\)15 min for certain calculations, and \(\sim\)5 min for decisions, based on these calculations. Considering then that the main bottlenecks slowing down the implementation have been identified, and that efforts are currently ongoing to improve the main algorithm implementing the ML methodology, it is expected to reach the objective of 25 ms per iteration in a future release. All of the source code was generated with open-source libraries (no proprietary code was used), allowing better traceability, updating, building from scratch, and reuse by the scientific community. The testing platform is based on ITER CODAC Core System (RHEL) or Ubuntu 18.04. The former is quite interesting because the solution can be executed in an ITER Fast Controller platform. The selection of the ArrayFire library as the core of the application is an excellent choice because the MATLAB data structures and functions can be ported in a fairly direct way, requiring less effort than building the same application with other programming environments. Additionally, ArrayFire simplifies enormously the use of the GPU. Another outstanding feature is the possibility of using a heterogeneous platform based on CPU and GPU, which allows balancing or choosing the most suitable for the nature of a given algorithm. Finally, it should be noted that the methodology followed can be applied to the development of applications into more complex frameworks used in large-scale science facilities, such as those corresponding to nuclear fusion. Methodology, validation and writing--review M.R., formal analysis and writing--review J.N., software, validation and writing--review V.C., conceptualization T.C., conceptualization E.P., investigation J.V., investigation A.M. All authors have read and agreed to the published version of the manuscript. Grants PID2019-108377 RB-C33 and PID2019-108377 RB-C31 funded by MCIN/AEI/10.130-39/501100011033; Comunidad de Madrid grant number PEJ-2019-AI/TIC-14507. Euratom Research and Training Programme (Grant Agreement No. 101052200--EUROfusion). Not applicable. The data that support the findings of this study are available upon reasonable request from the authors. JET Contributors: See the author list of \"Overview of JET results for optimising ITER operation\" by [PERSON] et al. to be published in the Nuclear Fusion Special Issue: Overview and Summary Papers from the 28 th Fusion Energy Conference (Nice, France, 10-15 May 2021). This work was carried out within the framework of the EUROfusion Consortium, funded by the European Union via the Euratom Research and Training Programme (Grant Agreement No. 101052200--EUROfusion). Views and opinions expressed are, however, those of the author(s) only and do not necessarily reflect those of the European Union or the European Commission.