From f19bcffee6b8018ca101ceb370e6e550a940289f Mon Sep 17 00:00:00 2001 From: Antonio Sanchez Date: Wed, 6 Jan 2021 09:41:15 -0800 Subject: Specialize std::complex operators for use on GPU device. NVCC and older versions of clang do not fully support `std::complex` on device, leading to either compile errors (Cannot call `__host__` function) or worse, runtime errors (Illegal instruction). For most functions, we can implement specialized `numext` versions. Here we specialize the standard operators (with the exception of stream operators and member function operators with a scalar that are already specialized in ``) so they can be used in device code as well. To import these operators into the current scope, use `EIGEN_USING_STD_COMPLEX_OPERATORS`. By default, these are imported into the `Eigen`, `Eigen:internal`, and `Eigen::numext` namespaces. This allow us to remove specializations of the sum/difference/product/quotient ops, and allow us to treat complex numbers like most other scalars (e.g. in tests). --- test/gpu_common.h | 1 + 1 file changed, 1 insertion(+) (limited to 'test/gpu_common.h') diff --git a/test/gpu_common.h b/test/gpu_common.h index fe0485e98..c37eaa13f 100644 --- a/test/gpu_common.h +++ b/test/gpu_common.h @@ -117,6 +117,7 @@ struct compile_time_device_info { void operator()(int i, const int* /*in*/, int* info) const { if (i == 0) { + EIGEN_UNUSED_VARIABLE(info) #if defined(__CUDA_ARCH__) info[0] = int(__CUDA_ARCH__ +0); #endif -- cgit v1.2.3