You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's impossible to run the code with both --multicore and --save_state at the same time. The reason is that the code tries to pickle the process pool, which is not possible, leading to a crash.
See below my fix for this issue.
--- a/PonyGE2/src/utilities/algorithm/state.py+++ b/PonyGE2/src/utilities/algorithm/state.py@@ -1,6 +1,9 @@
import pickle
import random
from os import path
+from multiprocessing import Pool++from utilities.algorithm.initialise_run import pool_init
def create_state(individuals):
@@ -32,6 +35,10 @@ def create_state(individuals):
pickle_params = {param: (check_name(params[param]) if callable(
params[param]) else params[param]) for param in params}
+ # the process pool is not picklable, so we don't save it+ if "POOL" in pickle_params:+ del pickle_params["POOL"]+
# Create a picklable version of the trackers module.
pickle_trackers = {i: getattr(trackers, i) for i in dir(trackers)
if not i.startswith("__")}
@@ -123,6 +130,11 @@ def set_state(state):
for param in state['params']:
params[param] = state['params'][param]
+ if params['MULTICORE']:+ # initialize pool if multi-core is enabled+ params['POOL'] = Pool(processes=params['CORES'], initializer=pool_init,+ initargs=(params,))+
# Set correct param imports for specified function options, including
# error metrics and fitness functions.
set_param_imports()
The text was updated successfully, but these errors were encountered:
It's impossible to run the code with both
--multicore
and--save_state
at the same time. The reason is that the code tries to pickle the process pool, which is not possible, leading to a crash.See below my fix for this issue.
The text was updated successfully, but these errors were encountered: