<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - CUDA and OpenMP math functions conflicts (using both -xcuda and -fopenmp)"
   href="https://bugs.llvm.org/show_bug.cgi?id=45533">45533</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>CUDA and OpenMP math functions conflicts (using both -xcuda and -fopenmp)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>9.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>OpenMP
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dontbugme@mailinator.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Compiling with -xcuda and -fopenmp options yields the following errors:

In file included from <built-in>:1:
In file included from
/usr/lib/clang/9.0.1/include/__clang_cuda_runtime_wrapper.h:36:
In file included from
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/9.3.0/../../../../include/c++/9.3.0/cmath:45:
In file included from /usr/include/math.h:290:
/usr/include/bits/mathcalls.h:95:17: error: exception specification in
declaration does not match previous declaration
__MATHCALL_VEC (exp,, (_Mdouble_ __x));
                ^
/usr/lib/clang/9.0.1/include/__clang_cuda_math_forward_declares.h:84:19: note:
previous declaration is here
__DEVICE__ double exp(double);

... along with other math functions.
Using CUDA 9.2 and Clang 9.0.1.
Test code:

#include <stdio.h>
#define N 1000

__global__ void add(int *a, int *b) {
    int i = blockIdx.x;
    if (i<N) {
        b[i] = 2*a[i];
    }
}

int main() {

    int ha[N], hb[N];
    int *da, *db;
    cudaMalloc((void **)&da, N*sizeof(int));
    cudaMalloc((void **)&db, N*sizeof(int));

    #pragma omp parallel for
    for (int i = 0; i<N; ++i) {
        ha[i] = i;
    }

    cudaMemcpy(da, ha, N*sizeof(int), cudaMemcpyHostToDevice);
    add<<<N, 1>>>(da, db);
    cudaMemcpy(hb, db, N*sizeof(int), cudaMemcpyDeviceToHost);

    for (int i = 0; i<N; ++i) {
        printf("%d\n", hb[i]);
    }

    cudaFree(da);
    cudaFree(db);
    return 0;
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>