Closed e-kayrakli closed 1 month ago
I believe csin
is missing because we use C++14 for GPU codegen, but rely on C99 complex number support. In C++14, complex.h
may not implement all of the complex math functions, resulting in the error about missing functions.
See https://github.com/Cray/chapel-private/issues/6277 for more details
Reported in https://chapel.discourse.group/t/complex-sine-broken-with-gpu-enabled-chapel/35562
GPU kernels don't support complex today, but the issue has nothing to do with GPU kernels, where:
fails compilation with the failure
CHPL_HOME/modules/internal/ChapelStandard.chpl:24: error: Could not find C function for csin; perhaps it is missing or is a macro?
with NVIDIA.I can't tell exactly why
csin
is missing. CUDA has complex headers which must providecsin
. I can reproduce the issue by:Using the same
args
aschpl
uses forclang
, you'll get the same issue. Drop-x cuda
, and it compiles just fine. I don't see any noticeable difference in-v
output from clang. I feel like some#ifdef
s get thrown off either in Chapel runtime or the clang/cuda headers. I suspect this is about a missing flag to thatclang
invocation, but I don't know what that is.A potential solution is to call
builtin
versions of the missing complex functions, but that doesn't feel quite satisfying as fixing the compilation.makes the snippet above compile successfully.