pygloo
Pygloo provides Python bindings for gloo. It is implemented using pybind11.
It is currenlty used in Ray for collective communication between CPUs.
Requirements
Python >= 3.6
Installation
Install From Wheels
We provide prepackaged Python wheels (manylinux2014_x86_64,manylinux_2_24_x86_64). To install from wheels:
pip install pygloo
Building from source
One can build pygloo from source if none of released wheels fit with the development environment.
Pygloo uses Bazel to automatically manange dependencies and compilation. To compile from source, install Bazel>=2.0.0 following the Bazel installation guide. After installing Bazel, build and install pygloo following this command:
python setup.py install
Testing
Pygloo uses Ray to create multiple, distributed processes for collective communication tests. See tests directory.
Example
An example for allreduce.
import os
import ray
import pygloo
import numpy as np
@ray.remote(num_cpus=1)
def test_allreduce(rank, world_size, fileStore_path):
'''
rank # Rank of this process within list of participating processes
world_size # Number of participating processes
fileStore_path # The path to create filestore
'''
context = pygloo.rendezvous.Context(rank, world_size)
# Prepare device and store for rendezvous
attr = pygloo.transport.tcp.attr("localhost")
dev = pygloo.transport.tcp.CreateDevice(attr)
fileStore = pygloo.rendezvous.FileStore(fileStore_path)
store = pygloo.rendezvous.PrefixStore(str(world_size), fileStore)
context.connectFullMesh(store, dev)
sendbuf = np.array([[1,2,3],[1,2,3]], dtype=np.float32)
recvbuf = np.zeros_like(sendbuf, dtype=np.float32)
sendptr = sendbuf.ctypes.data
recvptr = recvbuf.ctypes.data
pygloo.allreduce(context, sendptr, recvptr,
sendbuf.size, pygloo.glooDataType_t.glooFloat32,
pygloo.ReduceOp.SUM, pygloo.allreduceAlgorithm.RING)
if __name__ == "__main__":
ray.init(num_cpus=6)
world_size = 2
fileStore_path = f"{ray.worker._global_node.get_session_dir_path()}" + "/collective/gloo/rendezvous"
os.makedirs(fileStore_path)
ray.get([test_allreduce.remote(rank, world_size, fileStore_path) for rank in range(world_size)])
License
Gloo is licensed under the Apache License, Version 2.0.
Metadata
Release files for pygloo 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distributions (wheels)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pygloo-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.10 | CPython 3.10 | Linux glibc 2.17+ x86-64 | Details |
| pygloo-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.9 | CPython 3.9 | Linux glibc 2.17+ x86-64 | Details |
| pygloo-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | CPython 3.8 | Linux glibc 2.17+ x86-64 | Details |
Total release size: 3.1 MB
Release files / pygloo-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pygloo-0.2.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.10 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
cad24999074ac226aea2c323318209c458476856bb64b8e6f7d342a3dc9323f2
|
|
BLAKE2b-256 checksum How to use checksums |
418d6589f34e1dc55cec71305e9b373b556b80b063bd27e2a8ba82384e1cc868
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Release files / pygloo-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pygloo-0.2.1-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.9 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3039c065011e2b3067512beefc91ed6a825e91c056482301a58cf23603cd6d8e
|
|
BLAKE2b-256 checksum How to use checksums |
f459cbd050213a64ebc1efe445158ccd7eea32d46a92289d6b8a49efd57a5a38
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Release files / pygloo-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | pygloo-0.2.1-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 1.0 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 |
|
SHA-256 checksum How to use checksums |
3c727423d9ecbc8eb6da711b04af6ab4b3d099f10749fb91f8008b95b6bb0037
|
|
BLAKE2b-256 checksum How to use checksums |
e59079ecfb8e39c7132045f361045061fad38a182763a9b4517cf9f392bab16d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.10.14
|
Security for pygloo 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.