sbelharbi:

i tried with TORCH_CUDA_ARCH_LIST="6.0+PTX" python setup.py build, but nothing changed. i got the same error.


This could mean that the built binary itself should be correct.



 sbelharbi:

the doc says that by default, torch.utils.cpp_extension.CUDAExtension will build for all the visible archs.
so, it is supposed to build for the right cc. there are 2 gpus with same arch.


Yes, assuming you are using the latest PyTorch release.



 sbelharbi:

i dont know how to get what is offending cuda.
either the code of cuda extension does not go well with the current version cuda/pytorch.
or something is wrong with the installation (conda)…


Your setup seems to be the issue, since you are mixing the CUDA runtime used in the PyTorch binaries (11.1) with the local CUDA toolkit used to build the extension (10.0), so you would need to stick to the same version. I’ve rebuild the extension on a server with a P100 using matching CUDA versions and this code snippet works fine:
from PAM_cuda.pl import PermutohedralLattice

if __name__ == '__main__':
    import numpy as np
    pl = PermutohedralLattice.apply

    im = torch.randn(24, 24, 3)
    indices = np.reshape(np.indices(im.shape[:2]), (2, -1))[None, :]
    im = im.permute(2, 0, 1)
    rgb = im.reshape(3, -1).unsqueeze(0)
    out = pl(torch.from_numpy(indices / 5.0).cuda().float(),
             (rgb / 0.125).cuda().float())

    output = out.squeeze().cpu().numpy()
    output = np.transpose(output, (1, 0))
    output = np.reshape(output, (im.shape[1], im.shape[2], 3))
    print(output)