-
Notifications
You must be signed in to change notification settings - Fork 4
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
SPOT suggesting non-minimal configs and fixed log retriever #62
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f5190d8
Fixed plotting and fetching of log data
eriklangille 2540235
Request IDs logged to database and graph fixes
eriklangille 8e9ad1d
Jupyter notebook
eriklangille 79b6e14
Merge branch 'master' of github.com:ubc-cirrus-lab/ubc-SPOT into data…
eriklangille 51fbc2f
Format with Black
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ def __init__( | |
last_log_timestamp: int, | ||
benchmark_dir: str, | ||
mem_bounds: list, | ||
polynomial_degree=2, | ||
polynomial_degree=3, | ||
): | ||
super().__init__(function_name, vendor, db, last_log_timestamp) | ||
self._degree = polynomial_degree | ||
|
@@ -43,6 +43,10 @@ def __init__( | |
|
||
def _preprocess(self): | ||
self._df[MEM_SIZE] = self._df[MEM_SIZE].astype(int) | ||
self._df = self._df[ | ||
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. This is quite important addition! |
||
(self._df[MEM_SIZE] >= self.mem_bounds[0]) | ||
& (self._df[MEM_SIZE] <= self.mem_bounds[1]) | ||
] | ||
X_mem = self._df[MEM_SIZE].values | ||
y = self._df[COST].values | ||
X_labels = np.unique(X_mem) | ||
|
@@ -68,7 +72,9 @@ def train_model(self): | |
print("No data available to train the model") | ||
exit() | ||
|
||
self._model = np.polyfit(self._x, self._y, self._degree) | ||
self._model, self._residual, _, _, _ = np.polyfit( | ||
self._x, self._y, self._degree, full=True | ||
) | ||
self._save_model() | ||
|
||
""" | ||
|
@@ -92,7 +98,7 @@ def plot_memsize_vs_cost(self): | |
plt.scatter(self._x, self._y) | ||
|
||
# Add linear regression line | ||
xvars = np.linspace(128, 10240, 1024) | ||
xvars = np.linspace(self._x.min(), self._x.max(), 1024) | ||
plt.plot( | ||
xvars, | ||
np.polyval(self._model, xvars), | ||
|
@@ -102,9 +108,15 @@ def plot_memsize_vs_cost(self): | |
|
||
# Get optimal config | ||
x_min, y_min = self.get_optimal_config() | ||
mem_recommend = int(round(x_min, 0)) | ||
rsme = self._residual | ||
|
||
print(f"Minimum cost of {y_min} found at {mem_recommend} MB") | ||
print(f"Residual: {rsme}") | ||
|
||
# Plot best mem size, data points and polynomial regression fit | ||
plt.plot(x_min, y_min, "x") | ||
plt.text(x_min, y_min, f"{mem_recommend} MB", fontweight=700) | ||
plt.legend() | ||
plt.show() | ||
|
||
|
@@ -124,9 +136,9 @@ def plot_memsize_vs_cost(self): | |
|
||
def get_polynomial_equation_string(self): | ||
ret_val = "" | ||
for degree in range(len(self._model) - 1, 0, -1): | ||
for degree in range(len(self._model) - 1, -1, -1): | ||
if degree == 0: | ||
ret_val += str(self._model[degree]) | ||
ret_val += str("{:.2E}".format(self._model[degree])) | ||
else: | ||
ret_val += ( | ||
str("{:.2E}".format(self._model[degree])) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
{ | ||
"function_name": "pyaes", | ||
"vendor": "AWS", | ||
"region": "us-east-2", | ||
"mem_bounds": [ | ||
128, | ||
1024 | ||
], | ||
"mem_size": 128, | ||
"region": "us-east-2", | ||
"vendor": "AWS", | ||
"workload": { | ||
"test_name": "IntegrationTest1", | ||
"test_duration_in_seconds": 15, | ||
"random_seed": 100, | ||
"blocking_cli": false, | ||
"instances": { | ||
"instance1": { | ||
"application": "pyaes", | ||
"distribution": "Poisson", | ||
"rate": 5, | ||
"activity_window": [ | ||
5, | ||
10 | ||
], | ||
"payload": "payload.json", | ||
"application": "pyaes", | ||
"distribution": "Poisson", | ||
"host": "x8siu0es68.execute-api.us-east-2.amazonaws.com", | ||
"stage": "default", | ||
"resource": "/pyaes?format=json" | ||
"payload": "payload.json", | ||
"rate": 5, | ||
"resource": "/pyaes?format=json", | ||
"stage": "default" | ||
} | ||
} | ||
}, | ||
"random_seed": 100, | ||
"test_duration_in_seconds": 15, | ||
"test_name": "IntegrationTest1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
{ | ||
"function_name": "image_processing", | ||
"vendor": "AWS", | ||
"mem_bounds": [ | ||
256, | ||
10280 | ||
], | ||
"mem_size": 128, | ||
"region": "us-east-2", | ||
"mem_size": 512, | ||
"vendor": "AWS", | ||
"workload": { | ||
"test_name": "IntegrationTest1", | ||
"test_duration_in_seconds": 5, | ||
"random_seed": 100, | ||
"blocking_cli": false, | ||
"instances": { | ||
"instance1": { | ||
"application": "image_processing", | ||
"distribution": "Poisson", | ||
"rate": 1, | ||
"activity_window": [ | ||
1, | ||
5 | ||
], | ||
"payload": "payload.json", | ||
"application": "image_processing", | ||
"distribution": "Poisson", | ||
"host": "ts7p12m27c.execute-api.us-east-2.amazonaws.com", | ||
"stage": "default", | ||
"resource": "/image_processing?format=json" | ||
"payload": "payload.json", | ||
"rate": 1, | ||
"resource": "/image_processing?format=json", | ||
"stage": "default" | ||
} | ||
} | ||
}, | ||
"random_seed": 100, | ||
"test_duration_in_seconds": 5, | ||
"test_name": "IntegrationTest1" | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
What about using the
logging
module for warnings