Skip to main content

Asynchronous P2P communication backend for decentralized pipeline parallelism, built on top of Iroh

Project description

Prime Intellect

PRIME-IROH: P2P Pipeline Parallel Communication


This library exposes a Python interface for reliable, asynchronous peer-to-peer communication built upon Iroh. The core classes exposed are:

  • Node: A class combining a single-peer sender/ receiver in one class, allowing to send to exactly one and receive from exactly one (potentially different) peer. The class allows for concurrent communication by opening multiple, consistent streams.
  • SendWork: A class representing the future of an asynchronous send operation, that can be awaited using a wait method.
  • RecvWork: A class representing the future of an asynchronous receive operation, that can be awaited using a wait method.

Because we are building on top of Iroh, we get many nice networking features out of the box. Most importantly, the library guarantees reliable P2P connections between nodes, trying to establish directions connections whenever possible, and falling back to NAT-hole punching and relaying when necessary. The API is mirroring the way asynchronous communication is handled in torch.distributed, i.e. exposing isend and irecv that return work objects that can be awaited using a wait method. This allows for a clean integration with the rest of the PyTorch ecosystem.

Installation

Quick Install: Run the following command for a quick install:

curl -sSL https://raw.githubusercontent.com/PrimeIntellect-ai/prime-iroh/main/install.sh | bash

Manual Install: First, install uv and cargo to build the project.

curl -LsSf https://astral.sh/uv/install.sh | sh
source $HOME/.local/bin/env
curl https://sh.rustup.rs -sSf | sh
source $HOME/.cargo/env

Then, clone the repository

git clone git@github.com:PrimeIntellect-ai/prime-iroh.git && cd prime-iroh

To build the Rust backend run cargo build, to build the Python bindings run uv sync. This will let you install prime-iroh as a Python package within the virtual environment.

uv run python -c "import prime_iroh"

Examples

You can find the basic usage examples in the rust/examples and python/examples directories showing unidirectional and bidirectional communication patterns in Rust and Python.

Run unidirectional communication example:

# Rust
cargo run --example unidirectional
# Python
uv run python python/examples/unidirectional.py

Run bidirectional communication example:

# Rust
cargo run --example bidirectional
# Python
uv run python python/examples/bidirectional.py

You can set the log level by setting the RUST_LOG environment variable. For example, to see info logs from the prime-iroh crate, set RUST_LOG=prime_iroh=info.

Tests

We include unit tests and integration tests for Rust and Python.

Rust Tests

Run full test suite (unit and integration tests):

cargo test

Note: To run the tests with verbose output, use cargo test -- --nocapture.

Run single unit test, e.g. tests in src/node.rs (this will pattern match the test function names):

cargo test node

Run single integration test, e.g. tests/connection.rs:

cargo test --test connection

Python Tests

Run full test suite (only integration tests are available for now):

uv run pytest

To run the tests with verbose output, use uv run pytest -s.

Run single test, e.g. python/tests/test_unidirectional.py:

uv run pytest python/tests/test_unidirectional.py

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

prime_iroh-0.3.1.tar.gz (63.7 kB view details)

Uploaded Source

Built Distributions

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

prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (9.0 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

prime_iroh-0.3.1-cp313-cp313-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

prime_iroh-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (9.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

prime_iroh-0.3.1-cp312-cp312-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

prime_iroh-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (9.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

prime_iroh-0.3.1-cp311-cp311-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

prime_iroh-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (9.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686

prime_iroh-0.3.1-cp310-cp310-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

prime_iroh-0.3.1-cp310-cp310-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.6 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (9.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686

prime_iroh-0.3.1-cp39-cp39-macosx_11_0_arm64.whl (7.1 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

prime_iroh-0.3.1-cp39-cp39-macosx_10_12_x86_64.whl (7.4 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

Details for the file prime_iroh-0.3.1.tar.gz.

File metadata

  • Download URL: prime_iroh-0.3.1.tar.gz
  • Upload date:
  • Size: 63.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: maturin/1.8.6

File hashes

Hashes for prime_iroh-0.3.1.tar.gz
Algorithm Hash digest
SHA256 5421c9d7e6a86243067fd80e4c94d29983eac2e514c07d8578f5a9ad94f40c3f
MD5 4e5ff5b5e2a330d8a4ed478d7c5223e2
BLAKE2b-256 57899f229ffd4243321ef398fc9338a059e02ec266f8bd3b0b14485a851354b1

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 f5df35da5a7975c212b03f1276af1dd124d507abc2214763670605eabd9a2773
MD5 14aed5008a44ed00681fc666ab6e695b
BLAKE2b-256 4136359e859d14323bab1033b97e206ba632f30311df9ae4103ae4488a46b821

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c3b3788817dba5df00c55c5d84b02197772d05d7f8a614c47d4747883004b0f4
MD5 4484105df9e8da01d70547b9a41f46e5
BLAKE2b-256 26432075bacd7dfaa11457056b09b200b57844e7a237f4a72f3558c1676da996

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 29625ec1c53995b1c103b449fca8c28adb44f44748785d2bf01850ba064738e2
MD5 be3fd20d2f8c14783bd1e9045b8de2fc
BLAKE2b-256 dbf112b897b252c7d9098d2733f3ccbff2f859586a10a542f47a61b84861ed30

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 fd5667d4e13ea0edb635d2b9627581e57b83da41deb72b4e00d130abd5f07fea
MD5 2b581cea7add50b3aa4fbe3e480ff923
BLAKE2b-256 fcedb11620e86f6055a0bc9cdcf3583b73b2fe4798a48ece60a0cd1164346b36

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 cb5312c1b2fba7220e4d178f27f07f5d3ededb0cea55d52c65ac8dd424a25aa0
MD5 698529cc0459ca8219646248126d446a
BLAKE2b-256 b37bc4b69e63e8ae399d87ed15ee4e0e0a548c2e65d1d4d8758ba0bb61653b32

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 ad43bc215575e0310513dd70fdaea2105d8b7a8cce5109309c80303cec074654
MD5 cfd52c351393f3d46198e3a4d11307b4
BLAKE2b-256 5f364b1ab173d926ea65cbf850609b7eba7a4d61bde3ea407b9a03162cc4b8cc

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 17a76302c98587f3d5b9721efde9d82a572a774fa5c44f9de1b491d1a360a4d3
MD5 3d4a90bd8db07af71f15c2dc836fd607
BLAKE2b-256 b36a8cad0e1d04c0307fd2bb1e021277523702d53c097fb29f54df08afe37677

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 344cf2819d82db5caa92862c0596e8a26404fa75848a658667525a9a7a4a11ca
MD5 ec28acae95bff6fc0f0482ab610dbcf2
BLAKE2b-256 dfe7c51ebc8d6e70d847f7673359aff5827f5a1c8238f2613cce1a6bc3395031

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 dc924f1085ef276f5cbe216e5194b34d11a15072d507fb6ae97b131ad02deb4b
MD5 04a32c54d8c139d8c9f199b96e9cb668
BLAKE2b-256 7dfea5c941b6f3ae52cdaac9ab01fa4506fc24d0031b22065fad01f784dfc98d

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 f16d71e36cb0adee50ffe3ec817f97603adeaa532de80eaa990133cd125fe03d
MD5 fa213a5962489fc5b73fe64dfdedbdba
BLAKE2b-256 ba8832d53cd9e6bf3b6266f2c7c6155c97bebfa2f6aab58b9901beb789b536ef

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 57476f193f83ae5e23ffbdade626cf97ae7683e04cb9021c521e27db3abd95c2
MD5 026898bf60ec1eb01d2983ccc18c4927
BLAKE2b-256 df4ab9b290732028289eea4009aeafd36fb78dab9b55142804388bf21449c85f

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1a57f1dc0798123905e3cd495ab8aa0b94871b45aa6ab0e8e8d645ec69fdbc93
MD5 506917f43e079a1f0f75e634ed9bc47b
BLAKE2b-256 fdead4bea6f58c526364b702be9d27eed0c9164448a996bfaa59f3ef76ab6217

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 e9b67f5699fe9d6f5f22476b43249b5074c41a0e6899d159c5fec190739b2b25
MD5 903c0eb97b6a5a09a4243d40aab67e4e
BLAKE2b-256 81be8298270792130bfad8a0a54decccd32b538a54ed36ee98d1466792431450

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 331e9ca642bd1d48e8deac33a9cf653bbc41a64240aac5e4f92c2122f6f89856
MD5 d54f474d0e17e14b40dcbe86f5b074c6
BLAKE2b-256 4b27a539974eab51666027e4f690dc23d0170012feb344203492095211006edf

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 09cbde43dc201dc3e52d9111e5c922433ac9057459631c748a8d081f539c7356
MD5 5f525d2bc8693c2df9660ab3ce704350
BLAKE2b-256 ecccca423da3712ba02ac03ef9baddc0b6db4912206ff40a6ccff8ccc7d1d2ae

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp310-cp310-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 9c069f197c4d00d8d7a8af260ac9fca9a81646d2b3535c6f58e79333ec22b4b3
MD5 720e1af9f5c3ce4dedefb1904b68af20
BLAKE2b-256 34e77fc0f3fb6548489b252fbb65ee98c509a468aa92ade0964057360a2f1e2d

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 91c037597a3a6042440e3b451010cbbb7d5758edb0538ec8468ec763a2dac0c1
MD5 fdee869025b5dd6c56db3bcca38203bc
BLAKE2b-256 cc6daea07a42d72057704db558250e97d8f0e7f8f5340280727d36776f3467e1

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 27b28c0fe51e46f617cbdfeced5faa9ca92dfceaf1c6d10311f853b388b3eebe
MD5 84156c90f0f7de81927d97810401edfb
BLAKE2b-256 e28eec12f7a6de34be2975f1dac5c9b6a9c5f5d1aa8c22b1645178dd51b10387

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48bd9d58106170cfe4afce2cff62b2489116a6727f3fb2eb3834ddfb080dc64f
MD5 bc12bab33039e1bda0e358df1acedbde
BLAKE2b-256 1fce724f61e3dfad31aacd9a9abc65dec52cd58760f34abbdcafcb7a89d9c4b3

See more details on using hashes here.

File details

Details for the file prime_iroh-0.3.1-cp39-cp39-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for prime_iroh-0.3.1-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 1d019dc8e0fe3c61e33a90087f698bdaa3b8a68a8c449350ca45375edf423658
MD5 51565346d3f3ce2758015f15b4b39702
BLAKE2b-256 af2173863ae5198e5f6cdc41f8651cf47a83dddc8c2d599b81ea62aae2d65b6e

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