My task is like
from sklearn.gaussian_process import GaussianProcessRegressor
num = 100
model = dict()
for i in range(100):
model[i]=GaussianProcessRegressor(kernel=kernel, n_restarts_optimizer=20)
for i in range(num):
model[i].fit(X,Y)
where X,Y
are my training data constaining features and labels, respectively.
My Ubuntu has 4 CPUs. In order to reduce the training time cost to a quarter of the above code, I therefore want to execute model[0].fit(X, Y)
on CPU-0, model[1].fit(X, Y)
on CPU-1, model[2].fit(X, Y)
on CPU-2 and model[3].fit(X, Y)
on CPU-3, simultaneously. What should I do?