numba

Compile numerical Python functions with Numba JIT decorators.

7|1|Updated Jun 22, 2023
One-click install
npx skills add https://github.com/Konjkov/pycasino --skill numba-konjkov
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: numba
Source: https://github.com/Konjkov/pycasino/tree/main/.claude/skills/numba
Command: npx skills add https://github.com/Konjkov/pycasino --skill numba-konjkov

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Numba JIT compilation makes numerical Python code run at native speeds by compiling hot paths to optimized machine code, addressing the performance gap between Python and compiled languages.

Core Features & Use Cases

  • JIT compilation: Decorators like @nb.njit and @nb.jit to accelerate functions with minimal code changes.
  • NumPy interop: Efficient handling of NumPy arrays and operations inside JIT-compiled code.
  • Advanced capabilities: parallel=True, nb.prange, vectorize, guvectorize, nogil, fastmath with caveats.
  • Debugging & profiling: Tools and patterns for diagnosing typing or nopython-mode issues and inspecting compiled code.

Quick Start

Annotate a small numerical function with @nb.njit and compare its performance to the pure Python version.

Frequently Asked Questions about numba

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I speed up slow Python numerical loops with JIT compilation?

JIT compilation accelerates numerical Python loops by compiling hot paths to optimized native machine code using decorators like @nb.njit, bridging the performance gap to compiled languages with minimal code changes.

Does Numba JIT work with NumPy array operations in nopython mode?

Numba JIT provides efficient NumPy interoperability, allowing you to handle and process NumPy array operations directly inside nopython mode to achieve native execution speeds without Python overhead.

What is the best way to parallelize NumPy-heavy kernels in Python?

Parallelizing NumPy-heavy kernels involves using Numba's parallel=True parameter alongside nb.prange for loop parallelization, and leveraging nogil optimizations to bypass Python's Global Interpreter Lock for multi-threaded execution.

How do I debug typing and nopython mode issues when using JIT decorators?

Debugging nopython mode typing issues involves using Numba's built-in diagnostic tools and inspection patterns to identify unsupported Python operations, verify type inference, and review the generated compiled code.

When should I not use JIT compilation for numerical computations?

JIT compilation is not suitable when numerical code relies heavily on unsupported Python objects, dynamic typing, or complex external library calls that fall outside of nopython mode limitations and fail to compile.

Can I use vectorize and guvectorize to optimize numerical functions?

Yes, you can use @nb.vectorize to create generalized universal functions and @nb.guvectorize for array-wide operations, enabling efficient JIT-compiled execution across array elements with optional fastmath caveats.