Problems on Ubuntu 20.04 / linuxpower

I have PGI 19.1 Community Edition compilers installed on a Linux/ppc64le system.
It was working great with Ubuntu 18.04, but after upgrading to Ubuntu 20.04, every compilation fails as shown below. Reinstalling the compilers using a freshly downloaded tarball did not resolve the problem.

I suspect the answer will come down to “Ubuntu 20.04 is not supported”, possibly with “on Linux/ppc64le”. If that is the case, then I’d very much like to know when one can expect such support in a free edition. For the time being, I probably need to tell users of our software to build using GNU or LLVM compilers, instead of PGI, if using the latest Ubuntu LTS release.

The example below is a classic hello-world which should not need libpgmath.
So, I am also curious: is there is a work-around to omit link of libpgmath?

phargrov@openpower-6:~$ pgcc -V

pgcc 19.10-0 linuxpower target on Linuxpower
PGI Compilers and Tools
Copyright (c) 2019, NVIDIA CORPORATION.  All rights reserved.
phargrov@openpower-6:~$ cat hello.c
#include "stdio.h"
int main(void) {
        puts("Hello, World!");
        return 0;
}
phargrov@openpower-6:~$ pgcc hello.c
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__asinf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__sinh_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__atanhf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__exp_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__pow_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__cosh_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__acosh_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__sinhf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__log10f_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__asin_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__atanh_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__acosf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__log10_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__remainder_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__coshf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__expf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__atan2f_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__remainderf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__logf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__acos_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__log_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__acoshf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__powf_finite'
/usr/bin/ld: /opt/pgi/linuxpower/19.10/lib/libpgmath.so: undefined reference to `__atan2_finite'

Hi Paul,

You can find the supported OS for each compiler release in the release notes. For example: PGI Release Notes Version 19.10 for x86 and NVIDIA Processors

PGI 19.10 supported up to Ubuntu 18.10. Given Ubuntu 20.04 just came out, it will be a bit before it’s officially supported. Though more often than, installing older compiler on newer OS typically works fine. I just installed PGI 19.10 on a Ubuntu 20.04 system here (granted on x86_64 not power), and it was able to compile and link a basic program.

One thing I noticed, is that “libm.a” is no longer a library, but rather a linker script including two other library (libm2.31 and libmvec). It’s possible on Power, they’ve also modified the system libraries to remove these symbols or moved them elsewhere. Of course this is speculative, but if so, then this would be a breaking change and not much we can do except try to get it work with a future release.

is there is a work-around to omit link of libpgmath?

No, and our C runtime depends on it so you’d end-up with a lot more undefined references if you remove it.

-Mat

Thanks for the prompt reply, Mat.

Through some searching, I learned that _finite math functions in GNU libc are versions of their simpler namesakes which support gcc’s -ffinite-math-only optimization. For example, where acosh() has well defined behavior for infinities, the function __acosh_finite() is a (presumably faster) variant to which it is not legal to pass infinities.

So, I am now linking in an object generated from the source file below and my original problem is gone. I’ve gone a bit further and built a shared library from that and made some modification of my localrc (not for the average user) to link it transparently. The net result: I can now use PGI 19.10 on Ubuntu 20.04 as if there was never a problem.

So, if I can do it, there is hope that a future PGI release can too.

-Paul

phargrov@openpower-8:~$ cat mathstubs.c
#include <math.h>
double __acos_finite(double x) { return acos(x); }
float __acosf_finite(float x)  { return acosf(x); }
double __acosh_finite(double x) { return acosh(x); }
float __acoshf_finite(float x)  { return acoshf(x); }
double __asin_finite(double x) { return asin(x); }
float __asinf_finite(float x)  { return asinf(x); }
double __atanh_finite(double x) { return atanh(x); }
float __atanhf_finite(float x)  { return atanhf(x); }
double __cosh_finite(double x) { return cosh(x); }
float __coshf_finite(float x)  { return coshf(x); }
double __sinh_finite(double x) { return sinh(x); }
float __sinhf_finite(float x)  { return sinhf(x); }
double __exp_finite(double x) { return exp(x); }
float __expf_finite(float x)  { return expf(x); }
double __log10_finite(double x) { return log10(x); }
float __log10f_finite(float x)  { return log10f(x); }
double __log_finite(double x) { return log(x); }
float __logf_finite(float x)  { return logf(x); }
double __atan2_finite(double x, double y) { return atan2(x,y); }
float __atan2f_finite(float x, double y)  { return atan2f(x,y); }
double __pow_finite(double x, double y) { return pow(x,y); }
float __powf_finite(float x, double y)  { return powf(x,y); }
double __remainder_finite(double x, double y) { return remainder(x,y); }
float __remainderf_finite(float x, double y)  { return remainderf(x,y); }

NVIDIA HPC SDK 20.7 appears to have resolved this issue.