Closed Schefflera-Arboricola closed 1 year ago
Hmm, interesting. It seems like there is no speedups on your machine while running the timing task. Maybe something you can investigate? @Schefflera-Arboricola
@MridulS sir,
In the CPU core utilization window, the work was not distributed uniformly among all the 8 cores, most of the work was on one core at a time while the script was running.
The CPU% was around 100, and the number of threads for the process was 17(rarely become 18 or 20). It was the same when I executed currFun
for the standard and the parallel graph separately.
I even tried it for 1000 nodes graphs but I was still getting most of the values in the heatmap around 1.
I recently pulled some new changes and I was getting this error:
betweenness = dict.fromkeys(G, 0.0) # b[v]=0 for v in G
^^^^^^^^^^^^^^^^^^^^^
TypeError: 'ParallelGraph' object is not iterable
So I added this code to interface.py
:
class ParallelGraph:
__networkx_plugin__ = "parallel"
def __init__(self, graph_object):
self.graph_object = graph_object
def is_multigraph(self):
return self.graph_object.is_multigraph()
def is_directed(self):
return self.graph_object.is_directed()
def getitem(self, node):
if node in self.graph_object:
return list(self.graph_object.neighbors(node))
else:
raise KeyError(f"Node {node} not found in the graph.")
def iter(self):
return iter(self.graph_object.nodes())
def len(self):
return len(self.graph_object)
but I am still getting a similar heatmap.
Running on: MacBook Air(macOS: 13.3.1(a))
Could you please help me figure out what might be the issue here, or redirect me to some resource where I could learn more about it(parallel algorithms and their benchmarking, etc.)?
Also, if a cell in the heatmap corresponds to a graph with a particular number of nodes and a particular edge probability, then why have we used `0.5` instead of `p` [here](https://github.com/networkx/nx-parallel/blob/main/timing/timing_individual_function.py#L21)?
Thank you very much for your patience :)
@MridulS sir, I think it was happening because I didn't run pip install -e ".[developer]"
after setting up the environment, and I also didn't get that TypeError
now. The additional code in interface.py
was not required. I have updated the heat map.
But I am still doubtful about this :
Also, if a cell in the heatmap corresponds to a graph with a particular number of nodes and a particular edge probability, then why have we used
0.5
instead ofp
here?
I got this map for p
and this for 0.5
Thank you :)
Also, if a cell in the heatmap corresponds to a graph with a particular number of nodes and a particular edge probability, then why have we used 0.5 instead of p here?
Yes that looks like a bug, it should be using p
to create the random graph. Good catch!
Could you send a PR to the nx-parallel repo to fix it?
@MridulS done. see here
thanks!
heatmap task