Skip to content
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

Fix voloctree mapper #67

Merged
merged 2 commits into from
Jun 22, 2020
Merged

Fix voloctree mapper #67

merged 2 commits into from
Jun 22, 2020

Conversation

edoardolombardi
Copy link
Member

Fix inverse mapping re-communication

@andrea-iob
Copy link
Member

Changes to the .gitignore file doesn't belong to this pull request.

Mapping info can be large, can we avoid making the copy? Something along the lines with (not tested):

            // Remove old ids and ranks if rank != from local one
            auto infoItr = info.begin();
            while (infoItr != info.end()) {
                int rank = infoItr->ranks[i];
                if (rank != m_mappedPatch->getRank()){
                    infoItr = info.erase(infoItr);
                } else {
                    ++infoItr;
                }
            }

@edoardolombardi
Copy link
Member Author

Your proposal is not aligned with the code; erasing a whole info item is not an option here.
I pushed a new implementation without copy.

@andrea-iob
Copy link
Member

I don't fully understand the updated code; I don't see were the iterators are updated when you are deleting an entry. I would expect something like the following:

            auto idsIter = info.ids.begin();
            auto ranksIter = info.ranks.begin();
            while (idsIter != info.ids.end()){
                int rank = *ranksIter;
                if (rank != m_mappedPatch->getRank()){
                    idsIter = info.ids.erase(idsIter);
                    ranksIter = info.ranks.erase(ranksIter);
                }
                else{
                    idsIter++;
                    ranksIter++;
                }
            }

Anyways, I haven't look at what the code does except for the small portion changed by the patch, so if your code is tested and works that's fine with me. Also, if you are deleting single entries in a vector, you original code my be faster (I thought you were deleting the whole vectors).

@edoardolombardi
Copy link
Member Author

Ah, you're right, thanks. I'm pushing the fixed version.
I don't have any preferences between using the original version or this one. For our sample cases differences in time or memory are not appreciable.

@andrea-iob andrea-iob force-pushed the voloctree.fix.voloctree_mapper branch from a9712e3 to 52b1fc7 Compare June 22, 2020 06:58
Copy link
Member

@andrea-iob andrea-iob left a comment

Choose a reason for hiding this comment

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

I've split the changes in two commits and updated the coding style. I will merge as soon as the tests finish.

@andrea-iob andrea-iob merged commit 52b1fc7 into master Jun 22, 2020
@andrea-iob andrea-iob deleted the voloctree.fix.voloctree_mapper branch June 22, 2020 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants