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.4.0.tar.gz (45.0 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.4.0-cp313-cp313-manylinux_2_34_x86_64.whl (190.8 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

starway-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl (190.8 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

starway-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl (191.0 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

starway-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl (191.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

File details

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

File metadata

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

File hashes

Hashes for starway-0.4.0.tar.gz
Algorithm Hash digest
SHA256 151daf18dd1d447fa47df6032da3e67cec2f0148def5ff65c198c1a3da96705b
MD5 5bbbde5dd9bf1578d684bba5f8b8b5e9
BLAKE2b-256 74da018b68d27428b2637efac98e960bcb0cab11249f98eb71b20e70f5adb351

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.4.0.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.4.0-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.4.0-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 3aab9782a814417f1bc4c454c012cdda5ef3920da065d0f26aa9b4de16cbdb34
MD5 a31d48bac6b7da7f8718464c62c5f41c
BLAKE2b-256 7cf7b4c4a714f3b3c84f8256cc7f71da02a4a1dcdfcd965fbfc08b27cd1601fe

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.4.0-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.4.0-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.4.0-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 db3acdd65c41de2acf60ca37b5b0b4f1fe0d4a74acf76d375a84b4562c6354d0
MD5 4af7b3de03872a492c6e51ee131a8a29
BLAKE2b-256 6104e613ebb093d25f5348a5f9ab8342a132ddf9d3c835b9ac882e096463c3da

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.4.0-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.4.0-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.4.0-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 5ed6341c2bdd6bc8a5127b8e0cc44a9c2c01bf6c496760f6ce9bbc3bc8e93942
MD5 567e91587350adb5d3bcbde8f91ce1b8
BLAKE2b-256 2e6d29016dc8d54c29f2ae922855f5deb98e185d18dd9ed449ad367f4f770f9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.4.0-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.4.0-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

File hashes

Hashes for starway-0.4.0-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ed75d221ff4af847180e92e2739b3f921c04092bd816ae3749def0be80816c09
MD5 b28fcc45db5953fc65f1c4bbe8cf25b3
BLAKE2b-256 dd7ab0fe94624885a5891d08086d3773017dc053fe5aee6178047d4e9ecbf62f

See more details on using hashes here.

Provenance

The following attestation bundles were made for starway-0.4.0-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