Table of Contents
Fetching ...

TorchCor: High-Performance Cardiac Electrophysiology Simulations with the Finite Element Method on GPUs

Bei Zhou, Maximilian Balmus, Cesare Corrado, Ludovica Cicci, Shuang Qian, Steven A. Niederer

TL;DR

Cardiac electrophysiology (CEP) simulations demand substantial HPC resources, creating barriers for many researchers and clinicians. The authors introduce TorchCor, a GPU-accelerated FEM solver for the monodomain equation implemented in PyTorch, designed for large 3D heart meshes and easy local execution. The method combines a linear FEM spatial discretization with a θ-time stepping scheme and a PCG solver, and is rigorously validated via manufactured solutions and the $N$-version benchmark, showing accuracy on par with established codes. By unifying high-fidelity CEP modelling with the PyTorch ecosystem, TorchCor enables hybrid physics-ML workflows (e.g., PINNs, neural operators) and broad accessibility through a pure Python API and Docker-based deployment. The work demonstrates significant speedups over CPU-based solvers on modern GPUs, supports high-throughput studies, and lays groundwork for future multi-GPU, adaptive-time, and bidomain extensions toward real-time whole-heart simulations and digital twins.

Abstract

Cardiac electrophysiology (CEP) simulations are increasingly used for understanding cardiac arrhythmias and guiding clinical decisions. However, these simulations typically require high-performance computing resources with numerous CPU cores, which are often inaccessible to many research groups and clinicians. To address this, we present TorchCor, a high-performance Python library for CEP simulations using the finite element method on general-purpose GPUs. Built on PyTorch, TorchCor significantly accelerates CEP simulations, particularly for large 3D meshes. The accuracy of the solver is verified against manufactured analytical solutions and the $N$-version benchmark problem. TorchCor is freely available for both academic and commercial use without restrictions.

TorchCor: High-Performance Cardiac Electrophysiology Simulations with the Finite Element Method on GPUs

TL;DR

Cardiac electrophysiology (CEP) simulations demand substantial HPC resources, creating barriers for many researchers and clinicians. The authors introduce TorchCor, a GPU-accelerated FEM solver for the monodomain equation implemented in PyTorch, designed for large 3D heart meshes and easy local execution. The method combines a linear FEM spatial discretization with a θ-time stepping scheme and a PCG solver, and is rigorously validated via manufactured solutions and the -version benchmark, showing accuracy on par with established codes. By unifying high-fidelity CEP modelling with the PyTorch ecosystem, TorchCor enables hybrid physics-ML workflows (e.g., PINNs, neural operators) and broad accessibility through a pure Python API and Docker-based deployment. The work demonstrates significant speedups over CPU-based solvers on modern GPUs, supports high-throughput studies, and lays groundwork for future multi-GPU, adaptive-time, and bidomain extensions toward real-time whole-heart simulations and digital twins.

Abstract

Cardiac electrophysiology (CEP) simulations are increasingly used for understanding cardiac arrhythmias and guiding clinical decisions. However, these simulations typically require high-performance computing resources with numerous CPU cores, which are often inaccessible to many research groups and clinicians. To address this, we present TorchCor, a high-performance Python library for CEP simulations using the finite element method on general-purpose GPUs. Built on PyTorch, TorchCor significantly accelerates CEP simulations, particularly for large 3D meshes. The accuracy of the solver is verified against manufactured analytical solutions and the -version benchmark problem. TorchCor is freely available for both academic and commercial use without restrictions.

Paper Structure

This paper contains 12 sections, 10 equations, 5 figures, 4 tables, 1 algorithm.

Figures (5)

  • Figure 1: The difference between the simulation solution from TorchCor and manufactured solutions over time.
  • Figure 2: The performance of TorchCor on the $N$-version benchmark problem. It is comparable with Chaste and FEniCS solutions on this benchmark niederer2011verification.
  • Figure 3: Visualisation of simulation solutions on the bi-ventricle mesh at specified time.
  • Figure 4: Visualisation of the simulation solutions on a left atrium mesh with 660557 nodes at the specified times.
  • Figure 5: Execution time for electrophysiology simulations. The top row (a, b) shows results on 3D volume meshes with the TenTussherPanfilov ionic model, and the bottom row (c, d) shows results on 3D surface meshes with a modified version of Mitchell-Schaeffer as the ionic model. Simulations use openCARP on CPU cores and TorchCor on GPU devices. The CPU used is an AMD Ryzen Threadripper 3990X 64-Core Processor.