-
Notifications
You must be signed in to change notification settings - Fork 22
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
Need ygm::container::unordered_map
or similar
#118
Comments
@bwpriest, ++ on this. However, I would want us to fully convert to a separated key/value interface instead of the std::pair<const key,value>, including for_all(), before we start designing a new hash table. I'm not a big fan of std::unordered_map; IMHO, its not a big enough win over std::map to justify the effort. Fortunately, for our standard insert-more-than-delete use cases, there are much better simple tables we could design. Perhaps step 1 is to overhaul ygm::map and ygm::multimap to remove all echoes of std::pair<const key,value>. |
@rogerpearce if we're ready to lose all support for |
Lets wait to hear from @steiltre since he will have external code to update. I think its worth the pain to do this now. |
One thing I thought about: For array, we probably want to support both: array.for_all ( [](size_t index, auto& value) {} ) ; Also, we need a concept to determine at compile time what the interface is, similar to what "value_type" does for STL. We could have a "visit_types" that is a tuple and we just assume that its interpreted as separate arguments to a callback. |
This will be easy to manage for local lambdas. If we want to do something similar for remote lambdas, we'll be unable to distinguish between pointer-value and index-value intents with
I don't understand what you are proposing here. What would the elements of the |
I think I've managed to get all of the code I care about updated to the new map API today, or have pegged code I don't plan on supporting/updating to use YGM v0.5. I will merge in the associated PR to develop and send out a warning to anyone this may affect. |
Any reason we want this for |
I want it for_all() so that bag and array can behave similarly. I don't see the need for async_visit() to have both interfaces, because bag doesn't have an async_visit. |
In that case, does it make sense to also support:
|
I don't see the need for it for map now, but could be convinced if you think it would be useful. I think both Bag & Array should let you loop over all the elements without an index. Map its natural to loop overall all keys and values. Could have for_all_keys and for_all_values, but again, not necessary right now. |
My main argument for doing this is to maintain a similar interface for map and array. In a lot of my codes I like to template the index-feature container away and swap in what I want to use at compile time. For example, if I have my |
So would a for_all_values be useful for this? Seems so. Bag could support for_all_values, and then make it consistent with array, which is really what I'm after. In some ways we have Array acting as both a value container and an associative container. When we do finally get a tagged_bag container, will naturally have the key/value concept too. |
Trying to summarize the lambda interfaces that everyone wants.
Does this support everyone's desired functionality? Or do we need to add in some |
I don't have a use case for that right now, but I could imagine wanting to |
I thought we decided to do this via adapters, instead of for_all_values and for_all_keys, no? I do think we should have some typedefs: key_type -- could be missing for Bag |
I think I figured out how to compile time test if a lambda is properly invocable and if its STL (std::for_each) vs YGM (for_all()). If we had conatiner::for_each_types it could be robust. |
Actually, we should call them: for_all_args Each should be a tuple that is expanded before is_invocable. |
Ah. I do think that was the idea. Just saw PR #135 and forgot we were trying to handle this more generically. |
It will be useful for performance reasons to maintain a distributed key-value store with an interface like
ygm::container::map
that uses a hashmap under the hood instead ofstd::map
.std::unorderd_map
is a logical choice, but I gather that we will need to do something to ensure that we use different hash functions for assignment of keys to ranks versus keys to hash bins.The text was updated successfully, but these errors were encountered: