-
Notifications
You must be signed in to change notification settings - Fork 187
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
chore: load cpu architecture dependent models #1800
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -247,8 +247,18 @@ func setModelServerReqEndpoint() string { | |
|
||
// return local path to power model weight | ||
// e.g., /var/lib/kepler/data/model_weight/acpi_AbsPowerModel.json | ||
func GetDefaultPowerModelURL(modelOutputType, energySource string) string { | ||
return fmt.Sprintf(`/var/lib/kepler/data/model_weight/%s_%sModel.json`, energySource, modelOutputType) | ||
func GetDefaultPowerModelURL(modelOutputType, energySource, cpuArch string) string { | ||
// strip white space or new line from cpuArch | ||
cpuArch = strings.TrimSuffix(cpuArch, "\n") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TrimSpace should remove \n characters and white space, so you can remove this line |
||
cpuArch = strings.TrimSpace(cpuArch) | ||
fullPath := fmt.Sprintf(`/var/lib/kepler/data/%s/model_weight/%s_%sModel.json`, cpuArch, energySource, modelOutputType) | ||
// if the model does not exist, return the default model | ||
if _, err := os.Stat(fullPath); os.IsNotExist(err) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Won't this result in a possible race condition? If you can guarantee that after the os.Stat the file exists, then ignore this comment. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On a minor note, os.isNotExist(err) might be misleading as os.Stat can return other types of errors which is not the same as a file/model not existing. |
||
klog.Warningf("model %s does not exist, using default model", fullPath) | ||
return fmt.Sprintf(`/var/lib/kepler/data/model_weight/%s_%sModel.json`, energySource, modelOutputType) | ||
} | ||
// otherwise, return the full path | ||
return fullPath | ||
} | ||
|
||
func logBoolConfigs() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these files shouldn't change at all 🤔