We are trying to build a libtorch based C++ project using customized kernels which are written in .cu files, but encountered the following compiling errors. By commenting out line 191-197 in the THCNumerics.cuh, we are able to get a clean build. We are using CUDA 10.2 and cuDNN v7.6.5 on a V100 GPU server.

I wonder what is the real problem here and what is the best way to solve it. Thanks!

./libtorch/include/THC/THCNumerics.cuh(191): error: more than one operator “<” matches these operands:

built-in operator “arithmetic < arithmetic”

function “operator<(const __half &, const __half &)”

operand types are: c10::Half < c10::Half

./libtorch/include/THC/THCNumerics.cuh(192): error: more than one operator “<=” matches these operands:

built-in operator “arithmetic <= arithmetic”

function “operator<=(const __half &, const __half &)”

operand types are: c10::Half <= c10::Half

./libtorch/include/THC/THCNumerics.cuh(193): error: more than one operator “>” matches these operands:

built-in operator “arithmetic > arithmetic”

function “operator>(const __half &, const __half &)”

operand types are: c10::Half > c10::Half

./libtorch/include/THC/THCNumerics.cuh(194): error: more than one operator “>=” matches these operands:

built-in operator “arithmetic >= arithmetic”

function “operator>=(const __half &, const __half &)”

operand types are: c10::Half >= c10::Half

./libtorch/include/THC/THCNumerics.cuh(195): error: more than one operator “==” matches these operands:

built-in operator “arithmetic == arithmetic”

function “operator==(const __half &, const __half &)”

operand types are: c10::Half == c10::Half

./libtorch/include/THC/THCNumerics.cuh(197): error: more than one operator “!=” matches these operands:

built-in operator “arithmetic != arithmetic”

function “operator!=(const __half &, const __half &)”

operand types are: c10::Half != c10::Half