Democratizing Supercomputing in Cardiac Dynamics

Interactive High-Performance Computing on Personal Devices using WebGL

Abouzar Kaboudian*, PhD

*abouzar.kaboudian@physics.gatech.edu



Overview

  • Why are we interested in cardiac dynamics?
  • What are the challenges involved?
  • What is our suggested solution, and why?
  • How good is our suggested solution compared to others?
  • How impactful these methods can be?
  • Where do we go from here?
  • Other applications...
  • Concluding remarks and Q&A

Why study cardiac dynamics?

  • Cardiac desease continued to be the leading cause of death in US and globally until 2020, only to be overtaken by COVID-19!
  • 17.3 million people die each year globally due to cardiac desease!
  • The number of deaths is expected to rise to 23.6 million deaths per year by 2030.

Heart contraction is driven by the electrical activity

Cardiac Action Potential

Experimental studies vs. numerical simulations

Experimental studies are vital to

  • develop mathematical models;
  • ensure safety and efficacy of the models;

However, experimental studies

  • are time-consuming, expensive, and subject to limitations
  • can be extermely challenging to shed light on the physics and mechanisms of the problems

Numerical simulations

  • can complement experiments
  • can be used for mechanistic studies
  • can be efficient and less time consuming
  • can be virtually available to every group given appropriate approach is used.
  • reduce the number of experimental studies in drug trials (CiPA initiative).

Cardiac models and their complexities

\[ C_m\frac{\partial V}{\partial t}= \nabla.\left(D\nabla V\right)-I_{ion} \]
  • Minimal models have as low as 12 parameters and 2-4 variables.
  • TP model , 98 equations, 24 variables (ODEs)
  • Single-Cell models can have up to 100 variables!
  • Stiff ODEs ($dt\sim0.01ms$)
  • Spatial resolution ($\sim 200\mu m$)
  • Number of ODEs per computational cell (2-100)

So, for simulating 1 second of activity on a $4\times4$cm 2D slab, we need to solve

\[ \begin{array}{llcl} (200\times200)\times10^{5}\times&2 & = & 8\times10^{9} \\ & 100 & = & 4\times10^{11} \end{array} \]

Similarly, 1 second of simulation in 3d requires solving $\sim$twenty trillion ODE's.

Unfortunately, single processors are only able to solve about $10^6$ to $10^7$ ODEs per second.

What is the solution?

Parallel processing comes to the rescue


Technicians working on a large Linux cluster at the Chemnitz University of Technology, Germany.

What is the solution?

Parallel processing comes to the rescue


Cherry and Fenton, Pitt. Sup. Ctr. 2010. Proj. Sci. Comp. pg 28-31. January 2011.

Traditional parallel processing

  • can be expensive to aquire;
  • can be difficult to maintain;
  • can be challenging to implement code;
  • require users with specialized expertice to run their codes;
  • involves special expertise to debug codes;
  • involves the hassle of dealing with cluster queues;

So... Is there any alternative?

Yes! Of course there is an alternative :-D

Graphic Processing Units (GPUs) can provide high levels of parallelization at a fraction of the cost of clusters.

Why do you think GPU computing is the future?

Notice that CPU power has been stagnant in the order of a few GHz due to thermodynamic limits!

How do we program them?

What is our choice?

But... What is WebGL?

WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D computer graphics and 2D graphics within any compatible web browser without the use of plug-ins.

Why WebGL?

  • Runs all modern browsers, e.g. not Internet Explorer;
  • No need to compile
  • No need to install
  • Platform independent
  • Simultaneous processing and post-processing
  • Interactive
  • Free!

How easy is it to code in WebGL?

  1. The heart of a WebGL computational code is the implementation of ``Fragment Shaders''.
  2. Shaders have a C-like syntax!
  3. It used to be difficult to reach to the part where you can start to programm your shaders.

With the help of our library, Abubu.js, it is no longer so!

Abubu.js is freely available for download!

So, if you know C or a similar programming language, you can easily learn to program shaders!

We have released the source code along with this article.

We have also released a ton of resources at https://abubujs.org/

What is a fragment shader?

  • A fragment shader is a part of the WebGL application that is in charge of coloring each pixel on a surface!
  • Each pixel has three colors and a transparency value
  • Each shader can calculate at least 8 set of colors, and hence, 32 output variables!

Let's start with the Mandelbrot Set

\[ z_n = z_{n-1}^2 + z_0 \]

where $z_n$ is a complex number after $n$ iterations of the above iterative map.

A point ($z_0$) on the complex plane is a member of the set if and only if $|z|$ remains bounded.

Now, let's quickly program it!

Let's assume that I have a rectangular image that I want to colour.

Assume that each pixel on the image represents a point on the complex plane, and I want to write a recipe for coloring each pixel.

Mandelbrot-Set Fragment Shader

\[ z_n = z_{n-1}^2 + z_0 \]

How fast was this program?

MATLAB takes 15 seconds to calculate the same domain only once!

Our WebGL program re-calculated the entire domain 60 times a second!

For more details and live examples that you can try on your own computer see below.

Wait a minute! How was it any different from a regular C program, and why was it so fast?

  • We wrote a single program for every pixel! No looping over pixels!
  • The WebGL engine launches our shader program for every pixel and colors several pixels at a time using all the GPU cores available. That makes our program massively parallel!

Oook! Errrmmm! What does it have to do with cardiac dynamics?!

Remember the cardiac models?

\[ C_m\frac{\partial V}{\partial t}= \nabla.\left(D\nabla V\right)-I_{ion} \]
  • Minimal models have as low as 12 parameters and 2-4 variables.
  • TP model , 98 equations, 24 variables (ODEs)
  • Single-Cell models can have up to 100 variables!

Why not treat the time-marching problem as an image manipulation problem?!

  1. We consider our physical values on the domain to be stored into one/several image(s)!
  2. We assign state-variables to each color of every image
  3. We use shader language to update our solution by using these images as input and output!

Let's consider the FitzHugh-Nagumo model:

\[ \frac{\partial v}{\partial t} = D\nabla^2v + v(1-v)(v-a)-w \] \[ \frac{\partial w}{\partial t} = \epsilon(bv-w+\delta) \]

Let's quickly review the corresponding shader:

\[ \frac{\partial v}{\partial t} = D\nabla^2v + v(1-v)(v-a)-w \] \[ \frac{\partial w}{\partial t} = \epsilon(bv-w+\delta) \]

Cardiac tissue is an excitable medium.

An excitable medium supports propagation of excitation waves

An excitable medium exhibits periods of refractorines

Example: if a wildfire burns through the forest, no fire can return to a burnt spot until the vegetation has gone through its refractory period and regrown.

Alright! I think it's time to answer how fast these simulations can be?

On this machine with a USD600 GPU, in every second, I can solve $3.6\times 10^{10}$ ordinary differential equations!

How fast is that?

How fast is WebGL with Abubu.js when compared against other languages?

It's not enough to be fast...

How reliable are the results?

Let's campare against experimental results:

The experiments were reproduced using the 41-variable OVVR model*.

[*] O'Hara, Thomas, Laszlo Virag, Andras Varro, and Yoram Rudy. "Simulation of the undiseased human cardiac ventricular action potential: model formulation and experimental validation." PLoS computational biology 7, no. 5 (2011): e1002061.

Another comparison!

Comparing experimental data with the interactive simulations. (A) Single spiral wave (VT) and (B) fibrillation in porcine ventricles. (C) VT in rabbit with drug DAM. (D) Fibrillation in rabbit with drug CytoD.

VT in porcine ventricles

What can we do with this type of simulations?

Mechanistic studies are now intuitive...

The test to verify this mechanism of defibrillation is currently underway via Optogenetic experiemnts on 2D mono-layers by our collaboratores at McGill Univeristy.

The fact that we can interact with these simulations makes these types of mechanistic studies the more intuitive.

Once the mechanism is discoverred, the simulation may no longer be needed.

Variability and uncertainty play an important role in device efficacy, reliability and safety!

Uncertainty quantification and variability studies in cardiac EP models can be done in multi-dimensions!

Snapshots of activity at t = 1, 000 ms for 100 random parameters, under Ito parameter uncertainty in the canine cell model by Pathnamanathan et al (2019).

For details and more on this study see

At this point, I think you are almost convinced, but...

Why study 3D?

Dimensional Effects

Single-Cell Simulations in OVVR model

One-Dimensional Tissue Simulations in OVVR model

Two-Dimensional Tissue Simulations in OVVR model

Single stimulus leads to complex dynamics in 2D for OVVR model. I_Kr partial blockage leads to the complex dynamics in 2D.

How do we simulate dynamics in 3D?

It's easy. All we have to do is to flatten 3D space into 2:-D

... and use the following function instead of texture:

Ready for the simulation?

Let's use a patient specific model:

Patient specific fitting of the model can be helpful in understanding why dynamics can be different for different patients.

This technology can enable us to study the effects of variability of patient specific anatomies

Shouldn't we use this technology in AR/VR?

Of course we should!

These simulations can become the heart and sole of AR and VR programs such as this one:

NSF/FDA SIR award

Real-Time Simulations of Electrical Activity of the Heart and Augmented/Virtual Reality for Medical Device Applications

Award No: 2037894

Our goal is to help create a an infrastructure critically needed by the FDA to evaluate and validate in silico studies and VR/AR systems intended to explore new approaches for visualization and manipulation of cardiovascular anatomies, including electrical wave propagations and strategical planning of invasive procedures used in the clinic as well as anti-arrhythmic drug design.

What else can AR/VR help with?

  • Teaching: if a picture is worth a thousand words, how valuable is AR/VR?
  • Patient outreach;
  • Patient specific medicine;

Last question: can we bring fluid-flow into the picture?

So sorry! One more question...

Can you affor a pocket super computer?

Solving OVVR Model in 3D! This phone is solving 1.7 billion ODEs per second!

Concluding remarks

  • The proposed GPU technology can expand the types of research we can do!
  • This is not just a replacement of HPC!
  • The speed of the simulations can be illuminating and guiding us in our future studies.
  • The wide availability and universality of the technology, promotes a level field for all groups in cardiac dyanmics.

If you would like to try these programs on your own computer visit:

https://kaboudian.github.io/InterviewSeminarAtFDA/

Special thanks to my great mentor...

Thank you for the opportunity to present this work!

Thank you for your attention!