MockNcclGroup.cc中是不是有bug
Open
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 184
- Avg merge
- 13h 4m
- Merged PRs (30d)
- 1
Description
MockNcclGroup::DoubleBinaryTreeNode* MockNcclGroup::InterDouBinTreeShift(DoubleBinaryTreeNode* root,std::vector<int>nodes){
std::map<int,DoubleBinaryTreeNode*>node2treenode;
std::map<int,int>rank2index;
std::queue<DoubleBinaryTreeNode*>q;
for(int i =0 ;i<nodes.size();i++) {
node2treenode[nodes[i]] = new DoubleBinaryTreeNode(nodes[i]);
rank2index[nodes[i]] = i;
}
q.push(root);
while (!q.empty())
{
DoubleBinaryTreeNode* current = q.front();
q.pop();
int node = current->node;
int nodeshift = nodes[(rank2index[node] + 1) % nodes.size()];
DoubleBinaryTreeNode* currentshift = node2treenode[nodeshift];
if(current->left != nullptr) {
int leftnode = current->left->node;
int leftnodeshift = nodes[(rank2index[leftnode] + 1) % nodes.size()];
currentshift->left = node2treenode[leftnodeshift];
q.push(current->left);
}
if(current->right != nullptr) {
int rightnode = current->right->node;
int rightnodeshift = nodes[(rank2index[rightnode] + 1) % nodes.size()];
currentshift->right = node2treenode[rightnodeshift];
q.push(current->right);
}
}
return node2treenode[(nodes[rank2index[root->node]+1]) % nodes.size()];
有一个函数是这样的,返回语句的括号似乎写错位置了吧?
应该是这样对吗?
return node2treenode[nodes[(rank2index[root->node] + 1) % nodes.size()]];
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open MockNcclGroup.cc and inspect InterDouBinTreeShift, focusing first on the return expression's indexing and parentheses. Compare it with the node-shift calculations above, then verify that the corrected expression returns the shifted root node and run the project's relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- distributed-systems
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100