-
Notifications
You must be signed in to change notification settings - Fork 192
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
A possible solution to OOM in Metattack. #128
Comments
Hi! I've encountered the same problem that CUDA out of memory when using the following environment on Ubuntu 20.04.5 LTS:
I have already made the changes that you suggested. Could you please help me solve this problem? |
Hi! I'm sorry that I don't know why the changes don't work in your environment.
I'm running the code on a GPU with 98GB memory. If no changes are made, I encounter CUDA out of memory just like you after generating two or three graphs against Metattack. (I guess there are gradients or something not removed from GPU.) After doing the changes I mentioned, the memory cost on dataset Cora is about 3000-4000M, which is now acceptable to me. |
Hi, thanks for your reply!
to
When the process comes to around 45%, I encountered the OOM error, the error message shows like below:
Do you have any suggestions for me? Thanks! |
Hi! |
Hi, thanks for your suggestions! I tried to create an environment with the details below:
Under these settings, I can successfully run the dataset: 'cora', 'cora_ml', 'citeseer', 'polblogs'. But for the dataset 'pubmed', still has the OOM problem. Have you ever encountered this problem? Thanks! |
Hi! |
I found an efficient implementation in GreatX, hope it helps you. |
Hi @Leirunlin @nowyouseemejoe , thanks for your advice, I will try that! |
Thank you all for the great discussion and suggestions! We are a bit shorthanded right now and you may want to directly make pull request if you found any bugs. For the OOM issue,
You may want to try |
Hi,
|
Hi Enyan, Thank you for your suggestion! I tried to modify the code according to your way, but it still doesn't work on my device. May I ask how large is your GPU memory? Thanks |
Hi!
As mentioned in issues #90 and #127, OOM occurs when running Metattack in a higher version of Pytorch.
I check the source code in metattack.py and find that function ''get_adj_score()'' seems to be the reason.
DeepRobust/deeprobust/graph/global_attack/mettack.py
Lines 125 to 139 in 1c0ef07
I try substituting line 128 and 130 with explicit subtraction and it works fine to me to avoid OOM, that is using
adj_meta_grad = adj_meta_grad - adj_meta_grad.min()
and
adj_meta_grad = adj_meta_grad - torch.diag(torch.diag(adj_meta_grad, 0))
In fact, I found it is enough if only line 128 is replaced.
I think something goes wrong when "-=" and ".min()" are used together.
It would be really helpful for me if anyone could offer an explanation to it.
The text was updated successfully, but these errors were encountered: