PGI 19.4 and GCC 7.4.0, missing routine info for math functions

I am migrating from a build system with PGI19.4 + gcc 4.8.5 to one with PGI 19.4 + gcc 7.4.0 using a network installation. I have created a new localrc file in my home directory, and at first glance the gcc include directories look correct:

pgc++ --dryrun test.cpp


/common/pgi/linux86-64-llvm/19.4/bin/pggpp1-llvm --llalign -Dunix -D__unix -D__unix__ -Dlinux -D__linux -D__linux__ -D__NO_MATH_INLINES -D__LP64__ -D__x86_64 -D__x86_64__ -D__LONG_MAX__=9223372036854775807L ‘-D__SIZE_TYPE__=unsigned long int’ ‘-D__PTRDIFF_TYPE__=long int’ -D__extension__= -D__amd_64__amd64__ -D__k8 -D__k8__ -D__MMX__ -D__SSE__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__SSE4_1__ -D__SSE4_2__ -D__AVX__ -D__AVX2__ -D__AVX512F__ -D__AVX512VL__ -D__FMA__ -D__XSAVE__ -D__POPCNT__ -D__FXSR__ -D__PGI -D_GNU_SOURCE -D_PGCG_SOURCE -I- -I/common/pgi/linux86-64-llvm/19.4/include-gcc70 -I/common/pgi/linux86-64-llvm/19.4/include -I/usr/include/c++/7.4.0 -I/usr/include/c++/7.4.0/x86_64-pc-linux-gnu -I/usr/include/c++/7.4.0/backward -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include-fixed -I/usr/include -I/common/pgi/linux86-64-llvm/19.4/include-gcc70 -I/common/pgi/linux86-64-llvm/19.4/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include -I/usr/local/include -I/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include-fixed -I/usr/include -D__PGLLVM__ -D__extension__= --preinclude _cplus_preinclude.h --preinclude_macros _cplus_macros.h --gnu_version=70400 -D__pgnu_vsn=70400 -q -o test.il test.cpp

However, I am running into issues with any code that uses c standard math library functions. These problems were not encountered when I used gcc 4.8.5.

184, Accelerator restriction: call to ‘fabs’ with no acc routine information

I can bypass these issues by including “accelmath.h” in the problematic sources, but I would prefer to avoid this kind of platform-specific include if possible. Has anyone encountered this problem?

Thanks,

-David

Hi David,

I believe the difference is that “math.h” was getting implicitly included by the C++ cmath header with the GNU 4.8.5 compilers, but in 7.40 it only gets partially included (they added C++ macro guard so only parts are included). Hence, the definition for “fabs” is not longer getting implicitly included.

While you can use “accelmath.h” and then put a “#ifdef _OPENAC / #endif” guard around it for portability, you can also just include “math.h” instead.

Hope this helps,
Mat

Hi Mat,

Including accelmath.h should work, thanks for the sanity check.

Thanks,

-David