Skip to main content

Eiko: the GPU-accelerated Eikonal equation solver

Project description

Eiko

Eiko is a GPU-accelerated Eikonal equation solver, enabling fast computation of the shortest time-of-flight through an arbitrary 2D or 3D medium.

A few reasons to use Eiko:

  1. Eiko is fast - up to 10x faster than comparable libraries.
  2. Eiko is differentiable, allowing it to be used with PyTorch or JAX.
  3. Eiko supports advection, allowing it to compute apodizations through a lens.

Image of example

Installation

Requirements

Because Eiko compiles custom CUDA kernels during installation, your system must have the following:

  • OS: Linux or Windows
  • Hardware: NVIDIA GPU
  • Compiler:
    • A C++ compiler (e.g., GCC for Linux, MSVC for Windows)
    • The CUDA Toolkit (provides nvcc)

Installing for MATLAB

Run setup.m to install Eiko for MATLAB.

Installing for Python

Run

pip install eiko

You now have Eiko installed and ready for use.

See also the Eiko Python installation guide.

Quick Start

An example of how to use Eiko is shown below.
See EXAMPLES for many more examples.

MATLAB example

% 1. Setup grid parameters.
N = 101;            % Number of grid points (NxN grid)
dx = 0.001;         % Grid spacing in meters (1 mm, for example)
c = 1540;           % Speed of sound in m/s (uniform medium)

% 2. Create the slowness map (1/velocity).
f = ones(N, N, 'single', 'gpuArray') / c;

% 3. Initialize the time-of-flight field.
u_init = inf(N, N, 'single', 'gpuArray'); % Unknown points set to infinity.

% Set a point source at the center of the grid to time = 0.
center_idx = ceil(N/2);
u_init(center_idx, center_idx) = 0;

% 4. Compute the numerical solution using eiko.
u_numerical = eiko(u_init, f, dx);

% 5. Visualize the result.
% Create physical coordinate axes in millimeters using dx
axis_mm = ((1:N) - center_idx) * dx * 1000;

% Set up plot.
figure;
imagesc(axis_mm, axis_mm, u_numerical * 1e6);
axis image;

% Format axes and text size.
title('Time-of-Flight Field', 'FontSize', 14, 'FontWeight', 'bold');
xlabel('x (mm)', 'FontSize', 12, 'FontWeight', 'bold');
ylabel('y (mm)', 'FontSize', 12, 'FontWeight', 'bold');

% Format colorbar.
cb = colorbar;
cb.Label.String = 'Time (\mus)';
cb.Label.FontSize = 12;

For 3D inputs, call eiko3d.

Python example

from eiko import eiko

# 1. Setup device and grid parameters.
device = torch.device("cuda")
N = 101
dx = 0.001  # Grid spacing in meters (1 mm)
c = 1540.0  # Speed of sound in m/s (uniform medium)

# 2. Create the slowness map (1/velocity) on the device.
f = torch.full((N, N), 1.0 / c, dtype=torch.float32, device=device)

# 3. Initialize the time-of-flight field.
# Unknown points are set to infinity
u_init = torch.full((N, N), float('inf'), dtype=torch.float32, device=device)

# Set a point source at the center of the grid to time = 0.
center_idx = N // 2
u_init[center_idx, center_idx] = 0.0

# 4. Compute the numerical solution.
u_numerical = eiko(u_init, f, dx=dx)

For 3D inputs, use from eiko import eiko3d.

The result should look something like this:

Image of example

Project Layout

The files are as follows:

Eiko/
├── examples/       # Example scripts (tomography, lens design, etc.).
│   ├── matlab/     #   MATLAB example scripts 
│   └── python/     #   Python example scripts
├── matlab/         # MATLAB Eiko library
├── python/         # Python Eiko library
├── src/            # Core CUDA C++ Eiko implementation and interface
├── pyproject.toml  # Python package configuration (for pip install)
├── setup.m         # MATLAB compilation and setup script
├── THEORY.md       # Mathematical background and Eikonal algorithm details
└── README.md       # This file

To learn more about how Eiko works, see THEORY.

Citing

You can cite Eiko as

@misc{eiko2026,
  author = {Pr{\ae}sius, Sebastian},
  title = {Eiko: the GPU-accelerated Eikonal equation solver},
  year = {2026},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/sebftw/Eiko}}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

eiko-0.8.0.tar.gz (43.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

eiko-0.8.0-py3-none-any.whl (48.2 kB view details)

Uploaded Python 3

File details

Details for the file eiko-0.8.0.tar.gz.

File metadata

  • Download URL: eiko-0.8.0.tar.gz
  • Upload date:
  • Size: 43.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for eiko-0.8.0.tar.gz
Algorithm Hash digest
SHA256 3e76684372ffd5f12648e8936fdcb711c283cf447acdc753c041313b3a7aed2d
MD5 5bf9adc30fc3d2751699d96986c28e99
BLAKE2b-256 9fdeb3d9fe12a0d611e69ac1578274438048f7249e70cf880980ef36ee02e3a0

See more details on using hashes here.

File details

Details for the file eiko-0.8.0-py3-none-any.whl.

File metadata

  • Download URL: eiko-0.8.0-py3-none-any.whl
  • Upload date:
  • Size: 48.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for eiko-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f3e17e6e75e6519e9189d59e21b1703960b627880edce880d9f31197601dac0f
MD5 a6d67bf0f93ac105a24750845bae580b
BLAKE2b-256 30aa55bf11b10112ee3fb3be0f2f6f4061bdf99e3beca43ba718778b31379e81

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page