[Openmp-dev] Problem with complex math functions

Johannes Doerfert via Openmp-dev openmp-dev at lists.llvm.org
Wed Aug 25 09:13:18 PDT 2021


This is a bug, I'm looking into it.

~ Johannes

On 8/25/21 5:49 AM, Pushpinder Singh via Openmp-dev wrote:
> Hi all,
>
> I have been trying to use complex math functions in the openmp target
> region. I am able to use basic complex arithmetic but math functions
> like abs, sin do not work. I get a linker undefined error when I use
> these methods. I noticed that these methods are defined in
> openmp_wrappers/complex_cmath.h in the variant region in
> https://github.com/llvm/llvm-project/blob/main/clang/lib/Headers/openmp_wrappers/complex#L47.
> Am I missing something?
>
> More details,
> command line: clang++ test.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
> test.cpp:
> #include <iostream>
> #include <complex>
> #include <cmath>
>
> int main() {
>    std::complex<double> x, a, b;
> #pragma omp target map(tofrom: x)
>    {
>      x = std::exp(a * b);
>    }
>
>    std::cout << x << std::endl;
>    return 0;
> }
>
> linker error: nvlink error   : Undefined reference to 'cexp' in
> '/tmp/test-a02307.cubin'
> CUDA details:
> nvcc: NVIDIA (R) Cuda compiler driver
> Copyright (c) 2005-2020 NVIDIA Corporation
> Built on Tue_Sep_15_19:10:02_PDT_2020
> Cuda compilation tools, release 11.1, V11.1.74
> Build cuda_11.1.TC455_06.29069683_0
>
> Please let me know if more details are needed.
>
> Thanks & Regards,
> Pushpinder Singh
> _______________________________________________
> Openmp-dev mailing list
> Openmp-dev at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/openmp-dev


More information about the Openmp-dev mailing list