Conj not supported in a compute region

Hi,

I’m trying to compile an OpenACC application that makes extensive use of complex.h. This compiles correctly with pgcc 19.10 community edition, but on pgcc/nvc 20.7 this fails with the error message:

NVC++-S-0155-Procedures called in a compute region must have acc routine information: conj

I’ve put together a minimal failing example:

#include <stdio.h>
#include <complex.h>

int main(void) {
    double complex a[100], b[100];

#pragma acc kernels copyout(a[0:100], b[0:100])
    for (int i = 0; i < 100; i++) {
        a[i] = 1 + 1 * I;
        b[i] = conj(a[i]);
    }

    if (cimag(a[50]) == -cimag(b[50])) {
        printf("Conjugation worked!\n");
        return 0;
    } else {
        printf("Conjugation failed! %lf != %lf\n", cimag(a[50]), -cimag(b[50]));
        return 1;
    }
}

Running with 2019.10:

$ pgcc --version

pgcc 19.10-0 LLVM 64-bit target on x86-64 Linux -tp skylake
PGI Compilers and Tools
Copyright (c) 2019, NVIDIA CORPORATION.  All rights reserved.
$ pgcc -acc -o test test.c
$ ./test
Conjugation worked!

Running with 20.7:

$ pgcc --version

pgcc (aka nvc) 20.7-0 LLVM 64-bit target on x86-64 Linux -tp zen
PGI Compilers and Tools
Copyright (c) 2020, NVIDIA CORPORATION.  All rights reserved.
$ pgcc -acc -o test test.c
NVC++-S-0155-Procedures called in a compute region must have acc routine information: conj (test.c: 10)
NVC++-S-0155-Accelerator region ignored; see -Minfo messages  (test.c: 5)
NVC++/x86-64 Linux 20.7-0: compilation completed with severe errors

I’d appreciate any advice on how to get this working. I have benchmarking access to a DGX-A100 for the next couple of days and would like to test this software, but no older PGI compiler versions are installed, and I can’t access the download links for the community editions any more, so I need to get this working with the new version (or find an installer for the 19.10 community edition).

Many thanks

Ed

An update: I’ve managed to get my tests to run by looking at the preprocessed output from pgcc 19.10 and adding this to a header to achieve the same result:

#define conj __builtin_conj
#define creal __builtin_creal
#define cimag __builtin_cimag
#define conjf __builtin_conjf
#define crealf __builtin_crealf
#define cimagf __builtin_cimagf

All tests now compile and seem to work correctly (I’ll check the full output in the tomorrow to make sure the numbers are right). Still, it would be nice if this were fixed in the compiler.

Thanks for the report. Not sure what happened but my guess is that when we switched to using the C++ front-end for C,
“conj” isn’t being presented correctly so the compiler is missing making it a builtin. I added TPR #28890 and sent it to engineering for investigation.