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
hebo take up too much cpus #10
Comments
I think it's because numpy and pytorch used multi-threading for their computation, CPU usage should be limited if you disable numpy/torch multi-threading. https://pytorch.org/docs/stable/generated/torch.set_num_threads.html https://stackoverflow.com/questions/30791550/limit-number-of-threads-in-numpy |
I just wrote a demo, adding the import os
os.environ['OMP_NUM_THREADS'] = '1'
os.environ['MKL_NUM_THREADS'] = '1'
from tqdm import trange
from hebo.optimizers.hebo import HEBO
from hebo.benchmarks.synthetic_benchmarks import RosenbrockDummy
if __name__ == '__main__':
prob = RosenbrockDummy(10)
opt = HEBO(prob.space)
tbar = trange(100)
for i in tbar:
rec = opt.suggest()
y = prob(rec)
opt.observe(rec, y)
tbar.set_description(f'Iter {i}, y = {y.min():.2f}, best_y = {opt.y.min():.2f}') |
To me, numpy multi-threading does not seem to offer observable speed-up, so I actually just set the two environment variables to |
The main process of HEBO take up 1600% cpus, which makes other parts of the program run very slowly. Is there any way to reduce the cpu usage of hebo? Thanks!
The text was updated successfully, but these errors were encountered: