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

Error: expected primary-expression before ‘float’ frpm auction_match_gpu.cpp #8

Open
GabbySuwichaya opened this issue May 20, 2022 · 2 comments

Comments

@GabbySuwichaya
Copy link

I run the following line,

python eval.py --gpu 0 --resume logs/punet_baseline/punet_epoch_99.pth

Then, I received the following error

(PUNet10) gabby-suwichaya@gabby-suwichaya:/mnt/HDD4TB3/PU-Net_pytorch$ /home/gabby-suwichaya/anaconda3/envs/PUNet10/bin/python /mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match.py
Traceback (most recent call last):
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 960, in _build_extension_module
    check=True)
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match.py", line 11, in <module>
    am = load(name="am", sources=sources)
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 658, in load
    is_python_module)
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 827, in _jit_compile
    with_cuda=with_cuda)
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 880, in _write_ninja_file_and_build
    _build_extension_module(name, build_directory, verbose)
  File "/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 973, in _build_extension_module
    raise RuntimeError(message)
RuntimeError: Error building extension 'am': [1/2] c++ -MMD -MF auction_match_gpu.o.d -DTORCH_EXTENSION_NAME=am -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/TH -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda-11.1/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp -o auction_match_gpu.o
FAILED: auction_match_gpu.o 
c++ -MMD -MF auction_match_gpu.o.d -DTORCH_EXTENSION_NAME=am -DTORCH_API_INCLUDE_EXTENSION_H -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/TH -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/THC -isystem /usr/local/cuda-11.1/include -isystem /home/gabby-suwichaya/anaconda3/envs/PUNet10/include/python3.6m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++11 -c /mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp -o auction_match_gpu.o
In file included from /mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:1:
/home/gabby-suwichaya/anaconda3/envs/PUNet10/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/torch.h:11:4: warning: #warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h" [-Wcpp]
   11 | #  warning "Including torch/torch.h for C++ extensions is deprecated. Please include torch/extension.h"
      |    ^~~~~~~
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp: In function ‘int auction_match_wrapper_fast(int, int, at::Tensor, at::Tensor, at::Tensor, at::Tensor, at::Tensor)’:
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:9:46: error: expected primary-expression before ‘float’
    9 |     const float *xyz1 = xyz1_tensor.data_ptr<float>();
      |                                              ^~~~~
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:10:46: error: expected primary-expression before ‘float’
   10 |     const float *xyz2 = xyz2_tensor.data_ptr<float>();
      |                                              ^~~~~
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:11:42: error: expected primary-expression before ‘int’
   11 |     int *matchl = matchl_tensor.data_ptr<int>();
      |                                          ^~~
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:12:42: error: expected primary-expression before ‘int’
   12 |     int *matchr = matchr_tensor.data_ptr<int>();
      |                                          ^~~
/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp:13:40: error: expected primary-expression before ‘float’
   13 |     float *cost = cost_tensor.data_ptr<float>();
      |                                        ^~~~~
ninja: build stopped: subcommand failed.
@ZhuXiyue
Copy link

I had the same issue.
I changed all the 'data_ptr' into 'data' in the '/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp' file and it worked.

@yasamanparhizkar
Copy link

yasamanparhizkar commented Jun 2, 2024

I had the same issue. I changed all the 'data_ptr' into 'data' in the '/mnt/HDD4TB3/PU-Net_pytorch/auction_match/auction_match_gpu.cpp' file and it worked.

I just made this changed and it solved the ImportError: No module named 'am' problem as well.
Thank you @ZhuXiyue !

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

3 participants