GithubHelp home page GithubHelp logo

Comments (4)

fegennari avatar fegennari commented on May 25, 2024 1

Okay, thank you for looking into this. I'll continue to work around this using a sort on hashval, since this is only a problem with testing. It sounds like iteration order isn't guaranteed, so this isn't a bug. You can close this issue.

from parallel-hashmap.

greg7mdp avatar greg7mdp commented on May 25, 2024

Hum, I think that in general, tests should not depend on the order of iteration in any hash map. The iteration order is definitely not a provided guarantee, and indeed some containers (like the original abseil) make specific efforts to randomize iteration order (from here: "While std::unordered_map makes no guarantees about iteration order, many implementations happen to have a deterministic order based on the keys and their insert order. This is not true of absl::flat_hash_map and absl::node_hash_map. Thus, converting from std::unordered_map to absl::flat_hash_map can expose latent bugs where the code incorrectly depends on iteration order.").

Out of curiosity, what is the key type and hash function you are using for these containers?

from parallel-hashmap.

fegennari avatar fegennari commented on May 25, 2024

It's not really a bug, I'm mostly curious why the order differs. The tests that fail are ones that write some hash map contents out to disk and compare with golden results. My workaround has been to canonically sort the results for both the golden and actual run, and then everything agrees. As far as I can tell, gcc's hash_map, unordered_map, and google::sparse_hash_map agree across architectures.

The failing tests are all ones that unique polygon clips and write out the results. The key is a set of polygons (XY vertices) and the hash used is CityHash from here: https://github.com/google/cityhash. The hashes themselves agree - I printed them out. Only the iteration order disagrees. And it's only some minor changes, such as an isolated key jumping a few dozen spots in the order.

from parallel-hashmap.

greg7mdp avatar greg7mdp commented on May 25, 2024

Hum, not sure. My best guess as to the difference would be that maybe it uses different versions of phmap_mix<8> in phmap_utils.h (mixing is done after the hash computation), although in that case I would expect most keys to hash differently. If __int128 is supported on both platforms, and always provides the same results, then maybe there is a difference between the GroupSse2Impl (used on i86_64) and the GroupPortableImpl (used on ARM).

from parallel-hashmap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.