Comments (2)
Yeah that make sense.
Actually this is associated to another bug #3311, where a global variable initialized from num_performance_cores() become 0 after compile. Then the whole parallel body just don't execute.
Since num_work_items is not zero, if num_workers=0, the program would better complain it can't excecute instead of just don't execute.
Or we should clarify this in the doc and let the user to add some check.
I've changed the title
from mojo.
Hi, thanks for catching this.
when num_workers=0, the parallel fn does not execute.
That makes absolute sense to me, you're telling it to execute a function with 0 threads and it does exactly that. It's the same as doing:
for i in range(0):
print("hi")
it will do nothing 🤷♂️
num_workers<0 causes wierd output
This can probably be a quick fix by doing max(0, num_workers)
(or aborting if num_workers < 0). Could you change the title of the issue to refer to that so that this can be fixed by the Mojo team ? (parallelize is not open sourced yet so I can't make a PR)
(reproducible with mojo 2024.7.2605
)
from mojo.
Related Issues (20)
- [Docs] Suggestion: link to python types docs in module | Dict
- [BUG]Mojo doesnt recognise main function HOT 5
- [BUG] Errors with optional recursive struct definitions HOT 1
- [Feature Request] Make `StringRef.find` call `StringSlice.find`
- [BUG] [stdlib] Fix `String.format()` to use explicit byte indexing and not assume `String.__getitem__` indexes directly to byte offset.
- [BUG] Mojo SDK post-install test failures
- [BUG] Mojo SDK post-install test failures
- [BUG] Jupyter Notebook fails to load mojo kernel
- [Feature Request] Add functionality like `@classmethod` to enforce conditional conformance on struct static methods
- [Docs] Mojo URL leads to 404 HOT 2
- [BUG] Type checker is failing to compare two function types HOT 1
- [BUG] global variable initialized from num_performance_cores() become 0 after compile HOT 5
- [Modular CLI] mojo-nightly.path missing from modular.cfg post successfull install
- [BUG] Top level `var` segfaults when used from package HOT 4
- [BUG] `print(None)` doesn't work anymore
- [BUG] `0/0 != 1` returns `False` HOT 2
- [BUG] Compiler crash with (indirect) self referential type
- [Feature Request] Add `__name__`
- [BUG] Working LinkedList using pointers, but debug is failing.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mojo.