error 'invalid argument to attribute'

Hello,
I try to compile very simple test code that has only an empty main() function + includes (code is not accepted by the forum software!) Without including no error happens.

compiled with:
pgc++ -std=c++11 -I/opt/pgi/linux86-64/2017/include/ test.cpp

error is:
“/usr/include/bits/floatn.h”, line 61: error: invalid argument to attribute
mode
typedef _Complex float __cfloat128 attribute ((mode (TC)));
^

platform: arch linux
gcc: 7.2.0
pgi: 17.10

Do you have a patch to fix the issue?

ty,
Oliver

Oliver,

We have an answer. The Release Notes (see Support->Documentation->Release Notes->Supported Platforms)
for 17.10 release indicate the newest Ubuntu release we support is 16.10.

Either move to a Linux version we support, or wait for a PGI release
that supports Ubuntu 17.10.

dave

Dave,
I don’t use Ubuntu 17.10, I said that I use PGI 17.10 community edition on ArchLinux!

The error is caused by a header of the glibc (/usr/include/bits/floatn.h) and PGI 17.10 is unable to handle the attribute parameter mode - it’s a fault in PGI’s parser.

‘mode’ is not new (gcc-3.x or older), it defines the machine mode to be used for __cfloat128.

Oliver

Okay, I misspoke. We do not support Ubuntu 17.10 because we are
not compatible (yet) with gcc 7.2 . Since gcc changed things, we have work to do on headers, libs, and our install process to add gcc 7.2 support.

That has not happened yet.

So any other Linux version with gcc newer than 6.3 is not supported.

Gcc 7.2 will probably be supported in the Professional 18.1, and the next Community Edition 18.4 .

dave

Dave,

it is N O T related to gcc-7.2! It is simply a H E A D E R from GLIBC that contains the statement:

typedef _Complex float __cfloat128 attribute ((mode (TC)));

The error message tells us that PGI isn’t aware of attribute’s parameter ‘mode’.

I’ve compiled simple test app that contains the typedef from above with
GCC-4.9.2 - no error happened.

So your statement:
“So any other Linux version with gcc newer than 6.3 is not supported.”
isn’t true.

It is simply a bug in PGI-17.10, it is not compatible to GCC-4.9 (or older) attributes.
I guess if you would get PGI right it will run on ArchLinux and other distros too.

/lib/x86_64-linux-gnu/libc.so.6

will probably indicate you are linking with glibc 2.26.

dave

In SR1000251 I’ve already told you that my system uses glibc-2.26-5.

But that’s not the point - the problem is that PGI-17.10 is unable to parse system/libc headers - older GCC versions (for instance GCC-4.9.x) are able to compile the mentioned statement.

I’d like to use PGI for OpenACC because of its feature completeness.
But it is a show stopper if PGI fails to deal with system headers (libc).
That’s very, very pity.

I hope NVIDIA will provide a bug fix release soon and not in 6 months!

Installing another distro is not an option because I’ve setup my dev system and I need this dev env also for other developments (newest C++ features -> GCC/Clang etc.).
Using a virtualized system is not an option for OpenACC/GPU programming …

Hi, any news on this? I’m facing the exact same problem (PGI 17.10). Our code relies on the Boost library, which in turn depends on the GNU C library’s headers. I’m running Debian Stretch, which ships libboost 1.62 and libc6 2.24. Thank you.

I believe the 18.4 Community Edition release will support gcc 7.2/glibc 2.26 versions that previous CE releases did not.

It should be out this month.

dave

Hi Dave, I’m glad to hear that. Thank you for the information.

Hi, Dave, it’s me again. I’m using PGI 18.7 Professional Edition but still cannot compile this following simple code on Debian Stretch:

   #include <boost/lexical_cast.hpp>
   int main() {
      return 0;
   }

The error is:

 $ pgc++ -v -acc -ta=tesla:cuda9.1 main.cc

   Export PGI_CURR_CUDA_HOME=/opt/pgi/linux86-64/2018/cuda/9.1
   Export PGI=/opt/pgi

   /opt/pgi/linux86-64/18.7/bin/pggpp1 --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__SSE__ -D__MMX__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__PGI -D_GNU_SOURCE -D_PGCG_SOURCE -I- -I/opt/pgi/linux86-64/18.7/include-gcc60 -I/opt/pgi/linux86-64/18.7/include -I/usr/include/c++/6 -I/usr/include/x86_64-linux-gnu/c++/6 -I/usr/include/c++/6/backward -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include -I/opt/pgi/linux86-64/2018/cuda/9.1/include -D_ACCEL=201003 -D_OPENACC=201711 -D__CUDA_API_VERSION=9010 -DPGI_TESLA_TARGET --preinclude _cplus_preinclude.h --preinclude_macros _cplus_macros.h --gnu_version=60300 -D__pgnu_vsn=60300 --accel --preinclude openacc_predef.h --accel --preinclude openacc_predef.h -q -o /tmp/pgc++bGUddOVVMTHm.il main.cc

   "/usr/include/boost/type_traits/is_floating_point.hpp", line 25: error: class
             "boost::is_floating_point<long double>" has already been defined
        template<> struct is_floating_point<__float128> : public true_type{};
                          ^
   "/usr/lib/gcc/x86_64-linux-gnu/6/include/quadmath.h", line 32: error: 128-bit
             floating-point types are not supported in this configuration
     typedef _Complex float __attribute__((mode(TC))) __complex128;
                                           ^
   2 errors detected in the compilation of "main.cc".
   pgc++-Fatal-cpp1 completed with exit code 2

This is my environment configuration:

  • gcc 6.3.0
  • libboost 1.62
  • libc6 2.24

Hi d.a.a.,

I just downloaded Boost 1.68 from https://www.boost.org/ and you code compiled correctly for me.

% pgc++ -I /scratch/boost_1_68_0/ -V18.7 -acc -ta=tesla:cuda9.1 main.cc
%

I suspect that the system boost libraries you have installed have been configured for you’re system’s g++ compilers. Can you try using the version from boost.org?

Thanks,
Mat

Hi mkcolg,

I’m using the official libboost [1] package from Debian Stretch, which is the current Debian stable distribution. Using this package I can successfully compile the code with gcc and g++, but not with PGI.

Compiling the code with Boost 1.68 (from boost.org) as you suggested solved the first compilation error (redefinition of boost::is_floating_point), but still don’t pass the second error (related to mode(TC)):

   pgc++ -v  main.cc -I/tmp/boost_1_68_0

   Export PGI=/opt/pgi
   
   /opt/pgi/linux86-64/18.7/bin/pggpp1 --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__SSE__ -D__MMX__ -D__SSE2__ -D__SSE3__ -D__SSSE3__ -D__PGI -D_GNU_SOURCE -D_PGCG_SOURCE -I. -I- -I/opt/pgi/linux86-64/18.7/include-gcc60 -I/opt/pgi/linux86-64/18.7/include -I/usr/include/c++/6 -I/usr/include/x86_64-linux-gnu/c++/6 -I/usr/include/c++/6/backward -I/usr/lib/gcc/x86_64-linux-gnu/6/include -I/usr/local/include -I/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed -I/usr/include/x86_64-linux-gnu -I/usr/include --preinclude _cplus_preinclude.h --preinclude_macros _cplus_macros.h --gnu_version=60300 -D__pgnu_vsn=60300 -q -o /tmp/pgc++RJGgbEzquBGs.il main.cc
   "/usr/lib/gcc/x86_64-linux-gnu/6/include/quadmath.h", line 32: error: 128-bit
             floating-point types are not supported in this configuration
     typedef _Complex float __attribute__((mode(TC))) __complex128;
                                           ^
   
   1 error detected in the compilation of "main.cc".
   pgc++-Fatal-cpp1 completed with exit code 2

The offending header file /usr/lib/gcc/x86_64-linux-gnu/6/include/quadmath.h is provided by libgcc-6-dev (6.3.0-18+deb9u1), which is also a package from Debian Stretch. GCC 6.3 is supposed to work with PGI 18.7, isn’t it?


Thanks.

\

  1. https://packages.debian.org/stretch/libboost-all-dev

Hi d.b.a.

We don’t support quad precision so the quadmath.h header file shouldn’t be included. In Boost, quadmath is only included when “BOOST_HAS_FLOAT128” is defined. This should be undefined for PGI in the config header “boost/config/compiler/pgi.hpp”.

Why it’s being defined in your configuration, I’m not sure.

Has the pgi.hpp config been modified on your system? Is your Boost including the correct config for PGI?

You can check what head files are being include by using the “-E” flag and redirecting the output to a file. Then look for “pgi.hpp” to see if it’s being included.

-Mat

Hi mkcolg,

I’m using libboost 1.62 shipped officially with Debian stable without any modification. I have found that introducing the following definition in the beginning of ‘boost/math/tools/config.hpp’ solves the second compilation error (128-bit float point):

   #if defined(__PGI)
   #  define BOOST_MATH_DISABLE_FLOAT128
   #endif

As Alex from the PGI support suggested, editing ‘boost/type_traits/is_floating_point.hpp’ and replacing ‘#if defined(BOOST_HAS_FLOAT128)’ with ‘#if defined(BOOST_HAS_FLOAT128) && !defined(__PGI)’ solves the first compilation error (class redefinition). So now I can finally compile a C++ code that depends on Boost on my OS.

Changing a system-wide file from an official package is not the ideal solution, but at least now I have a work-around.

Maybe some patches should be submitted to Debian (stable) to address these incompatibility issues.

Thank you.

Similar errors (mode(TC)) occur on Ubuntu 18.04 server with PGI 18.4 and 18.10. I suggest to change the file /usr/include/x86_64-linux-gnu/bits/floatn.h as follows:

#if (defined __x86_64__                                                 \
     ? __GNUC_PREREQ (4, 3)                                             \
     : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \
     &&  !defined(__CUDACC__) && !defined(__ICC)
// PGI compiler hack 
#if defined(__PGI) 
#define __HAVE_FLOAT128 0
#else
# define __HAVE_FLOAT128 1
#endif

#else
# define __HAVE_FLOAT128 0
#endif