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

Print CPU and GPU output when _assert_equal fails to help debug given… #2657

Merged
merged 2 commits into from
Jun 10, 2021

Conversation

abellina
Copy link
Collaborator

@abellina abellina commented Jun 9, 2021

… the failed path

Signed-off-by: Alessandro Bellina abellina@nvidia.com

This seems like a simple way to capture the output of a test on failure, to help debug. One could take this output and them diff the cpu and the gpu, so one can match that with the "path", as already provided by the test framework on failure.

Re: #2477.

@abellina abellina added the test Only impacts tests label Jun 9, 2021
@abellina abellina requested a review from revans2 June 9, 2021 18:46
_assert_equal(cpu, gpu, float_check=get_float_check(), path=[])
except Exception as ex:
print("CPU OUTPUT: %s \n\n GPU OUTPUT: %s" % (cpu, gpu))
raise ex
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: we can re-raise the last exception with less boilerplate

try:
    ...
except:
    ...
    raise

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

done

try:
_assert_equal(cpu, gpu, float_check=get_float_check(), path=[])
except Exception as ex:
print("CPU OUTPUT: %s \n\n GPU OUTPUT: %s" % (cpu, gpu))
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: multi-line f string

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not entirely sure if I understood this comment. But I split this into two print statements, please let me know if I misunderstood.

… the failed path

Signed-off-by: Alessandro Bellina <abellina@nvidia.com>
@abellina abellina force-pushed the debug/print_sort_in_part_output branch from 9725ff1 to 259a6a1 Compare June 9, 2021 21:18
@sameerz
Copy link
Collaborator

sameerz commented Jun 10, 2021

build

1 similar comment
@pxLi
Copy link
Collaborator

pxLi commented Jun 10, 2021

build

_assert_equal(cpu, gpu, float_check=get_float_check(), path=[])
except:
print("CPU OUTPUT: %s" % cpu)
print("GPU OUTPUT: %s" % gpu)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: technically this is not guaranteed to be the output for the GPU or the CPU because we could have sorted it locally first, but I think everyone will understand and I think this is the right place to print out the info.

@revans2
Copy link
Collaborator

revans2 commented Jun 10, 2021

@abellina is this supposed to be 21.06? Should this be updated to 21.08?

@sameerz sameerz added this to the June 7 - June 18 milestone Jun 10, 2021
@sameerz sameerz merged commit 4e5ccf4 into NVIDIA:branch-21.06 Jun 10, 2021
@abellina abellina deleted the debug/print_sort_in_part_output branch June 10, 2021 17:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Only impacts tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants