-
Notifications
You must be signed in to change notification settings - Fork 164
pso_gen with batch evaluator (thread_bfe) not invoking batch_fitness() in custom UDP #598
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
Comments
Hi @dsriaditya999 ! The issue is that by calling pso_algo.set_bfe(pagmo::bfe{}); You will see that your As an alternative, you could also just remove the
which will confirm that the single evaluations are indeed running in parallel. |
Hi @bluescarni , Thanks a lot for your reply. I tried incorporating your suggestion and it did work in the dummy toy example, that I shared. But when I try to apply the same changes to my actual problem, batch processing still does not happen. I have tried using my implementation and using Any suggestions on how to tackle this problem? Does the fitness function have to satisfy any constraints in order to enable parallel processing? |
Hi @dsriaditya999 , could you explain in a bit more detail what you mean when you say that only single thread processing happens? I.e., how have you been checking that multithreading is active? |
I have checked by printing some indicative text in the custom batch processor and also by using |
Is there any chance your objective function is holding some lock that force serialised fitness evaluations? Do you see any multithreaded evaluation if you replace your current objective function with some other code but leave the rest of the setup unchanged? It would be helpful to see the code :) |
I'm trying to use the generational PSO algorithm (pso_gen) with a batch fitness evaluator (using pagmo::thread_bfe) to enable multithreaded evaluation of my user‑defined problem. My final goal is to run pso_gen in batch mode so that, when I have (for example) 30 particles, they are evaluated in parallel via the problem's batch_fitness() method.
I created a minimal dummy problem that implements both the single-evaluation
fitness()
and thebatch_fitness()
methods. However, during evolution, I only see output fromfitness()
being called (i.e. one-by-one evaluation) and no indication thatbatch_fitness()
is ever invoked.Below is my dummy example code and Makefile. Could someone please help me understand what I might be missing so that
batch_fitness()
is correctly used?dummy_batch.cpp
Makefile
Issue Summary:
Despite setting up a dummy problem with both
fitness()
andbatch_fitness()
, my generational PSO algorithm (pso_gen) never seems to callbatch_fitness()
. Instead, I only see output from fitness() being printed for each evaluation. I compile with OpenMP enabled and useset_bfe(pagmo::bfe{ pagmo::thread_bfe{} })
.My final goal is to use pso_gen with batch evaluators and multithreading in my real problem. Can someone please help clarify what might be wrong or missing in my UDP such that batch evaluation is not used? Any insight or suggestions would be appreciated!
The text was updated successfully, but these errors were encountered: