[llvm-bugs] [Bug 51639] New: Complex math functions not linking on nvptx

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 26 23:11:48 PDT 2021


            Bug ID: 51639
           Summary: Complex math functions not linking on nvptx
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: release blocker
          Priority: P
         Component: OpenMP
          Assignee: unassignedclangbugs at nondot.org
          Reporter: pushpinderdhaliwal00 at gmail.com
                CC: johannes at jdoerfert.de, llvm-bugs at lists.llvm.org

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
Am I missing something?

More details,
command line: clang++ test.cpp -fopenmp -fopenmp-targets=nvptx64-nvidia-cuda
#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
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

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210827/95216013/attachment.html>

More information about the llvm-bugs mailing list