Skip to main content

Python bindings for Cimba, a multithreaded discrete-event-simulation C library

Project description

Cimba logo

Cimba Python

Fast discrete event simulation for Python

Cimba Python is a Python interface to Cimba, a multithreaded discrete event simulation engine written in C and assembly.

It is designed for Python simulation models that need more speed than pure Python event scheduling can usually provide. In the included M/M/1 benchmark, Cimba Python runs about 8.5-8.9x faster than SimPy, while keeping model code in Python.

On an AMD Ryzen 7 9700X under WSL Ubuntu 24.04, averaged over 10 runs:

Benchmark SimPy Cimba Python Cimba C
Single core, single trial 3.185 s 0.375 s 0.095 s
Multicore, 100 trials 41.820 s 4.698 s 1.178 s

The benchmark data and charts are in benchmarks/AMD_Ryzen_7_9700X_WSL.ods.

Install

pip install cimba

or with uv:

uv add cimba

Python 3.13 or newer is required. The PyPI wheels embed the Cimba C library, so you do not need to install Cimba separately.

What is it?

Cimba Python gives Python models access to Cimba's native simulation engine: processes, event queues, buffers, object queues, priority queues, resources, conditions, random distributions, time series, and summary statistics.

What does the code look like?

import cimba


def arrival(queue):
    while True:
        cimba.hold(cimba.exponential(1.0 / 0.75))
        queue.put(1)


def service(queue):
    while True:
        queue.get(1)
        cimba.hold(cimba.exponential(1.0))


with cimba.Simulation(seed=123) as sim:
    queue = cimba.Buffer("Queue")
    queue.start_recording()

    cimba.Process("Arrival", arrival, queue).start()
    cimba.Process("Service", service, queue).start()

    sim.stop_at(1000.0)
    sim.execute()

    queue.stop_recording()
    print(queue.history().summary().mean)

More examples, tutorials, topical guides, and the API reference are in the documentation.

License

Cimba Python is licensed under Apache-2.0. See LICENSE and NOTICE.

The bundled Cimba C library is also Apache-2.0 licensed. See subprojects/cimba/NOTICE for attribution.

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

cimba-0.2.1.tar.gz (6.7 MB view details)

Uploaded Source

Built Distributions

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

cimba-0.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (403.7 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cimba-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (418.9 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cimba-0.2.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (402.1 kB view details)

Uploaded CPython 3.13tmanylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

cimba-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (415.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64manylinux: glibc 2.28+ x86-64

File details

Details for the file cimba-0.2.1.tar.gz.

File metadata

  • Download URL: cimba-0.2.1.tar.gz
  • Upload date:
  • Size: 6.7 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for cimba-0.2.1.tar.gz
Algorithm Hash digest
SHA256 cad09e4edfe63b400c3a2280e536568899daa3fd6d3dba883021fe35ad2ea4d1
MD5 08ddfe86f003fe0eb22c060f95606d40
BLAKE2b-256 a7b28da85da7d0bfb001fb1376b8a2680585e0c26f7d779d9140ddfd1c3adfc2

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.2.1.tar.gz:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ea359b775cb9e0844532e67e16acff0f3bf3e2f585352629bd48a0af6e776718
MD5 4b369fc47c38835949671dfd34a9bfd6
BLAKE2b-256 c7026aeb8e643279840ffd2d319974c943076a8eb47bd33148d36c404140ae67

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.2.1-cp314-cp314t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c1b7fd270420db21757e836576783cede9a043e92d07985131fd0459633be775
MD5 498f6353307a405484b7e5534b07bac0
BLAKE2b-256 e8cf352b40b12aa8ec245c18966ccccd40f11ec887302d90a9f95f470da4e46c

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.2.1-cp314-cp314-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.2.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.2.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 974793eb0d1e940d52c397f4895eb8217f1c85c9440321f9bc7508149c6d0bd9
MD5 df29960ab74c8e71db36c6daa74d55bd
BLAKE2b-256 c44f3ffd0af3fcd451fbd62a88d9ce4e7f4c86ca0b9e1ae42a7cb4718fc254cd

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.2.1-cp313-cp313t-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file cimba-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for cimba-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3cb6af8cbcf833e24745eb4ea3d44a5b1338ee7dcc38636a42f5850734581fdb
MD5 12e898b7a75e6f3148ed2d03fafc3688
BLAKE2b-256 47ade6e93b30ee00a4d6637fa02a7f639117e0972995e0df9b70a1500c6be112

See more details on using hashes here.

Provenance

The following attestation bundles were made for cimba-0.2.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release.yml on FBarrca/cimba_python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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