Skip to content

Don't use @assert, and print some debugging info if C is not approximately equal to reference #47

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

Merged
merged 2 commits into from
Feb 1, 2021

Conversation

DilumAluthge
Copy link
Member

Fixes #46

Also, if C !≈ reference, we print some info (the name of the library, as well as the values of M, K, and N) to help with debugging.

) where {F}
maybe_sleep(sleep_time)
t0 = @elapsed f!(C, A, B)
isnothing(reference) || @assert C ≈ reference
if (reference !== nothing) && (!(C ≈ reference))
msg = "C is not approximately equal to reference"
Copy link
Collaborator

Choose a reason for hiding this comment

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

The reference is the first of the libraries passed to runbenchmark, so perhaps the order does matter -- we should trust that the reference is correct.
When we get this error, we know either the ref or lib is wrong.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not quite sure what you mean. Can you elaborate on this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh I see what you mean.

Copy link
Member Author

Choose a reason for hiding this comment

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

Should we instead just always use LinearAlgebra.mul! to compute the reference C0?

Copy link
Collaborator

Choose a reason for hiding this comment

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

That could take potentially many extra seconds at larger sizes, and do we trust it more than BinaryBuilder OpenBLAS or MKL (or BLIS)?
The time issue would be major when it's integers, and mul! calls the generic matmul.
I guess it'd be nice to always know what the reference is, though.

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good point. Hmmm.

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's keep the current behavior for now.

Copy link
Collaborator

@chriselrod chriselrod left a comment

Choose a reason for hiding this comment

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

Looks good.

@chriselrod
Copy link
Collaborator

Feel free to merge when ready.

@DilumAluthge DilumAluthge merged commit a365246 into master Feb 1, 2021
@DilumAluthge DilumAluthge deleted the dpa/assert branch February 1, 2021 08:23
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.

Replace @asserts
2 participants