Skip to content

Fix voloctree mapper - #67

Merged
andrea-iob merged 2 commits into
masterfrom
voloctree.fix.voloctree_mapper
Jun 22, 2020
Merged

andrea-iob merged 2 commits into
masterfrom
voloctree.fix.voloctree_mapper

Conversation

@edoardolombardi

Copy link
Copy Markdown
Member

Fix inverse mapping re-communication

@andrea-iob

Copy link
Copy Markdown
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
edoardolombardi force-pushed the voloctree.fix.voloctree_mapper branch from cec1db5 to 4772193 Compare June 10, 2020 12:38
@edoardolombardi

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

@edoardolombardi
edoardolombardi force-pushed the voloctree.fix.voloctree_mapper branch from 4772193 to a9712e3 Compare June 10, 2020 14:23
@andrea-iob
andrea-iob force-pushed the voloctree.fix.voloctree_mapper branch from a9712e3 to 52b1fc7 Compare June 22, 2020 06:58

@andrea-iob andrea-iob left a comment

Copy link
Copy Markdown
Member

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