hancyran/RepSurf

[Seg. Pointops Compile] name "pointops_cuda" conflicts with Cls. Pointops

Margaretya opened this issue · 2 comments

Dear authors,
Thank you so much for your awesome work.

When I follow your source code to compile Pointops in Classification and then compile the other Pointops in Segmentation, the Pointops imported will come from Cls.'s.

This problem was found by

File './RepSurf/segmentation/modules/pointops/functions/pointops.py', line 126, in forward
    pointops_cuda.knnquery_cuda(m, nsample, xyz, new_xyz, offset, new_offset, idx, dist2)
TypeError: knnquery_cuda(): incompatible function arguments. The following argument types are supported:
    1. (arg0: int, arg1: int, arg2: int, arg3: int, arg4: at::Tensor, arg5: at::Tensor, arg6: at::Tensor, arg7: at::Tensor) -> None

Since knnquery_cuda() in Seg.'s Pointops support (arg0: int, arg1: int, arg2: at::Tensor, arg3: at::Tensor, arg4: at::Tensor, arg5: at::Tensor, arg6: at::Tensor, arg7: at::Tensor).

Then I found setup( name='pointops', ext_modules=[ CUDAExtension('pointops_cuda', in Cls's Pointops and
setup( name='pointops_cuda', ext_modules=[ CUDAExtension('pointops_cuda', in Seg's Pointops. They have different python site-packages names but the same CUDAExtension name. This may cause upon problems during import pointops_cuda.

Because I am not familiar with C++, would you help me solve this problem?
(The solution for now on is to delete the other site-packages while using one)

Thanks again for your great work.

Thank you for your interest in our work.

This is the conflict of cuda extensions. A simple way to solve it is to follow our init.sh scripts to create two different conda envs for the two tasks (for cls and seg).

There is another way but it might be a bit complex - you need to compile the cuda extensions locally. By default, we use the command python3 setup.py install to install pointops globally. To install it locally, you need to use python setup.py build_ext --inplace instead. Accordingly, you also need to import pointops extension locally by replacing Line 7-28 in pointops.py with from .. import pointops_cuda.

Hope these could help.

Thank you, your suggestions are helpful. We found that changing one CUDAExtension name and recompiling, then replacing all pointops_cuda in pointops.py with the new name will also work.