-
Notifications
You must be signed in to change notification settings - Fork 222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generator prevent the program from receiving system signals like CTRL-C #1193
Comments
Hi, I tested your code above and removed the Pytorch code (basically just doing the network generation) and added a print after each generation. There, SIGINT calls are received:
So it's likely part of Pytorch. My system is a 14.4 macOS with Python 3.12 (using NetworKit 11.0). |
I guess it is not caused by Pytorch. I very roughly check the source code of used functions of networkit, it looks like that some of the graph generating functions are using parallel edge generators. If you can change I guess one reason you can not see the problem is that you are not yet accessing those generated graph instances. I slighly update the test case, hopefully can provide more clues from time import sleep
import networkit as nk
# import torch
# from torch_geometric.data import Data
# from torch_geometric.utils.convert import from_networkit
glist = []
er_model = nk.generators.ErdosRenyiGenerator(80, 4 / 80)
for i in range(5):
nk_g = er_model.generate()
# pyg_e, _ = from_networkit(nk_g)
glist.append(nk_g)
# glist.append(Data(x=torch.zeros(80, requires_grad=False), edge_index=pyg_e))
sleep(1)
print(f"iter: {i}, {nk_g}")
for i, g in enumerate(glist):
sleep(1)
print(f"iter: {i}, {g}") The python's main function can normally accept the signals up until the first for-loop finish running. If the program progresses into the second for-loop, the main function will not accept the signals anymore. In this way, it will repeat the same issue I raised in the initial post. One ugly turn-around is that you can manually reclaim the ownership of signal handlers. But I am sure it's not the right way to resolve it. Actually, I am not fully confident to say if the problem is on torch or networkit, but let's take a look the above code first. |
I attached my code and my platform information
Software:
I am using the latest version of networkit installed via pip.
Problem and how to reproduce:
The program can not be terminated by sending ctrl-C signal. If I use NetworkX to generate graph and turn it into Networkit graph object, everything is ok. For example, if I replace
nk_g = er_model.generate()
bynk_g=nk.nxadapter.nx2nk(nx.erdos_renyi_graph(80, 4 / 80))
, then there is no problem at all.Please help me locate if the problem is on networkit or torch geometrics.
The text was updated successfully, but these errors were encountered: