Cardiac electrophysiology simulation calculation method, device and equipment and storage medium
By performing cell ion channel dynamics calculations at N consecutive time steps in cardiac electrophysiology simulation and calculating the potential diffusion term at the Nth time step, the problem of frequent I/O access is solved, achieving efficient utilization of computing resources and improved simulation speed.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING ACAD OF ARTIFICIAL INTELLLIGENCE
- Filing Date
- 2025-06-17
- Publication Date
- 2026-04-10
AI Technical Summary
In existing cardiac electrophysiology simulation methods, multiple variables in global memory need to be read and updated at each time step, resulting in heavy I/O access tasks, low computational efficiency, and underutilization of hardware computing resources. The I/O bottleneck has become a key obstacle restricting real-time simulation.
Cellular ion channel dynamics calculations are performed over N consecutive time steps, and the potential diffusion term is calculated in the Nth time step. This reduces the number of global memory reads and writes, and a loop unrolling strategy is used to improve computational density and resource utilization.
It significantly reduces memory access frequency, improves computing efficiency and throughput, enhances the resource utilization of GPU computing cores, increases simulation speed by more than 2 times, and reduces hardware costs and energy consumption.
Smart Images

Figure CN120727305B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of cardiac electrophysiology simulation, and in particular to a cardiac electrophysiology simulation calculation method, device, equipment and storage medium. BACKGROUND
[0002] As an important digital medical technology means, cardiac electrophysiology simulation is widely used in the fields of arrhythmia mechanism research, surgical planning and drug screening. The cardiac electrophysiology simulation model usually has a highly complex structure, often including a high-resolution three-dimensional grid, ten million myocardial cell units and dozens of dynamically changing cell state variables. In order to ensure the simulation accuracy, the cardiac electrophysiology simulation model needs to frequently read and update multiple variables in the global memory at each time step, resulting in extremely heavy I / O access tasks.
[0003] In addition, the cardiac electrophysiology simulation model has a low calculation density, that is, the calculation amount (FLOPS / Byte, that is, the number of floating point operations corresponding to each byte of data movement) corresponding to unit data access is limited. Specifically, the variables such as the voltage, ion concentration and current of the myocardial cell need to be forwarded through the L2 cache (i.e., the second level cache) and the L1 cache (i.e., the first level cache) before being loaded into the registers of the GPU (Graphics Processing Unit, graphics processing unit), but these variables are usually used only once after being loaded and then released, resulting in extremely low cache hit rate. This "one-time use" data access mode limits the performance optimization effect brought by the cache mechanism and shared memory, further exacerbating the memory bandwidth bottleneck.
[0004] Due to the above problems, the GPU computing core is often in a state of waiting for I / O response in actual execution, resulting in that the hardware computing resources are not fully utilized, thereby significantly reducing the overall calculation efficiency. The I / O bottleneck has become a key obstacle to realizing real-time simulation of the cardiac electrophysiology simulation model. Therefore, an optimization scheme is urgently needed to reduce the memory access overhead and improve the utilization rate of computing resources, so as to improve the overall performance of the cardiac electrophysiology simulation. SUMMARY
[0005] The present application provides a cardiac electrophysiology simulation calculation method, device, equipment and storage medium to solve the problem that the existing cardiac electrophysiology simulation method needs to read and update multiple variables in the global memory at each time step, resulting in heavy I / O access tasks and low calculation efficiency.
[0006] In a first aspect, the present application provides a cardiac electrophysiology simulation calculation method, comprising:
[0007] S1: loading a cardiac electrophysiology simulation model and initializing each cell state variable;
[0008] S2: store initial values of each cell state variable in global memory;
[0009] S3: read required cell state variables from global memory and load into registers;
[0010] S4: in the registers, continuously perform cell ion channel dynamics calculation of N time steps according to the cell state variables, and calculate potential diffusion term at the Nth time step; wherein N > 1;
[0011] S5: calculate cell membrane potential at the Nth time step according to the cardiac electrophysiology simulation model, the cell ion channel dynamics calculation result at the Nth time step and the potential diffusion term;
[0012] S6: write the calculation results of N time steps and the cell state variables into global memory;
[0013] S7: repeat steps S3 to S6 until the simulation ends.
[0014] Further, in the S1, the specific expression of the cardiac electrophysiology simulation model is:
[0015]
[0016] wherein C m represents the membrane capacitance per unit area; V represents the cell membrane potential; represents the potential diffusion term, i.e. the propagation of electrical signals in cardiac tissue, represents the divergence operator, D represents the diffusion coefficient, represents the gradient operator; I ion represents the total ion current, g represents the ion channel gating variable, and t represents time; I stim represents the applied stimulation current.
[0017] Further, before storing the initial values of each cell state variable in global memory, data memory allocation is also performed, specifically including:
[0018] allocate cell state array, temporary calculation buffer and potential diffusion term buffer in global memory on the GPU device side, and store the initial values of each cell state variable in the cell state array.
[0019] Further, start the kernel function on the GPU side, and use the kernel function to perform steps S3 to S7 on all myocardial cells.
[0020] Further, in the step S4, according to the cell state variables, the cell ion channel dynamics calculation of N time steps is continuously performed by using a loop unrolling strategy.
[0021] Further, the size of the continuous execution time step number N is determined according to the GPU memory and the computing core load.
[0022] Further, the cell state variables include a depolarization-related current, a repolarization-related current and an ion balance-related current; the depolarization-related current includes a fast sodium current and an L-type calcium current; the repolarization-related current includes a transient outward potassium current, a fast delayed rectifier potassium current, a slow delayed rectifier potassium current and an inward rectifier potassium current; and the ion balance-related current includes a sodium-calcium exchange current, a sodium-potassium pump current, a calcium pump current, a potassium pump current, a background sodium current and a background calcium current.
[0023] In a second aspect, the present application further provides a cardiac electrophysiology simulation computing device, comprising:
[0024] a loading and initializing unit configured to load a cardiac electrophysiology simulation model and initialize each cell state variable;
[0025] a storage unit configured to store the initial values of each cell state variable in a global memory and write the calculation results of N time steps and the cell state variables into the global memory;
[0026] a reading and loading unit configured to read the required cell state variables from the global memory and load them into a register;
[0027] a computing unit configured to continuously perform N time step cell ion channel dynamics calculations according to the cell state variables in the register, calculate a potential diffusion item at the Nth time step, and calculate a cell membrane potential at the Nth time step according to the cardiac electrophysiology simulation model, the cell ion channel dynamics calculation results at the Nth time step and the potential diffusion item; wherein N>1;
[0028] a judging unit configured to judge whether the simulation time reaches a set total simulation time, and repeatedly call the reading and loading unit, the computing unit and the storage unit when the simulation time does not reach the set total simulation time.
[0029] In a third aspect, the present application further provides an electronic device comprising a memory, a processor and a computer program / instruction stored in the memory, wherein the processor executes the computer program / instruction to implement the cardiac electrophysiology simulation computing method of the present application as described above.
[0030] In a fourth aspect, the present application further provides a computer readable storage medium having a computer program / instruction stored thereon, wherein the computer program / instruction is executed by a processor to implement the cardiac electrophysiology simulation computing method of the present application as described above.
[0031] The present application has the following beneficial effects:
[0032] The cardiac electrophysiology simulation calculation method provided by the application comprises the following steps: reading data from the global memory, performing cell ion channel dynamics calculation of N time steps in the local register continuously, calculating the potential diffusion item and the cell membrane potential only at the Nth time step, and then writing the calculation result into the global memory.
[0033] The cell ion channel dynamics calculation of N time steps in the local register continuously makes the data stay in the register for a longer time, has a higher multiplexing rate, improves the effective calculation amount (i.e., the calculation density) of unit data, and greatly improves the calculation efficiency and throughput capacity. BRIEF DESCRIPTION OF DRAWINGS
[0034] In order to more clearly illustrate the technical solutions of the application, the following will briefly introduce the drawings needed to be used in the embodiments. Obviously, the drawings in the following description are only a part of the application, and other drawings can be obtained by those skilled in the art without creative effort.
[0035] Figure 1 The cardiac electrophysiology simulation calculation method flow chart of the embodiment of the application;
[0036] Figure 2 The cardiac electrophysiology simulation calculation device structure block diagram of the embodiment of the application;
[0037] Figure 3 The electronic device structure block diagram of the embodiment of the application. DETAILED DESCRIPTION
[0038] The technical solutions in the application will be described clearly and completely in combination with the drawings in the embodiments of the application. Obviously, the described embodiments are only a part of the embodiments of the application, but not all the embodiments. Based on the embodiments of the application, all other embodiments obtained by those skilled in the art without creative effort belong to the protection scope of the application.
[0039] The technical solutions of the application will be described in detail in combination with the following specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described in some embodiments.
[0040] Embodiment one
[0041] The specific expression of the cardiac electrophysiology simulation model is:
[0042]
[0043] where C m represents the membrane capacitance per unit area, unit: μF / cm 2 ; V represents the membrane potential, unit: mV represents the potential diffusion term, i.e. the electrical signal propagation in the cardiac tissue, represents the divergence operator, and D represents the diffusion coefficient, represents the gradient operator; I ion represents the total ion current, g represents the ion channel gating variable (i.e. the cell state variable), and t represents time; I stim represents the applied stimulation current.
[0044] According to formula (1), the calculation of the cardiac electrophysiological simulation model mainly includes two items, i.e. ion (V, g, t) and I ion (V, g, t) is a current item reflecting the dynamics of ion channels in the cell, which changes rapidly and needs to be updated at a high frequency; is an item describing the voltage diffusion coupling between cells, which changes relatively slowly over time and needs to be updated at a relatively low frequency.
[0045] In traditional cardiac electrophysiological simulation, the update of I ion (V, g, t) and and global memory access are performed at each time step, resulting in a large number of redundant global memory read and write operations, which seriously restricts the simulation efficiency; the ion channel state of the myocardial cell is loaded from the global memory, L2 cache, L1 cache, and finally to the register for calculation, but almost every cell state variable only participates in one calculation and is then released, resulting in a very low cache hit rate, which limits the performance optimization effect of the cache mechanism and shared memory. In addition, a large number of global memory read and write operations lead to an imbalance between I / O and computing load, and further cause the computing unit to spend most of the time waiting for I / O operations. Therefore, the high-frequency access of global memory I / O becomes a performance bottleneck, which significantly affects the efficiency of simulation calculation, especially in large-scale simulation tasks, frequent memory access consumes a large amount of bandwidth, thereby limiting the throughput of the computing process.
[0046] Based on the above technical problems, the embodiment of the present application provides a cardiac electrophysiological simulation calculation method, which controls the update frequency of on the basis of fully evaluating the time variation stability and error controllability of ion (V, g, t) is updated at each of the continuous N time steps, and The updating of the global memory is performed every N time steps, without the need for separate global memory access every time step, thereby significantly reducing the number of accesses to the global memory, reducing the memory bandwidth pressure, and reducing the access delay and the waiting time of the GPU computing core.
[0047] Figure 1 A flowchart of a cardiac electrophysiology simulation calculation method provided by an embodiment of the application is shown. As shown in the figure, the simulation calculation method comprises the following steps: Figure 1
[0048] S1: Load the cardiac electrophysiology simulation model and initialize the cell state variables.
[0049] According to formula (1), the parameters of the cardiac electrophysiology simulation model include the cell membrane voltage, the cell ion channel state, the ion concentration parameter, etc., the cell ion channel state is described by a plurality of cell state variables, and I ion (V, g, t) is calculated according to the plurality of cell state variables. Before the simulation calculation, the cell state variables are initialized.
[0050] In this embodiment, the cell state variables include depolarization-related current, repolarization-related current, and ion balance-related current; the depolarization-related current includes fast sodium current and L-type calcium current; the repolarization-related current includes transient outward potassium current, fast delayed rectifier potassium current, slow delayed rectifier potassium current, and inward rectifier potassium current; and the ion balance-related current includes sodium-calcium exchange current, sodium-potassium pump current, calcium pump current, potassium pump current, background sodium current, and background calcium current.
[0051] In step S1, simulation parameters are also set, such as the total simulation time, the step size dt of a single time step, the number N of consecutive time steps to be executed, etc. The number N of consecutive time steps to be executed is greater than 1 and is determined according to the GPU memory and computing core load, and N is usually 3-5. For H100 Tensor Core GPU, N is 5.
[0052] S2: Store the initial values of the cell state variables in the global memory.
[0053] The cell state array, the temporary calculation buffer, and the potential diffusion item buffer are allocated in the global memory of the GPU device, the initial values of the cell state variables are stored in the cell state array, and the GPU computing core is accessed.
[0054] The kernel function is started on the GPU side, and steps S3 to S7 are executed in parallel for all myocardial cells. The GPU has a large number of computing cores and is suitable for processing large-scale parallel task kernels. The kernel function can perform calculations independently for each myocardial cell, realize fine-grained parallelization, and significantly speed up the overall calculation process.
[0055] S3: Read the required cell state variables from global memory and load them into registers.
[0056] S4: In the register, the cell ion channel dynamics calculation is performed continuously for N time steps based on the cell state variables, and the potential diffusion term is calculated at the Nth time step.
[0057] The cell ion channel dynamics calculation is performed continuously for N time steps, that is, the cell ion channel state is calculated N times in N*dt, without reading or writing to global memory, and the N times are completed using a cell state variable read from global memory. ion The calculation of (V, g, t) enables high-frequency updates of the current term in the cardiac electrophysiology simulation model; at the last time step of every N time steps (i.e., the Nth time step), the potential diffusion term is calculated. That is, the potential diffusion term is performed every N time steps. The update realizes the potential diffusion term. The low-frequency update; then the I calculated at the Nth time step ion (V, g, t) and Substitute into formula (1) to calculate the cell membrane potential at the Nth time step; finally, write the calculation results of the Nth time step into the global memory, that is, only one read and write operation is performed on the global memory every N time steps.
[0058] This invention's N-time-step continuous computation strategy significantly reduces the number of global memory accesses while ensuring computational accuracy, effectively reducing memory bandwidth pressure and improving memory access efficiency. After each data read from global memory, multiple time-step calculations are performed, increasing computational density and efficiency, and significantly reducing GPU latency caused by waiting for I / O responses.
[0059] By adopting an N-time-step continuous computation strategy, data resides in registers for a longer time and has a higher reuse rate, resulting in a significant increase in the effective computational load (i.e., computational density) per unit of data. Furthermore, in a specific embodiment of this invention, a loop unrolling strategy is used to continuously execute N time-step cell ion channel dynamics calculations, effectively reducing branching and loop overhead and improving the instruction parallelism and computational throughput of the GPU computing core. Experiments show that the overall simulation speed can be improved by more than 2 times.
[0060] The application realizes the reduction of the required computing resources for equivalent simulation accuracy under the premise of ensuring numerical stability and precision. Compared with the traditional method, about 50% of GPU computing resources can be saved or the equivalent simulation time can be shortened by more than half, effectively reducing the hardware cost and energy consumption overhead in the process of simulation platform construction and operation, and having significant engineering application value.
[0061] S5: Calculate the cell membrane potential of the Nth time step according to the cardiac electrophysiology simulation model, the cell ion channel dynamics calculation result of the Nth time step, and the potential diffusion term.
[0062] S6: Write the calculation results of N time steps and the cell state variables into the global memory.
[0063] S7: Determine whether the simulation time reaches the set total simulation time, if not, go to step S3; if yes, go to step S8.
[0064] S8: Read the results from the GPU, including the cell membrane potential of each myocardial cell at each time step, cell state variables, etc., for subsequent visualization, analysis and machine learning modeling.
[0065] The application significantly reduces the I / O bottleneck caused by data loading in the simulation calculation process through the N time step continuous calculation strategy, improves the effective calculation amount corresponding to unit memory access, effectively reduces the idle time of the GPU calculation core, and improves the overall operation efficiency of the GPU; at the same time, the loop development strategy further improves the instruction parallelism and kernel throughput capacity. The application is particularly suitable for large-scale three-dimensional cardiac tissue electrophysiology simulation tasks, can realize more than 2 times performance improvement, has good scalability and engineering practical value, and provides a feasible path for realizing high-precision, low-delay real-time cardiac electrophysiology simulation.
[0066] The application can be adapted to various cardiac cell models based on the Forward Euler Method for time integration, such as the Luo-Rudy model, the Ten Tusscher-Panfilov model, the O'Hara-Rudy Dynamic model, etc., and has good universality and scalability. Whether in two-dimensional sheet simulation or three-dimensional complete cardiac tissue simulation, the application method can be deployed to improve performance, significantly save computing resources, and reduce operating costs.
[0067] Embodiment Two
[0068] Figure 2 A structure block diagram of a cardiac electrophysiology simulation calculation device provided by an embodiment of the application is shown. As shown in the figure, Figure 2 The simulation calculation device includes a loading and initialization unit, a storage unit, a reading and loading unit, a calculation unit, and a judgment unit.
[0069] a loading and initializing unit, configured to load a cardiac electrophysiological simulation model and initialize each cell state variable;
[0070] a storage unit, configured to store the initial values of the cell state variables in a global memory, and write the calculation results of N time steps and the cell state variables into the global memory;
[0071] a reading and loading unit, configured to read the required cell state variables from the global memory and load them into registers;
[0072] a calculation unit, configured to continuously perform cell ion channel dynamics calculation of N time steps according to the cell state variables in the registers, and calculate a potential diffusion item at the Nth time step; and calculate a cell membrane potential at the Nth time step according to the cardiac electrophysiological simulation model, the calculation results of cell ion channel dynamics of the Nth time step and the potential diffusion item; wherein N>1;
[0073] a judging unit, configured to judge whether the simulation time reaches a set total simulation time, and repeatedly call the reading and loading unit, the calculation unit and the storage unit when the simulation time does not reach the set total simulation time.
[0074] In some embodiments of the present application, the cardiac electrophysiological simulation calculation device can be combined with the cardiac electrophysiological simulation calculation method in Embodiment One, and vice versa.
[0075] Embodiment Three
[0076] The present application also provides an electronic device, as shown in the figure, which comprises a memory, a processor and a computer program / instruction stored in the memory, and the processor executes the computer program / instruction to implement the cardiac electrophysiological simulation calculation method in Embodiment One of the present application. Figure 3
[0077] Although not shown, the electronic device includes a processor, which can perform various appropriate operations and processes according to programs and / or data stored in a read-only memory (ROM) or programs and / or data loaded from a storage section into a random access memory (RAM). The processor can be a multi-core processor or can include multiple processors. In some embodiments, the processor can include a general-purpose main processor and one or more special-purpose coprocessors, such as a central processing unit, a graphics processing unit (GPU), a neural network processing unit (NPU), a digital signal processor (DSP), etc. In the RAM, various programs and data required for device operation are also stored. The processor, ROM and RAM are connected to each other through a bus. An input / output (I / O) interface is also connected to the bus.
[0078] The processor and the memory are used together to execute the programs / instructions stored in the memory, which, when executed by the computer, can implement the methods, steps or functions described in the above embodiments.
[0079] Although not shown, the embodiments of the present application also provide a computer readable storage medium having stored thereon computer programs / instructions, which, when executed by a processor, implement the cardiac electrophysiology simulation calculation method in the first embodiment of the present application
[0080] The computer readable storage medium includes permanent and non-permanent, removable and non-removable media, which can be realized by any method or technology to store information. The information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassette, disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. According to the definition herein, computer readable media does not include transitory media such as modulated data signals and carriers.
[0081] Although the preferred embodiments of the present application have been described, those skilled in the art can make further changes and modifications to the embodiments once they know the basic inventive concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application. Obviously, those skilled in the art can make various modifications and variations to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application also intends to include these modifications and variations.
Claims
1. A method of cardiac electrophysiology simulation computation, characterized by, The calculation method comprises: S1: loading a cardiac electrophysiology simulation model and initializing each cell state variable, setting the number N of continuously executed time steps, the number N of continuously executed time steps being greater than 1 and being determined according to GPU memory and computing core load; S2: storing initial values of each cell state variable in a global memory; S3: reading required cell state variables from the global memory and loading them into a register; S4: in the register, continuously performing cell ion channel dynamics calculation of N time steps according to the cell state variables by using a loop unrolling strategy; wherein, in the continuously executed N time steps, the potential diffusion term is calculated only once at the Nth time step; S5: calculating the cell membrane potential at the Nth time step according to the cardiac electrophysiology simulation model, the cell ion channel dynamics calculation result at the Nth time step and the potential diffusion term; S6: writing the calculation results of N time steps and the cell state variables into the global memory; S7: repeating steps S3 to S6 until the simulation ends.
2. The cardiac electrophysiology simulation computation method of claim 1, wherein, In S1, the specific expression of the cardiac electrophysiology simulation model is: ; wherein, represents the membrane capacitance per unit area; represents the cell membrane potential; represents the potential diffusion term, i.e. the propagation of the electrical signal in the cardiac tissue, represents the divergence operator, represents the diffusion coefficient, represents the gradient operator; represents the sum of the ionic currents, represents the ion channel gating variable, represents time; represents the applied stimulus current.
3. The cardiac electrophysiology simulation computation method of claim 1, wherein, Before storing the initial values of each cell state variable in the global memory, data memory allocation is also performed, specifically including: Allocating a cell state array, a temporary calculation buffer and a potential diffusion term buffer in the global memory of the GPU device, and storing the initial values of each cell state variable in the cell state array.
4. The cardiac electrophysiology simulation computation method of claim 1, wherein, Starting a kernel function on the GPU end, and using the kernel function to perform steps S3 to S7 on all myocardial cells.
5. The cardiac electrophysiology simulation calculation method according to any one of claims 1 to 4, characterized in that, The cell state variables include depolarization-related currents, repolarization-related currents and ion balance-related currents; the depolarization-related currents include fast sodium currents and L-type calcium currents; the repolarization-related currents include transient outward potassium currents, fast delayed rectifier potassium currents, slow delayed rectifier potassium currents and inward rectifier potassium currents; and the ion balance-related currents include sodium-calcium exchange currents, sodium-potassium pump currents, calcium pump currents, potassium pump currents, background sodium currents and background calcium currents.
6. A cardiac electrophysiology simulation computing device, characterized by, The simulation calculation device comprises: A loading and initializing unit for loading a cardiac electrophysiology simulation model and initializing each cell state variable, setting the number N of continuously executed time steps, the number N of continuously executed time steps being greater than 1 and being determined according to GPU memory and computing core load; A storage unit for storing initial values of each cell state variable in a global memory, and for writing calculation results of N time steps and the cell state variables into the global memory; A reading and loading unit for reading required cell state variables from the global memory and loading them into a register; A calculation unit for continuously performing cell ion channel dynamics calculation of N time steps in the register according to the cell state variables by using a loop unrolling strategy, wherein the potential diffusion term is calculated only once at the Nth time step in the continuously executed N time steps; and for calculating the cell membrane potential at the Nth time step according to the cardiac electrophysiology simulation model, the cell ion channel dynamics calculation result at the Nth time step and the potential diffusion term; A judging unit is configured to judge whether the simulation time reaches the set total simulation time, and repeatedly call the reading and loading unit, the calculating unit and the storing unit when the simulation time does not reach the set total simulation time.
7. An electronic device comprising a memory, a processor, and a computer program / instructions stored on the memory, wherein, The processor executes the computer program / instruction to implement the cardiac electrophysiology simulation calculation method according to any one of claims 1-5.
8. A computer readable storage medium having stored thereon computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the cardiac electrophysiology simulation calculation method according to any one of claims 1-5.
Citation Information
Patent Citations
Heart electrophysiology simulation method based on GPU
CN111091912A