libcudacxx icon indicating copy to clipboard operation
libcudacxx copied to clipboard

Added integral type support to sqrt

Open mnicely opened this issue 4 years ago • 0 comments

$ nvcc -arch=sm_70 -c test.cu
test.cu(2): error: calling a constexpr __host__ function("sqrt") from a __global__ function("test") is not allowed. The experimental flag '--expt-relaxed-constexpr' can be used to allow this.

1 error detected in the compilation of "test.cu".

$ cat test.cu
__global__ void test (int x) {
    int y = std::sqrt(x);
}

In this code sqrt on an integral type should use the overload for double (as of C++11) and thus should be eligible to use in device code.

@brycelelbach can we put this in cuda::std::sqrt?

@maxpkatz for vix

mnicely avatar Sep 08 '21 20:09 mnicely