Skip to content

add ParallelEvaluator#34

Merged
robertfeldt merged 7 commits into
SciML:masterfrom
alyst:parallel_evaluator
Nov 28, 2015
Merged

add ParallelEvaluator#34
robertfeldt merged 7 commits into
SciML:masterfrom
alyst:parallel_evaluator

Conversation

@alyst
Copy link
Copy Markdown
Contributor

@alyst alyst commented Sep 17, 2015

Implements ParallelEvaluator <: Evaluator that distributes the calculation of candidates' fitnesses across the worker processes. Should be beneficial for NES family of optimizers that regenerate the population at each step.

It does require channels from Julia 0.4, but unlike ParallelOptimizer from #25 communication between the processes is much more straighforward (it's very similar to pmap(), except that the problem object needs to be sent to the workers only once at ParallelEvaluator creation).

To use it, simply add Workers= parameter to bbsetup/bboptimize(problem) call. E.g.

addprocs(2)
bbsetup(problem, Workers=workers())

@robertfeldt
Copy link
Copy Markdown
Collaborator

Thanks, looks great. Can we set things up so this is only activated on 0.4 and later and that its tests are only run if on 0.4? Or maybe we just wait until 0.4 is officially released and we require it. What do you think?

@alyst
Copy link
Copy Markdown
Contributor Author

alyst commented Sep 22, 2015

Since the 0.4 release is very near, I think it would be easier to just require 0.4 at some point, then merge this PR. Last week Julia 0.4rc2 was released, it fixes some stability issues related to interprocess communication, so in principle we can already switch the master to 0.4 and tag the new version after the official release.
Meanwhile METADATA.jl points to BlackBoxOptim v0.0.1 that supports 0.3, and as long as the new version is not tagged, 0.3 users would not be affected.

@alyst alyst force-pushed the parallel_evaluator branch from de94703 to db4f82d Compare November 19, 2015 15:31
@alyst
Copy link
Copy Markdown
Contributor Author

alyst commented Nov 20, 2015

I've rebased the PR to the master. It builds on 0.4, fails on 0.3 (the PR requires channels, so it would not work 0.3), fails on nightly (the core devs are changing the parallel API, but I don't think it makes sense to update the PR now. I expect there would be more changes in the 0.5 development cycle).
So accepting this PR requires dropping 0.3 compatibility.
I was using it quite extensively for several different problems in a cluster environment, and it was looking stable.

@robertfeldt
Copy link
Copy Markdown
Collaborator

Sounds good. I'm ready to require 0.4. Will check and run on my side and then merge. @alyst , do you recommend we also exclude nightly from the travis build/testing? Disturbing not to have a travis pass.

@alyst alyst force-pushed the parallel_evaluator branch from 7a90149 to 50f8039 Compare November 20, 2015 20:06
required to workaround the Julia (de)serialization issues between
master-worker
distributes evaluation of fitness for an array of Candidate{F} between
the workers
if Workers= parameter is specified (in bbsetup() or bboptimize()),
and the optimizer is a subclass of AskTellOptimizer,
ParallelOptimizer is used
@alyst alyst force-pushed the parallel_evaluator branch from 50f8039 to 5d9f664 Compare November 20, 2015 20:13
@alyst
Copy link
Copy Markdown
Contributor Author

alyst commented Nov 20, 2015

IMO nightlies should be kept. I've added the commit disabling ParallelEvaulator on 0.3 and 0.5. Unfortunately, it didn't worked out:

  • on 0.3 it's ctor compatibility issue
  • on 0.5 it's some strange error in sorting along the dimension in the latin cube. It might be the problem with Julia nightlies that would be resolved soon.

As for 0.3, I think it should be dropped. BlackBoxOptim extensively uses type parameters, and support for type parameters was much enhanced in 0.4, so maintaining 0.3 compatibility would mean writing less elegant code.

@robertfeldt
Copy link
Copy Markdown
Collaborator

Ok, I've tried this and it looks good. I think we should also add an example file that runs an opt first with only one worker process and then with several, to show people how it can be used and what the benefits are. Will see if I have time to add one, if not I'd appreciate one from you. :)

robertfeldt added a commit that referenced this pull request Nov 28, 2015
@robertfeldt robertfeldt merged commit cef941f into SciML:master Nov 28, 2015
@robertfeldt
Copy link
Copy Markdown
Collaborator

Hmm, I have problems ensuring all code is loaded on all workers and get something like:

ERROR: LoadError: On worker 4:
UndefVarError: ParallelEvaluatorWorker not defined
 in anonymous at /Users/feldt/tmp/bbo/BlackBoxOptim.jl/src/parallel_evaluator.jl:117
...

after trying to addprocs() and then setup and run an optimization with multiple Workers. Maybe I need a small example from you anyway... Can you please check and do a PR on this file:

https://github.com/robertfeldt/BlackBoxOptim.jl/blob/master/examples/rosenbrock_parallel.jl

@alyst alyst deleted the parallel_evaluator branch July 24, 2017 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants