We run the PGI compiler within docker containers containing different Linux flavors and GCC installations. Currently I am working with a docker container with Centos-7 and GCC 7.4. To make our build system portable across different containers we call the following in our build scripts to generate a new localrc on the fly:
ndir=$(dirname $0)
export PGI_LOCALRC=readlink -f ${ndir}/../../$PLATFORM
/pgilocalrc
export PGI_LOCALDIR=readlink -f ${ndir}/../../$PLATFORM
/common/pgi/Linux_x86_64/20.9/compilers/bin/makelocalrc /common/pgi/Linux_x86_64/20.9/compilers/ -net ${PGI_LOCALDIR} -o > ${PGI_LOCALRC}
echo “switch -pthread is append(LDLIB1=-lpthread);” >> ${PGI_LOCALRC}
echo “set DEFSTDOBJDIR=/usr/lib64/;” >> ${PGI_LOCALRC}
echo "Using localrc = " ${PGI_LOCALRC}
The contents of the resulting localrc looks reasonable:
$ cat pgilocalrc
localrc.centos7 contents
set LFC=-lgfortran;
set LDSO=/lib64/ld-linux-x86-64.so.2;
set GCCDIR=/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0;
set G77DIR=/usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/;
set OEM_INFO=64-bit target on x86-64 Linux $INFOTPVAL;
set GNUATOMIC=-latomic;
set GCCINC= /usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include-fixed /usr/include;
set GPPDIR= /usr/include/c++/7.4.0 /usr/include/c++/7.4.0/x86_64-pc-linux-gnu /usr/include/c++/7.4.0/backward /usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include /usr/local/include /usr/lib/gcc/x86_64-pc-linux-gnu/7.4.0/include-fixed /usr/include;
set LOCALRC=YES;
set EXTENSION=extension=;
set COMPGCCINCDIR=include-gcc70;
set LC=$if(-Bstatic,-lgcc -lgcc_eh -lc -lgcc -lgcc_eh -lc, -lgcc -lc -lgcc -lgcc_s);
GLIBC version 2.17
GCC version 7.4.0
set GCCVERSION=70400;
set LIBNCURSES=YES;
export PGI=$COMPBASE;
makelocalrc executed by david Fri Oct 9 23:49:07
############################
switch -pthread is append(LDLIB1=-lpthread);
set DEFSTDOBJDIR=/usr/lib64/;
However, the compilation fails due to missing C++ includes:
c++ _obj__fusion/_solver/_6dofDynamics/PitchPlungeAirfoilModel.o
“_src/_6dofDynamics/PitchPlungeAirfoilModel.C”, line 28: catastrophic error:
cannot open source file “system_error”
#include <system_error>
I see that the missing file is present in /usr/include/c++/7.4.0/, which is included in GPPDIR in pgilocalrc:
[david@centos7 LINUX_X86_PGI18_OMPI2.1]$ ls /usr/include/c++/7.4.0/system_error
/usr/include/c++/7.4.0/system_error
Thus, I have 2 questions:
- Is the localrc file shown above configured correctly?
- It the method of setting the PGI_LOCALRC environment variable still valid? This worked with PGI 19.X, but this is the first time I have tried with the NVIDIA HPC SDK.
Thanks,
-David