Open RohanK22 opened 3 months ago
The following two DSL snippets are logically the same:
if(newPageRank - v.pageRank >= 0) {
diff = newPageRank - v.pageRank + diff;
} else {
diff = v.pageRank - newPageRank + diff;
}
and
if(newPageRank - v.pageRank >= 0) {
diff += newPageRank - v.pageRank;
} else {
diff += v.pageRank - newPageRank;
}
Both snippets update diff
by adding the absolute difference between newPageRank
and v.pageRank
.
To avoid this issue, we have been using the following workaround:
float newPageRank = (1 - delta) / numNodes + delta * sum;
if (newPageRank - v.pageRank >= 0) {
diff_temp = newPageRank - v.pageRank + diff;
} else {
diff_temp = v.pageRank - newPageRank + diff;
}
diff = diff_temp;
With this workaround, the double declaration does not occur.
To ensure correct behavior and eliminate redundant declarations, we need to address the root cause of the problem: the unary operator conversion in our DSL. The DSL should support language constructs that handle unary operations properly.
PageRankDSLV3 Code (Static):
Generated MPI Code that contains duplicate declaration of variable (diff_temp):