[llvm-bugs] [Bug 52068] New: OpenMP Offload with complex math function on
via llvm-bugs
llvm-bugs at lists.llvm.org
Mon Oct 4 12:11:23 PDT 2021
https://bugs.llvm.org/show_bug.cgi?id=52068
Bug ID: 52068
Summary: OpenMP Offload with complex math function on
Product: OpenMP
Version: unspecified
Hardware: PC
OS: All
Status: NEW
Severity: enhancement
Priority: P
Component: Runtime Library
Assignee: unassignedbugs at nondot.org
Reporter: tapplencourt at anl.gov
CC: llvm-bugs at lists.llvm.org
Math function in std::complex. Maybe related to 45003.
This code doesn't compile:
```
#include <complex>
#include <cmath>
#include <iomanip>
#include <stdlib.h>
#include <limits>
#include <iostream>
#include <cstdlib>
using namespace std;
bool almost_equal(complex<double> x, complex<double> y, int ulp) {
return std::abs(x-y) <= std::numeric_limits<double>::epsilon() *
std::abs(x+y) * ulp || std::abs(x-y) < std::numeric_limits<double>::min();
}
void test_cos(){
const char* usr_precision = getenv("OVO_TOL_ULP");
const int precision = usr_precision ? atoi(usr_precision) : 4;
complex<double> in0 { 0.42, 0.0 };
complex<double> out1_host {};
complex<double> out1_device {};
{
out1_host = cos(in0);
}
#pragma omp target map(tofrom: out1_device )
{
out1_device = cos(in0);
}
if ( !almost_equal(out1_host,out1_device, precision) ) {
std::cerr << std::setprecision
(std::numeric_limits<double>::max_digits10 ) << "Host: " << out1_host << " GPU:
" << out1_device << std::endl;
std::exit(112);
}
}
int main()
{
test_cos();
}
```
Error message:
```
tapplencourt at gpu07:~> clang++ --version
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
63c566b1fde33344688fb0e37dc4223a230ad575)
[...]
tapplencourt at gpu07:~> clang++ -fopenmp -fopenmp-targets=nvptx64 -Xopenmp-target
-march=sm_80 test.cpp
clang-14: warning: unknown CUDA version: version.txt: 11.0.207.; assuming the
latest supported version 10.1 [-Wunknown-cuda-version]
nvlink error : Undefined reference to 'ccos' in '/tmp/test-e10f6f.cubin'
clang-14: error: nvlink command failed with exit code 255 (use -v to see
invocation)
clang version 14.0.0 (https://github.com/llvm/llvm-project.git
63c566b1fde33344688fb0e37dc4223a230ad575)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /soft/compilers/llvm/master-latest/bin
clang-14: note: diagnostic msg: Error generating preprocessed source(s).
```
More tests here:
https://github.com/TApplencourt/OvO/tree/master/test_src/cpp/mathematical_function/cpp11-complex
One can do:
```
./ovo.sh run ./test_src/cpp/mathematical_function/cpp11-complex/
```
--
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/20211004/39042973/attachment.html>
More information about the llvm-bugs
mailing list