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
I have 5 separate functions I want to execute in parallel:
# Defining the BO acquisition function
acquisition_function = UtilityFunction(kind="ei",xi=1e-1)
# Defining a wrapper function that calls maximize - wilson
def wilson_wrapper():
print('in wilson wrapper')
wilson_optimizer.maximize(
n_iter=n_iter_BO,
init_points=init_points_BO,
acquisition_function=acquisition_function
)
# Defining a wrapper function that calls maximize - wong
def wong_wrapper():
print('in wong wrapper')
wong_optimizer.maximize(
n_iter=n_iter_BO,
init_points=init_points_BO,
acquisition_function=acquisition_function
)
# Defining a wrapper function that calls maximize - jansen
def jansen_wrapper():
print('in jansen wrapper')
jansen_optimizer.maximize(
n_iter=n_iter_BO,
init_points=init_points_BO,
acquisition_function=acquisition_function
)
# Defining a wrapper function that calls maximize - larter
def larter_wrapper():
print('in larter wrapper')
larter_optimizer.maximize(
n_iter=n_iter_BO,
init_points=init_points_BO,
acquisition_function=acquisition_function
)
# Defining a wrapper function that calls maximize - kuramoto
def kuramoto_wrapper():
print('in kuramoto wrapper')
kuramoto_optimizer.maximize(
n_iter=n_iter_BO,
init_points=init_points_BO,
acquisition_function=acquisition_function
)
in a jupyter notebook. For some reason, when I try to define each as a process in this way:
Nothing happens, with or without if __name__ == '__main__' (cell just runs in 0.3 seconds, and no print() statements print). I tried defining it in a different way, where I make one function and a list of all the optimizer objects that will be called:
from multiprocess import Process
max_pool = 5
with Pool(max_pool) as p:
pool_outputs = list(
tqdm(
p.imap(partial(main_wrapper, n_iter_BO, init_points_BO, acquisition_function),
optimizers_list),
total=len(optimizers_list)
)
)
# Getting the results of the 5 repetitions from the process outputs
multiprocessing_outputs = list(zip(*pool_outputs))
multiprocessing_outputs = list(multiprocessing_outputs[1])
print(multiprocessing_outputs)
And this also doesn't work. Is there any way to run 5 independent functions in a Jupyter Notebook? Thank you so much for your help!!
The text was updated successfully, but these errors were encountered:
Hello,
I have 5 separate functions I want to execute in parallel:
in a jupyter notebook. For some reason, when I try to define each as a process in this way:
Nothing happens, with or without
if __name__ == '__main__'
(cell just runs in 0.3 seconds, and noprint()
statements print). I tried defining it in a different way, where I make one function and a list of all theoptimizer
objects that will be called:then with:
And this also doesn't work. Is there any way to run 5 independent functions in a Jupyter Notebook? Thank you so much for your help!!
The text was updated successfully, but these errors were encountered: