vinits5 / emd

This repository has Earth Mover Distance Function's CUDA implementation for Tensorflow And PyTorch.
7 stars 0 forks source link

What environment did you deploy on? I use pytorch1.6+cuda10.2 #2

Open linsanityyong opened 2 years ago

linsanityyong commented 2 years ago

however, I can not compile the code Thank you for your reply!

linsanityyong commented 2 years ago

running install running bdist_egg running egg_info writing PyTorch_EMD.egg-info\PKG-INFO writing dependency_links to PyTorch_EMD.egg-info\dependency_links.txt writing top-level names to PyTorch_EMD.egg-info\top_level.txt reading manifest file 'PyTorch_EMD.egg-info\SOURCES.txt' writing manifest file 'PyTorch_EMD.egg-info\SOURCES.txt' installing library code to build\bdist.win-amd64\egg running install_lib running build_py running build_ext C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py:270: UserWarning: Error checking compiler version for cl: 'utf-8' codec can't decode byte 0xd3 in position 0: invalid continuation byte warnings.warn('Error checking compiler version for {}: {}'.format(compiler, error)) building '_emd' extension Emitting ninja build file F:\Important Code\emd-master\emd_torch\build\temp.win-amd64-3.7\Release\build.ninja... Compiling objects... Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N) [1/2] cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -Ipkg/include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\TH -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\13001\Anaconda3\envs\pytorch\include -IC:\Users\13001\Anaconda3\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IF:\Windows Kits\10\include\10.0.16299.0\ucrt" "-IF:\Windows Kits\10\include\10.0.16299.0\shared" "-IF:\Windows Kits\10\include\10.0.16299.0\um" "-IF:\Windows Kits\10\include\10.0.16299.0\winrt" "-IF:\Windows Kits\10\include\10.0.16299.0\cppwinrt" -c "F:\Important Code\emd-master\emd_torch\pkg\src\emd.cpp" /Fo"F:\Important Code\emd-master\emd_torch\build\temp.win-amd64-3.7\Release\pkg/src/emd.obj" -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_emd -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14 FAILED: F:/Important Code/emd-master/emd_torch/build/temp.win-amd64-3.7/Release/pkg/src/emd.obj cl /showIncludes /nologo /Ox /W3 /GL /DNDEBUG /MD /MD /wd4819 /wd4251 /wd4244 /wd4267 /wd4275 /wd4018 /wd4190 /EHsc -Ipkg/include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\TH -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\13001\Anaconda3\envs\pytorch\include -IC:\Users\13001\Anaconda3\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IF:\Windows Kits\10\include\10.0.16299.0\ucrt" "-IF:\Windows Kits\10\include\10.0.16299.0\shared" "-IF:\Windows Kits\10\include\10.0.16299.0\um" "-IF:\Windows Kits\10\include\10.0.16299.0\winrt" "-IF:\Windows Kits\10\include\10.0.16299.0\cppwinrt" -c "F:\Important Code\emd-master\emd_torch\pkg\src\emd.cpp" /Fo"F:\Important Code\emd-master\emd_torch\build\temp.win-amd64-3.7\Release\pkg/src/emd.obj" -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_emd -D_GLIBCXX_USE_CXX11_ABI=0 /std:c++14 F:\Important Code\emd-master\emd_torch\pkg\src\emd.cpp(1): fatal error C1083: 无法打开包括文件: “emd.h”: No such file or directory [2/2] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Ipkg/include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\TH -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\13001\Anaconda3\envs\pytorch\include -IC:\Users\13001\Anaconda3\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IF:\Windows Kits\10\include\10.0.16299.0\ucrt" "-IF:\Windows Kits\10\include\10.0.16299.0\shared" "-IF:\Windows Kits\10\include\10.0.16299.0\um" "-IF:\Windows Kits\10\include\10.0.16299.0\winrt" "-IF:\Windows Kits\10\include\10.0.16299.0\cppwinrt" -c "F:\Important Code\emd-master\emd_torch\pkg\src\cuda\emd.cu" -o "F:\Important Code\emd-master\emd_torch\build\temp.win-amd64-3.7\Release\pkg/src/cuda/emd.obj" -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_emd -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 FAILED: F:/Important Code/emd-master/emd_torch/build/temp.win-amd64-3.7/Release/pkg/src/cuda/emd.obj C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\bin\nvcc -Xcompiler /MD -Xcompiler /wd4819 -Xcompiler /wd4251 -Xcompiler /wd4244 -Xcompiler /wd4267 -Xcompiler /wd4275 -Xcompiler /wd4018 -Xcompiler /wd4190 -Xcompiler /EHsc -Xcudafe --diag_suppress=base_class_has_different_dll_interface -Xcudafe --diag_suppress=field_without_dll_interface -Xcudafe --diag_suppress=dll_interface_conflict_none_assumed -Xcudafe --diag_suppress=dll_interface_conflict_dllexport_assumed -Ipkg/include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\torch\csrc\api\include -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\TH -IC:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.2\include" -IC:\Users\13001\Anaconda3\envs\pytorch\include -IC:\Users\13001\Anaconda3\envs\pytorch\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IF:\Windows Kits\10\include\10.0.16299.0\ucrt" "-IF:\Windows Kits\10\include\10.0.16299.0\shared" "-IF:\Windows Kits\10\include\10.0.16299.0\um" "-IF:\Windows Kits\10\include\10.0.16299.0\winrt" "-IF:\Windows Kits\10\include\10.0.16299.0\cppwinrt" -c "F:\Important Code\emd-master\emd_torch\pkg\src\cuda\emd.cu" -o "F:\Important Code\emd-master\emd_torch\build\temp.win-amd64-3.7\Release\pkg/src/cuda/emd.obj" -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=_emd -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_61,code=sm_61 F:/Important Code/emd-master/emd_torch/pkg/src/cuda/emd.cu(5): fatal error C1083: 无法打开包括文件: “cuda/emd.cuh”: No such file or directory emd.cu ninja: build stopped: subcommand failed. Traceback (most recent call last): File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py", line 1515, in _run_ninja_build env=env) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\subprocess.py", line 512, 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 "setup.py", line 28, in cmdclass={'build_ext': BuildExtension}, File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools__init__.py", line 153, in setup return distutils.core.setup(**attrs) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\dist.py", line 966, in run_commands self.run_command(cmd) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\install.py", line 67, in run self.do_egg_install() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install self.run_command('bdist_egg') File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\bdist_egg.py", line 164, in run
cmd = self.call_command('install_lib', warn_dir=0) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\bdist_egg.py", line 150, in call_command self.run_command(cmdname) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\command\install_lib.py", line 107, in build self.run_command('build_ext') File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\dist.py", line 985, in run_command cmd_obj.run() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\build_ext.py", line 79, in run _build_ext.run(self) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\command\build_ext.py", line 340, in run self.build_extensions() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py", line 649, in build_extensions build_ext.build_extensions(self) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\command\build_ext.py", line 449, in build_extensions self._build_extensions_serial() File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\setuptools\command\build_ext.py", line 196, in build_extension _build_ext.build_extension(self, ext) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\distutils\command\build_ext.py", line 534, in build_extension depends=ext.depends) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py", line 631, in win_wrap_ninja_compile with_cuda=with_cuda) File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py", line 1233, in _write_ninja_file_and_compile_objects error_prefix='Error compiling objects for extension') File "C:\Users\13001\Anaconda3\envs\pytorch\lib\site-packages\torch\utils\cpp_extension.py", line 1529, in _run_ninja_build raise RuntimeError(message) RuntimeError: Error compiling objects for extension

abysee commented 1 year ago

The problem really is

/std:c++14 F:\Important Code\emd-master\emd_torch\pkg\src\emd.cpp(1): fatal error C1083: 无法打开包括文件: “emd.h”: No such file or directory [2/2] C:\Program Files\NVIDIA GPU Computing

It is probably that your IDE failed to detect the existing file. So you have to go to the emd.cpp file and change the include line into #include "../include/emd.h". There should be another similar one you need to modify. For your reference is in the file cmd.cu and to modify the fifth line into #include "../../include/cuda/emd.cuh" in my case.

aruig666 commented 3 months ago

Snipaste_2024-07-25_20-00-53 I have modified the following content: “emd_torch\pkg\src\emd.cpp” line 1 from #include "emd.h" to #include "../include/emd.h"

“emd_torch\pkg\src\src\cuda\emd.cu” line 5 from #include "cuda/emd.cuh" to #include "../../include/cuda/emd.cuh"

“emd_torch\pkg\include\cuda\emd.cuh” line 4 from #include "cuda_helper.h" to #include "../cuda_helper.h"

This error seems to be caused by the relative path error of the header file. But I don't know C++, please take a look at it and update the code. Thank you very much

476857578 commented 2 months ago

Snipaste_2024-07-25_20-00-53 I have modified the following content: “emd_torch\pkg\src\emd.cpp” line 1 from #include "emd.h" to #include "../include/emd.h"

“emd_torch\pkg\src\src\cuda\emd.cu” line 5 from #include "cuda/emd.cuh" to #include "../../include/cuda/emd.cuh"

“emd_torch\pkg\include\cuda\emd.cuh” line 4 from #include "cuda_helper.h" to #include "../cuda_helper.h"

This error seems to be caused by the relative path error of the header file. But I don't know C++, please take a look at it and update the code. Thank you very much

Please replace 'AT_CHECK' as 'TORCH_CHECK' in the file of 'emd-master\emd_torch\pkg\include\cuda_helper.h'. Then try again