Export to an OpenCL simulation. A driver is provided to run cable simulations and a quick plot script is included.
The generated code requires OpenCL enabled drivers for the GPU or CPU it’s runnning on to be pre-installed, as well as an implementation of the OpenCL libraries. These can be downloaded from various hardware manufacturers’ websites.
The standard interface for exporting and accessing expression writers is provided:
Returns a dict of all exporters available in this module.
- class myokit.formats.opencl.OpenCLExporter¶
Exportercreates a cable simulation that can run on any OpenCL environment (GPU or CPU).
A value must be bound to
diffusion_currentwhich represents the current flowing from cell to cell. This is defined as positive when the cell is acting as a source, negative when it acts like a sink. In other words, it is defined as an outward current.
The membrane potential must be labelled as
By default, the simulation is set to log all state variables. This is nice to explore results with, but quite slow…
Please keep in mind that CellML and other downloaded formats are typically not directly suitable for GPU simulation. Specifically, when simulating on single-precision devices a lot of divide-by-zero errors might crop up that remain hidden when using double precision single cell simulations on the CPU.
- class myokit.formats.opencl.OpenCLRLExporter¶
OpenCLExporterbut uses a Rush-Larsen update step where applicable.
Returns a dict of all expression writers available in this module.
- class myokit.formats.opencl.OpenCLExpressionWriter(precision=32, native_math=True)¶
Converts an equation to a string
Converts an Expression to a string.
- Sets a naming function, will be called to get the variable name from a
fshould be a function that takes an
LhsExpressionas input and returns a string.