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

ModuleNotFoundError: No module named 'lib.afm_op.CUDA' #4

Open
dhuznn opened this issue Mar 22, 2019 · 36 comments
Open

ModuleNotFoundError: No module named 'lib.afm_op.CUDA' #4

dhuznn opened this issue Mar 22, 2019 · 36 comments

Comments

@dhuznn
Copy link

dhuznn commented Mar 22, 2019

No description provided.

@dhuznn dhuznn closed this as completed Mar 22, 2019
@dhuznn dhuznn reopened this Mar 22, 2019
@TangXiaoyu9
Copy link

I have the same issue.

@cherubicXN
Copy link
Owner

  1. Please ensure the libraries located in <AFM_root>/lib is compiled in the first. If not, please run
cd <AFM_root>/lib
make
cd ..
  1. Once the lib is compiled, please run the commands
conda develop <AFM_root>
conda develop <AFM_root>/lib

The conda will add paths into your virtual environment to solve this issue.

Please read the INSTALL.md carefully for this issue.

@ShidiDaisy
Copy link

Hi, I also met the same problem.

And when I run make under <AFM_root>/lib, my output has this error:
"error: command 'g++' failed with exit status 1"
Does it mean make is not successful and cause the subsequent problem?

@cherubicXN
Copy link
Owner

Hi, I also met the same problem.

And when I run make under <AFM_root>/lib, my output has this error:
"error: command 'g++' failed with exit status 1"
Does it mean make is not successful and cause the subsequent problem?

Yes. Did you check your compilers (including g++ and CUDA)?

@ShidiDaisy
Copy link

Hi, I also met the same problem.
And when I run make under <AFM_root>/lib, my output has this error:
"error: command 'g++' failed with exit status 1"
Does it mean make is not successful and cause the subsequent problem?

Yes. Did you check your compilers (including g++ and CUDA)?

I'm using gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04):
Using built-in specs. COLLECT_GCC=g++ COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.3.0-27ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 7.3.0 (Ubuntu 7.3.0-27ubuntu1~18.04)

The CUDA driver version is 10.0. The deviceQuery result is PASS. And the pytorch is installed with cudatoolkit=10.0

@cherubicXN
Copy link
Owner

Could you share all of the output after running the make command?

@ShidiDaisy
Copy link

Could you share all of the output after running the make command?
Here is output for make:

cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/usr/local/lib/python3.6/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cuda
gcc -pthread -B /usr/local/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/local/lib/python3.6/site-packages/torch/lib/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/TH -I/usr/local/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/usr/local/include/python3.6m -c ./vision.cpp -o build/temp.linux-x86_64-3.6/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
gcc -pthread -B /usr/local/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/usr/local/lib/python3.6/site-packages/torch/lib/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/TH -I/usr/local/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/usr/local/include/python3.6m -c ./vision (1).cpp -o build/temp.linux-x86_64-3.6/./vision (1).o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/usr/local/lib/python3.6/site-packages/torch/lib/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/torch/csrc/api/include -I/usr/local/lib/python3.6/site-packages/torch/lib/include/TH -I/usr/local/lib/python3.6/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/usr/local/include/python3.6m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.6/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.6
g++ -pthread -shared -B /usr/local/compiler_compat -L/usr/local/lib -Wl,-rpath=/usr/local/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/./vision.o build/temp.linux-x86_64-3.6/./vision (1).o build/temp.linux-x86_64-3.6/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.6/CUDA.cpython-36m-x86_64-linux-gnu.so
build/temp.linux-x86_64-3.6/./vision (1).o: In function std::operator-(std::_Bit_iterator_base const&, std::_Bit_iterator_base const&)': /usr/local/lib/python3.6/site-packages/torch/lib/include/pybind11/pybind11.h:419: multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'
build/temp.linux-x86_64-3.6/./vision.o:/content/gdrive/My Drive/SteelMesh/line detection/afm_cvpr2019-master/lib/afm_op/./afm.h:9: first defined here
build/temp.linux-x86_64-3.6/./vision (1).o: In function pybind11::detail::instance::allocate_layout()': /usr/include/c++/7/bits/stl_bvector.h:925: multiple definition of PyInit_CUDA'
build/temp.linux-x86_64-3.6/./vision.o:/content/gdrive/My Drive/SteelMesh/line detection/afm_cvpr2019-master/lib/afm_op/./vision.cpp:3: first defined here
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

@cherubicXN
Copy link
Owner

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

@ShidiDaisy
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

@cherubicXN
Copy link
Owner

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

@ShidiDaisy
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

@zhiyunpengpeng
Copy link

I have some problems, when i make ,the warning is , " skipping 'squeeze.cpp' Cython extension (up-to-date)"
make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/zyp/anaconda3/lib/python3.7/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/zyp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./vision.cpp -o build/temp.linux-x86_64-3.7/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.7/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/zyp/anaconda3/compiler_compat -L/home/zyp/anaconda3/lib -Wl,-rpath=/home/zyp/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./vision.o build/temp.linux-x86_64-3.7/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so ->
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

@cherubicXN
Copy link
Owner

I have some problems, when i make ,the warning is , " skipping 'squeeze.cpp' Cython extension (up-to-date)"
make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/zyp/anaconda3/lib/python3.7/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/zyp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./vision.cpp -o build/temp.linux-x86_64-3.7/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.7/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/zyp/anaconda3/compiler_compat -L/home/zyp/anaconda3/lib -Wl,-rpath=/home/zyp/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./vision.o build/temp.linux-x86_64-3.7/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so ->
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

Hi, you can ignore the warnings. Your output is correct and the libraries have been compiled successfully.

@cherubicXN
Copy link
Owner

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

@zhiyunpengpeng
Copy link

I have some problems, when i make ,the warning is , " skipping 'squeeze.cpp' Cython extension (up-to-date)"
make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/zyp/anaconda3/lib/python3.7/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/zyp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./vision.cpp -o build/temp.linux-x86_64-3.7/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.7/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/zyp/anaconda3/compiler_compat -L/home/zyp/anaconda3/lib -Wl,-rpath=/home/zyp/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./vision.o build/temp.linux-x86_64-3.7/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so ->
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

Hi, you can ignore the warnings. Your output is correct and the libraries have been compiled successfully.

thank you

@ShidiDaisy
Copy link

I have some problems, when i make ,the warning is , " skipping 'squeeze.cpp' Cython extension (up-to-date)"
make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/zyp/anaconda3/lib/python3.7/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/zyp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./vision.cpp -o build/temp.linux-x86_64-3.7/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.7/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/zyp/anaconda3/compiler_compat -L/home/zyp/anaconda3/lib -Wl,-rpath=/home/zyp/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./vision.o build/temp.linux-x86_64-3.7/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so ->
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

Hi, may I ask, did you also use gcc-5.4 to compile?

@ShidiDaisy
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

No, I only tried in google colab. Could that be the source of the problem?

@zhiyunpengpeng
Copy link

I have some problems, when i make ,the warning is , " skipping 'squeeze.cpp' Cython extension (up-to-date)"
make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/zyp/anaconda3/lib/python3.7/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.7
creating build/temp.linux-x86_64-3.7/cuda
gcc -pthread -B /home/zyp/anaconda3/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./vision.cpp -o build/temp.linux-x86_64-3.7/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/torch/csrc/api/include -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/TH -I/home/zyp/anaconda3/lib/python3.7/site-packages/torch/lib/include/THC -I/usr/local/cuda/include -I/home/zyp/anaconda3/include/python3.7m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.7/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.7
g++ -pthread -shared -B /home/zyp/anaconda3/compiler_compat -L/home/zyp/anaconda3/lib -Wl,-rpath=/home/zyp/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.7/./vision.o build/temp.linux-x86_64-3.7/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.7/CUDA.cpython-37m-x86_64-linux-gnu.so ->
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)

Hi, may I ask, did you also use gcc-5.4 to compile?

是的, 5.4.0

@zhiyunpengpeng
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

can i use python3.7?

@chengxius
Copy link

I have the same issue, and it didn't work as the INSTALL.md .Otherwise,if i change 'from .CUDA import afm' to 'from .cuda import afm', the problem changes to 'ImportError: cannot import name 'afm''. I don't how to deal with it .

@ShidiDaisy
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

After I changed to AWS GPU, the problem solved.

@zhiyunpengpeng
Copy link

RuntimeError: CUDA out of memory. Tried to allocate 25.00 MiB (GPU 0; 3.94 GiB total capacity; 3.14 GiB already allocated; 21.56 MiB free; 634.00 KiB cached)

do you have this problem?how to deal with it?

@cherubicXN
Copy link
Owner

I have the same issue, and it didn't work as the INSTALL.md .Otherwise,if i change 'from .CUDA import afm' to 'from .cuda import afm', the problem changes to 'ImportError: cannot import name 'afm''. I don't how to deal with it .

You cannot change 'from .CUDA import afm' to 'from .cuda import afm'. The afm_op.CUDA is a compiled library for attraction field map generating.

@cherubicXN
Copy link
Owner

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

After I changed to AWS GPU, the problem solved.

So, the problem is caused by colab?

@ShidiDaisy
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

After I changed to AWS GPU, the problem solved.

So, the problem is caused by colab?

Looks like colab can't compile the files when files are located in the mapped google drive path.

@siyuada
Copy link

siyuada commented Jul 31, 2019

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

I have tried to compile with gcc-5.5, it also gave the same error.

It is weird. Did you try to compile the lib on other computers?

After I changed to AWS GPU, the problem solved.

So, the problem is caused by colab?

Looks like colab can't compile the files when files are located in the mapped google drive path.

hey, could you explain more details for how to solve this problem? Really thanks.

@siyuada
Copy link

siyuada commented Jul 31, 2019

I get the error when I make the lib.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/huangsiyu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c squeeze.cpp -o build/temp.linux-x86_64-3.6/squeeze.o -Wno-unused-function
squeeze.cpp:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Could you give any help?

@siyuada
Copy link

siyuada commented Aug 6, 2019

I get the error when I make the lib.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/huangsiyu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c squeeze.cpp -o build/temp.linux-x86_64-3.6/squeeze.o -Wno-unused-function
squeeze.cpp:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have solved above problem by install python3.6-dev.
Make environment:
python 3.6
GCC 5.4
cuda 10.0

@cherubicXN
Copy link
Owner

I get the error when I make the lib.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/huangsiyu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c squeeze.cpp -o build/temp.linux-x86_64-3.6/squeeze.o -Wno-unused-function
squeeze.cpp:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have solved above problem by install python3.6-dev.
Make environment:
python 3.6
GCC 5.4
cuda 10.0

Sorry for replying you late. Did you use the conda environment?

@siyuada
Copy link

siyuada commented Aug 6, 2019

I get the error when I make the lib.

x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/huangsiyu/.local/lib/python3.6/site-packages/numpy/core/include -I/usr/include/python3.6m -c squeeze.cpp -o build/temp.linux-x86_64-3.6/squeeze.o -Wno-unused-function
squeeze.cpp:4:20: fatal error: Python.h: No such file or directory
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

I have solved above problem by install python3.6-dev.
Make environment:
python 3.6
GCC 5.4
cuda 10.0

Sorry for replying you late. Did you use the conda environment?

No, I didn't use conda environment, I just use pip3 install to set the environment. It looks well now. I'll download the dataset and try it next.

Really thanks for your work!

@siyuada
Copy link

siyuada commented Aug 7, 2019

@cherubicXN Your code runs OK with above environment.

@wangzhiqiangwq
Copy link

Dear, you compile the makefile in Ubuntu or in Windows? I try to complie your code in window10, I install Wingw32 to complie the makefile, and also appear the error above.

@zhiyunpengpeng
Copy link

Hi, I also met the same problem.
And when I run make under <AFM_root>/lib, my output has this error:
"error: command 'g++' failed with exit status 1"
Does it mean make is not successful and cause the subsequent problem?

Yes. Did you check your compilers (including g++ and CUDA)?

Hi, thanks to your work, i want to test the value of Precision and recall, but the code have nothing about it .Do you have the corresponding code?

@zhiyunpengpeng
Copy link

multiple definition of afm(at::Tensor const&, at::Tensor const&, int, int)'

The problem seems to be this error. Did you change the code?

Hi, I didn't change any.

I guess the problem is caused by gcc-7.3. I cannot compile with gcc-7.3 either but it works for gcc-5.4. I need more time to fix this problem.

Hi, thanks to your work, i want to test the value of Precision and recall, but the code have nothing about it .Do you have the corresponding code?

@JanineCHEN
Copy link

Hey, I am getting the same issue here after executing INSTALL.md without errors (seemly like), the following are details for make and develop:

(afm) user:~/afm_cvpr2019-master$ cd lib
(afm) user:~/afm_cvpr2019-master/lib$ make
cd afm_op; python setup.py build_ext --inplace; rm -rf build; cd ../../
/home/anaconda3/envs/afm/lib/python3.6/distutils/extension.py:131: UserWarning: Unknown Extension options: 'defined_macros'
  warnings.warn(msg)
running build_ext
building 'CUDA' extension
creating build
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/cuda
gcc -pthread -B /home/anaconda3/envs/afm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I. -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/TH -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/anaconda3/envs/afm/include/python3.6m -c ./vision.cpp -o build/temp.linux-x86_64-3.6/./vision.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
/usr/local/cuda/bin/nvcc -I. -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/TH -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/anaconda3/envs/afm/include/python3.6m -c ./cuda/afm.cu -o build/temp.linux-x86_64-3.6/./cuda/afm.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --compiler-options '-fPIC' -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=CUDA -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++11
creating build/lib.linux-x86_64-3.6
g++ -pthread -shared -B /home/anaconda3/envs/afm/compiler_compat -L/home/anaconda3/envs/afm/lib -Wl,-rpath=/home/anaconda3/envs/afm/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/./vision.o build/temp.linux-x86_64-3.6/./cuda/afm.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.6/CUDA.cpython-36m-x86_64-linux-gnu.so
copying build/lib.linux-x86_64-3.6/CUDA.cpython-36m-x86_64-linux-gnu.so -> 
cd squeeze/; python setup.py build_ext --inplace; rm -rf build; cd ../../
running build_ext
skipping 'squeeze.cpp' Cython extension (up-to-date)
building 'squeeze' extension
creating build
creating build/temp.linux-x86_64-3.6
gcc -pthread -B /home/anaconda3/envs/afm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include -I/home/anaconda3/envs/afm/include/python3.6m -c kernel.cpp -o build/temp.linux-x86_64-3.6/kernel.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
kernel.cpp: In function ‘void region_grow(int, int, float, float&, std::vector<Point>&, std::vector<Point>&, std::vector<float>&, PoLsMap&, float)’:
kernel.cpp:132:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int id = 0; id < map(x,y).size(); ++id) {
                     ~~~^~~~~~~~~~~~~~~~~
kernel.cpp:154:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < reg_int.size(); ++i)
                    ~~^~~~~~~~~~~~~~~~
kernel.cpp:164:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
                 for(int k = 0; k < map(xx,yy).size(); ++k) {
                                ~~^~~~~~~~~~~~~~~~~~~
kernel.cpp: In function ‘bool region2rect(const std::vector<Point>&, const std::vector<float>&, float, float, float, Rectangle&)’:
kernel.cpp:199:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<reg_int.size(); ++i)
                  ~^~~~~~~~~~~~~~~
kernel.cpp:218:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<reg_int.size(); ++i)
                  ~^~~~~~~~~~~~~~~
kernel.cpp: In function ‘void refine(std::vector<Point>&, Rectangle&, std::vector<float>&, PoLsMap&)’:
kernel.cpp:277:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < reg_int.size(); ++i)
                    ~~^~~~~~~~~~~~~~~~
kernel.cpp:291:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < reg_rot.size(); ++i)
                    ~~^~~~~~~~~~~~~~~~
kernel.cpp:312:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i = 0; i < local_ind.size();++i)
                        ~~^~~~~~~~~~~~~~~~~~
kernel.cpp:317:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int n = 0; n < map(x,y).size();++n)
                            ~~^~~~~~~~~~~~~~~~~
kernel.cpp:267:11: warning: unused variable ‘x1’ [-Wunused-variable]
     float x1 = rect.l_min*dx - rect.w_min*dy;
           ^~
kernel.cpp:268:11: warning: unused variable ‘y1’ [-Wunused-variable]
     float y1 = rect.l_min*dy + rect.w_min*dx;
           ^~
kernel.cpp:269:11: warning: unused variable ‘x2’ [-Wunused-variable]
     float x2 = rect.l_max*dx - rect.w_min*dy;
           ^~
kernel.cpp:270:11: warning: unused variable ‘y2’ [-Wunused-variable]
     float y2 = rect.l_max*dy + rect.w_min*dx;
           ^~
kernel.cpp:271:11: warning: unused variable ‘x3’ [-Wunused-variable]
     float x3 = rect.l_max*dx - rect.w_max*dy;
           ^~
kernel.cpp:272:11: warning: unused variable ‘y3’ [-Wunused-variable]
     float y3 = rect.l_max*dy + rect.w_max*dx;
           ^~
kernel.cpp:273:11: warning: unused variable ‘x4’ [-Wunused-variable]
     float x4 = rect.l_min*dx - rect.w_max*dy;
           ^~
kernel.cpp:274:11: warning: unused variable ‘y4’ [-Wunused-variable]
     float y4 = rect.l_min*dy + rect.w_max*dx;
           ^~
kernel.cpp: In function ‘void _region_grow(int, int, const float*, const float*, const float*, int, float*, int*)’:
kernel.cpp:364:15: warning: unused variable ‘length’ [-Wunused-variable]
         float length = sqrt((vec_rects[i].x1-vec_rects[i].x2)*(vec_rects[i].x1-vec_rects[i].x2) +
               ^~~~~~
gcc -pthread -B /home/anaconda3/envs/afm/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include -I/home/anaconda3/envs/afm/include/python3.6m -c squeeze.cpp -o build/temp.linux-x86_64-3.6/squeeze.o -Wno-unused-function
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include/numpy/ndarraytypes.h:1832:0,
                 from /home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include/numpy/ndarrayobject.h:12,
                 from /home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include/numpy/arrayobject.h:4,
                 from squeeze.cpp:581:
/home/anaconda3/envs/afm/lib/python3.6/site-packages/numpy/core/include/numpy/npy_1_7_deprecated_api.h:17:2: warning: #warning "Using deprecated NumPy API, disable it with " "#define NPY_NO_DEPRECATED_API NPY_1_7_API_VERSION" [-Wcpp]
 #warning "Using deprecated NumPy API, disable it with " \
  ^~~~~~~
g++ -pthread -shared -B /home/anaconda3/envs/afm/compiler_compat -L/home/anaconda3/envs/afm/lib -Wl,-rpath=/home/anaconda3/envs/afm/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/kernel.o build/temp.linux-x86_64-3.6/squeeze.o -o /home/afm_cvpr2019-master/lib/squeeze/squeeze.cpython-36m-x86_64-linux-gnu.so
(afm) user:~/afm_cvpr2019-master/lib$ conda develop . ./lib
added /home/.local/share/Trash/files/lib
completed operation for: /home/.local/share/Trash/files/lib
added /home/.local/share/Trash/files/lib/lib
completed operation for: /home/.local/share/Trash/files/lib/lib

@ch-hristov
Copy link

I noticed this gets fixed easily if I'm building the library on a CUDA compatible PC

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

10 participants