Skip to content
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

Torch not compiled with CUDA enabled in CPU mode #10

Open
matgreco opened this issue Jan 8, 2019 · 3 comments
Open

Torch not compiled with CUDA enabled in CPU mode #10

matgreco opened this issue Jan 8, 2019 · 3 comments

Comments

@matgreco
Copy link

matgreco commented Jan 8, 2019

When i run the command ./run_DGCNN.sh in CPU mode i get the following error.

I set the var gpu_or_cpu=cpu, and i don't have cuda on this pc.

How can i fix this error?

====== begin of s2v configuration ======
| msg_average = 0
====== end of s2v configuration ======
Namespace(batch_size=50, data='DD', dropout=True, extract_features=False, feat_dim=0, fold=10, gm='DGCNN', hidden=128, latent_dim=[32, 32, 32, 1], learning_rate=1e-05, max_lv=4, mode='cpu', num_class=0, num_epochs=200, out_dim=0, printAUC=False, seed=1, sortpooling_k=0.6, test_number=0)
loading data

classes: 2

maximum node tag: 82

train: 1061, # test: 117

k used in SortPooling is: 291
Initializing DGCNN
0%| | 0/21 [00:00<?, ?batch/s]Traceback (most recent call last):
File "main.py", line 187, in
avg_loss = loop_dataset(train_graphs, classifier, train_idxes, optimizer=optimizer)
File "main.py", line 131, in loop_dataset
logits, loss, acc = classifier(batch_graph)
File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "main.py", line 107, in forward
embed = self.s2v(batch_graph, node_feat, None)
File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in call
result = self.forward(*input, **kwargs)
File "/home/mat/Escritorio/DGCNN/pytorch_DGCNN/DGCNN_embedding.py", line 58, in forward
if isinstance(node_feat, torch.cuda.FloatTensor):
File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/init.py", line 161, in _lazy_init
_check_driver()
File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/init.py", line 75, in _check_driver
raise AssertionError("Torch not compiled with CUDA enabled")
AssertionError: Torch not compiled with CUDA enabled

@muhanzhang
Copy link
Owner

Hi, very sorry for the late reply as I was busying with a paper. I have reproduced your bug and updated the code. It should work in cpu mode now.

@matgreco
Copy link
Author

Thank's for your answer.

After to make a pull, I have tried to run the code and i get the followin error:

Traceback (most recent call last): File "main.py", line 187, in <module> avg_loss = loop_dataset(train_graphs, classifier, train_idxes, optimizer=optimizer) File "main.py", line 131, in loop_dataset logits, loss, acc = classifier(batch_graph) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "main.py", line 107, in forward embed = self.s2v(batch_graph, node_feat, None) File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/nn/modules/module.py", line 489, in __call__ result = self.forward(*input, **kwargs) File "/home/mat/Escritorio/DGCNN/pytorch_DGCNN/DGCNN_embedding.py", line 58, in forward if isinstance(node_feat, torch.cuda.FloatTensor): File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 161, in _lazy_init _check_driver() File "/home/mat/Escritorio/DGCNN/env/lib/python3.6/site-packages/torch/cuda/__init__.py", line 75, in _check_driver raise AssertionError("Torch not compiled with CUDA enabled") AssertionError: Torch not compiled with CUDA enabled

I used a venv whit torch==1.0.0 and set have setted the gpu_or_cpu var as cpu.

@muhanzhang
Copy link
Owner

Hi, I checked your bug information, the line 58 seems to be still the old version. In the new version, it has changed to "if torch.cuda.is_available() and isinstance(node_feat, torch.cuda.FloatTensor):". Can you check if your DGCNN_embedding.py is the new version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants