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

fix ZeroDivisionError in utils.bottleneck #11987

Closed
wants to merge 4 commits into from
Closed

fix ZeroDivisionError in utils.bottleneck #11987

wants to merge 4 commits into from

Conversation

egg-west
Copy link
Contributor

ZeroDivisionError occurs when cuda_prof_exec_time is small enough.
This situation is normal for a project that has little CUDA work.

Or someone does not make his work transferred to CUDA successfully. In this time he profiles the code, this error occurs.

pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time
if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 1e-6:

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 1e-6:
pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time
if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 1e-6:

This comment was marked as off-topic.

pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time
if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 0.0:

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

This comment was marked as off-topic.

@zou3519 zou3519 self-assigned this Oct 15, 2018
Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

Please change the check to check if the profiling result is empty. Thank you for noticing the problem and submitting a fix, @egg-west!

pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time
if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 0.0:

This comment was marked as off-topic.

pct_diff = cuda_prof_exec_time - cpu_prof_exec_time / cuda_prof_exec_time
if abs(pct_diff) > 0.05:
print_autograd_prof_summary(autograd_prof_cpu, 'CPU', autograd_prof_sortby, autograd_prof_topk)
if cuda_prof_exec_time > 0.0:

This comment was marked as off-topic.

Copy link
Contributor

@zou3519 zou3519 left a comment

Choose a reason for hiding this comment

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

Please fix the lint, other than that, lgtm. Thanks @egg-west!

@egg-west
Copy link
Contributor Author

@apaszke PTAL.

@zou3519
Copy link
Contributor

zou3519 commented Oct 18, 2018

@egg-west could you rebase this on top of master so that the circle-ci tests run?

You can do that with:

git pull --rebase upstream master
git push -f

ZeroDivisionError occurs when cuda_prof_exec_time is small enough.
This situation is normal for a project that has little CUDA work. 

Or someone does not make his work transferred to CUDA successfully. In this time he profiles the code, this error occurs.
take the advice from advice and fix a newly discovered problem.
Change the check of `cuda_prof_exec_time` to check the length of cpu profile events.
line 230: remove space for blank line.
@egg-west
Copy link
Contributor Author

@zou3519 Thank you for all the help. I have done rebase, but there are still 2 test failed.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

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

soumith is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

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

Successfully merging this pull request may close these issues.

None yet

6 participants