pnnl / chgl

Chapel HyperGraph Library (CHGL) - HPC-class Hypergraphs in Chapel
https://pnnl.github.io/chgl/
MIT License
29 stars 8 forks source link

*Fix* remove seg fault from having more than 2 data files #48

Closed mandysack closed 5 years ago

mandysack commented 5 years ago

In file src/modules/Components.chpl

in function:

proc getEdgeComponentMappings(graph, s = 1)

There is recursive function that gets called visit (below) that tries to read in the component. However, there is no check to make sure there is another component to read in. I added a check to remove the seg fault error:

proc visit(e : graph._value.eDescType, id) : int {
        var currId = id;

        while true {
            var eid = components[e.id].read();

Fix:

      proc visit(e : graph._value.eDescType, id) : int {
        var currId = id;

        while true {
            if components[e.id].read() == max(int){
                return currId;
            }
            var eid = components[e.id].read();