-
Notifications
You must be signed in to change notification settings - Fork 299
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
[Autotuner] Plotting utility + test #2394
base: master
Are you sure you want to change the base?
Conversation
luarss
commented
Sep 29, 2024
- Plotting utility
- README
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.
Please add a call to this script in the test_helper.py
so we test this script.
except Exception as e: | ||
print(f"Error in {fname}: {e}") | ||
continue |
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.
Should we keep a list of the files that were not processed so we can print them at the very end in order for the error not to be buried in the logs? And should the script fail silently in this case?
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.
And should the script fail silently in this case?
Just to clarify, this exception happens when any Autotuner run does not proceed to the "finish" stage, it does not fail silently
Should we keep a list of the files that were not processed so we can print them at the very end in order for the error not to be buried in the logs?
Sure I can add that.
z = np.polyfit(df["timestamp"], df[key], 1) | ||
p = np.poly1d(z) |
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.
z
I assume is the z-axis; what is p
?
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.
z
is the np array of polynomial (ax+b) coefficients, and p
is the actual polynomial function.
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.
Then let's use more descriptive names, maybe:
z
--> coeff
p
--> poly_func
plt.boxplot(df[key]) | ||
plt.ylabel(key) | ||
plt.title(f"{key} Boxplot") | ||
plt.savefig(f"images/{key}-boxplot.png") |
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.
Let's also parametrize the output folder to save images from CI into the reports folder for the design. This way it will be automatically saved to the build artifacts.
--platform ${PLATFORM} \ | ||
--design ${DESIGN_NAME} \ |
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.
At the beginning of this script, you are casting these values to be uppercase, which does not match the path since Linux is case-sensitive. From the CI:
02:32:36 Running Autotuner plotting smoke test
02:32:36 ls: cannot access './flow/logs/SKY130HD/gcd/*/': No such file or directory
02:32:36 No experiments found for plotting
02:32:36 + exit 0
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.
If we call the plot script and do not find data to plot, this should be an error, right?
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.
Yup, these are 2 separate errors, will fix them.
flow/test/test_autotuner.sh
Outdated
@@ -20,28 +22,23 @@ python3 -m unittest tools.AutoTuner.test.smoke_test_sweep.${PLATFORM}SweepSmokeT | |||
echo "Running Autotuner smoke tests for --sample and --iteration." | |||
python3 -m unittest tools.AutoTuner.test.smoke_test_sample_iteration.${PLATFORM}SampleIterationSmokeTest.test_sample_iteration | |||
|
|||
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN" == "gcd" ]; then | |||
if [ "$PLATFORM" == "asap7" ] && [ "$DESIGN_NAME" == "gcd" ]; then |
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.
The first check will never be true because you are casting to uppercase on line 14.
Would it be simpler/easier if we just use the platform name everywhere and just remove the dashes if that is not supported by the unittest
Python lib?
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.
The main concern is that I prefer name of smoke tests to be capitalized. We could also do something like asap7SampleIterationSmokeTest
, but might be less readable
Perhaps a UPPERCASE_PLATFORM
would make the distinction clearer?
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.
Modifying PLATFORM or another variable already in use somewhere else in the code can easily lead to confusion. Other options could be PLATFORM_UT
where UT is 'under test' or TEST_PLATFORM
. That said, I don't see any issue with asap7SampleIterationSmokeTest
.
flow/test/test_autotuner.sh
Outdated
echo "No experiments found for plotting" | ||
exit 0 |
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.
This is still exiting with a success code.
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.
This is returning 0 because I didn't want to error out for smoke tests that are not suitable for plotting. I will modify it to only run plot.py
for valid smoke tests then.
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.
We could then change line 31 to list either manually the tests we want or use a better regex in the experiment names to differentiate whether the plot is available or not.
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: luarss <[email protected]>
Signed-off-by: Vitor Bandeira <[email protected]>
Signed-off-by: luarss <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
- run plot.py for all log files in the autotuner supported design/platforms - parameterised img_dir, so we can store all AT image runs in build artifacts - argparse interface now takes in platform, design, experiment for easier usage - chdir before running plot.py - add docstrings - more error handling Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: luarss <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>
Signed-off-by: Jack Luar <[email protected]>