turbopipe 1.0.5__cp38-cp38-win_amd64.whl → 1.2.0__cp38-cp38-win_amd64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of turbopipe might be problematic. Click here for more details.
- turbopipe/__init__.py +15 -9
- turbopipe/_turbopipe.cp38-win_amd64.pyd +0 -0
- {turbopipe-1.0.5.dist-info → turbopipe-1.2.0.dist-info}/METADATA +24 -20
- turbopipe-1.2.0.dist-info/RECORD +7 -0
- turbopipe-1.0.5.dist-info/RECORD +0 -7
- {turbopipe-1.0.5.dist-info → turbopipe-1.2.0.dist-info}/License.md +0 -0
- {turbopipe-1.0.5.dist-info → turbopipe-1.2.0.dist-info}/WHEEL +0 -0
turbopipe/__init__.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
from
|
|
1
|
+
from typing import Optional, Union
|
|
2
2
|
|
|
3
3
|
from moderngl import Buffer
|
|
4
4
|
|
|
5
5
|
from turbopipe import _turbopipe
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
def pipe(buffer: Buffer,
|
|
8
|
+
def pipe(buffer: Union[Buffer, memoryview], fileno: int) -> None:
|
|
9
9
|
"""
|
|
10
|
-
Pipe the content of a moderngl.Buffer to a file descriptor,
|
|
11
|
-
|
|
10
|
+
Pipe the content of a moderngl.Buffer or memoryview to a file descriptor, fast, threaded and
|
|
11
|
+
blocking when needed. Call `sync(buffer)` before this, and `sync()` when done for
|
|
12
12
|
|
|
13
13
|
Usage:
|
|
14
14
|
```python
|
|
@@ -24,11 +24,17 @@ def pipe(buffer: Buffer, file: IOBase) -> None:
|
|
|
24
24
|
turbopipe.pipe(buffer, child.stdin.fileno())
|
|
25
25
|
```
|
|
26
26
|
"""
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
if isinstance(buffer, Buffer):
|
|
28
|
+
buffer = memoryview(buffer.mglo)
|
|
29
|
+
_turbopipe.pipe(buffer, fileno)
|
|
30
|
+
del buffer
|
|
31
|
+
|
|
32
|
+
def sync(buffer: Optional[Union[Buffer, memoryview]]=None) -> None:
|
|
33
|
+
"""Waits for any pending write operation on a buffer, or 'all buffers' if None, to finish"""
|
|
34
|
+
if isinstance(buffer, Buffer):
|
|
35
|
+
buffer = memoryview(buffer.mglo)
|
|
36
|
+
_turbopipe.sync(buffer)
|
|
37
|
+
del buffer
|
|
32
38
|
|
|
33
39
|
def close() -> None:
|
|
34
40
|
"""Syncs and deletes objects"""
|
|
Binary file
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: turbopipe
|
|
3
|
-
Version: 1.0
|
|
4
|
-
Summary: 🌀 Faster
|
|
3
|
+
Version: 1.2.0
|
|
4
|
+
Summary: 🌀 Faster MemoryView inter-process data transfers for subprocesses
|
|
5
5
|
Home-page: https://brokensrc.dev
|
|
6
6
|
Author-Email: Tremeschin <29046864+Tremeschin@users.noreply.github.com>
|
|
7
7
|
License: MIT License
|
|
@@ -35,12 +35,18 @@ Description-Content-Type: text/markdown
|
|
|
35
35
|
|
|
36
36
|
> [!IMPORTANT]
|
|
37
37
|
> <sub>Also check out [**ShaderFlow**](https://github.com/BrokenSource/ShaderFlow), where **TurboPipe** shines! 😉</sub>
|
|
38
|
-
|
|
38
|
+
<!-- PyPI -->
|
|
39
39
|
<div align="center">
|
|
40
40
|
<a href="https://brokensrc.dev/"><img src="https://raw.githubusercontent.com/BrokenSource/TurboPipe/main/turbopipe/resources/images/turbopipe.png" width="200"></a>
|
|
41
41
|
<h1>TurboPipe</h1>
|
|
42
|
+
Faster <a href="https://github.com/moderngl/moderngl"><b>ModernGL Buffers</b></a> inter-process data transfers for subprocesses
|
|
43
|
+
<br>
|
|
42
44
|
<br>
|
|
43
|
-
|
|
45
|
+
<a href="https://pypi.org/project/turbopipe/"><img src="https://img.shields.io/pypi/v/turbopipe?label=PyPI&color=blue"></a>
|
|
46
|
+
<a href="https://pypi.org/project/turbopipe/"><img src="https://img.shields.io/pypi/dw/turbopipe?label=Installs&color=blue"></a>
|
|
47
|
+
<a href="https://github.com/BrokenSource/TurboPipe"><img src="https://img.shields.io/github/v/tag/BrokenSource/TurboPipe?label=GitHub&color=orange"></a>
|
|
48
|
+
<a href="https://github.com/BrokenSource/TurboPipe/stargazers"><img src="https://img.shields.io/github/stars/BrokenSource/TurboPipe?label=Stars&style=flat&color=orange"></a>
|
|
49
|
+
<a href="https://discord.gg/KjqvcYwRHm"><img src="https://img.shields.io/discord/1184696441298485370?label=Discord&style=flat&color=purple"></a>
|
|
44
50
|
</div>
|
|
45
51
|
|
|
46
52
|
<br>
|
|
@@ -53,7 +59,7 @@ The **optimizations** involved are:
|
|
|
53
59
|
|
|
54
60
|
- **Zero-copy**: Avoid unnecessary memory copies or allocation (intermediate `buffer.read()`)
|
|
55
61
|
- **C++**: The core of TurboPipe is written in C++ for speed, efficiency and low-level control
|
|
56
|
-
- **Chunks**: Write in chunks of 4096 bytes (RAM page size), so the hardware is happy
|
|
62
|
+
- **Chunks**: Write in chunks of 4096 bytes (RAM page size), so the hardware is happy (Unix)
|
|
57
63
|
- **Threaded**:
|
|
58
64
|
- Doesn't block Python code execution, allows to render next frame
|
|
59
65
|
- Decouples the main thread from the I/O thread for performance
|
|
@@ -68,7 +74,7 @@ It couldn't be easier! Just install the [**`turbopipe`**](https://pypi.org/proje
|
|
|
68
74
|
|
|
69
75
|
```bash
|
|
70
76
|
# With pip (https://pip.pypa.io/)
|
|
71
|
-
|
|
77
|
+
pip install turbopipe
|
|
72
78
|
|
|
73
79
|
# With Poetry (https://python-poetry.org/)
|
|
74
80
|
poetry add turbopipe
|
|
@@ -84,7 +90,7 @@ rye add turbopipe
|
|
|
84
90
|
|
|
85
91
|
# 🚀 Usage
|
|
86
92
|
|
|
87
|
-
See also the [**Examples**](https://github.com/BrokenSource/TurboPipe/tree/main/examples) folder for
|
|
93
|
+
See also the [**Examples**](https://github.com/BrokenSource/TurboPipe/tree/main/examples) folder for comparisons, and [**ShaderFlow**](https://github.com/BrokenSource/ShaderFlow/blob/main/ShaderFlow/Scene.py) usage of it!
|
|
88
94
|
|
|
89
95
|
```python
|
|
90
96
|
import subprocess
|
|
@@ -106,7 +112,7 @@ ffmpeg = subprocess.Popen(
|
|
|
106
112
|
for _ in range(60 * 60):
|
|
107
113
|
turbopipe.pipe(buffer, ffmpeg.stdin.fileno())
|
|
108
114
|
|
|
109
|
-
# Finalize writing
|
|
115
|
+
# Finalize writing, encoding
|
|
110
116
|
turbopipe.sync()
|
|
111
117
|
ffmpeg.stdin.close()
|
|
112
118
|
ffmpeg.wait()
|
|
@@ -148,9 +154,9 @@ ffmpeg.wait()
|
|
|
148
154
|
| 🐢 | Null | 1 | 882 fps | 2.44 GB/s | |
|
|
149
155
|
| 🚀 | Null | 1 | 793 fps | 2.19 GB/s | -10.04% |
|
|
150
156
|
| 🌀 | Null | 1 | 1911 fps | 5.28 GB/s | 116.70% |
|
|
151
|
-
| 🐢 | Null | 4 |
|
|
152
|
-
| 🚀 | Null | 4 |
|
|
153
|
-
| 🌀 | Null | 4 |
|
|
157
|
+
| 🐢 | Null | 4 | 857 fps | 2.37 GB/s | |
|
|
158
|
+
| 🚀 | Null | 4 | 891 fps | 2.47 GB/s | 4.05% |
|
|
159
|
+
| 🌀 | Null | 4 | 2309 fps | 6.38 GB/s | 169.45% |
|
|
154
160
|
| 🐢 | ultrafast | 4 | 714 fps | 1.98 GB/s | |
|
|
155
161
|
| 🚀 | ultrafast | 4 | 670 fps | 1.85 GB/s | -6.10% |
|
|
156
162
|
| 🌀 | ultrafast | 4 | 1093 fps | 3.02 GB/s | 53.13% |
|
|
@@ -166,9 +172,9 @@ ffmpeg.wait()
|
|
|
166
172
|
| 🐢 | Null | 4 | 390 fps | 2.43 GB/s | |
|
|
167
173
|
| 🚀 | Null | 4 | 391 fps | 2.43 GB/s | 0.26% |
|
|
168
174
|
| 🌀 | Null | 4 | 756 fps | 4.71 GB/s | 94.01% |
|
|
169
|
-
| 🐢 | ultrafast | 4 |
|
|
170
|
-
| 🚀 | ultrafast | 4 |
|
|
171
|
-
| 🌀 | ultrafast | 4 |
|
|
175
|
+
| 🐢 | ultrafast | 4 | 269 fps | 1.68 GB/s | |
|
|
176
|
+
| 🚀 | ultrafast | 4 | 272 fps | 1.70 GB/s | 1.48% |
|
|
177
|
+
| 🌀 | ultrafast | 4 | 409 fps | 2.55 GB/s | 52.29% |
|
|
172
178
|
| 🐢 | slow | 4 | 115 fps | 0.72 GB/s | |
|
|
173
179
|
| 🚀 | slow | 4 | 118 fps | 0.74 GB/s | 3.40% |
|
|
174
180
|
| 🌀 | slow | 4 | 119 fps | 0.75 GB/s | 4.34% |
|
|
@@ -178,9 +184,9 @@ ffmpeg.wait()
|
|
|
178
184
|
| 🐢 | Null | 1 | 210 fps | 2.33 GB/s | |
|
|
179
185
|
| 🚀 | Null | 1 | 239 fps | 2.64 GB/s | 13.84% |
|
|
180
186
|
| 🌀 | Null | 1 | 534 fps | 5.91 GB/s | 154.32% |
|
|
181
|
-
| 🐢 | Null | 4 |
|
|
182
|
-
| 🚀 | Null | 4 |
|
|
183
|
-
| 🌀 | Null | 4 |
|
|
187
|
+
| 🐢 | Null | 4 | 219 fps | 2.43 GB/s | |
|
|
188
|
+
| 🚀 | Null | 4 | 231 fps | 2.56 GB/s | 5.64% |
|
|
189
|
+
| 🌀 | Null | 4 | 503 fps | 5.56 GB/s | 129.75% |
|
|
184
190
|
| 🐢 | ultrafast | 4 | 141 fps | 1.56 GB/s | |
|
|
185
191
|
| 🚀 | ultrafast | 4 | 150 fps | 1.67 GB/s | 6.92% |
|
|
186
192
|
| 🌀 | ultrafast | 4 | 226 fps | 2.50 GB/s | 60.37% |
|
|
@@ -360,9 +366,7 @@ On realistically loads, like [**ShaderFlow**](https://github.com/BrokenSource/Sh
|
|
|
360
366
|
|
|
361
367
|
# 📚 Future work
|
|
362
368
|
|
|
363
|
-
- Add support for NumPy arrays, memoryviews, and byte-like objects
|
|
364
369
|
- Disable/investigate performance degradation on Windows iGPUs
|
|
365
370
|
- Improve the thread synchronization and/or use a ThreadPool
|
|
366
|
-
- Stabler way for finding mglo struct offsets (moderngl.h?)
|
|
367
371
|
- Maybe use `mmap` instead of chunks writing on Linux
|
|
368
|
-
- Test on
|
|
372
|
+
- Test on macOS 🙈
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
turbopipe-1.2.0.dist-info/METADATA,sha256=GshXnXUHFzM7sZFhvu3nDaTtgbgWA6PpjWNw6lyQ_78,21721
|
|
2
|
+
turbopipe-1.2.0.dist-info/WHEEL,sha256=vIXzP6jLUy4sdmrQppnovVBqmdfNCkEM0I7EHxeJ-zs,83
|
|
3
|
+
turbopipe-1.2.0.dist-info/License.md,sha256=s3HF089BzBa_7DenpGj5kPHBu-XhGLP6gRzhhhLXLls,1096
|
|
4
|
+
turbopipe/_turbopipe.cp38-win_amd64.pyd,sha256=NcVE1U5a6KLzv1Sth63QL-O6TGxRJ7nXk9SAL43vXqg,35840
|
|
5
|
+
turbopipe/_turbopipe.cp38-win_amd64.lib,sha256=PMdYfGloeL0aoriS0sJJug1lOBmSSwxODwh1h0BQspM,2052
|
|
6
|
+
turbopipe/__init__.py,sha256=D0FP-CR87qJeLGv_VYCGRcwdONFhBYt02D2bm4Xdax4,1346
|
|
7
|
+
turbopipe-1.2.0.dist-info/RECORD,,
|
turbopipe-1.0.5.dist-info/RECORD
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
turbopipe-1.0.5.dist-info/METADATA,sha256=tHesZ-pctUtrb6nqF-kdjzAnR4f_UYBUbqV4JtaLY5A,21059
|
|
2
|
-
turbopipe-1.0.5.dist-info/WHEEL,sha256=vIXzP6jLUy4sdmrQppnovVBqmdfNCkEM0I7EHxeJ-zs,83
|
|
3
|
-
turbopipe-1.0.5.dist-info/License.md,sha256=s3HF089BzBa_7DenpGj5kPHBu-XhGLP6gRzhhhLXLls,1096
|
|
4
|
-
turbopipe/_turbopipe.cp38-win_amd64.pyd,sha256=MWC-1Vwe_dPVT9WYpO_LxHHfx2BsrLwrV14AUkqpAAI,35840
|
|
5
|
-
turbopipe/_turbopipe.cp38-win_amd64.lib,sha256=PMdYfGloeL0aoriS0sJJug1lOBmSSwxODwh1h0BQspM,2052
|
|
6
|
-
turbopipe/__init__.py,sha256=8aMUtfquTKmZl_D9liQ2gqGyHD_-z76oDzwIcZRWzu8,961
|
|
7
|
-
turbopipe-1.0.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|