turbopipe 1.2.0__tar.gz → 1.2.2__tar.gz

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.

@@ -0,0 +1,2 @@
1
+ patreon: Tremeschin
2
+ github: Tremeschin
@@ -22,9 +22,9 @@ jobs:
22
22
  run: python -m build --sdist -o package
23
23
 
24
24
  - name: upload
25
- uses: actions/upload-artifact@v3
25
+ uses: actions/upload-artifact@v4
26
26
  with:
27
- name: package
27
+ name: package-sdist
28
28
  path: package/*.tar.gz
29
29
 
30
30
  wheels:
@@ -35,9 +35,9 @@ jobs:
35
35
  os: [ubuntu-latest, windows-latest, macos-14]
36
36
 
37
37
  env:
38
- CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-*
38
+ CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* cp313-*
39
39
  CIBW_ARCHS_LINUX: auto
40
- CIBW_ARCHS_MACOS: arm64
40
+ CIBW_ARCHS_MACOS: arm64 x86_64
41
41
  CIBW_ARCHS_WINDOWS: auto
42
42
  CIBW_SKIP: '*musllinux* *i686* *-win32'
43
43
 
@@ -50,15 +50,15 @@ jobs:
50
50
  uses: bus1/cabuild/action/msdevshell@v1
51
51
 
52
52
  - name: deps
53
- run: python -m pip install cibuildwheel==2.19.2
53
+ run: python -m pip install cibuildwheel==2.21.3
54
54
 
55
55
  - name: wheels
56
56
  run: python -m cibuildwheel --output-dir package
57
57
 
58
58
  - name: upload
59
- uses: actions/upload-artifact@v3
59
+ uses: actions/upload-artifact@v4
60
60
  with:
61
- name: package
61
+ name: package-wheels-${{ matrix.os }}
62
62
  path: package/*.whl
63
63
 
64
64
  publish:
@@ -71,9 +71,10 @@ jobs:
71
71
  - uses: actions/setup-python@v5
72
72
 
73
73
  - name: Download artifacts
74
- uses: actions/download-artifact@v3
74
+ uses: actions/download-artifact@v4
75
75
  with:
76
- name: package
76
+ pattern: 'package-*'
77
+ merge-multiple: true
77
78
  path: package
78
79
 
79
80
  - name: deps
@@ -1,34 +1,34 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: turbopipe
3
- Version: 1.2.0
4
- Summary: 🌀 Faster MemoryView inter-process data transfers for subprocesses
5
- Home-page: https://brokensrc.dev
3
+ Version: 1.2.2
4
+ Summary: 🌀 Faster ModernGL Buffers inter-process data transfers for subprocesses
6
5
  Author-Email: Tremeschin <29046864+Tremeschin@users.noreply.github.com>
7
6
  License: MIT License
8
-
9
- Copyright (c) 2024 Gabriel Tremeschin
10
-
11
- Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions:
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
28
- Project-URL: Issues, https://github.com/BrokenSource/TurboPipe/issues
29
- Project-URL: Repository, https://github.com/BrokenSource/TurboPipe
30
- Project-URL: Documentation, https://github.com/BrokenSource/TurboPipe
31
- Project-URL: Homepage, https://brokensrc.dev
7
+
8
+ Copyright (c) 2024 Gabriel Tremeschin
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: issues, https://github.com/BrokenSource/TurboPipe/issues
29
+ Project-URL: repository, https://github.com/BrokenSource/TurboPipe
30
+ Project-URL: documentation, https://github.com/BrokenSource/TurboPipe
31
+ Project-URL: homepage, https://brokensrc.dev
32
32
  Requires-Python: >=3.7
33
33
  Requires-Dist: moderngl
34
34
  Description-Content-Type: text/markdown
@@ -100,7 +100,7 @@ import turbopipe
100
100
 
101
101
  # Create ModernGL objects
102
102
  ctx = moderngl.create_standalone_context()
103
- buffer = ctx.buffer(reserve=1920*1080*3)
103
+ buffers = [ctx.buffer(reserve=1920*1080*3) for _ in range(2)]
104
104
 
105
105
  # Make sure resolution, pixel format matches!
106
106
  ffmpeg = subprocess.Popen(
@@ -109,12 +109,15 @@ ffmpeg = subprocess.Popen(
109
109
  )
110
110
 
111
111
  # Rendering loop of yours (eg. 1m footage)
112
- for _ in range(60 * 60):
112
+ for frame in range(60 * 60):
113
+ buffer = buffers[frame % len(buffer)]
114
+ turbopipe.sync(buffer)
115
+ fbo.read_into(buffer)
113
116
  turbopipe.pipe(buffer, ffmpeg.stdin.fileno())
114
117
 
115
118
  # Finalize writing, encoding
116
- turbopipe.sync()
117
119
  ffmpeg.stdin.close()
120
+ turbopipe.close()
118
121
  ffmpeg.wait()
119
122
  ```
120
123
 
@@ -369,4 +372,3 @@ On realistically loads, like [**ShaderFlow**](https://github.com/BrokenSource/Sh
369
372
  - Disable/investigate performance degradation on Windows iGPUs
370
373
  - Improve the thread synchronization and/or use a ThreadPool
371
374
  - Maybe use `mmap` instead of chunks writing on Linux
372
- - Test on macOS 🙈
@@ -65,7 +65,7 @@ import turbopipe
65
65
 
66
66
  # Create ModernGL objects
67
67
  ctx = moderngl.create_standalone_context()
68
- buffer = ctx.buffer(reserve=1920*1080*3)
68
+ buffers = [ctx.buffer(reserve=1920*1080*3) for _ in range(2)]
69
69
 
70
70
  # Make sure resolution, pixel format matches!
71
71
  ffmpeg = subprocess.Popen(
@@ -74,12 +74,15 @@ ffmpeg = subprocess.Popen(
74
74
  )
75
75
 
76
76
  # Rendering loop of yours (eg. 1m footage)
77
- for _ in range(60 * 60):
77
+ for frame in range(60 * 60):
78
+ buffer = buffers[frame % len(buffer)]
79
+ turbopipe.sync(buffer)
80
+ fbo.read_into(buffer)
78
81
  turbopipe.pipe(buffer, ffmpeg.stdin.fileno())
79
82
 
80
83
  # Finalize writing, encoding
81
- turbopipe.sync()
82
84
  ffmpeg.stdin.close()
85
+ turbopipe.close()
83
86
  ffmpeg.wait()
84
87
  ```
85
88
 
@@ -334,4 +337,3 @@ On realistically loads, like [**ShaderFlow**](https://github.com/BrokenSource/Sh
334
337
  - Disable/investigate performance degradation on Windows iGPUs
335
338
  - Improve the thread synchronization and/or use a ThreadPool
336
339
  - Maybe use `mmap` instead of chunks writing on Linux
337
- - Test on macOS 🙈
@@ -7,7 +7,7 @@ homepage = "https://brokensrc.dev"
7
7
  [project]
8
8
  name = "turbopipe"
9
9
  dynamic = ["version"]
10
- description = "🌀 Faster MemoryView inter-process data transfers for subprocesses"
10
+ description = "🌀 Faster ModernGL Buffers inter-process data transfers for subprocesses"
11
11
  authors = [{name="Tremeschin", email="29046864+Tremeschin@users.noreply.github.com"}]
12
12
  readme = "Readme.md"
13
13
  license = {file="License.md"}
@@ -23,7 +23,6 @@
23
23
  #include <unordered_map>
24
24
  #include <deque>
25
25
 
26
- #define dict std::unordered_map
27
26
  using namespace std;
28
27
 
29
28
  // ------------------------------------------------------------------------------------------------|
@@ -57,10 +56,16 @@ public:
57
56
  // each thread's writing loop is done, guaranteeing finish
58
57
  for (auto& values: queue) {
59
58
  while (true) {
60
- if (data != nullptr && values.second.find(data) == values.second.end())
61
- break;
62
- if (data == nullptr && values.second.empty())
63
- break;
59
+ {
60
+ // Prevent segfault on iteration on changing data
61
+ lock_guard<mutex> lock(mutexes[values.first]);
62
+
63
+ // Either all empty or some memory not queued (None or specific)
64
+ if (data != nullptr && values.second.find(data) == values.second.end())
65
+ break;
66
+ if (data == nullptr && values.second.empty())
67
+ break;
68
+ }
64
69
  this_thread::sleep_for(chrono::microseconds(200));
65
70
  }
66
71
  }
@@ -76,11 +81,11 @@ public:
76
81
  }
77
82
 
78
83
  private:
79
- dict<int, dict<void*, condition_variable>> pending;
80
- dict<int, unordered_set<void*>> queue;
81
- dict<int, deque<Work>> stream;
82
- dict<int, thread> threads;
83
- dict<int, mutex> mutexes;
84
+ unordered_map<int, unordered_map<void*, condition_variable>> pending;
85
+ unordered_map<int, unordered_set<void*>> queue;
86
+ unordered_map<int, deque<Work>> stream;
87
+ unordered_map<int, thread> threads;
88
+ unordered_map<int, mutex> mutexes;
84
89
  condition_variable signal;
85
90
  bool running;
86
91
 
@@ -88,18 +93,20 @@ private:
88
93
  Work work = {data, file, size};
89
94
  unique_lock<mutex> lock(mutexes[file]);
90
95
 
91
- // Notify this memory is queued, wait if pending
92
- if (!queue[file].insert(data).second) {
93
- pending[file][data].wait(lock, [this, file, data] {
94
- return queue[file].find(data) == queue[file].end();
95
- });
96
+ /* Notify this memory is queued, wait if pending */ {
97
+ if (!queue[file].insert(data).second) {
98
+ pending[file][data].wait(lock, [this, file, data] {
99
+ return queue[file].find(data) == queue[file].end();
100
+ });
101
+ }
96
102
  }
97
103
 
98
- // Add another job to the queue
99
- stream[file].push_back(work);
100
- queue[file].insert(data);
101
- this->running = true;
102
- lock.unlock();
104
+ /* Add another job to the queue */ {
105
+ stream[file].push_back(work);
106
+ queue[file].insert(data);
107
+ this->running = true;
108
+ lock.unlock();
109
+ }
103
110
 
104
111
  // Each file descriptor has its own thread
105
112
  if (threads.find(file) == threads.end())
@@ -139,11 +146,13 @@ private:
139
146
  }
140
147
  #endif
141
148
 
142
- // Signal work is done
143
149
  lock.lock();
144
- pending[file][work.data].notify_all();
145
- queue[file].erase(work.data);
146
- signal.notify_all();
150
+
151
+ /* Signal work is done */ {
152
+ pending[file][work.data].notify_all();
153
+ queue[file].erase(work.data);
154
+ signal.notify_all();
155
+ }
147
156
  }
148
157
  }
149
158
  };
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env python3
2
- __version__ = "1.2.0"
2
+ __version__ = "1.2.2"
3
3
 
4
4
  if __name__ == "__main__":
5
5
  print(__version__)
File without changes
File without changes
File without changes
File without changes
File without changes