Coder Social home page Coder Social logo

Comments (2)

SynodicMonth avatar SynodicMonth commented on July 29, 2024 1

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.

martinvuyk avatar martinvuyk commented on July 29, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.