Abstract
With the increase of the computing needs of high energy physics and astrophysicsexperiments, in a context where the energetic efficiency becomes the rule, the optimizationof scientific codes plays a major role. In this context, we have studied the optimizationpossibilities of the Monte-Carlo simulation software CORSIKA 7, widely used by severalscientific communities, like the CTA gamma-ray observatory.Within the CTA collaboration, massive simulations are realized by distributing tens ofthousands of independent computing tasks across the computing centers of the europeangrid, for an overall consumption of about 100 million normalized CPU hours (HS06). Astrong requirement of the project was to guarantee code portability across all these centersequipped with different models and generations of CPU. Moreover, in order to make thenew version of CORSIKA quickly adopted by the CTA collaboration, it was required toreproduce exactly the same numerical results than the original version. Given the currentuse case and the nature of the program, we have tried to optimize single-core performances,using different methods like SIMD vectorization, memory access optimization, etc.The final result of this work is a speed-up of 1.26 in execution time, which represents aneconomy of about 20 million normalized CPU hours per year for the CTA project. Thenumerical results have also been validated against the original version.Benefiting of this work, we have then contributed to the CORSIKA 8 project for there-writing of CORSIKA in a more modular and flexible way in C++17 language, theoriginal version being written in Fortran 77 and C. Our main contribution was thedevelopment of a new module treating the physics process of Cherenkov emission, one ofthe most CPU time consuming in CTA simulations. CTA simulations.All along the above-mentioned optimization and development work, we have been stronglyrelying on several profiling tools. The experience gained with all these tools motivated usto propose a new approach for code analysis, based on performance counters and phasedetection. We have implemented partly this approach in a new tool called PALPATINE,aiming to quickly identify the portions of code to optimize while remaining portable acrossseveral platforms and easy to use.