Giter VIP home page Giter VIP logo

torch-mesh-isect's Introduction

Detecting & Penalizing Mesh Intersections

This package provides a PyTorch module that can efficiently (1) detect and (2) penalize (self-)intersections for a triangular mesh.

Table of Contents

License

Software Copyright License for non-commercial scientific research purposes. Please read carefully the terms and conditions and any accompanying documentation before you download and/or use the SMPL-X/SMPLify-X model, data and software, (the "Model & Software"), including 3D meshes, blend weights, blend shapes, textures, software, scripts, and animations. By downloading and/or using the Model & Software (including downloading, cloning, installing, and any other use of this github repository), you acknowledge that you have read these terms and conditions, understand them, and agree to be bound by them. If you do not agree with these terms and conditions, you must not download and/or use the Model & Software. Any infringement of the terms of this agreement will automatically terminate your rights under this License.

Description

This repository provides a PyTorch wrapper around a CUDA kernel that implements the method described in Maximizing parallelism in the construction of BVHs, octrees, and k-d trees. More specifically, given an input mesh it builds a BVH tree for each one and queries it for self-intersections. Moreover, we provide a conical 3D distance field based loss for resolving the interpenetrations, as in Capturing Hands in Action using Discriminative Salient Points and Physics Simulation.

Please note that in the current implementation, for batching one needs to provide meshes with the same number of faces. Moreover, the code by default works for self-penetrations of a body mesh. The module can be used also for inter-penetrations of different meshes - for this the easiest and naive approach (without additional bookkeeping) is to fuse all meshes in a single mesh and treat inter-penetrations as self-penetrations.

Installation

Before installing anything please make sure to set the environment variable $CUDA_SAMPLES_INC to the path that contains the header helper_math.h, which can be found in the repo CUDA Samples repository. To install the module run the following commands:

1. Clone this repository

git clone https://github.com/vchoutas/torch-mesh-isect
cd torch-mesh-isect

2. Install the dependencies

pip install -r requirements.txt 

3. Run the setup.py script

python setup.py install

Examples

  • Collision Detection: Given an input mesh file, detect and plot all the collisions. Use:

    python examples/detect_and_plot_collisions.py PATH_TO_MESH
  • Batch Collision resolution: Resolve self-penetrations for a batch of body models. To run use:

    WEIGHT=0.001
    python examples/batch_smpl_untangle.py --coll_loss_weight=$WEIGHT --model_folder=$MODEL_PARENT_FOLDER --part_segm_fn=$PATH_part_segm_fn 
    --param_fn PKL_FN1 PKL_FN2 ... PKL_FNN  

    where PKL_FN* are the filenames of the .pkl files that can be downloaded here and contain the parameters for each body model.

    For batch_smpl_untangle:

Dependencies

  1. PyTorch

Example dependencies

  1. SMPL-X

Optional Dependencies

  1. Trimesh for loading triangular meshes
  2. Pyrender for visualization

The code has been tested with Python 3.6, CUDA 10.0, CuDNN 7.3 and PyTorch 1.0.

Citation

If you find this code useful in your research please cite the relevant work(s) of the following list, for detecting and penalizing mesh intersections accordingly:

@inproceedings{Karras:2012:MPC:2383795.2383801,
    author = {Karras, Tero},
    title = {Maximizing Parallelism in the Construction of BVHs, Octrees, and K-d Trees},
    booktitle = {Proceedings of the Fourth ACM SIGGRAPH / Eurographics Conference on High-Performance Graphics},
    year = {2012},
    pages = {33--37},
    numpages = {5},
    url = {https://doi.org/10.2312/EGGH/HPG12/033-037}, 
    doi = {10.2312/EGGH/HPG12/033-037},
    publisher = {Eurographics Association}
}
@article{Tzionas:IJCV:2016, title = {Capturing Hands in Action using Discriminative Salient Points and Physics Simulation},
    author = {Tzionas, Dimitrios and Ballan, Luca and Srikantha, Abhilash and Aponte, Pablo and Pollefeys, Marc and Gall, Juergen},
    journal = {International Journal of Computer Vision (IJCV)},
    volume = {118},
    number = {2},
    pages = {172--193},
    month = jun,
    year = {2016},
    url = {https://doi.org/10.1007/s11263-016-0895-4}, 
    month_numeric = {6} 
}

This repository was originally developed for SMPL-X / SMPLify-X (CVPR 2019), you might be interested in having a look: https://smpl-x.is.tue.mpg.de.

Contact

The code of this repository was implemented by Vassilis Choutas.

For questions, please contact [email protected].

For commercial licensing (and all related questions for business applications), please contact [email protected]. Please note that the method for this component has been patented by NVidia and a license needs to be obtained also by them.

torch-mesh-isect's People

Contributors

dimtzionas avatar vchoutas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

torch-mesh-isect's Issues

Segmentation fault (core dumped)

Hi, @vchoutas
Thanks for your awesome work.

When I try to run your code, I get following error:

Number of triangles = 13776 Segmentation fault (core dumped)
Do you know what happened?

RuntimeError: after reduction step 1: cudaErrorInvalidDevice: invalid device ordinal

python smplifyx/main.py --config cfg_files/fit_smpl.yaml --data_folder input --output_folder output --visualize=True --model_folder models --vposer_ckpt vposer_v1_0 --part_segm_fn smplx_parts_segm.pkl --gender male
Processing: input/images/63f28b0b-765a-440f-9aad-f11bcd64dd4c.jpg
Found Trained Model: vposer_v1_0/snapshots/TR00_E096.pt
/home/arash/Desktop/SMPLX/smplify-x/smplifyx/optimizers/lbfgs_ls.py:238: UserWarning: This overload of add_ is deprecated:
        add_(Number alpha, Tensor other)
Consider using one of the following signatures instead:
        add_(Tensor other, *, Number alpha) (Triggered internally at  /opt/conda/conda-bld/pytorch_1627336316785/work/torch/csrc/utils/python_arg_parser.cpp:1005.)
  p.data.add_(step_size, update[offset:offset + numel].view_as(p.data))
Camera initialization done after 3.4924
Camera initialization final loss 1970.4176
Stage 000 done after 1.6123 seconds                                                                                                                              
Stage 001 done after 1.2765 seconds                                                                                                                              
Stage:  50%|███████████████████████████████████████████████████████████▌                                                           | 2/4 [00:02<00:02,  1.50s/it]
Orientation:   0%|                                                                                                                         | 0/1 [00:02<?, ?it/s]
Traceback (most recent call last):
  File "smplifyx/main.py", line 272, in <module>
    main(**args)
  File "smplifyx/main.py", line 262, in main
    **args)
  File "/home/arash/Desktop/SMPLX/smplify-x/smplifyx/fit_single_frame.py", line 444, in fit_single_frame
    use_vposer=use_vposer)
  File "/home/arash/Desktop/SMPLX/smplify-x/smplifyx/fitting.py", line 175, in run_fitting
    loss = optimizer.step(closure)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/torch/optim/optimizer.py", line 89, in wrapper
    return func(*args, **kwargs)
  File "/home/arash/Desktop/SMPLX/smplify-x/smplifyx/optimizers/lbfgs_ls.py", line 280, in step
    orig_loss = closure()
  File "/home/arash/Desktop/SMPLX/smplify-x/smplifyx/fitting.py", line 253, in fitting_func
    **kwargs)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/arash/Desktop/SMPLX/smplify-x/smplifyx/fitting.py", line 434, in forward
    collision_idxs = self.search_tree(triangles)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/mesh_intersection-0.1.0-py3.7-linux-x86_64.egg/mesh_intersection/bvh_search_tree.py", line 56, in forward
    return BVHFunction.apply(triangles)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 27, in decorate_context
    return func(*args, **kwargs)
  File "/home/arash/anaconda3/envs/scratch/lib/python3.7/site-packages/mesh_intersection-0.1.0-py3.7-linux-x86_64.egg/mesh_intersection/bvh_search_tree.py", line 39, in forward
    max_collisions=BVHFunction.max_collisions)
RuntimeError: after reduction step 1: cudaErrorInvalidDevice: invalid device ordinal

I am getting the above error when trying to run smplify-x project using the interpenetration set to True. My CUDA version is 11.3 and torch correctly detects my cuda installation. I have also tried changing the device = torch.device('cuda:0') in all places and then compiling mesh_intersection but that doesn't work either. Let me know how I can check what the device bvh is using and how I can change it. Thanks

Edit 1:
I checked my cuda device number (ordinal) just before this line max_collisions=BVHFunction.max_collisions where the error was, the cuda current device number is set to 0 which is correct but i am still getting the error

Can't install successfully on windows

I'm having trouble getting this to work on Windows. I get these errors when running setup.py

`src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: identifier "start" is undefined

src/bvh_cuda_op.cu(945): error: identifier "stop" is undefined

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected a ";"

src/bvh_cuda_op.cu(945): warning: variable "triangles_ptr" was declared but never referenced

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: identifier "start" is undefined

src/bvh_cuda_op.cu(945): error: identifier "stop" is undefined

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

Error limit reached.
100 errors detected in the compilation of "C:/Users/fitzgcon/AppData/Local/Temp/1/tmpxft_00001d58_00000000-10_bvh_cuda_op.cpp1.ii".
Compilation terminated.
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\bin\nvcc.exe' failed with exit status 1`

cannot install in win10 and python3.6

env:
Win10,Python3.6 cannot install

install output log:
running install
running bdist_egg
running egg_info
writing mesh_intersection.egg-info\PKG-INFO
writing dependency_links to mesh_intersection.egg-info\dependency_links.txt
writing requirements to mesh_intersection.egg-info\requires.txt
writing top-level names to mesh_intersection.egg-info\top_level.txt
reading manifest file 'mesh_intersection.egg-info\SOURCES.txt'
writing manifest file 'mesh_intersection.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
running build_ext
C:\ProgramData\Anaconda3\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 'bvh_cuda' extension
Emitting ninja build file E:\github\torch-mesh-isect\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/1] C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\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 -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\TH -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\THC -Iinclude -I -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\TH -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c E:\github\torch-mesh-isect\src\bvh_cuda_op.cu -o E:\github\torch-mesh-isect\build\temp.win-amd64-3.7\Release\src/bvh_cuda_op.obj -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
FAILED: E:/github/torch-mesh-isect/build/temp.win-amd64-3.7/Release/src/bvh_cuda_op.obj
C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\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 -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\TH -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\THC -Iinclude -I -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\torch\csrc\api\include -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\TH -IC:\ProgramData\Anaconda3\lib\site-packages\torch\include\THC "-IC:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.0\include" -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\VC\Tools\MSVC\14.26.28801\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.8\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.18362.0\cppwinrt" -c E:\github\torch-mesh-isect\src\bvh_cuda_op.cu -o E:\github\torch-mesh-isect\build\temp.win-amd64-3.7\Release\src/bvh_cuda_op.obj -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75
E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: identifier "start" is undefined

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: identifier "stop" is undefined

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected a ";"

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): warning: variable "triangles_ptr" was declared but never referenced

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: identifier "start" is undefined

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: identifier "stop" is undefined

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: expected an expression

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

E:/github/torch-mesh-isect/src/bvh_cuda_op.cu(945): error: "#" not expected here

Error limit reached.
100 errors detected in the compilation of "E:/github/torch-mesh-isect/src/bvh_cuda_op.cu".
Compilation terminated.
bvh_cuda_op.cu
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1515, in _run_ninja_build
env=env)
File "C:\ProgramData\Anaconda3\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 97, in
cmdclass={'build_ext': BuildExtension})
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools_init_.py", line 144, in setup
return distutils.core.setup(**attrs)
File "C:\ProgramData\Anaconda3\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 966, in run_commands
self.run_command(cmd)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install.py", line 67, in run
self.do_egg_install()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install.py", line 109, in do_egg_install
self.run_command('bdist_egg')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 172, in run
cmd = self.call_command('install_lib', warn_dir=0)
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\bdist_egg.py", line 158, in call_command
self.run_command(cmdname)
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\install_lib.py", line 11, in run
self.build()
File "C:\ProgramData\Anaconda3\lib\distutils\command\install_lib.py", line 107, in build
self.run_command('build_ext')
File "C:\ProgramData\Anaconda3\lib\distutils\cmd.py", line 313, in run_command
self.distribution.run_command(command)
File "C:\ProgramData\Anaconda3\lib\distutils\dist.py", line 985, in run_command
cmd_obj.run()
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 87, in run
_build_ext.run(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 186, in run
_build_ext.build_ext.run(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 649, in build_extensions
build_ext.build_extensions(self)
File "C:\ProgramData\Anaconda3\lib\site-packages\Cython\Distutils\old_build_ext.py", line 195, in build_extensions
_build_ext.build_ext.build_extensions(self)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 449, in build_extensions
self._build_extensions_serial()
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 474, in _build_extensions_serial
self.build_extension(ext)
File "C:\ProgramData\Anaconda3\lib\site-packages\setuptools\command\build_ext.py", line 208, in build_extension
_build_ext.build_extension(self, ext)
File "C:\ProgramData\Anaconda3\lib\distutils\command\build_ext.py", line 534, in build_extension
depends=ext.depends)
File "C:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 631, in win_wrap_ninja_compile
with_cuda=with_cuda)
File "C:\ProgramData\Anaconda3\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:\ProgramData\Anaconda3\lib\site-packages\torch\utils\cpp_extension.py", line 1529, in _run_ninja_build
raise RuntimeError(message)
RuntimeError: Error compiling objects for extension

About gcc version

The package compiles CPP/CUDA files.
I use conda environment and install torch via pip install.
My python version is 3.6.9, and related gcc version is 7.3.
The package is set up successfully but failed when running the example.
The error message is "Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)"
I address the segfault at https://github.com/vchoutas/torch-mesh-isect/blob/master/src/bvh_cuda_op.cu#L830.
Could you provide the gcc version on your PC? Maybe different compiler causes this problem.

It'll really help if you can resolve this issue.

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: identifier "start" is undefined

src/bvh_cuda_op.cu(945): error: identifier "stop" is undefined

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

src/bvh_cuda_op.cu(945): error: expected an expression

src/bvh_cuda_op.cu(945): error: "#" not expected here

error: command '/usr/local/cuda/bin/nvcc' failed with exit status 2

hi, @vchoutas
When I install , I meet an error:
2 errors detected in the compilation of "/tmp/tmpxft_00005eb9_00000000-7_bvh_cuda_op.cpp1.ii". error: command '/usr/local/cuda/bin/nvcc' failed with exit status 2
I goole it but not find something help about status 2. Can you help me , I want to know why and solve it soon .Thx~!!!!

CUDA 11 support

Hi,

I'm encountering some strange errors when using mesh_intersection on 3090 GPU, CUDA 11.1, python 3.8.8, pytorch 1.8.1.

I encountered a CUDA out of memory error when running examples/batch_smpl_untangle.py using suggested parameters.
If I add a line val += np.random.normal(0, 0.1, val.shape) between examples/batch_smpl_untangle.py:129 and 130, coll_idx can sometimes have a negative length in loss.py:224.

It looks like that the problem is with CUDA11. Is it possible for you to support CUDA 11?

Thank you very much!

Several solutions for problems I met

Thanks for your great work! I have met several problems during compiling and find out corresponding solutions to share with everyone.

  1. About CUDA version
    I have tried CUDA-9.0, CUDA=10.1 and CUDA-11.1, turns out CUDA-11.1 works for me
    After compiling successfully in CUDA-9.0 and CUDA-10.1, it breaks down when I tried to import package:

mesh_intersection-0.1.0-py3.7-linux-x86_64.egg/bvh_cuda.cpython-37m-x86_64-linux-gnu.so: undefined symbol: _ZNK2at6Tensor6deviceEv

  1. double_vec_ops.h not found
    Turns out it's in this repo: ./include, move it to ./src

  2. AT_CHECK
    Adding following lines in bvh.cpp before using AT_CHECK

#ifndef AT_CHECK
#define AT_CHECK TORCH_CHECK
#endif

ModuleNotFoundError: No module named 'bvh_cuda'

I have already build and install mesh-intersection。I find this line
g++ -pthread -shared -B /root/anaconda3/compiler_compat -L/root/anaconda3/lib -Wl,-rpath=/root/anaconda3/lib -Wl,--no-as-needed -Wl,--sysroot=/ build/temp.linux-x86_64-3.6/src/bvh.o build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o -L/usr/local/cuda/lib64 -lcudart -o build/lib.linux-x86_64-3.6/bvh_cuda.cpython-36m-x86_64-linux-gnu.so
but it produce nothing in the directory pointed by -o, without any error info

how to solve gcc: fatal error: cannot execute 'cc1plus': execvp: Permission denied?

After changing

bvh_include_dirs = torch.utils.cpp_extension.include_paths() + [
    'include',
    '/usr/local/cuda-11.4/samples/common/inc']

I run the commend python setup.py install and I got:

(pytorch) wjrzm@DESKTOP-QJIK4OK:~/SMPL-IK/torch-mesh-isect$ python setup.py install
running install
/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  setuptools.SetuptoolsDeprecationWarning,
/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/setuptools/command/easy_install.py:147: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  EasyInstallDeprecationWarning,
running bdist_egg
running egg_info
writing mesh_intersection.egg-info/PKG-INFO
writing dependency_links to mesh_intersection.egg-info/dependency_links.txt
writing requirements to mesh_intersection.egg-info/requires.txt
writing top-level names to mesh_intersection.egg-info/top_level.txt
/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/utils/cpp_extension.py:339: UserWarning: Attempted to use ninja as the BuildExtension backend but we could not find ninja.. Falling back to using the slow distutils backend.
  warnings.warn(msg.format('we could not find ninja.'))
reading manifest file 'mesh_intersection.egg-info/SOURCES.txt'
adding license file 'LICENSE'
writing manifest file 'mesh_intersection.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'bvh_cuda' extension
gcc -pthread -B /home/wjrzm/anaconda3/envs/pytorch/compiler_compat -Wl,--sysroot=/ -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/TH -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/THC -Iinclude -I/usr/local/cuda-11.4/samples/common/inc -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/torch/csrc/api/include -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/TH -I/home/wjrzm/anaconda3/envs/pytorch/lib/python3.7/site-packages/torch/include/THC -I/home/wjrzm/anaconda3/envs/pytorch/include/python3.7m -c src/bvh.cpp -o build/temp.linux-x86_64-cpython-37/src/bvh.o -DTORCH_API_INCLUDE_EXTENSION_H -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
gcc: fatal error: cannot execute 'cc1plus': execvp: Permission denied
compilation terminated.
error: command '/home/wjrzm/anaconda3/envs/pytorch/bin/gcc' failed with exit code 1

Do you know how to solve it?

Python:3.7.16 Torch:1.7.0 cuda:11.4

Demo Result Question

Hi , @vchoutas

Thanks for your awesome work! I just met some questions about your demo script batch_smpl_untangle.py.

I changed your optimizer from SGD to Adam, and set lr to 0.001, which is a normal configuration. The reason I did this is to optimize faster, since I noticed your original SGD version change little poses even after a lot of optimization.

In most cases, the loss started around 0.00003, then reduced to 0.00001

My questions are as follows :

  1. even when the loss is 0.00000, there are still obvious collision. Is it normal ?
  2. Why we can't remove all collision. Even 10000 steps later and the meshes change a lot, there are still collisions. But since there are only collision loss and a little reg_loss, the script should solve all collision.

I guess they are the result of imperfection loss from Capturing Hands in Action using Discriminative Salient Points and Physics Simulation, but I am not quite sure.

Following is 10000 steps result.

image

How can I save this problem?

C:\Users\Leo\anaconda3\envs\PMC2D\include\pyerrors.h(315): note: 参见“HAVE_SNPRINTF”的前一个定义
src/bvh.cpp(30): error C3861: “AT_CHECK”: 找不到标识符
error: command 'C:\Program Files\Microsoft VisualStudio\2022\Professional\VC\Tools\MSVC\14.35.32215\bin\HostX86\x64\cl.exe' failed with exit code 2

What's your CUDA version?

Hi @vchoutas , there is a prolem, hope you can help me.
When I run setup.py, CUDA INC PATH seems lacks, so I mannualy point it to '/usr/lcoal/cuda/samples/common/inc'. it worked. However, a cuda error happened when i try examples/detect_and_plot_collisions.py. The error is:
Error inside sort: radix_sort: failed on 2nd step: invalid argument
Cuda failure src/bvh_cuda_op.cu:877: 'invalid argument'

How Can I Solve This Problem

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: identifier "start" is undefined

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: identifier "stop" is undefined

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected a ";"

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): warning #177-D: variable "triangles_ptr" was declared but never referenced

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: identifier "start" is undefined

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: identifier "stop" is undefined

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: expected an expression

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

C:\Users\Leo\Desktop\smplify-x\smplifyx\torch-mesh-isect\src\bvh_cuda_op.cu(945): error: "#" not expected here

Error limit reached.
100 errors detected in the compilation of "src/bvh_cuda_op.cu".
Compilation terminated.
error: command 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.8\bin\nvcc.exe' failed with exit code 1

nvcc fatal : Unknown option '-generate-dependencies-with-compile'

I am using a conda to manage my environment. I got the following error:
python 36
cuda 10.1 (cuda10.0 tried too)
When I tried to install this pkg:

running install
running bdist_egg
running egg_info
writing mesh_intersection.egg-info/PKG-INFO
writing dependency_links to mesh_intersection.egg-info/dependency_links.txt
writing requirements to mesh_intersection.egg-info/requires.txt
writing top-level names to mesh_intersection.egg-info/top_level.txt
reading manifest file 'mesh_intersection.egg-info/SOURCES.txt'
writing manifest file 'mesh_intersection.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
running build_ext
building 'bvh_cuda' extension
Emitting ninja build file /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] /usr/local/cuda-10.1/bin/nvcc --generate-dependencies-with-compile --dependency-output /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o.d -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -Iinclude '-I' -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/media/frank/easystore/anaconda3/envs/MANO/include/python3.6m -c -c /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh_cuda_op.cu -o /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -ccbin /usr/bin/gcc-5 -std=c++14
FAILED: /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o 
/usr/local/cuda-10.1/bin/nvcc --generate-dependencies-with-compile --dependency-output /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o.d -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -Iinclude '-I' -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/media/frank/easystore/anaconda3/envs/MANO/include/python3.6m -c -c /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh_cuda_op.cu -o /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_BFLOAT16_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_70,code=compute_70 -gencode=arch=compute_70,code=sm_70 -ccbin /usr/bin/gcc-5 -std=c++14
nvcc fatal   : Unknown option '-generate-dependencies-with-compile'
[2/2] /usr/bin/g++-5 -MMD -MF /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -Iinclude '-I' -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/media/frank/easystore/anaconda3/envs/MANO/include/python3.6m -c -c /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp -o /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
FAILED: /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh.o 
/usr/bin/g++-5 -MMD -MF /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh.o.d -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -Iinclude '-I' -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/TH -I/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda-10.1/include -I/media/frank/easystore/anaconda3/envs/MANO/include/python3.6m -c -c /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp -o /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh.o -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -std=c++14
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
In file included from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/Parallel.h:140:0,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/utils.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/nn/cloneable.h:5,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/nn.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:13,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
                 from /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:18:
/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/ParallelOpenMP.h:83:0: warning: ignoring #pragma omp parallel [-Wunknown-pragmas]
 #pragma omp parallel for if ((end - begin) >= grain_size)
 ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp: In function ‘at::Tensor bvh_forward(at::Tensor, int)’:
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:25:39: warning: ‘at::DeprecatedTypeProperties& at::Tensor::type() const’ is deprecated: Tensor.type() is deprecated. Instead use Tensor.options(), which in many cases (e.g. in a constructor) is a drop-in replacement. If you were using data from type(), that is now available from Tensor itself, so instead of tensor.type().scalar_type(), use tensor.scalar_type() instead and instead of tensor.type().backend() use tensor.device(). [-Wdeprecated-declarations]
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
                                       ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:27:24: note: in expansion of macro ‘CHECK_CUDA’
 #define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
                        ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:30:5: note: in expansion of macro ‘CHECK_INPUT’
     CHECK_INPUT(triangles);
     ^
In file included from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/Tensor.h:3:0,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/Context.h:4,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/ATen.h:9,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/types.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader_options.h:4,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/base.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader/stateful.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data/dataloader.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/data.h:3,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/csrc/api/include/torch/all.h:8,
                 from /media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/torch/extension.h:4,
                 from /media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:18:
/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/include/ATen/core/TensorBody.h:303:30: note: declared here
   DeprecatedTypeProperties & type() const {
                              ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:25:79: error: ‘AT_CHECK’ was not declared in this scope
 #define CHECK_CUDA(x) AT_CHECK(x.type().is_cuda(), #x " must be a CUDA tensor")
                                                                               ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:27:24: note: in expansion of macro ‘CHECK_CUDA’
 #define CHECK_INPUT(x) CHECK_CUDA(x); CHECK_CONTIGUOUS(x)
                        ^
/media/frank/easystore/Code/HPE/Video_based/torch-mesh-isect/src/bvh.cpp:30:5: note: in expansion of macro ‘CHECK_INPUT’
     CHECK_INPUT(triangles);
     ^
ninja: build stopped: subcommand failed.
Traceback (most recent call last):
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1673, in _run_ninja_build
    env=env)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['ninja', '-v']' returned non-zero exit status 1.

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "setup.py", line 97, in <module>
    cmdclass={'build_ext': BuildExtension})
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/__init__.py", line 163, in setup
    return distutils.core.setup(**attrs)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/install.py", line 109, in do_egg_install
    self.run_command('bdist_egg')
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 175, in run
    cmd = self.call_command('install_lib', warn_dir=0)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/bdist_egg.py", line 161, in call_command
    self.run_command(cmdname)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/install_lib.py", line 11, in run
    self.build()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/command/install_lib.py", line 107, in build
    self.run_command('build_ext')
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/cmd.py", line 313, in run_command
    self.distribution.run_command(command)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 87, in run
    _build_ext.run(self)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/command/build_ext.py", line 339, in run
    self.build_extensions()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 708, in build_extensions
    build_ext.build_extensions(self)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/command/build_ext.py", line 448, in build_extensions
    self._build_extensions_serial()
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/command/build_ext.py", line 473, in _build_extensions_serial
    self.build_extension(ext)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/setuptools/command/build_ext.py", line 208, in build_extension
    _build_ext.build_extension(self, ext)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/distutils/command/build_ext.py", line 533, in build_extension
    depends=ext.depends)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 538, in unix_wrap_ninja_compile
    with_cuda=with_cuda)
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1359, in _write_ninja_file_and_compile_objects
    error_prefix='Error compiling objects for extension')
  File "/media/frank/easystore/anaconda3/envs/MANO/lib/python3.6/site-packages/torch/utils/cpp_extension.py", line 1683, in _run_ninja_build
    raise RuntimeError(message) from e
RuntimeError: Error compiling objects for extension


RuntimeError: parallel_for failed: invalid configuration argument

Thanks for your excellent work!
I encountered some problems when running detect_and_plot_collisions.py in the example
I install torch-mesh-isect with cuda10.1 gcc5.3 torch1.1 and python3.6

Details:

Number of triangles =  20908
Traceback (most recent call last):
  File "examples/detect_and_plot_collisions.py", line 81, in <module>
    outputs = m(triangles)
  File "/dockerdata/wellswzhang/venv_smplifyx/lib64/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    result = self.forward(*input, **kwargs)
  File "/dockerdata/wellswzhang/venv_smplifyx/lib64/python3.6/site-packages/mesh_intersection-0.1.0-py3.6-linux-x86_64.egg/mesh_intersection/bvh_search_tree.py", line 56, in forward
    return BVHFunction.apply(triangles)
  File "/dockerdata/wellswzhang/venv_smplifyx/lib64/python3.6/site-packages/torch/autograd/grad_mode.py", line 43, in decorate_no_grad
    return func(*args, **kwargs)
  File "/dockerdata/wellswzhang/venv_smplifyx/lib64/python3.6/site-packages/mesh_intersection-0.1.0-py3.6-linux-x86_64.egg/mesh_intersection/bvh_search_tree.py", line 39, in forward
    max_collisions=BVHFunction.max_collisions)
RuntimeError: parallel_for failed: invalid configuration argument

Looking forward to your reply

smplify-x/torch-mesh-isect/src/bvh_cuda_op.cu:37:10: fatal error: double_vec_ops.h: No such file or directory #include "double_vec_ops.h"

I am installing this package as a prereq for SMPLify-X package. When I try to install, I get the following error. Could you please guide how to fix it?

(smplifyx) mona@ubuntu:mona/code/smplify-x/torch-mesh-isect$ python setup.py install
running install
running bdist_egg
running egg_info
writing mesh_intersection.egg-info/PKG-INFO
writing dependency_links to mesh_intersection.egg-info/dependency_links.txt
writing requirements to mesh_intersection.egg-info/requires.txt
writing top-level names to mesh_intersection.egg-info/top_level.txt
reading manifest file 'mesh_intersection.egg-info/SOURCES.txt'
writing manifest file 'mesh_intersection.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/mesh_intersection
copying mesh_intersection/__init__.py -> build/lib.linux-x86_64-3.6/mesh_intersection
copying mesh_intersection/bvh_search_tree.py -> build/lib.linux-x86_64-3.6/mesh_intersection
copying mesh_intersection/filter_faces.py -> build/lib.linux-x86_64-3.6/mesh_intersection
copying mesh_intersection/loss.py -> build/lib.linux-x86_64-3.6/mesh_intersection
running build_ext
building 'bvh_cuda' extension
creating mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6
creating mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6/src
Emitting ninja build file mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6/build.ninja...
Compiling objects...
Allowing ninja to set a default number of workers... (overridable by setting the environment variable MAX_JOBS=N)
[1/2] /usr/local/cuda/bin/nvcc -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/TH -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/THC -Iinclude -I/usr/local/cuda-10.2/samples/common/inc/ -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/TH -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/mona/venv/smplifyx/include -I/usr/include/python3.6m -c -c mona/code/smplify-x/torch-mesh-isect/src/bvh_cuda_op.cu -o mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++14
FAILED: mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o 
/usr/local/cuda/bin/nvcc -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/TH -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/THC -Iinclude -I/usr/local/cuda-10.2/samples/common/inc/ -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/torch/csrc/api/include -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/TH -I/home/mona/venv/smplifyx/lib/python3.6/site-packages/torch/include/THC -I/usr/local/cuda/include -I/home/mona/venv/smplifyx/include -I/usr/include/python3.6m -c -c mona/code/smplify-x/torch-mesh-isect/src/bvh_cuda_op.cu -o mona/code/smplify-x/torch-mesh-isect/build/temp.linux-x86_64-3.6/src/bvh_cuda_op.o -D__CUDA_NO_HALF_OPERATORS__ -D__CUDA_NO_HALF_CONVERSIONS__ -D__CUDA_NO_HALF2_OPERATORS__ --expt-relaxed-constexpr --compiler-options ''"'"'-fPIC'"'"'' -DPRINT_TIMINGS=0 -DDEBUG_PRINT=0 -DERROR_CHECKING=1 -DCOLLISION_ORDERING=1 -DTORCH_API_INCLUDE_EXTENSION_H '-DPYBIND11_COMPILER_TYPE="_gcc"' '-DPYBIND11_STDLIB="_libstdcpp"' '-DPYBIND11_BUILD_ABI="_cxxabi1011"' -DTORCH_EXTENSION_NAME=bvh_cuda -D_GLIBCXX_USE_CXX11_ABI=0 -gencode=arch=compute_75,code=sm_75 -std=c++14
mona/code/smplify-x/torch-mesh-isect/src/bvh_cuda_op.cu:37:10: fatal error: double_vec_ops.h: No such file or directory
 #include "double_vec_ops.h"
          ^~~~~~~~~~~~~~~~~~
compilation terminated.

*** stack smashing detected ***: python terminated

When I run the python -m pdb examples/detect_and_plot_collisions.py ...
I got *** stack smashing detected ***: python terminated
at this line: outputs = m(triangles[0,...])
Thanks very much if anyone can address this issue.

A problem when running usr/local/cuda-10.1/bin/nvcc

07ba95b40197057d4654cf973236b7a
After I run the code python setup.py install, I meet the problem above. But I set the the environment variable $CUDA_SAMPLES_INC to the path that contains the header helper_math.h. I hope you can help me solve this problem. Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.