indygreg / indygreg/PyOxidizer
Another Multiprocessing Example, on Windows 11
- Dominant language
- Rust
- Stars
- 6.2k
- Forks
- 256
- PR merge metrics
- No merged PRs in 30d
Description
This works fine on CPython, but breaks when run in Pyoxidizer using `python_config.run_filename`:
```python
from concurrent.futures import ProcessPoolExecutor
import math
import time
import os
def cpu_intensive(n: int, multiplier: int) -> float:
result: float = 0
for i in range(10_000_000 * multiplier):
result += math.sqrt(i**3 + i**2 + i * n)
return result
if __name__ == "__main__":
multiplier = 1 # Increase for longer computations
logical_processors = os.cpu_count()
print(f"{logical_processors = }")
tasks = (logical_processors - 0) * 1 # Try different numbers
print(f"{tasks = }")
start = time.monotonic()
with ProcessPoolExecutor() as executor:
results = executor.map(cpu_intensive, range(tasks), [multiplier] * tasks)
print(list(results))
print(f"Elapsed time: {time.monotonic() - start:.2f}s")
```
Note that I had similar issues with Nuitka, but these are the only two packagers I've tried so far.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by running the supplied ProcessPoolExecutor example on Windows 11 with CPython and PyOxidizer using python_config.run_filename, then compare the failure behavior. Done means the multiprocessing example runs successfully when packaged with PyOxidizer; the issue does not name a repository file or test to inspect.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100