Skip to content

Polars Engine

Syed Ibrahim Omer edited this page Apr 13, 2026 · 1 revision

Polars Engine (CPU vs GPU)

The CLI passes engine from -e / --engine into calculate_indicators, which ends up in:

df.collect(engine=engine)

What this controls

engine selects Polars’ execution backend when collecting the lazy plan into a materialized DataFrame:

  • cpu (default): standard CPU execution.
  • gpu: GPU execution when the Polars build and environment support it.

Availability

GPU collection can fail if:

  • Polars is not built with GPU support, or
  • Drivers / CUDA stack are missing or incompatible.

Profiling and tests may skip GPU scenarios when GPU execution is unavailable (see profiling records with status: skipped).

Relationship to “streaming”

The main indicator pipeline is expressed on a LazyFrame and collected once per ticker package. Other code paths (e.g. some test helpers) may use different Polars APIs; this page refers to the main CLI path in calculate_indicators.

When to use GPU

Useful when:

  • Large frames and heavy rolling/EWM work dominate, and
  • Your environment supports Polars GPU collect reliably.

For repeatable benchmarks, prefer cached profiling (deterministic fixture) over live Yahoo data.

Related pages:

Clone this wiki locally