Hanjun-Dai / graph_adversarial_attack

Adversarial Attack on Graph Structured Data (https://arxiv.org/abs/1806.02371)
MIT License
127 stars 33 forks source link

Error with graph_attack and node_classification #4

Open clb0063 opened 4 years ago

clb0063 commented 4 years ago

I am able to successfully run the graph classification, but when I try to attack the graph, I get this error: undefined symbol: __cudaRegisterFatBinaryEnd

This error occurs with each attack method except for the genetic algorithm which works successfully. The error also occurs when running the node_classification.

I am using CUDA 9.1, pytorch 0.3.1, and cffi 1.11.2

acharkq commented 4 years ago

Same issue here.

Here is the full error report while running ./run_dqn.sh

(py27) zyliu@next-dgx1-01:~/code/graph_adversarial_attack/code/graph_attack$ ./run_dqn.sh -phase train
====== begin of s2v configuration ======
| msg_average = 0
======   end of s2v configuration ======
Namespace(adj_norm=1, base_model_dump='../../dropbox/scratch/results/graph_classification/components/nodes-90-100-p-0.02-c-1-3-lv-2/epoch-best', batch_size=50, bilin_q=0, cross_rate=0.1, ctx='cpu', data_folder='../../dropbox/data/components', dataset=None, del_rate=0, dropout=0.5, er_p=0.02, feat_dim=0, feature_dim=None, fold=1, frac_meta=0.1, gm='mean_field', hidden=32, idx_start=None, latent_dim=64, learning_rate=0.001, logfile='/storage/zyliu/scratch/results/graph_classification/components/nodes-90-100-p-0.02-c-1-3-lv-2/lv-5-frac-0.1/log.txt', max_c=3, max_lv=5, max_n=100, meta_test=0, min_c=1, min_n=90, mlp_hidden=64, mutate_rate=0.2, n_graphs=5000, n_hops=2, num_class=None, num_epochs=1000, num_instances=None, num_mod=1, num_steps=100000, out_dim=0, phase='train', population_size=100, rand_att_type=None, reward_type=None, rounds=10, save_dir='/storage/zyliu/scratch/results/graph_classification/components/nodes-90-100-p-0.02-c-1-3-lv-2/lv-5-frac-0.1', saved_model=None, seed=1, targeted=0, weight_decay=0.0005)
Traceback (most recent call last):
  File "dqn.py", line 17, in <module>
    from q_net import NStepQNet, QNet, greedy_actions
  File "/storage/zyliu/code/graph_adversarial_attack/code/graph_attack/q_net.py", line 22, in <module>
    from modules.custom_mod import JaggedMaxModule
  File "/storage/zyliu/code/graph_adversarial_attack/code/graph_attack/../common/modules/custom_mod.py", line 2, in <module>
    from functions.custom_func import JaggedLogSoftmax, JaggedArgmax, JaggedMax
  File "/storage/zyliu/code/graph_adversarial_attack/code/graph_attack/../common/functions/custom_func.py", line 3, in <module>
    from _ext import my_lib
  File "/storage/zyliu/code/graph_adversarial_attack/code/graph_attack/../common/_ext/my_lib/__init__.py", line 3, in <module>
    from ._my_lib import lib as _lib, ffi as _ffi
ImportError: /storage/zyliu/code/graph_adversarial_attack/code/graph_attack/../common/_ext/my_lib/_my_lib.so: undefined symbol: __cudaRegisterFatBinaryEnd
acharkq commented 4 years ago

Actually, for run_grad.sh, we can simply comment the 17th line of grad_attack.py and the code would be good to run.

lijianwen96 commented 3 years ago

The same error occurs when I run "./run_dqn.sh".

The most likely reason is that the cuda version at compile time is inconsistent with the cuda version at runtime. For me, the default cuda version of the server I use is 10.2, and its installation location is "/usr/local/cuda". Because I don't have root privileges, so I install cuda-9.1 under my own user path "/home/lijianwen/cuda" and add this path into "~/.bashrc". When doing make in "graph_adversarial_attack/code/common", the 12th line in file "Makefile" should be modified to "CUDA_HOME := /home/lijianwen/cuda", where it was "#CUDA_HOME := /usr/local/cuda" originally. Then, you could do make successfully and run it without error "undefined symbol: __cudaRegisterFatBinaryEnd".

Besides, the Networkx version should be 1.11 or lower, otherwise it would report an error "'Graph' object has no attribute '_node'".

Hanjun-Dai commented 3 years ago

thanks for figuring out the issue! Sorry this code is not well maintained as most dependencies have been updated. I'll see if I can make some adaptation to the latest version of CUDA at some point.