Skip to content

parallel-for over concurrent hash map #163

Description

@jacopol

Hi, I want to do a parallel-for-loop (with OpenMP), iterating over the contents of a (concurrent) hash map.
In std::unordered_set one cannot write the following, since parallel-for needs a random-access iterator.

    #pragma omp parallel for
    for (auto m : current) { ... }

Instead, one can write the following, which is good enough:

    #pragma omp parallel for
    for (size_t b=0; b<current.bucket_count(); b++)
    for (auto m=current.begin(b); m!=current.end(b); m++) { ... }

Here the outer parallel-loop iterates over all buckets (random access), while the inner, sequential loop iterates over all elements in a given bucket.

Problem: it seems I cannot do the same in libcuckoo. I can get a sequential iterator over a locked_table, but this wouldn't have random access.
I couldn't find a way to get access to and iterate over the elements in a particular given bucket b; (i.e., current.begin(b) doesn't work, even not if current is locked_table).
Is there a way to achieve this? Or is it easy to extend the libcuckoo API with this functionality?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions