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.0.tar.gz (63.8 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.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl (9.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ i686

prime_iroh-0.3.0-cp313-cp313-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

prime_iroh-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.13macOS 10.12+ x86-64

prime_iroh-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl (9.2 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ i686

prime_iroh-0.3.0-cp312-cp312-macosx_11_0_arm64.whl (7.2 MB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

prime_iroh-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.12macOS 10.12+ x86-64

prime_iroh-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl (9.2 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ i686

prime_iroh-0.3.0-cp311-cp311-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

prime_iroh-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.11macOS 10.12+ x86-64

prime_iroh-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl (9.2 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ i686

prime_iroh-0.3.0-cp310-cp310-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

prime_iroh-0.3.0-cp310-cp310-macosx_10_12_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.10macOS 10.12+ x86-64

prime_iroh-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.8 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

prime_iroh-0.3.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl (9.2 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ i686

prime_iroh-0.3.0-cp39-cp39-macosx_11_0_arm64.whl (7.3 MB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

prime_iroh-0.3.0-cp39-cp39-macosx_10_12_x86_64.whl (7.5 MB view details)

Uploaded CPython 3.9macOS 10.12+ x86-64

File details

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

File metadata

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

File hashes

Hashes for prime_iroh-0.3.0.tar.gz
Algorithm Hash digest
SHA256 99d197edfb949063cb414bea473cedf4fe15ee7206f1214d2dde55b6269a14d8
MD5 8eb7e3e9964bf8d37de19116fc3d7800
BLAKE2b-256 7a8c96fe94f5e863815db11e41854a31368459975dce783bcbc99e2e9e2ecf9d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 acbe07f01e28785c5d4f70e7cd274694f335d35ad293de7d632faa9a52963d91
MD5 706695e8e7536f2dce7b30b64d8d6156
BLAKE2b-256 433f4ec09dce3fd685ae8c2faff1da1d52a846424bc31c461e4abd45e96e29ae

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp313-cp313-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 19d8fa3b60ba21c4e363659f72a2adfea189eaf690046cf16fbc9d00699b7f78
MD5 2e7c02f1ccf9d10e8766ad3aee0a70ba
BLAKE2b-256 621f538fba961e2e12bd3cb74ddf6aa09777e7e06f99d5b33191b6d2edad911b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 a17e974deb7cc938183031d94157c3aa48416ead727c44e119d5ff1279acb678
MD5 52636c233dad5f3db87fb1b3c8ee4329
BLAKE2b-256 75a8fdefe5c6da1795b996fd1f373b33cc1278f53b8420625724969f493583ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp313-cp313-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4f1aa24d3063508a76678b1cec522bab927fdb5be731ecba15f05aa30359d465
MD5 ae5ed829945f32c5484cdc42fab43d0f
BLAKE2b-256 88641f58ec7d94fd66b99e8ba5abe853b0d701cf6b4eecda1399ee2a2867e634

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 8d6ff7373dcbe2b2423b2a434877619be24a8e54afda0ddfc1de9f2e3963d13f
MD5 bc184d26a6ed36dd369ff88042bae28d
BLAKE2b-256 22661f507ca5b144b58aa5532f1975be71ddb5e9605d2fb274cafa5630ffd176

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp312-cp312-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 c7c3b46c106e1045046260d98514b20ae26ec145828fb858ee33e92f40a44469
MD5 b91c2e3e4b2912d3bbf7737471ff2591
BLAKE2b-256 b5a710a2cc633a36a6f6283037fbfc55de1b4f1a8925b90d2cce47b6325a8728

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3ece5968049cfe97d551bda7962f607f1f7c20d0b69dba3e7307836a78ed8e68
MD5 f5a76ef31a3b180f8d5420190ddfebc9
BLAKE2b-256 1f071eea2b71229d07856d323d21fe92a3bddb5395bc38f95298f434421c9467

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp312-cp312-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 d0d3d2e667710577e567cd7657335f65ac047e721b756bc440f0e1564cad94ab
MD5 3e51139945df4753f854d07f652eb76c
BLAKE2b-256 c34e8c5473aad4141699159abbee209da78ea9b5f338f10d8a3bf961527fb92a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 71ed80b8cdb040bc5e7a2548b482785591173c205846bc5a2c42afa1f4c48a39
MD5 057d6d83dbf2c0634e286cfc90e5e56d
BLAKE2b-256 519d1d045c5951bf06adedc1e20aaca53b3f162051476ce575dfc94cf7b484d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp311-cp311-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 3f29b3afd56d87b379626c7036c43eab574ac8aab0078711f6916157abaa374e
MD5 ae06f48ecdbc387dd1e185d140e2dfe3
BLAKE2b-256 e2fbfb46fbd2faafda5e0a1ec48341461360d29577d6e74bb4e6ba76644c540c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 f298f630625c07b238c0dfaf1e9591116580fe47ee91dc73deccde54f78deeb6
MD5 b24aea52326c46f878e7f36a6e9b2623
BLAKE2b-256 c2895d632436a0e767f86549f6ade259fcba0383f246d96ebc5acf47e4f605c9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp311-cp311-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 4bd095087a7d4a3b8e909cb76f321a6c5062315fe2be63a9d6ed69c78f04d8cc
MD5 e94d0494db5cd85f55476a87a072a3c5
BLAKE2b-256 2a82aed298aff61334b3c8b300a64b1839a3b6d55c3a9ce3c0090a56b33253de

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d637629e91934f99f1fd5c6077aea870e9765a4795fd05fb6e366306da33601f
MD5 d650a9448c7e6106082e681406bbd1c0
BLAKE2b-256 d5b6b15da124625457ca1cc17a8ea4e85d1263ccbfff845dd7a46f3d4c76182b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp310-cp310-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 6b9dc4f022ace226d7f25f0c995230703db56b48a465312c7fe78f57ad10f3a1
MD5 8b2e0ec10a17de4068bb912fe9a389fb
BLAKE2b-256 7b6fa2453a0fa195b9df644dc7becab915a55ef60edbf721d17b2036c000bffd

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9650f76739c56b333545ffb0070f678dddb729b237088cb111408af2ed10e63a
MD5 4d0249e658ff4f251b0f257499a45721
BLAKE2b-256 0d79f924965d5cbeaa8443941299209eb225b943f9dc1edcaa15842f0882ac3c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp310-cp310-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 cfcf3ab1ae7419245c748f0c5fe98738e65efc12e3ec005810e9f2048a48a129
MD5 98dd901cee162a9a6552e3437aadb3f8
BLAKE2b-256 349d7d004bc6a0d1384db2694860084b8dc4780f1fb8f245839d6c52e992da70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 2ed84eee0f24081e69c892c5c89adf596ca01b598ec8c04d331a8d6f9ea55839
MD5 2ba056842e1d6e336c17e967029d8b19
BLAKE2b-256 2059f425e2777d661dc930b9a7fcad348be3fdd921a7473286d5944366e02c0b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp39-cp39-manylinux_2_17_i686.manylinux2014_i686.whl
Algorithm Hash digest
SHA256 554f62380b4b34f73bfdd0ea29a18acca2568c8260bd6aa0898f7531ebf9a533
MD5 7cf8b6afa9065c24f5896fdc85636c27
BLAKE2b-256 39680cf3e07bd88227a88f22938714f51e1c82a04b646d54c2b36f1563d4e96b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 63251c5b357282d8b87e038206e0807110c81fe250bc9fb11d469c8413d8cec5
MD5 283b206ce4e02197cae76f4b4f6ecb0c
BLAKE2b-256 64172553d549095942199a4f7fc59681d2570683cbd4ef1dece608b63403dd79

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for prime_iroh-0.3.0-cp39-cp39-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 8630a7c28059b029197879bce46270af27c627e666818f397a28d298247d89c3
MD5 2f5498a9780c01d9694f71b08a4320a6
BLAKE2b-256 01ae7112daaf685ec918d324e56c4715643d2bb90999ea60e7cf62685f3cd49e

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