NVlabs / nvdiffrast

Nvdiffrast - Modular Primitives for High-Performance Differentiable Rendering
Other
1.35k stars 144 forks source link

running docker example failed "__match_any_sync is undefined" #10

Closed IQ17 closed 3 years ago

IQ17 commented 3 years ago

Hi, I meet a "__match_any_sync is undefined" problem. Although I have done the replacement in common.h as mentioned here, I failed to build the texture.o.

The common.h looks like: `template static device forceinline void swap(T& a, T& b) { T temp = a; a = b; b = temp; }

//------------------------------------------------------------------------ // Coalesced atomics. These are all done via macros.

define CA_TEMP _ca_temp

define CA_TEMP_PARAM float CA_TEMP

define CA_DECLARE_TEMP(threads_per_block) CA_TEMP_PARAM

define CA_SET_GROUP_MASK(group, thread_mask)

define CA_SET_GROUP(group)

define caAtomicAdd(ptr, value) atomicAdd((ptr), (value))

define caAtomicAdd3_xyw(ptr, x, y, w) \

do {                                \
    atomicAdd((ptr), (x));          \
    atomicAdd((ptr)+1, (y));        \
    atomicAdd((ptr)+3, (w));        \
} while(0)

define caAtomicAddTexture(ptr, level, idx, value) atomicAdd((ptr)+(idx), (value))

//------------------------------------------------------------------------

endif // CUDACC`

The error is the following:

`Using container image: gltorch:latest Running command: ./samples/torch/cube.py --resolution 32 No output directory specified, not saving log or images Mesh has 12 triangles and 8 vertices. Traceback (most recent call last): File "/opt/conda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1515, in _run_ninja_build env=env) File "/opt/conda/lib/python3.7/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 "./samples/torch/cube.py", line 200, in main() File "./samples/torch/cube.py", line 191, in main mp4save_fn='progress.mp4' File "./samples/torch/cube.py", line 76, in fit_cube glctx = dr.RasterizeGLContext() File "/opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/ops.py", line 142, in init self.cpp_wrapper = _get_plugin().RasterizeGLStateWrapper(output_db, mode == 'automatic') File "/opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/ops.py", line 83, in _get_plugin torch.utils.cpp_extension.load(name=plugin_name, sources=source_paths, extra_cflags=opts, extra_cuda_cflags=opts, extra_ldflags=ldflags, with_cuda=True, verbose=False) File "/opt/conda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 974, in load keep_intermediates=keep_intermediates) File "/opt/conda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1179, in _jit_compile with_cuda=with_cuda) File "/opt/conda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1279, in _write_ninja_file_and_build_library error_prefix="Error building extension '{}'".format(name)) File "/opt/conda/lib/python3.7/site-packages/torch/utils/cpp_extension.py", line 1529, in _run_ninja_build raise RuntimeError(message) RuntimeError: Error building extension 'nvdiffrast_plugin': [1/13] c++ -MMD -MF common.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/common.cpp -o common.o [2/13] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/interpolate.cu -o interpolate.cuda.o FAILED: interpolate.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/interpolate.cu -o interpolate.cuda.o /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/interpolate.cu(178): error: identifier "__match_any_sync" is undefined

1 error detected in the compilation of "/tmp/tmpxft_0000001b_00000000-6_interpolate.cpp1.ii". [3/13] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/antialias.cu -o antialias.cuda.o FAILED: antialias.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/antialias.cu -o antialias.cuda.o /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/antialias.cu(550): error: identifier "__match_any_sync" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00000023_00000000-6_antialias.cpp1.ii". [4/13] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/rasterize.cu -o rasterize.cuda.o FAILED: rasterize.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/rasterize.cu -o rasterize.cuda.o /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/rasterize.cu(66): error: identifier "__match_any_sync" is undefined

1 error detected in the compilation of "/tmp/tmpxft_00000017_00000000-6_rasterize.cpp1.ii". [5/13] /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu -o texture.cuda.o FAILED: texture.cuda.o /usr/local/cuda/bin/nvcc -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -DCUDA_NO_HALF_OPERATORS -DCUDA_NO_HALF_CONVERSIONS -DCUDA_NO_HALF2_OPERATORS --expt-relaxed-constexpr -gencode=arch=compute_61,code=sm_61 --compiler-options '-fPIC' -DNVDR_TORCH -std=c++14 -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu -o texture.cuda.o /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(593): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(594): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(595): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(596): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(600): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(601): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(602): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(603): error: identifier "__match_any_sync" is undefined

/opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cu(936): error: identifier "__match_any_sync" is undefined

9 errors detected in the compilation of "/tmp/tmpxft_0000001d_00000000-6_texture.cpp1.ii". [6/13] c++ -MMD -MF texture.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/texture.cpp -o texture.o [7/13] c++ -MMD -MF torch_antialias.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/torch_antialias.cpp -o torch_antialias.o [8/13] c++ -MMD -MF torch_interpolate.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/torch_interpolate.cpp -o torch_interpolate.o [9/13] c++ -MMD -MF rasterize.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/common/rasterize.cpp -o rasterize.o [10/13] c++ -MMD -MF torch_rasterize.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/torch_rasterize.cpp -o torch_rasterize.o [11/13] c++ -MMD -MF torch_texture.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/torch_texture.cpp -o torch_texture.o [12/13] c++ -MMD -MF torch_bindings.o.d -DTORCH_EXTENSION_NAME=nvdiffrast_plugin -DTORCH_API_INCLUDE_EXTENSION_H -isystem /opt/conda/lib/python3.7/site-packages/torch/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -isystem /opt/conda/lib/python3.7/site-packages/torch/include/TH -isystem /opt/conda/lib/python3.7/site-packages/torch/include/THC -isystem /usr/local/cuda/include -isystem /opt/conda/include/python3.7m -D_GLIBCXX_USE_CXX11_ABI=0 -fPIC -std=c++14 -DNVDR_TORCH -c /opt/conda/lib/python3.7/site-packages/nvdiffrast/torch/torch_bindings.cpp -o torch_bindings.o ninja: build stopped: subcommand failed. `

s-laine commented 3 years ago

That's strange because nvdiffrast/common/common.h is the only file that refers to __match_any_sync(), and that's what the compilation is still complaining about. Have you perhaps already done a pip install . and then edited a copy in the local directory without redoing the install? If so, try pip uninstall nvdiffrast followed by pip install . to refresh the code in site-packages.

IQ17 commented 3 years ago

Oh yes thanks! After modifying the common.h, I should rerun the command "./run_sample.sh --build-container" to refresh the docker.