Skip to content

MOM_murmur: MurmurHash3 implementation#834

Merged
Hallberg-NOAA merged 1 commit intoNOAA-GFDL:dev/gfdlfrom
marshallward:murmur
Feb 14, 2025
Merged

MOM_murmur: MurmurHash3 implementation#834
Hallberg-NOAA merged 1 commit intoNOAA-GFDL:dev/gfdlfrom
marshallward:murmur

Conversation

@marshallward
Copy link
Copy Markdown
Member

This PR adds a new module, MOM_murmur, that computes the MurmurHash of an input array. The murmur function computes a unique 32-bit hash of an array. Hashes are unique to a particular reordering and can also detect presence of negative zeros. Both cases are currently undetected by current debug tests (mean/min/max/bitcount).

Hash checksums are currently disabled, since our testing reports hash differences for a few diagnostics. It can be enabled at compile-time when needed, and we can enable this test at some later date after the offending arrays have been investigated.

Comment thread src/framework/MOM_checksums.F90 Outdated
Copy link
Copy Markdown
Member

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

Thank you for this valuable new contribution. I note about a half-dozen lines that should be modified to conform to the MOM6 style guide that should be changed before this could be accepted.

Also, I find that the name murmur() is not very self explanatory. Would you consider changing this to murmur_hash() instead to give a clearer hint of what it is doing?

@marshallward
Copy link
Copy Markdown
Member Author

I renamed murmur() to murmur_hash().

I screwed up the rebase and accidentally merged the two commits, but I suppose they sort of belong together anyway.

See the inline comments about the array indexing convention.

Copy link
Copy Markdown
Member

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

This PR is now looks good to me.

Comment thread src/framework/MOM_murmur_hash.F90 Outdated
Copy link
Copy Markdown
Member

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

Unfortunately this PR is not compiling with the version of the PGI / NVIDIA compiler we have access to due to non-support of the Fortran 2008 shiftr() function. (It is compiling and running perfectly well with the intel and gnu compilers.) This PR needs to be changed to compile with all of the compilers we are using for testing, or perhaps we need another strategy for how to handle this valuable new capability so that we can still use it for debugging when we are not using the PGI/NVIDIA compiler.

Copy link
Copy Markdown
Member

@Hallberg-NOAA Hallberg-NOAA left a comment

Choose a reason for hiding this comment

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

Thank you for these revisions, which should hopefully work better across a range of compilers.

This patch adds the MOM_murmur_hash module, a non-cryptographic hash
function used to generate unique hashes for arrays.

The particular property of interest is that murmur hashes are sensitive
to order.  This will allow us to detect a wider range of answer changes
which would otherwise be undetected by the current min/max/mean/bitcount
method.

The checksum functions have also been modified to produce murmur hashes,
although the compile-time flag to generate them is currently disabled.
@Hallberg-NOAA
Copy link
Copy Markdown
Member

This PR has passed pipeline testing at https://gitlab.gfdl.noaa.gov/ogrp/mom6ci/MOM6/-/pipelines/26395.

@Hallberg-NOAA Hallberg-NOAA merged commit 38a0cb0 into NOAA-GFDL:dev/gfdl Feb 14, 2025
@marshallward marshallward deleted the murmur branch March 13, 2025 20:13
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.

2 participants