Abstract
We show the benefits of the novel MLIR compiler technology to the generation of code from a DSL, namely EasyML used in openCARP, a widely used simulator in the cardiac electrophysiology community. Building on an existing work that deeply modified openCARP’s native DSL code generator to enable efficient vectorized CPU code, we extend the code generation for GPUs (Nvidia CUDA and AMD ROCm). Generating optimized code for different accelerators requires specific optimizations and we review how MLIR has been used to enable multi-target code generation from an integrated generator. Experiments conducted on the 48 ionic models provided by openCARP show that the GPU code executes \(3.17\times \) faster and delivers more than \(7\times \) FLOPS per watt than the vectorized CPU code, on an Nvidia A100 GPU versus a 36-cores AVX-512 Intel CPU.
T. T. Jost and A. Thangamani—Both authors contributed equally to the paper.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
References
Aliev, R.R., Panfilov, A.V.: A simple two-variable model of cardiac excitation. Chaos Solitons Fractals 7(3), 293–301 (1996). https://doi.org/10.1016/0960-0779(95)00089-5
Anzt, H., et al.: GINKGO: a modern linear operator algebra framework for high performance computing. ACM Trans. Math. Softw. 48(1), 1–33 (2022). https://doi.org/10.1145/3480935
Augonnet, C., Thibault, S., Namyst, R., Wacrenier, P.A.: StarPU: a unified platform for task scheduling on heterogeneous multicore architectures. CCPE - Concurr. Comput.: Pract. Exp. Spec. Issue: Euro-Par 2009 23, 187–198 (2011). https://doi.org/10.1002/cpe.1631
Balay, S., et al.: PETSc Web page (2022). https://petsc.org/
Campos, J., Oliveira, R., dos Santos, R., Rocha, B.: Lattice Boltzmann method for parallel simulations of cardiac electrophysiology using GPUs. J. Comput. Appl. Math. 295(C), 70–82 (2016). https://doi.org/10.1016/j.cam.2015.02.008
Certik, O.: SymPy python library for symbolic mathematics (2008)
Clerx, M., Collins, P., de Lange, E., Volders, P.G.: Myokit: a simple interface to cardiac cellular electrophysiology. Prog. Biophys. Mol. Biol. 120(1), 100–114 (2016). https://doi.org/10.1016/j.pbiomolbio.2015.12.008
Cytron, R., Ferrante, J., Rosen, B.K., Wegman, M.N., Zadeck, F.K.: An efficient method of computing static single assignment form. In: Proceedings of the 16th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 1989, pp. 25–35. ACM (1989). https://doi.org/10.1145/75277.75280
Gysi, T., et al.: Domain-specific multi-level IR rewriting for GPU: the open earth compiler for GPU-accelerated climate simulation. ACM Trans. Archit. Code Optim. 18(4), 1–23 (2021). https://doi.org/10.1145/3469030
Lattner, C., Adve, V.: LLVM: a compilation framework for lifelong program analysis & transformation. In: 2004 International Symposium on Code Generation and Optimization, pp. 75–86 (2004). https://doi.org/10.1109/CGO.2004.1281665
Lattner, C., et al.: MLIR: scaling compiler infrastructure for domain specific computation. In: 2021 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), pp. 2–14 (2021). https://doi.org/10.1109/CGO51591.2021.9370308
Lionetti, F.V.: GPU accelerated cardiac electrophysiology. Masters thesis, University of California, San Diego (2010)
Lionetti, F.V., McCulloch, A.D., Baden, S.B.: Source-to-source optimization of CUDA C for GPU accelerated cardiac cell modeling. In: D’Ambra, P., Guarracino, M., Talia, D. (eds.) Euro-Par 2010. LNCS, vol. 6271, pp. 38–49. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-15277-1_5
Moses, W.S., Chelini, L., Zhao, R., Zinenko, O.: Polygeist: raising C to polyhedral MLIR. In: 30th International Conference on Parallel Architectures and Compilation Techniques (PACT), pp. 45–59 (2021). https://doi.org/10.1109/PACT52795.2021.00011
Plank, G., et al.: The openCARP simulation environment for cardiac electrophysiology. Comput. Methods Program. Biomed. 208, 106223 (2021). https://doi.org/10.1016/j.cmpb.2021.106223
Potse, M., Saillard, E., Barthou, D., Coudière, Y.: Feasibility of whole-heart electrophysiological models with near-cellular resolution. In: 2020 Computing in Cardiology, pp. 1–4 (2020). https://doi.org/10.22489/CinC.2020.126
Sommer, L., Axenie, C., Koch, A.: SPNC: an open-source MLIR-based compiler for fast sum-product network inference on CPUs and GPUs. In: 2022 IEEE/ACM International Symposium on Code Generation and Optimization (CGO), pp. 1–11 (2022). https://doi.org/10.1109/CGO53902.2022.9741277
Thangamani, A., Trevisan, T., Loechner, V., Genaud, S., Bramas, B.: Lifting code generation of cardiac physiology simulation to novel compiler technology. In: 21st ACM/IEEE International Symposium on Code Generation and Optimization (CGO). ACM, Montréal Québec (2023). https://doi.org/10.1145/3579990.3580008
Trevisan Jost, T., Thangamani, A., Colin, R., Loechner, V., Genaud, S., Bramas, B.: Artifact for GPU code generation of cardiac electrophysiology simulation with MLIR (2023). https://doi.org/10.6084/m9.figshare.23546157
Vigmond, E.: EasyML (2021). https://opencarp.org/documentation/examples/01_ep_single_cell/05_easyml
Zhang, L., Wang, K., Zuo, W., Gai, C.: G-heart: a GPU-based system for electrophysiological simulation and multi-modality cardiac visualization. J. Comput. 9(2), 360–367 (2014)
Acknowledgments
This work was supported by the European High-Performance Computing Joint Undertaking EuroHPC under grant agreement No 955495 (MICROCARD), co-funded by the Horizon 2020 programme of the European Union (EU), and France, Italy, Germany, Austria, Norway, and Switzerland (https://microcard.eu).
Some experiments presented in this paper were carried out using the PlaFRIM experimental test bed, supported by Inria, CNRS (LABRI and IMB), Université de Bordeaux, Bordeaux INP and Conseil Régional d’Aquitaine (https://plafrim.fr). Some experiments presented in this paper were carried out using the Grid’5000 testbed, supported by a scientific interest group hosted by Inria and including CNRS, RENATER and several Universities as well as other organizations (https://www.grid5000.fr).
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2023 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this paper
Cite this paper
Trevisan Jost, T., Thangamani, A., Colin, R., Loechner, V., Genaud, S., Bramas, B. (2023). GPU Code Generation of Cardiac Electrophysiology Simulation with MLIR. In: Cano, J., Dikaiakos, M.D., Papadopoulos, G.A., Pericàs, M., Sakellariou, R. (eds) Euro-Par 2023: Parallel Processing. Euro-Par 2023. Lecture Notes in Computer Science, vol 14100. Springer, Cham. https://doi.org/10.1007/978-3-031-39698-4_37
Download citation
DOI: https://doi.org/10.1007/978-3-031-39698-4_37
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-39697-7
Online ISBN: 978-3-031-39698-4
eBook Packages: Computer ScienceComputer Science (R0)