I;m trying to use CUDA_tensor_applyN from ATen/cuda/CUDAApplyUtils.cuh 2 in an extension. While it builds fine when I try to import the extension I get:
ImportError: /root/local/miniconda/lib/python3.7/site-packages/mish_cuda/_C.cpython-37m-x86_64-linux-gnu.so:
undefined symbol: _ZN2at6native6legacy4cuda27_th_copy_ignoring_overlaps_ERNS_6TensorERKS3_

Demangled: at::native::legacy::cuda::_th_copy_ignoring_overlaps_(at::Tensor&, at::Tensor const&)
I don’t think it’s a compiler compatability or linker options issue as similar posts tend to be, but I have very little c++ dev experience so could be wrong. I’ve built another extension that imports and runs fine on the same system (though different conda environment). I’ve tried with both conda installed toolchain (gxx_linux-64 7.3.0/binutils_linux-64 2.31.1) and system toolchain (Arch linux). I also tried in a docker based off of pytorch/extension-script though with FROM nvidia/cuda:10.0-cudnn7-devel-ubuntu16.04 for CUDA support.
Poking around PyTorch libs in the docker I find:
$ objdump -t ${CONDA_PREFIX}/lib/python3.7/site-packages/torch/lib/libtorch.so\
  | grep '_ZN2at6native6legacy4cuda27_th_copy_ignoring_overlaps_ERNS_6TensorERKS3_'
0000000003bfed90 l     F .text  0000000000000552              _ZN2at6native6legacy4cuda27_th_copy_ignoring_overlaps_ERNS_6TensorERKS3_
$ objdump -T ${CONDA_PREFIX}/lib/python3.7/site-packages/torch/lib/libtorch.so \
  | grep '_ZN2at6native6legacy4cuda27_th_copy_ignoring_overlaps_ERNS_6TensorERKS3_'
$

I’m not using any custom compiler/linker options (except --expt-extended-lambda for nvcc). I did try explicitly linking against libtorch.so which didn’t help and I gather isn’t needed as CUDAExtension explicitly only links this on windows.
I nastily hacked out that function (only used for overlapping tensors) through a #define and the extension builds, imports and runs fine.
Thanks.