[Openmp-dev] Problem with complex math functions

Pushpinder Singh via Openmp-dev openmp-dev at lists.llvm.org
Thu Aug 26 23:12:59 PDT 2021


It works now with the D108774. Thanks. I have filed the bug here:
https://bugs.llvm.org/show_bug.cgi?id=51639.

On Thu, 26 Aug 2021 at 23:50, Johannes Doerfert
<johannesdoerfert at gmail.com> wrote:
>
> Should be fixed with https://reviews.llvm.org/D108774.
> Was an issue I observed before but did not get around to fix.
>
> Can you file a bug so we can ask to backport it into 13?
>
> ~ 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