JuliaLang / Distributed.jl

Create and control multiple Julia processes remotely for distributed computing. Ships as a Julia stdlib.
https://docs.julialang.org/en/v1/stdlib/Distributed/
MIT License
29 stars 11 forks source link

pmap feature request to facilitate dynamic scheduling #54

Open iwelch opened 6 years ago

iwelch commented 6 years ago

code that is called by pmap() should have the ability to signal to the scheduler a (dynamic) determination not to schedule any more new tasks. existing tasks should either be finished or aborted, depending on signal.

For example, after any one task function has signaled “TASKSNONEW”, the scheduler should stop scheduling further processes, but let’s the remaining tasks finish (e.g., we already found the alien, when the search parties come back, don’t send them out again); when any one task function signals “TASKSALLABORT”, the scheduler should further immediately terminates all other tasks ( (e.g., the alien has found us, is hostile, and we will need all search parties to come back immediately to help defend the base).

I think this is in the spirit of pmap, but greatly improves its previously static functionality to become dynamic. I also hope that it can be implemented with relatively little pain to the developers (catch interrupt?) and to the user. it becomes much easier for the user to signal “done” than having to write their own schedulers---a more obscure task.

In addition, I think the pmap() call should have arguments to set timeouts, both for itself and for individual tasks.

ViralBShah commented 6 years ago

cc @amitmurthy @tanmaykm

iwelch commented 6 years ago

if you decide to implement this, maybe lay the groundwork for another feature, too: two more signals like "TASKraiseimportance" and "TASKlowerimportance." they could help the scheduler assign the current task to a lower or higher end CPU in a heterogeneous environment, for example. this is of secondary importance and probably not worth the effort, at least not soon.

/iaw

vchuravy commented 6 years ago

I think pmap is the wrong interface to provide this, but I would encourage development of functionality like this in a package first to experiment with the implementation