CUDA extension undefined symbol (I do import torch before the extension)

Okay, so I have a question about build a CUDA extension.

I have an undefined symbol error and it seems to me that my cpp file cannot see the function inside the cu file even though the cpp has the header of the function.
But since the cpp file is not included in the cu file, how does the system know that the header inside the cpp is implemented in the cu file? How it is getting called?

The reason for my error is most likely lack of knowledge which I hope someone where can provide.
I have of cause read the tutorial about extensions again and again and read the code examples on github but even though I mirror everything just with my own implementations I have undefined symbol on during runtime. And yes I do import torch before the extension.


Were you able to figure this out?

1 Like