Skip to content
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

SMAC time budget walltime vs CPU time #1159

Open
thijssnelleman opened this issue Nov 14, 2024 · 6 comments
Open

SMAC time budget walltime vs CPU time #1159

thijssnelleman opened this issue Nov 14, 2024 · 6 comments

Comments

@thijssnelleman
Copy link

Hi,

I am currently implementing SMAC3 2.2.0 into my software, and want to use both Walltime and CPU time budgets (Not at the same time persay). However, when investigating the package, I noted that cputime_limit is rarely used and could only find and update in smac/main/smbo.py as the following:

@property def remaining_cputime(self) -> float: """Subtracts the target function running budget with the used time.""" return self._scenario.cputime_limit - self._used_target_function_walltime

However, the self._used_target_function_walltime is used there and there seems to be no self.used_target_function_cputime.

As we currently do our CPU time measurements ourselves, it would be no problem to have these be delivered by the target_function, but currently only the cost can be returned by that.

Would it be possible to have the target function also declare how much CPU time / Wall clock time it used?

Thanks!

Best,

Thijs

@benjamc
Copy link
Contributor

benjamc commented Nov 14, 2024

Hi Thijs,
yes, you can add additional information. You can explicitly add time but also other information in the TrialValue object.
See the ask and tell example.
Here is the TrialValue defined.
Are you using SMAC in ask and tell mode?

@thijssnelleman
Copy link
Author

Thanks for the quick reply! Looks like I should use Ask and tell mode. Does the as/tell mechanic also optimize the model, or is that only done when using the Facade in .optimize mode?

@benjamc
Copy link
Contributor

benjamc commented Nov 14, 2024

At the end of tell (or before ask?), the model is trained. Everything works as usual.

@thijssnelleman
Copy link
Author

Then as a last question: TrialValue does not distinguish CPU time from Wallclock in order to update SMAC's budgets. Would it be possible to add this into the package? With some assistance, I could perhaps create a PR for that.

@benjamc
Copy link
Contributor

benjamc commented Nov 14, 2024

Yes, currently CPU time (or any time passed to TrialValue) means wallclock time.
Happy to assist in a PR! Although I would need a refresher why you need to have to different times and why it is not the same.:)
When you create a PR, branch off the dev branch.

@thijssnelleman
Copy link
Author

Sure! I will send you a slack message with my email adress so we can set up a meeting to discuss

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants