ArrayFIFO
A FIFO buffer (queue) for efficient sharing of numpy arrays between multiple processes. Faster than multiprocessing.Queue because it uses shared memeory as a ring buffer, rather than pickling data and sending it over slow pipes.
Inspired by ArrayQueues. ArrayFIFO uses locks to support more than one producer and comsumer process, and it supports arrays whose shape and dtype can change arbitrarily with every put call.
Usage example
import numpy as np
from multiprocessing import Process
from arrayfifo import ArrayFIFO
def produce(queue):
for i in range(20):
random_shape = np.random.randint(5,10, size=3)
array = np.random.randn(*random_shape)
queue.put(array, meta=i)
print(f'produced {type(array)} {array.shape} {array.dtype}; meta: {i}; hash: {hash(array.tobytes())}\n')
def consume(queue, pid):
while True:
array, meta = queue.get()
print(f'consumer {pid} consumed {type(array)} {array.shape} {array.dtype}; meta: {meta}; hash: {hash(array.tobytes())}\n')
queue = ArrayFIFO(bytes=10e6)
producer = Process(target=produce, args=(queue,))
consumers = [Process(target=consume, args=(queue, pid)) for pid in range(3)]
for c in consumers:
c.start()
producer.start()
Metadata
Release files for arrayfifo 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| arrayfifo-0.0.3.tar.gz | 3.9 kB | Without provenance | Details for arrayfifo-0.0.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| arrayfifo-0.0.3-py3-none-any.whl | Python 3 | none | any | Details for arrayfifo-0.0.3-py3-none-any.whl |
Total release size: 8.1 kB
Release files / arrayfifo-0.0.3.tar.gz
| Download URL | arrayfifo-0.0.3.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7159ce546c05e85f8c15637a2789cbfbe1fc25307a463666e4f9d5e1f0995e7c
|
|
BLAKE2b-256 checksum How to use checksums |
95caabf98dc8d0b4f95f9b7c668b3a9b6e9ff4d7b1a59772ec456afca832e663
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Release files / arrayfifo-0.0.3-py3-none-any.whl
| Download URL | arrayfifo-0.0.3-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
916b2644805b94b676d26dcf98a449a17f338685150dd5b5f327d14a4265637e
|
|
BLAKE2b-256 checksum How to use checksums |
e361dc57a5460a7ed5c3698b3841c61d973e900c236ea193d72871c767dfa57c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.0 CPython/3.9.19
|
Security for arrayfifo 0.0.3
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.