Skip to content

[refactor] [misc] Refactoring benchmark code for performance monitoring#3269

Merged
yolo2themoon merged 2 commits intotaichi-dev:masterfrom
yolo2themoon:benchmark_refactor
Oct 27, 2021
Merged

[refactor] [misc] Refactoring benchmark code for performance monitoring#3269
yolo2themoon merged 2 commits intotaichi-dev:masterfrom
yolo2themoon:benchmark_refactor

Conversation

@yolo2themoon
Copy link
Copy Markdown
Contributor

Related issue = #3220

@netlify
Copy link
Copy Markdown

netlify Bot commented Oct 26, 2021

❌ Deploy Preview for jovial-fermat-aa59dc failed.

🔨 Explore the source changes: be2d045

🔍 Inspect the deploy log: https://app.netlify.com/sites/jovial-fermat-aa59dc/deploys/6177d9b574070d0007f19b4e

Copy link
Copy Markdown
Contributor

@ailzhang ailzhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Comment thread benchmarks/misc/membound.py Outdated
self.data_size = dsize
self.min_time_in_us = []
self.results_evaluation = results_evaluation
self.data_size = dsize #list
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using type annotation in python can save you from doing these comments and (some) manual checks ;)
https://docs.python.org/3/library/typing.html

Comment thread benchmarks/misc/membound.py Outdated
Comment thread benchmarks/misc/utils.py Outdated
Comment thread benchmarks/misc/utils.py Outdated
return pow(product, 1.0 / len(data_array))


def repeat_times(arch, datasize, repeat=1):
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function name isn't very informative ;) It's a bit unknown what I should expect when I pass in a repeat to repeat_times function :P

Comment thread benchmarks/misc/run.py Outdated
Comment thread benchmarks/misc/run.py Outdated
Comment thread benchmarks/misc/run.py Outdated
self.min_time_in_us.append(
self.func(self.arch, self.test_dtype, test_dsize,
MemoryBound.basic_repeat_times))
time.sleep(0.2)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just for my own understanding ;/, why do we need sleep 0.2 here?

Copy link
Copy Markdown
Contributor Author

@yolo2themoon yolo2themoon Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea was to give the device a cooling time, but here sleep(0.2s) is quite arbitrary.
Theoretically, we just need to make sure that this condition is consistent for each benchmark test.
Perhaps we can remove sleep(0.2s) to avoid performance fluctuations caused by subsequent changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, ok, good to know. Thanks. The time is probably HW and workload dependent, hard to quantify.

Copy link
Copy Markdown
Contributor

@qiao-bo qiao-bo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, looks good. I wonder how are memory bound cases defined for ti.cpu? are operations like fill and saxpy still memory bound as in ti.cuda.

@yolo2themoon
Copy link
Copy Markdown
Contributor Author

thanks, looks good. I wonder how are memory bound cases defined for ti.cpu? are operations like fill and saxpy still memory bound as in ti.cuda.

Good idea! We should be careful to divide the benchmark cases into suites. After all, there are devices with different computational intensities.
As of now, the arithmetic intensities of these cases are low enough for both backends to be divided into the MemoryBound suite.

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

Successfully merging this pull request may close these issues.

3 participants