mostra 0.2.0__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.
- mostra-0.2.0/.gitignore +28 -0
- mostra-0.2.0/CHANGELOG.md +46 -0
- mostra-0.2.0/LICENSE +201 -0
- mostra-0.2.0/NOTICE +76 -0
- mostra-0.2.0/PKG-INFO +311 -0
- mostra-0.2.0/README.md +278 -0
- mostra-0.2.0/extras/__init__.mojo +1 -0
- mostra-0.2.0/extras/max_backend.mojo +152 -0
- mostra-0.2.0/hatch_build.py +297 -0
- mostra-0.2.0/pyproject.toml +297 -0
- mostra-0.2.0/python/README.md +153 -0
- mostra-0.2.0/python/src/interop/python_cpu_interop.mojo +14 -0
- mostra-0.2.0/python/src/interop/python_gpu_interop.mojo +1550 -0
- mostra-0.2.0/python/src/mostra/__init__.py +138 -0
- mostra-0.2.0/python/src/mostra/async_support.py +299 -0
- mostra-0.2.0/python/src/mostra/combinators.py +619 -0
- mostra-0.2.0/python/src/mostra/graph.py +655 -0
- mostra-0.2.0/python/src/mostra/introspect.py +626 -0
- mostra-0.2.0/python/src/mostra/jit.py +1147 -0
- mostra-0.2.0/python/src/mostra/mojo_mostra.pyi +140 -0
- mostra-0.2.0/python/src/mostra/native.py +820 -0
- mostra-0.2.0/python/src/mostra/py.typed +0 -0
- mostra-0.2.0/python/src/mostra/streaming.py +414 -0
- mostra-0.2.0/python/tests/__init__.py +1 -0
- mostra-0.2.0/python/tests/mostra/__init__.py +0 -0
- mostra-0.2.0/python/tests/mostra/test_edge_cases.py +1540 -0
- mostra-0.2.0/python/tests/mostra/test_graph.py +758 -0
- mostra-0.2.0/python/tests/mostra/test_phase3.py +261 -0
- mostra-0.2.0/python/tests/mostra/test_phase4.py +421 -0
- mostra-0.2.0/python/tests/mostra/test_phase5_ux.py +886 -0
- mostra-0.2.0/src/__init__.mojo +1 -0
- mostra-0.2.0/src/_internal/__init__.mojo +1 -0
- mostra-0.2.0/src/_internal/os_sync.mojo +598 -0
- mostra-0.2.0/src/_internal/runtime.mojo +37 -0
- mostra-0.2.0/src/_internal/work_stealing.mojo +1492 -0
- mostra-0.2.0/src/executors/__init__.mojo +889 -0
- mostra-0.2.0/src/interop/__init__.mojo +1 -0
- mostra-0.2.0/src/interop/_py_abi.mojo +653 -0
- mostra-0.2.0/src/interop/_py_arrow_simd.mojo +552 -0
- mostra-0.2.0/src/interop/_py_buffer_dlpack.mojo +1408 -0
- mostra-0.2.0/src/interop/_py_capi.mojo +1003 -0
- mostra-0.2.0/src/interop/native_abi.mojo +456 -0
- mostra-0.2.0/src/interop/python_interop.mojo +6354 -0
- mostra-0.2.0/src/pipeline/__init__.mojo +1389 -0
- mostra-0.2.0/src/pipeline/async_fn.mojo +889 -0
- mostra-0.2.0/src/pipeline/closures.mojo +156 -0
- mostra-0.2.0/src/pipeline/combinators.mojo +968 -0
- mostra-0.2.0/src/pipeline/compt.mojo +1477 -0
- mostra-0.2.0/src/pipeline/fallible.mojo +766 -0
- mostra-0.2.0/src/pipeline/resilience.mojo +781 -0
- mostra-0.2.0/src/pipeline/span_par.mojo +682 -0
- mostra-0.2.0/src/stateful/__init__.mojo +540 -0
- mostra-0.2.0/src/stateful/async_stage.mojo +420 -0
mostra-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# python generated files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[oc]
|
|
4
|
+
build/
|
|
5
|
+
dist/
|
|
6
|
+
wheels/
|
|
7
|
+
*.egg-info
|
|
8
|
+
|
|
9
|
+
# venv
|
|
10
|
+
.venv
|
|
11
|
+
# pixi environments
|
|
12
|
+
.pixi
|
|
13
|
+
*.egg-info
|
|
14
|
+
# magic environments
|
|
15
|
+
.magic
|
|
16
|
+
|
|
17
|
+
# Package to ignore
|
|
18
|
+
package/*.mojoc
|
|
19
|
+
package/*.so
|
|
20
|
+
examples/*.mojoc
|
|
21
|
+
tests/*.mojoc
|
|
22
|
+
python/src/mostra/*.so
|
|
23
|
+
|
|
24
|
+
.vscode
|
|
25
|
+
kgen.trace.*
|
|
26
|
+
# pixi environments
|
|
27
|
+
.pixi/*
|
|
28
|
+
!.pixi/config.toml
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-12-03
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Lock-free Chase-Lev work-stealing runtime (`src/_internal/work_stealing.mojo`, `src/_internal/os_sync.mojo`)**: Pure-Mojo POSIX/OS synchronization, stack-allocated help-first `fork_join` (deadlock-free under arbitrary nesting), adaptive range-split `parallel_for`, and thread-local cooperative `CancelToken`.
|
|
14
|
+
- **Pluggable zero-cost `Executor` architecture (`mostra.executors`, `extras.max_backend`)**: `WorkStealingExecutor` (new `DefaultExecutor`), `SequentialExecutor`, lock-free atomic slot-pulling `BoundedExecutor`, `TracingExecutor`, `AsyncRTExecutor`, and optional `MaxDeviceExecutor`.
|
|
15
|
+
- **Capturing Mojo closures (`mostra.pipeline.closures`)**: `stage(...)` / `ClosureStage` and `raising_stage(...)` / `RaisingClosureStage` for zero-heap-allocation `{imm}` capturing closures.
|
|
16
|
+
- **SIMD cache-tiled parallel span stages (`mostra.pipeline.span_par`)**: `SimdKernel`, register-fused `FusedSimd` (`|`), and `ParSpanStage` (`par_span`) executing `std.algorithm.vectorize` over contiguous `Span`/`MutSpan` buffers and `List` pipelines.
|
|
17
|
+
- **Zero-copy Python Buffer Protocol & DLPack (`ArrowArray`)**: PEP 3118 / PEP 688 (`__buffer__`, `ArrowArray.from_buffer`) and DLPack v0.8 / v1.0 (`__dlpack__`, `__dlpack_device__`, `ArrowArray.from_dlpack`) alongside Apache Arrow C Data Interface (`__arrow_c_array__`).
|
|
18
|
+
- **On-demand Mojo JIT (`@mojo_task`, `compile_mojo_stage`)**: Compiles inline Mojo functions or `.mojo` files (`int64`, `float64`, `arrow_float64`, `arrow_int64`) into disk-cached (`MOSTRA_CACHE_DIR`) dual-ABI (`Py_MOD_GIL_NOT_USED`) GIL-free stages.
|
|
19
|
+
- **Dual-ABI free-threaded Python `3.13t` / `3.14t` / `3.15t` support (`src/interop/_py_abi.mojo`)**: Single `mojo_mostra.so` dynamically adapts to 16-byte GIL `PyObject` and 32-byte free-threaded `_PyObjectFT` layouts, calling `PyUnstable_Module_SetGIL(..., Py_MOD_GIL_NOT_USED)` so importing Mostra or using `@mojo_task` never re-enables the GIL.
|
|
20
|
+
- **Backend benchmark suite (`examples/bench_backends.mojo`)**: `pixi run bench_backends` comparing `WorkStealingExecutor`, `AsyncRTExecutor`, `BoundedExecutor`, and `SequentialExecutor`.
|
|
21
|
+
- **Attribution & Licensing (`NOTICE`)**: Added Apache-2.0 `NOTICE` file covering Modular Mojo/MAX license disclosures and third-party algorithm/specification credits.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
- **Breaking (Mojo combinators)**: Replaced fixed-arity `Spread2..4` and `Zip2..3` with fully variadic `Spread` and `Zip` (`mostra.pipeline.combinators`, `mostra.pipeline.compt`).
|
|
25
|
+
- Migrated all Mojo sync pipeline engines (`pipeline`, `compt`, `combinators`, `fallible`, `resilience`, `stateful`) and `mojo_mostra.so` onto `WorkStealingExecutor` / `WorkStealingPool` by default.
|
|
26
|
+
- Emitted dual-ABI `py3-none-<platform>` wheels (`hatch_build.py`) tested in CI & Release across Python `3.13`, `3.13t`, `3.14`, `3.14t`, `3.15`, and `3.15t`.
|
|
27
|
+
- Expanded `runtime_info()` to report `gpu_available`, `backend`, and `pool_workers`.
|
|
28
|
+
- Rewrote `README.md` and `python/README.md` for approachable, benefit-driven onboarding while keeping detailed technical references in `docs/` and `DESIGN.md`.
|
|
29
|
+
|
|
30
|
+
### Performance
|
|
31
|
+
- **Mojo `WorkStealingExecutor` vs `AsyncRTExecutor`**: **4.90×–22.57× faster** (JIT) and **9.27×–227.74× faster** (AOT) on fine-grained and nested fan-outs with zero deadlocks at depth 4 and zero wave barriers on `BoundedExecutor`.
|
|
32
|
+
- **Tile-fused Arrow/Buffer SIMD (`_py_arrow_simd.mojo`)**: Single-pass L1 cache-tiled (`4096`) `vectorize` + `WorkStealingPool` evaluation achieving **79×–176×** speedups on 1M-element `Float64` chains with zero intermediate allocations.
|
|
33
|
+
- **Cached GPU execution (`python_gpu_interop.mojo`)**: Mutex-cached `DeviceContext`, pooled `DeviceBuffer`s (`create_sub_buffer`), single-kernel fused float chains, bulk DMA, device-resident DLPack fast paths, and CUDA/HIP `DeviceGraph` replay.
|
|
34
|
+
- **Free-threaded Python (`3.13t`–`3.15t`)**: Verified **2.40×–2.99×** scaling on pure-Python 4-way `&` fan-outs and **1.05–1.58 µs/call** 4-way native parallel dispatch with `gil_enabled=False`.
|
|
35
|
+
|
|
36
|
+
## [0.1.0] - 2026-12-02
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- Series/Parallel pipeline runner on top of Mojo `asyncrt` with compile-time and runtime combinators, fallible stages, resilience (retry, timeout, fallback), stateful/async stages, executors, and introspection.
|
|
40
|
+
- GIL-free native Mojo C-ABI v1 stages (`TaskGroup`, `map_list`, `native_stage`, fused chains) and Python hybrid async/bounded streaming support.
|
|
41
|
+
- Arrow C Data Interface columnar support and optional MAX GPU stage execution.
|
|
42
|
+
- Portable Hatchling wheel build hook (`mojo_mostra.so`) and GitHub Actions CI/CD workflows for PyPI Trusted Publishing and GitHub Releases.
|
|
43
|
+
|
|
44
|
+
[Unreleased]: https://github.com/IbarraSamuel/mostra/compare/v0.2.0...HEAD
|
|
45
|
+
[0.2.0]: https://github.com/IbarraSamuel/mostra/compare/v0.1.0...v0.2.0
|
|
46
|
+
[0.1.0]: https://github.com/IbarraSamuel/mostra/releases/tag/v0.1.0
|
mostra-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
mostra-0.2.0/NOTICE
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
Mostra
|
|
2
|
+
Copyright 2026 Samuel Ibarra
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see LICENSE).
|
|
5
|
+
|
|
6
|
+
================================================================================
|
|
7
|
+
Modular Platform (Mojo & Optional MAX SDK)
|
|
8
|
+
================================================================================
|
|
9
|
+
|
|
10
|
+
Mostra is built with Mojo and optionally integrates with Modular's MAX SDK
|
|
11
|
+
(`mostra[max]` extra / `pixi -e max`, `extras/max_backend.mojo`, and
|
|
12
|
+
`python/src/interop/python_gpu_interop.mojo`).
|
|
13
|
+
|
|
14
|
+
- Mojo (`mojo-compiler`, `mojo`, and the Mojo standard library):
|
|
15
|
+
Copyright Modular Inc. Licensed under the Apache License, Version 2.0 with
|
|
16
|
+
LLVM Exceptions (https://llvm.org/LICENSE.txt).
|
|
17
|
+
|
|
18
|
+
- MAX (`max`, optional dependency for GPU acceleration and `MaxDeviceExecutor`):
|
|
19
|
+
Copyright Modular Inc., a Qualcomm Company. Portions of the MAX SDK and its
|
|
20
|
+
binary distributions are licensed under the MAX License
|
|
21
|
+
(https://www.modular.com/legal/max-license); the remainder of the open-source
|
|
22
|
+
MAX components are licensed under the Apache License, Version 2.0 with LLVM
|
|
23
|
+
Exceptions.
|
|
24
|
+
|
|
25
|
+
Mostra's source repository and default CPU package do not bundle MAX binaries.
|
|
26
|
+
If you install the optional `max` dependency or redistribute an application
|
|
27
|
+
or binary wheel containing MAX components, your use and redistribution of
|
|
28
|
+
those MAX portions remain subject to the MAX License (including its
|
|
29
|
+
requirement to provide a human-readable copy of the MAX License terms with
|
|
30
|
+
distributed object code or applications).
|
|
31
|
+
|
|
32
|
+
Mostra is an independent open-source project and is not affiliated with,
|
|
33
|
+
endorsed by, approved by, or sponsored by Modular Inc. or Qualcomm. Modular,
|
|
34
|
+
Mojo, and MAX are trademarks of Modular Inc.
|
|
35
|
+
|
|
36
|
+
================================================================================
|
|
37
|
+
Algorithms, Specifications & Ecosystem Credits
|
|
38
|
+
================================================================================
|
|
39
|
+
|
|
40
|
+
Mostra's runtime and interoperability modules implement the following published
|
|
41
|
+
algorithms and open C-ABI specifications from scratch:
|
|
42
|
+
|
|
43
|
+
1. Chase-Lev Work-Stealing Deque (`src/_internal/work_stealing.mojo`)
|
|
44
|
+
- David Chase and Yossi Lev, "Dynamic Circular Work-Stealing Deque,"
|
|
45
|
+
Proceedings of the 17th Annual ACM Symposium on Parallelism in Algorithms
|
|
46
|
+
and Architectures (SPAA '05), 2005.
|
|
47
|
+
- Nhat Minh Le, Antoniu Pop, Albert Cohen, and Francesco Zappa Nardelli,
|
|
48
|
+
"Correct and Efficient Work-Stealing for Weak Memory Models,"
|
|
49
|
+
Proceedings of the 18th ACM SIGPLAN Symposium on Principles and Practice
|
|
50
|
+
of Parallel Programming (PPoPP '13), 2013.
|
|
51
|
+
|
|
52
|
+
2. xorshift64* PRNG (`src/_internal/work_stealing.mojo`)
|
|
53
|
+
- George Marsaglia, "Xorshift RNGs," Journal of Statistical Software, 2003.
|
|
54
|
+
- Sebastiano Vigna, "An Experimental Exploration of Marsaglia's xorshift
|
|
55
|
+
Generators, Scrambled," ACM Transactions on Mathematical Software, 2016.
|
|
56
|
+
|
|
57
|
+
3. Apache Arrow C Data Interface (`src/interop/python_interop.mojo`)
|
|
58
|
+
- Implements the Apache Arrow C Data Interface (`ArrowSchema`, `ArrowArray`,
|
|
59
|
+
and `__arrow_c_array__` PyCapsule protocol).
|
|
60
|
+
- Copyright The Apache Software Foundation. Specification licensed under the
|
|
61
|
+
Apache License, Version 2.0 (https://arrow.apache.org/).
|
|
62
|
+
|
|
63
|
+
4. DLPack (`src/interop/_py_buffer_dlpack.mojo`)
|
|
64
|
+
- Implements the DLPack v0.8 / v1.0 C-ABI structures (`DLTensor`,
|
|
65
|
+
`DLManagedTensor`, `DLManagedTensorVersioned`) and `__dlpack__` /
|
|
66
|
+
`__dlpack_device__` PyCapsule exchange protocol.
|
|
67
|
+
- Copyright DMLC / DLPack contributors. Specification licensed under the
|
|
68
|
+
Apache License, Version 2.0 (https://github.com/dmlc/dlpack).
|
|
69
|
+
|
|
70
|
+
5. CPython C-API, Buffer Protocol & Free-Threaded Python ABI
|
|
71
|
+
(`src/interop/_py_abi.mojo`, `src/interop/_py_capi.mojo`,
|
|
72
|
+
`src/interop/_py_buffer_dlpack.mojo`, `python/src/mostra/jit.py`)
|
|
73
|
+
- Implements C-ABI interoperability with CPython's PEP 3118 / PEP 688 Buffer
|
|
74
|
+
Protocol, PEP 654 Exception Groups, and PEP 703 Free-Threaded CPython
|
|
75
|
+
(`Py_GIL_DISABLED` / `Py_MOD_GIL_NOT_USED`, authored by Sam Gross).
|
|
76
|
+
- Copyright Python Software Foundation (PSF License).
|
mostra-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,311 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: mostra
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Series/Parallel Runner on top of mojo asyncrt
|
|
5
|
+
Project-URL: Homepage, https://github.com/IbarraSamuel/mostra
|
|
6
|
+
Project-URL: Repository, https://github.com/IbarraSamuel/mostra
|
|
7
|
+
Project-URL: Issues, https://github.com/IbarraSamuel/mostra/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/IbarraSamuel/mostra/blob/main/CHANGELOG.md
|
|
9
|
+
Author-email: Samuel Ibarra <ing.samuelibarra@gmail.com>
|
|
10
|
+
License-Expression: Apache-2.0
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
License-File: NOTICE
|
|
13
|
+
Keywords: arrow,async,concurrency,mojo,parallel,pipeline,task-group
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Operating System :: MacOS
|
|
18
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
19
|
+
Classifier: Programming Language :: Python :: 3
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.15
|
|
23
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
25
|
+
Classifier: Typing :: Typed
|
|
26
|
+
Requires-Python: >=3.13
|
|
27
|
+
Requires-Dist: mojo-compiler<2.0.0,>=1.3.0.dev2026120205
|
|
28
|
+
Provides-Extra: max
|
|
29
|
+
Requires-Dist: max>=26.0.0; extra == 'max'
|
|
30
|
+
Provides-Extra: mojo
|
|
31
|
+
Requires-Dist: mojo<2.0.0,>=1.3.0.dev2026120205; extra == 'mojo'
|
|
32
|
+
Description-Content-Type: text/markdown
|
|
33
|
+
|
|
34
|
+
# Mostra
|
|
35
|
+
|
|
36
|
+
**Make your Python and Mojo code run faster across every CPU core (and GPU) — with just two symbols.**
|
|
37
|
+
|
|
38
|
+
Most code runs one step at a time, leaving most of your computer sitting idle. **Mostra** lets you connect steps into a clean, readable flow that automatically runs work at the same time:
|
|
39
|
+
|
|
40
|
+
- **`a | b`** — **Then**: run `a`, and send its answer to `b`.
|
|
41
|
+
- **`a & b`** — **At the same time**: run `a` and `b` side by side on the same input, and get both answers back together.
|
|
42
|
+
|
|
43
|
+
That's the entire mental model. No messy thread code, no lock bugs, and no rewriting your app from scratch.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Why Try Mostra?
|
|
48
|
+
|
|
49
|
+
Real speedups measured on an 8-core Apple Silicon laptop:
|
|
50
|
+
|
|
51
|
+
| What you want to do | Normal Python | With Mostra | Real gain |
|
|
52
|
+
| :--- | :---: | :---: | :--- |
|
|
53
|
+
| **Run math on 1,000,000 numbers** *(4 steps)* | ~160 ms | **~1.6 ms** | **~100× faster** |
|
|
54
|
+
| **Run 4 normal Python tasks at once** *(free-threaded Python 3.13t–3.15t)* | ~150 ms | **~50 ms** | **~3× faster** |
|
|
55
|
+
| **Process a batch of heavy jobs** | ~60 ms | **~17 ms** | **~3.5× faster** |
|
|
56
|
+
| **Launch parallel work in Mojo** | ~10–30 µs *(built-in async)* | **~0.1–1 µs** | **Up to 227× faster launch** |
|
|
57
|
+
|
|
58
|
+
Plus:
|
|
59
|
+
- **Keep your existing tools** — works directly with lists, `memoryview`, NumPy, PyArrow, Polars, PyTorch, and JAX without making extra copies of your data.
|
|
60
|
+
- **Drop in compiled Mojo speed from Python** — write a small fast function with `@mojo_task` and plug it straight into your Python pipeline.
|
|
61
|
+
- **Safe by default** — built-in retries, timeouts, fallbacks, memory-safe streaming for huge datasets, and automatic flowchart diagrams.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Install in Seconds
|
|
66
|
+
|
|
67
|
+
### Python
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Default install (fast multi-core CPU engine):
|
|
71
|
+
pip install "git+https://github.com/IbarraSamuel/mostra.git"
|
|
72
|
+
|
|
73
|
+
# Optional: add GPU acceleration:
|
|
74
|
+
pip install "mostra[max] @ git+https://github.com/IbarraSamuel/mostra.git"
|
|
75
|
+
|
|
76
|
+
# Or with uv:
|
|
77
|
+
uv add "mostra @ git+https://github.com/IbarraSamuel/mostra.git"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Works on both standard Python (`3.13+`) and **free-threaded Python (`3.13t`, `3.14t`, `3.15t`)** out of the box.
|
|
81
|
+
|
|
82
|
+
### Mojo
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
git clone https://github.com/IbarraSamuel/mostra.git
|
|
86
|
+
cd mostra
|
|
87
|
+
pixi install # default (fast multi-core CPU)
|
|
88
|
+
pixi install -e max # optional: with GPU support
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## See It in Action (Python)
|
|
94
|
+
|
|
95
|
+
### 1. Run Steps Side by Side in 5 Lines
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from mostra import spread, task
|
|
99
|
+
|
|
100
|
+
@task
|
|
101
|
+
def parse_price(text: str) -> float:
|
|
102
|
+
return float(text.strip("$"))
|
|
103
|
+
|
|
104
|
+
@task
|
|
105
|
+
def apply_discount(price: float) -> float:
|
|
106
|
+
return price * 0.90
|
|
107
|
+
|
|
108
|
+
@task
|
|
109
|
+
def estimate_tax(price: float) -> float:
|
|
110
|
+
return price * 0.08
|
|
111
|
+
|
|
112
|
+
@spread
|
|
113
|
+
def total_receipt(discounted: float, tax: float) -> str:
|
|
114
|
+
return f"Total: ${discounted + tax:.2f}"
|
|
115
|
+
|
|
116
|
+
# Parse first, then calculate discount and tax AT THE SAME TIME, then combine:
|
|
117
|
+
checkout = parse_price | (apply_discount & estimate_tax) | total_receipt
|
|
118
|
+
|
|
119
|
+
print(checkout("$100")) # "Total: $98.00"
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
**Real gain:** Your workflow reads like a diagram from left to right. On free-threaded Python (`3.13t+`), normal Python branches connected with `&` run on separate CPU cores at the same time — giving **2.4×–3× real speedups** with zero extra setup.
|
|
123
|
+
|
|
124
|
+
*(Want nested output groups instead of a flat tuple? Wrap any pair with `group(a & b)`.)*
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
### 2. Process 1,000,000 Numbers ~100× Faster
|
|
129
|
+
|
|
130
|
+
Need to transform a huge list of numbers? Built-in fast stages run compiled Mojo code across all your CPU cores automatically — and accept `ArrowArray`, `array.array`, `memoryview`, NumPy, PyArrow, or Polars directly:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from mostra import ArrowArray, native_arrow_float_linear, native_arrow_float_poly
|
|
134
|
+
|
|
135
|
+
prices = ArrowArray([float(i) for i in range(1_000_000)])
|
|
136
|
+
|
|
137
|
+
# Chain multiple math steps — Mostra fuses them into a single high-speed pass:
|
|
138
|
+
adjust = native_arrow_float_linear(scale=1.5, bias=0.25)
|
|
139
|
+
curve = native_arrow_float_poly(c0=1.0, c1=-0.5, c2=0.25)
|
|
140
|
+
|
|
141
|
+
fast_pipeline = adjust | curve
|
|
142
|
+
result = fast_pipeline(prices) # ~1.6 ms instead of ~160 ms in plain Python!
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Real gain:** Instead of looping in Python one number at a time (~160 ms), Mostra combines your steps into a single pass that uses every CPU core and hardware vector math at once — **~100× faster**, with zero copies when sharing data with NumPy, Polars, PyArrow, or PyTorch.
|
|
146
|
+
|
|
147
|
+
> Have a GPU? Swap `native_arrow_*` for `gpu_arrow_float_linear` / `gpu_arrow_float_poly`. Chained GPU steps stay on the GPU from start to finish in one fused launch.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
### 3. Write Your Own Ultra-Fast Step in Python (`@mojo_task`)
|
|
152
|
+
|
|
153
|
+
Don't see the exact math you need? Drop a small Mojo function right inside your Python file — Mostra compiles and caches it once, then runs it at full native speed alongside your normal Python tasks:
|
|
154
|
+
|
|
155
|
+
```python
|
|
156
|
+
from mostra import mojo_task
|
|
157
|
+
|
|
158
|
+
@mojo_task(kind="float64")
|
|
159
|
+
def fast_score():
|
|
160
|
+
"""
|
|
161
|
+
def fast_score(x: Float64) -> Float64:
|
|
162
|
+
return x * x + 2.0 * x + 1.0
|
|
163
|
+
"""
|
|
164
|
+
|
|
165
|
+
# Runs at full speed across all CPU cores — even on standard Python:
|
|
166
|
+
scores = fast_score.map([1.0, 2.0, 3.0, 4.0], max_in_flight=4)
|
|
167
|
+
print(scores) # [4.0, 9.0, 16.0, 25.0]
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
**Real gain:** Accelerate only the slow 5% of your Python program without leaving Python or manually managing C/C++ extensions. Behind the scenes, `@mojo_task` compiles and caches a native Mojo stage that runs completely outside Python's GIL.
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
### 4. Stream Huge Datasets & Protect Flaky Steps
|
|
175
|
+
|
|
176
|
+
```python
|
|
177
|
+
from mostra import fallback, retry, task, timeout
|
|
178
|
+
|
|
179
|
+
@task
|
|
180
|
+
def fetch_price(sku: str) -> float:
|
|
181
|
+
return 19.99
|
|
182
|
+
|
|
183
|
+
@task
|
|
184
|
+
def cached_price(_sku: str) -> float:
|
|
185
|
+
return 20.00
|
|
186
|
+
|
|
187
|
+
# Automatically retry slow or flaky steps, with a deadline and backup:
|
|
188
|
+
safe_fetch = fallback(
|
|
189
|
+
retry(timeout(fetch_price, seconds=1.0), max_attempts=3, backoff=0.05),
|
|
190
|
+
cached_price,
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
# Stream thousands (or infinite!) items while keeping at most 4 active at once:
|
|
194
|
+
for sku_price in safe_fetch.stream((f"item-{i}" for i in range(10_000)), max_in_flight=4):
|
|
195
|
+
print(sku_price)
|
|
196
|
+
break # stops early and cleans up pending work automatically
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
**Real gain:** Process massive datasets with flat, predictable memory usage, and keep workflows running smoothly when external services hiccup.
|
|
200
|
+
|
|
201
|
+
---
|
|
202
|
+
|
|
203
|
+
### 5. Mix `async def` & Visualize Your Pipeline Automatically
|
|
204
|
+
|
|
205
|
+
```python
|
|
206
|
+
import asyncio
|
|
207
|
+
from mostra import TracingExecutor, async_task
|
|
208
|
+
|
|
209
|
+
@async_task
|
|
210
|
+
async def fetch_profile(user_id: int) -> str:
|
|
211
|
+
await asyncio.sleep(0.01)
|
|
212
|
+
return f"user-{user_id}"
|
|
213
|
+
|
|
214
|
+
@async_task
|
|
215
|
+
async def fetch_points(user_id: int) -> int:
|
|
216
|
+
await asyncio.sleep(0.01)
|
|
217
|
+
return user_id * 10
|
|
218
|
+
|
|
219
|
+
dashboard = fetch_profile & fetch_points
|
|
220
|
+
|
|
221
|
+
print(asyncio.run(dashboard.arun(7))) # ("user-7", 70)
|
|
222
|
+
print(dashboard.to_mermaid()) # generates a Mermaid flowchart automatically!
|
|
223
|
+
|
|
224
|
+
# See exactly where time is spent:
|
|
225
|
+
tracer = TracingExecutor(sequential=False)
|
|
226
|
+
_ = tracer.run(dashboard, 7)
|
|
227
|
+
print(tracer.format_report())
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
**Real gain:** Mix async web/database calls with CPU-heavy steps in one graph, measure every step's timing, and auto-generate up-to-date diagrams straight from code.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## See It in Action (Mojo)
|
|
235
|
+
|
|
236
|
+
The exact same `|` and `&` operators work natively in Mojo — with compile-time type checking, inline closures, and a built-in multi-core engine that launches parallel tasks in fractions of a microsecond:
|
|
237
|
+
|
|
238
|
+
```mojo
|
|
239
|
+
from mostra.pipeline import Fn, stage
|
|
240
|
+
from mostra.pipeline.combinators import spread
|
|
241
|
+
|
|
242
|
+
def parse_int(s: String) -> Int:
|
|
243
|
+
try:
|
|
244
|
+
return Int(s)
|
|
245
|
+
except:
|
|
246
|
+
return 0
|
|
247
|
+
|
|
248
|
+
def format_total(a: Int, b: Int) -> String:
|
|
249
|
+
return String("Total: ", a + b)
|
|
250
|
+
|
|
251
|
+
def main():
|
|
252
|
+
var bonus = 10
|
|
253
|
+
def double_val(x: Int) {imm} -> Int: return x * 2
|
|
254
|
+
def add_bonus(x: Int) {imm} -> Int: return x + bonus
|
|
255
|
+
|
|
256
|
+
var parse = Fn(parse_int)
|
|
257
|
+
var merge = spread(format_total)
|
|
258
|
+
|
|
259
|
+
# Parse -> run both branches in parallel across CPU cores -> combine:
|
|
260
|
+
var pipe = parse | (stage(double_val) & stage(add_bonus)) | merge
|
|
261
|
+
print(pipe("15")) # "Total: 55"
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
**Real gain:** Express complex parallel graphs in a few lines with zero boilerplate. Behind the scenes, Mostra runs your work on a lock-free work-stealing thread pool (stack-allocated tasks, deadlock-free nesting), making parallel dispatch **up to 227× faster** than Mojo's built-in coroutine tasks.
|
|
265
|
+
|
|
266
|
+
Want to process big arrays at maximum hardware speed in Mojo? Combine `SimdKernel` stages with `|` and run them with `par_span` — Mostra fuses every step into registers and splits tiles across all CPU cores automatically.
|
|
267
|
+
|
|
268
|
+
---
|
|
269
|
+
|
|
270
|
+
## Ready to Go Deeper?
|
|
271
|
+
|
|
272
|
+
All technical specifications, advanced APIs, and architecture details live in the focused guides:
|
|
273
|
+
|
|
274
|
+
| Guide | What's Inside |
|
|
275
|
+
| :--- | :--- |
|
|
276
|
+
| **[Python Hybrid, JIT, Zero-Copy & Streaming Guide](docs/python-hybrid-async-streaming.md)** | `@mojo_task` JIT caching, Buffer Protocol (`memoryview`/NumPy), DLPack (PyTorch/JAX/CuPy), Apache Arrow, custom C-ABI `PyCapsule` extensions, free-threaded `3.13t–3.15t`, `asyncio` (`arun`), and sliding-window streaming. |
|
|
277
|
+
| **[Mojo Pipelines Guide](docs/mojo-pipelines.md)** | Borrowed & `owned` pipelines, capturing closures (`stage` / `raising_stage`), `SimdKernel` + `ParSpanStage`, compile-time `compt` graphs (`comptime_run`), `__async`, fallible (`raises`), stateful (`mut self`), and GPU `DeviceBuffer` pipelines. |
|
|
278
|
+
| **[Combinators & Resilience Guide](docs/combinators-and-resilience.md)** | `identity`, `select`, variadic `spread` & `zip_*`, `map_stage` / `map_task`, `stream_map`, `branch`, `retry`, `fallback`, cooperative `CancelToken` `timeout`, and `recover`. |
|
|
279
|
+
| **[Executors & Introspection Guide](docs/executors-and-introspection.md)** | Pluggable `Executor` trait, `WorkStealingExecutor`, `BoundedExecutor`, `SequentialExecutor`, `TracingExecutor`, `AsyncRTExecutor`, optional `MaxDeviceExecutor`, custom executors, `GraphStats`, and Mermaid/DOT diagrams. |
|
|
280
|
+
| **[Design & Architecture (`DESIGN.md`)](DESIGN.md)** | Internal work-stealing runtime (`WorkStealingPool`), Chase-Lev deques, dual-ABI free-threaded CPython shim (`_py_abi.mojo`), tile-fused SIMD & GPU `DeviceGraph` internals, C-ABI spec, and full benchmark tables. |
|
|
281
|
+
| **[Changelog (`CHANGELOG.md`)](CHANGELOG.md)** | Release history and notable changes. |
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## Running Tests & Benchmarks
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Run all Mojo + Python tests and docstring checks:
|
|
289
|
+
pixi run tests
|
|
290
|
+
|
|
291
|
+
# Run the Mojo backend benchmark (WorkStealing vs AsyncRT vs Sequential):
|
|
292
|
+
pixi run bench_backends
|
|
293
|
+
|
|
294
|
+
# Run the Python hybrid, Arrow/Buffer SIMD, and free-threaded benchmarks:
|
|
295
|
+
uv run python examples/benchmark_hybrid.py
|
|
296
|
+
|
|
297
|
+
# Lint and type-check Python:
|
|
298
|
+
uv run --no-sync ruff check python/ hatch_build.py examples/
|
|
299
|
+
uv run --no-sync ty check
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## License, Credits & Notices
|
|
305
|
+
|
|
306
|
+
- **Mostra** is licensed under the **Apache License 2.0**. See [LICENSE](LICENSE) and [NOTICE](NOTICE) for full details.
|
|
307
|
+
- **Modular (Mojo & optional MAX)**:
|
|
308
|
+
- Mostra uses **Mojo** (`mojo-compiler`, Apache License 2.0 with LLVM Exceptions).
|
|
309
|
+
- If you install the optional GPU/MAX extras (`mostra[max]` or `pixi -e max`), portions of Modular's **MAX SDK** and its binary distribution are governed by the [MAX License](https://www.modular.com/legal/max-license) (with open-source components under Apache License 2.0 with LLVM Exceptions). Mostra does not bundle MAX in its source repository or default CPU package; any redistribution that includes MAX remains subject to the MAX License.
|
|
310
|
+
- Mostra is an independent project and is not affiliated with, endorsed by, or sponsored by Modular Inc. or Qualcomm. Mojo and MAX are trademarks of Modular Inc.
|
|
311
|
+
- **Credits & Standards**: Mostra's work-stealing runtime and zero-copy interop implement published algorithms and open standards from scratch, including the Chase-Lev work-stealing deque (Chase & Lev 2005; Lê et al. 2013), xorshift64\* (Marsaglia / Vigna), the Apache Arrow C Data Interface, DLPack, and CPython's Buffer Protocol / PEP 703 free-threaded ABI. Full citations and attributions are listed in [NOTICE](NOTICE).
|