-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Can't run DEAP program with SCOOP #57
Comments
This is not an issue with DEAP itself, so I am tagging this as invalid. Please use Github issues to report bugs and DEAP mailing-list to ask question on how to use it. That said, I see that we have omitted to put a link to the mailing-list in the README. Here is the link: I will fix that, thank you for the involuntary bug report ;). Now for your problem, the answer is in the final line of the stacktrace:
The module object scoop is refering to is the creator module. The problem is that you probably called creator.create somewhere else than the global scope of your main module. The global scope of your main module is executed by every Scoop worker. Since the creator constructs new classes dynamically, if the I cannot blame you, this is a common mistake and as far I as know, we have not documented this behaviour properly. Although all of our examples explictly call That said, I have recently made a breakthrough in one of my branch that will alleviate DEAP from this infamous pickling problem and will save us from having to write more documentation. I will not cover the details here, you can see the commit here : cmd-ntrf@c71b773 The change has not made its entry in DEAP's master branch yet because I am a bit busy and I still have to work on some details. However, if you want to give it a try, here is the link to my fork: Simply replace your installation of DEAP by this one, and it should solve your problem. If it does not... well I will be glad to hear feedback from you :). Use my fork Issues page to report any problem. I am closing this issue for now and I will modify our README to link to the mailing-list. Use the mailing-list if you have more questions on DEAP. |
Hello, Is there definitive solution to this? I am running into a similar situation on Windows (with Scoop or Multiprocessing/Pool). |
If you want to avoid this problem but don't want to have to move all your DEAP code to your main module, a workaround is to do all your calls to creator.create in the main module (which scoop executes) and then pass that creator down to the lower module where the rest of your DEAP stuff happens. E.g.
and then in the other module
|
Another work around is to use Edit: dill does not work robustly here. |
Is there any progress on this? If deap requires to mess with the main module just to make parallelization work, this is a huge drawback.. To be honest, I don't understand the invalid-tag here. |
I am having the same issue. Would love to hear an update. |
@paddymccrudden Have you tried the proposed workaround? |
Hi @fmder. Thanks! I was able to get that part running, but ran into another problem with pickling:
which led to:
To make this work, I had to refactor my code base in order to expose the functions, toolboxes, stats objects etc at the top level of main, along with making some variables global (not pretty). I also had an issue with the use of decorators in the code. I have been using decorators once to enforce stochastic fitness (see wiki), and once to process individuals to enforce constraints. I should be able get around these by using inline functions rather than decorators, and change the flow of the code. I've learnt that it pays to think parallel first. Easier than refactoring! |
No updates to documentation on this matter? It's still plaguing me. I designed my deap system prior to trying to swap in scoop, and now it's proving a huge headache to get this working. Not only that, but it requires me to make my otherwise modular, tested, and easily reusable framework code into deap's idiosyncratic boilerplate, which now has to be copy and pasted in any deap application I may have. It's not a great feeling, to be honest. The examples in deap's docs should clearly show the main entrypoint in an |
So I can add one more workaround. My 'Individuals' genome is fully specified by a simple list of numbers. So for evaluation, inside the map function, which triggers the parallel evaluation in the HPC environment, I convert the Individual to an actual python list, which can be pickled. That way, all the DEAP specifics stay locally. When the results come back, I update the local Individuals based on what comes back from the HPC environment. |
I'm trying to run Python script that uses DEAP and SCOOP to process evaluations in parallel, however I get the following traceback.
I've tried to run it through debugging, but I can never reach the code in _control.py because the program terminates before then with the following traceback.
I understand that this may not necessarily be an issue with DEAP, so I will also post this query to SCOOP developers for help. Any help or advice you can provide would be appreciated.
The text was updated successfully, but these errors were encountered: