Skip to main content

Starway UCX P2P communication lib.

Project description

Starway

Starway aims to be an ultra-fast communication library, which features:

  1. Zero Copy, supports sending from pointer and receiving into pre-allocated buffer.
  2. RDMA support, by utilizing OpenMPI/OpenUCX for transportation.
  3. Ease of use, generally should work out of the box, and don't require much configuration efforts.
  4. Full-duplex, asynchronous API.

Current Python alternatives are lacking core features:

  1. ZeroMQ, no support for RDMA.
  2. MPI, hard to use, hard to setup environment properly.

Installation

Starway depends on OpenUCX, which must be linked dynamically. There are two options:

  1. Install OpenUCX system-wide, or whatever method you like as long as it can be found dynamically.
  2. Install libucx-cu12 wheel package, which contains libucx.so files that can be loaded by Starway during initialization.

We don't add libucx-cu12 as Starway Python dependency by default, but generally you can install it on your cluster machines as a fallback option: when libucx cannot be found in system, it would look for wheel installation.

You can use environment variable to control System/Wheel preference:

import os
os.environ["STARWAY_USE_SYSTEM_UCX"] = "false" # defaults to true
import starway  # now we will use libucx-cu12 pypi wheel package, while falling back to system if not found

Full-Duplex Communication

Starway now supports full-duplex communication, allowing for simultaneous, two-way data exchange between the client and server. This feature significantly improves the library's responsiveness and efficiency in handling real-time data streams.

Usage

Here's an example of how to use the full-duplex communication feature:

import asyncio
import time
import numpy as np
from starway import Client, Server

async def tester():
    server = Server("127.0.0.1", 19198)
    client = Client("127.0.0.1", 19198)
    
    # Client to Server
    send_buf_c2s = np.arange(10, dtype=np.uint8)
    recv_buf_c2s = np.empty(10, dtype=np.uint8)
    
    # Server to Client
    send_buf_s2c = np.arange(20, dtype=np.uint8)
    recv_buf_s2c = np.empty(10, dtype=np.uint8)

    # Wait for client to connect
    while not (clients := server.list_clients()):
        time.sleep(0.1)
    client_ep = clients[0]

    # Perform concurrent send and receive
    client_send_future = client.asend(send_buf_c2s, tag=1)
    server_recv_future = server.arecv(recv_buf_c2s, tag=1, tag_mask=0xFFFF)
    server_send_future = server.asend(client_ep, send_buf_s2c, tag=2)
    client_recv_future = client.arecv(recv_buf_s2c, tag=2, tag_mask=0xFFFF)

    await asyncio.gather(
        client_send_future,
        server_recv_future,
        server_send_future,
        client_recv_future
    )

    assert np.allclose(send_buf_c2s, recv_buf_c2s)
    assert np.allclose(send_buf_s2c, recv_buf_s2c)
    
asyncio.run(tester())

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

starway-0.2.6.tar.gz (37.9 kB view details)

Uploaded Source

Built Distributions

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

starway-0.2.6-cp313-cp313-manylinux_2_34_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

starway-0.2.6-cp312-cp312-manylinux_2_34_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

starway-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl (83.9 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

starway-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl (84.2 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

Details for the file starway-0.2.6.tar.gz.

File metadata

  • Download URL: starway-0.2.6.tar.gz
  • Upload date:
  • Size: 37.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for starway-0.2.6.tar.gz
Algorithm Hash digest
SHA256 2a3ade766802191ff648c49c82a76206937a1b3db043cca31f9c304c312f288f
MD5 9c0c1dbddb59688c8a844b4499153810
BLAKE2b-256 3347e35aeaf64a70001b28bceb3da49320936fbe2c9cd12d65a5af748fc6e65e

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.2.6.tar.gz:

Publisher: wheels.yml on Clouder0/starway

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

File details

Details for the file starway-0.2.6-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.2.6-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 85580aa8e093764faf26f6729a3f445bf7e1e184bbe12fc6c8605752944f3480
MD5 a8ae2e42f6cbad4e76e35cb660619dca
BLAKE2b-256 a96c809dbd004392fef4a7ca4633abbf0637d075963607a9356bb6fb0060e0f4

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.2.6-cp313-cp313-manylinux_2_34_x86_64.whl:

Publisher: wheels.yml on Clouder0/starway

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

File details

Details for the file starway-0.2.6-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.2.6-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 b17121679e7bc64c7f05aa3663a3dc013e143b532c286c8ad0c678f8f55c2412
MD5 c597eab9348abc083969699a555dca9e
BLAKE2b-256 a693c4d3706ee17b5d79c4df3a0c07150109c7b705a3e9c60006188026f52f89

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.2.6-cp312-cp312-manylinux_2_34_x86_64.whl:

Publisher: wheels.yml on Clouder0/starway

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

File details

Details for the file starway-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e98b11b7bff9391dcb9647aea88df4b2946b5d311f0e310c3ab3bf2a2013c0c9
MD5 af7f39238dbc4839a483a514555ce933
BLAKE2b-256 72917a020fc623a1065254317d32f07446ab0aadae99845e8b6750c6e6253516

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.2.6-cp311-cp311-manylinux_2_34_x86_64.whl:

Publisher: wheels.yml on Clouder0/starway

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

File details

Details for the file starway-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7458b14fe6e19810b931b0fcf6700dd50bf764f1144f2b7328288a842cd0a5a4
MD5 61e00e62d29b9c5145a700bd86519c74
BLAKE2b-256 0f37a3f8b7cfd5f8477a3e73e6f8194c9e660207db9157393744146a889c8b30

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.2.6-cp310-cp310-manylinux_2_34_x86_64.whl:

Publisher: wheels.yml on Clouder0/starway

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