Acceleration of an Algorithm Based on the Maximum Likelihood Bolometric Tomography for the Determination of Uncertainties in the Radiation Emission on JET Using Heterogeneous Platforms
Abstract
:1. Introduction
2. Materials and Methods
- The magnetic surfaces, the first wall, and the last closed surface (or separatrix) cartesian coordinates.
- The time traces of a few related quantities such as the radial position of the magnetic axis and the vertical position of the so-called X-point.
- The data array obtained from JET bolometers that are averaged depending on the phenomenon to analyze, typically with a time window of 25 ms around the time instance of interest.
2.1. MATLAB Algorithm
2.2. Analysis of the Different Alternatives
- MATLAB code analysis, which has an extension of approximately 2500 lines. This code uses high-level functions from MATLAB’s toolboxes that solve curve fitting, 1D and 2D interpolations, and median and Gaussian image filtering. Unfortunately, from most parts of these functions, MathWorks does not provide the source code, complicating the implementation of the final solution.
- The code profiling analysis with the specific MATLAB tool to identify the time needed to execute the different algorithm phases. The algorithm is based on executing several configurable iterations, and the execution time depends on this.
- The analysis of the different options to shorten the execution time of the different code sections according to two different scenarios:
- Use of MATLAB:
- ▪
- Use of MATLAB Executable Files (MEX);
- ▪
- Use of parallel computing toolbox;
- ▪
- Use of MATLAB-optimized libraries;
- ▪
- Using GPUs in MATLAB (not all functions support GPU acceleration, and using GPU arrays in MATLAB is not efficient if the arrays are small).
- Use of other programming languages, rewriting the code in C++ with the help of optimized libraries for heterogeneous platforms:
- ▪
- CPU: ArrayFire, ALGLIB, libigl, armadillo, Intel MKL, IPP;
- ▪
- GPU: ArrayFire, CUDA (NVCC compiler, cuBLAS libraries, etc.);
- ▪
- FPGA: Use of IntelFPGA/XILINX acceleration techniques.
- Identification and selection of the most suitable hardware platform to accelerate a specific portion of the algorithm. Due to some functions’ complexity, the most suitable hardware is considered to be a heterogeneous solution using an Intel multicore CPU and an NVIDIA GPU.
- Selection of the software to be used for the implementation considered criteria such as being Open Source, the best performance for CPU or GPU, and the possibility of using different programming languages.
2.2.1. ArrayFire
2.2.2. ALGLIB—C++/C# Numerical Analysis Library
2.2.3. MATIO
2.3. Profiling of MATLAB Code
2.4. Development of the C++ Application and ArrayFire Optimization Techniques
function [prj] = projections_bolo(no_rays, nrpct_o, nrpct_v, pix, rec1) for k = 1:no_rays if (k <= 24) || (k >= 33) mysum = 0; for i = 1:nrpct_v for j = 1:nrpct_o mysum = mysum + pix(i,j,k)*rec1(i,j); end end prj(k) = mysum; else prj(k) = 0; end end end |
af::array projections_bolo(const std::int32_t &no_rays, const af::array &pix, const af::array &rec1) { af::array prj = af::constant(0, no_rays, f64); af::array kSlices = af::join(0, seq(24 - 1), seq(33 - 1, no_rays - 1)); af::array ppixSlices = pix(span, span, kSlices); af::array rec1Slices = af::tile(rec1, 1, 1, kSlices.elements()); af::array aux = ppixSlices * rec1Slices; aux = af::sum(af::sum(aux)); prj(kSlices) = af::reorder(aux, 2, 0, 1); return prj; } |
3. Results
4. Discussion
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Wesson, J. Tokamaks, 4th ed.; Oxford University Press: Oxford, UK, 2011; ISBN 9780199592234. [Google Scholar]
- Huber, A.; McCormick, K.; Andrew, P.; de Baar, M.R.; Beaumont, P.; Dalley, S.; Fink, J.; Fuchs, J.C.; Fullard, K.; Fundamenski, W.; et al. Improved radiation measurements on JET–First results from an upgraded bolometer system. J. Nucl. Mater. 2007, 363–365, 365–370. [Google Scholar] [CrossRef]
- Huber, A.; McCormick, K.; Andrew, P.; Beaumont, P.; Dalley, S.; Fink, J.; Fuchs, J.C.; Fullard, K.; Fundamenski, W.; Ingesson, L.C.; et al. Upgraded bolometer system on JET for improved radiation measurements. Fusion Eng. Des. 2007, 82, 1327–1334. [Google Scholar] [CrossRef]
- Ingesson, L.C.; Alper, W.B.; Chen, H.; Edwards, A.W.; Fehmers, G.C.; Fuchs, J.C.; Giannella, R.; Gill, R.D.; Lauro-Taroni, L.; Romanelli, M. Soft X ray tomography during ELMs and impurity injection in JET. Nucl. Fusion 1998, 38, 1675. [Google Scholar] [CrossRef]
- Mlynar, J.; Craciunescu, T.; Ferreira, D.R.; Carvalho, P.; Ficker, O.; Grover, O.; Imrisek, M.; Svoboda, J. Current Research into Applications of Tomography for Fusion Diagnostics. J. Fusion Energy 2019, 38, 458–466. [Google Scholar] [CrossRef] [Green Version]
- Craciunescu, T.; Peluso, E.; Murari, A.; Gelfusa, M.; JET Contributors. Maximum likelihood bolometric tomography for the determination of the uncertainties in the radiation emission on JET TOKAMAK. Rev. Sci. Instrum. 2018, 89, 053504. [Google Scholar] [CrossRef] [PubMed]
- Peluso, E.; Craciunescu, T.; Murari, A.; Carvalho, P.; Gelfusa, M. A comprehensive study of the uncertainties in bolometric tomography on JET using the maximum likelihood method. Rev. Sci. Instrum. 2019, 90, 123502. [Google Scholar] [CrossRef] [PubMed]
- Peluso, E.; Craciunescu, T.; Gelfusa, M.; Murari, A.; Carvalho, P.J.; Gaudio, P. On the effects of missing chords and systematic errors on a new tomographic method for JET bolometry. Fusion Eng. Des. 2019, 146, 2124–2129. [Google Scholar] [CrossRef]
- Murari, A.; Peluso, E.; Craciunescu, T.; Lowry, C.; Aleiferis, S.; Carvalho, P.; Gelfusa, M. Investigating the thermal stability of highly radiative discharges on JET with a new tomographic method. Nucl. Fusion 2020, 60, 46030. [Google Scholar] [CrossRef]
- Matos, F.A.; Ferreiraa, D.R.; Carvalho, P.J. Deep learning for plasma tomography using the bolometer system at JET. Fusion Eng. Des. 2017, 114, 18–25. [Google Scholar] [CrossRef] [Green Version]
- Ferreira, D.R.; Carvalhob, P.J.; Carvalho, I.S.; Stuart, C.; Lomas, P.J. Monitoring the plasma radiation profile with real-time bolometer tomography at JET. Fusion Eng. Des. 2021, 164, 112179. [Google Scholar] [CrossRef]
- Fuchs, J.; Neu, R.; Dux, R.; Fuchs, J.C.; Junker, W.; Kallenbach, A.; Mertens, V.; de PefiarHempel, S.; Schonmann, K.; ASDEX Upgrade Team. Influence of the Carbon and the Oxygen Concentration on the Density Limit in ASDEX Upgrade ECA. In Proceedings of the 21st EPS Conference Contribution, Montpellier, France, 27 June–1 July 1994; Volume 18B. [Google Scholar]
- Carr, M.; Meakins, A.; Bernert, M.; David, P.; Giroud, C.; Harrison, J.; Henderson, S.; Lipschultz, B.; Reimold, F. Description of complex viewing geometries of fusion tomography diagnostics by ray-tracing. Rev. Sci. Instrum. 2018, 89, 083506. [Google Scholar] [CrossRef] [PubMed]
- David, P.; Bernert, M.; Pütterich, T.; Fuchs, C.; Glöggler, S.; Eich, T. Optimization of the computation of total and local radiated power at ASDEX Upgrade. Nucl. Fusion 2021, 61, 066025. [Google Scholar] [CrossRef]
- Konoshima, S.; Leonard, A.W.; Ishijima, T.; Shimizu, K.; Kamata, I.; Meyer, W.H.; Sakurai, S.; Kubo, H.; Hosogane, N.; Tamai, H. Tomographic reconstruction of bolometry for JT-60U diverted tokamak characterization. Plasma Phys. Control. Fusion 2001, 43, 959. [Google Scholar] [CrossRef]
- Blas, J.G.; Dolz, M.F.; Garcia, J.D.; Carretero, J.; Daducci, A.; Aleman, Y.; Canales-Rodriguez, E.J. Porting Matlab Applications to High-Performance C++ Codes: CPU/GPU-Accelerated Spherical Deconvolution of Diffusion MRI Data. Lect. Notes Comput. Sci. 2016, 10048, 630–643. [Google Scholar]
- Castro, R.; Romero, J.A.; Vega, J.; Nieto, J.; Ruiz, M.; Sanz, D.; Barrera, E.; de Arcas, G. Soft real-time EPICS extensions for fast control: A case study applied to a TCV equilibrium algorithm. Fusion Eng. Des. 2014, 89, 638–643. [Google Scholar] [CrossRef]
- Esquembri, S.; Nieto, J.; Carpeño, A.; Ruiz, M.; Astrain, M.; Costa, V.; de Garcia, A. Application of Heterogeneous Computing Techniques for the Development of an Image-Based Hot Spot Detection System Using MTCA. IEEE Trans. Nucl. Sci. 2021, 68, 2151–2158. [Google Scholar] [CrossRef]
- Esquembri, S.; Nieto, J.; Ruiz, M.; de Gracia, A.; de Arcas, G. Methodology for the implementation of real-time image processing systems using FPGAs and GPUs and their integration in EPICS using Nominal Device. Fusion Eng. Des. 2018, 130, 26–31. [Google Scholar] [CrossRef]
- ArrayFire. Available online: https://arrayfire.com/ (accessed on 1 May 2022).
- ALGLIB. Available online: https://www.alglib.net/ (accessed on 1 May 2022).
- MATIO. Available online: https://github.com/tbeu/matio (accessed on 1 May 2022).
- Aguilar-Rivera, A. A GPU fully vectorized approach to accelerate performance of NSGA-2 based on stochastic non-domination sorting and grid-crowding. Appl. Soft Comput. 2020, 88, 106047. [Google Scholar] [CrossRef]
- HajiRassouliha, A.; Taberner, A.J.; Nash, M.P.; Nielsen, P.M.F. Suitability of recent hardware accelerators (DSPs, FPGAs, and GPUs) for computer vision and image processing algorithms. Signal Processing Image Commun. 2018, 68, 101–119. [Google Scholar] [CrossRef]
- Performance of ArrayFire JIT Code Generation. Available online: https://arrayfire.com/blog/performance-of-arrayfire-jit-code-generation/ (accessed on 1 May 2022).
- Astrain, M.; Ruiz, M.; Carpeño, A.; Esquembri, S.; Barrera, E.; Vega, J. A methodology to standardize the development of FPGA-based high-performance DAQ and processing systems using OpenCL. Fusion Eng. Des. 2020, 155, 111561. [Google Scholar] [CrossRef]
Function | Time (ms) | Time for 15 Iterations |
---|---|---|
Initialization for smoothing on the open magnetic curves | 3183.0 | n/a |
Load projections | 3.0 | n/a |
Load geometry | 165.0 | n/a |
Backprojections | 10.0 | n/a |
Uncertainty preparations | 20.0 | n/a |
Projection lines approach loop | 2560.0 | 38,400.0 |
Smooth the closed and open surfaces | 160.0 | 2400.0 |
Smooth LCF inside and outside | 326.8 | 4902.0 |
Evaluation of emissivity | 1.8 | 27.0 |
Uncertainty estimation | 1363.5 | 5454.0 |
Evaluation of the reconstruction projection at iteration ith | 42.0 | 630.0 |
Final projections | 1.2 | n/a |
Compute profile radiation and noise | 7624.0 | n/a |
TOTAL | 15,460.3 | 62,819.2 |
Function | MATLAB for 15 Iterations (ms) | C++ for 15 Iterations (ms) | Gain (ms) |
---|---|---|---|
Initialization for smoothing on the open magnetic curves | 3183.0 | 125.6 | 3057.4 |
Load projections | 3.0 | 5.0 | −2.0 |
Load geometry | 165.0 | 103.3 | 61.7 |
Backprojections | 10.0 | 0.6 | 9.5 |
Uncertainty preparations | 20.0 | 0.5 | 19.5 |
Projection lines approach loop | 38,400.0 | 19.5 | 38,380.5 |
Smooth the closed and open surfaces | 2400.0 | 54.5 | 2345.6 |
Smooth LCF inside and outside | 4902.0 | 2703.5 | 2198.6 |
Evaluation of emissivity | 27.0 | 3.3 | 23.7 |
Uncertainty estimation | 5454.0 | 2953.1 | 2500.9 |
Evaluation of the reconstruction projection at iteration ith | 630.0 | 12.8 | 617.3 |
Final projections | 1.2 | 1.2 | 0.0 |
Compute profile radiation and noise | 7624.0 | 264 | 7360.0 |
TOTAL | 62,819.2 | 6246.7 | 56,572.5 |
Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Ruiz, M.; Nieto, J.; Costa, V.; Craciunescu, T.; Peluso, E.; Vega, J.; Murari, A.; JET Contributors. Acceleration of an Algorithm Based on the Maximum Likelihood Bolometric Tomography for the Determination of Uncertainties in the Radiation Emission on JET Using Heterogeneous Platforms. Appl. Sci. 2022, 12, 6798. https://doi.org/10.3390/app12136798
Ruiz M, Nieto J, Costa V, Craciunescu T, Peluso E, Vega J, Murari A, JET Contributors. Acceleration of an Algorithm Based on the Maximum Likelihood Bolometric Tomography for the Determination of Uncertainties in the Radiation Emission on JET Using Heterogeneous Platforms. Applied Sciences. 2022; 12(13):6798. https://doi.org/10.3390/app12136798
Chicago/Turabian StyleRuiz, Mariano, Julián Nieto, Víctor Costa, Teddy Craciunescu, Emmanuele Peluso, Jesús Vega, Andrea Murari, and JET Contributors. 2022. "Acceleration of an Algorithm Based on the Maximum Likelihood Bolometric Tomography for the Determination of Uncertainties in the Radiation Emission on JET Using Heterogeneous Platforms" Applied Sciences 12, no. 13: 6798. https://doi.org/10.3390/app12136798
APA StyleRuiz, M., Nieto, J., Costa, V., Craciunescu, T., Peluso, E., Vega, J., Murari, A., & JET Contributors. (2022). Acceleration of an Algorithm Based on the Maximum Likelihood Bolometric Tomography for the Determination of Uncertainties in the Radiation Emission on JET Using Heterogeneous Platforms. Applied Sciences, 12(13), 6798. https://doi.org/10.3390/app12136798