Extremely slow compile times for PGI 11 and newer

We have a user who is getting horrible compile times from PGI C++ compilers greater than version 10.9. Under 10.9 his code compiles in about 8 seconds. For 11 and newer it takes around 13 minutes.

The following code and test.sh runscript demonstrate essentially what the user is doing.


#include <string>

using std::string;
enum FuncType {FUNC_};
class Function
    Function(string a, int n, string b);
    string get_a() { return a; }
    string get_b() { return b; }
    int n;
    string a;
    string b;
void init()
	int f[32];
	f[0] = 0;
	f[1] = 0;
	f[2] = 0;
	f[3] = 0;
	f[4] = 0;
	f[5] = 0;
	f[6] = 0;
	f[7] = 0;
	f[8] = 0;
	f[9] = 0;
	f[10] = 0;
	f[11] = 0;
	f[12] = 0;
	f[13] = 0;
	f[14] = 0;
	f[15] = 0;
	f[16] = 0;
	f[17] = 0;
	f[18] = 0;
	f[19] = 0;
	f[20] = 0;
	f[21] = 0;
	f[22] = 0;
	f[23] = 0;
	f[24] = 0;
	f[25] = 0;
	f[26] = 0;
	f[27] = 0;
	f[28] = 0;
	f[29] = 0;
	f[30] = 0;
	f[31] = 0;


# This script demonstrates a problem with PGI 11 and 12.x (x < 4).
# Compile time increases superlinearly with the number of
# Function declarations in the init() function.
time pgCC -w -c slow_demo.cc
cp slow_demo.cc test.cc
for i in `seq 0 $1`
	sed "s/	f.${i}. = 0;/	Function f${i}(\"f${i}\", 1, \"real\");/" test.cc > sed.out
	mv -f sed.out test.cc
	time pgCC -w -c test.cc
# All done

Here are the results of running this using PGI C++ v. 10.9. As you can see, the compile time remains relatively flat.

$ pgcc -V

pgcc 10.9-0 64-bit target on x86-64 Linux -tp istanbul-64
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2010, STMicroelectronics, Inc. All Rights Reserved.

$ ./test.sh 30 2>&1 | grep real
real 0m0.327s
real 0m0.347s
real 0m0.350s
real 0m0.354s
real 0m0.359s
real 0m0.358s
real 0m0.363s
real 0m0.363s
real 0m0.367s
real 0m0.370s
real 0m0.375s
real 0m0.375s
real 0m0.378s
real 0m0.380s
real 0m0.382s
real 0m0.386s
real 0m0.387s
real 0m0.391s
real 0m0.394s
real 0m0.391s
real 0m0.395s
real 0m0.399s
real 0m0.402s
real 0m0.402s
real 0m0.407s
real 0m0.411s
real 0m0.411s
real 0m0.414s
real 0m0.415s
real 0m0.419s
real 0m0.423s
real 0m0.428s

And here is what happens when we use PGI 11.10. We get similar timings for PGI 12.4 and 12.5 as well.

$ pgcc -V

pgcc 11.10-0 64-bit target on x86-64 Linux -tp istanbul
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2011, STMicroelectronics, Inc. All Rights Reserved.

./test.sh 30 2>&1 | grep real
real 0m0.317s
real 0m0.351s
real 0m0.353s
real 0m0.363s
real 0m0.372s
real 0m0.411s
real 0m0.408s
real 0m0.446s
real 0m0.501s
real 0m0.581s
real 0m0.711s
real 0m0.901s
real 0m1.187s
real 0m1.591s
real 0m2.164s
real 0m2.974s
real 0m4.068s
real 0m5.521s
real 0m7.440s
real 0m9.973s
real 0m13.222s
real 0m17.216s
real 0m22.349s
real 0m28.791s
real 0m36.798s
real 0m46.748s
real 0m58.346s
real 1m12.720s
real 1m29.976s
real 1m49.561s
real 2m13.474s
real 2m42.062s

Hi David,

Thanks for the report. This issue was first reported via Cray Support on June 5th and was logged as TPR#18743. Note that the compile time with the 12.4 and 12.5 compilers is much better. However, it’s not clear why the time improved. Hence, we are currently investigating why the slow down occurred as well as what changed.

Best Regards,

% pgCC -V10.9 -w -c test.cc -fast -time
  Timing stats:
    init                    66 millisecs     3%
    parser                  50 millisecs     2%
    expand                 116 millisecs     5%
    vectorize               67 millisecs     3%
    optimize                34 millisecs     1%
    schedule              1817 millisecs    83%
    unroll                  33 millisecs     1%
    Total time            2183 millisecs
% pgCC -V12.3 -w -c test.cc -fast -time
  Timing stats:
    init                    16 millisecs     0%
    parser              303050 millisecs    95%
    expand                2200 millisecs     0%
    vectorize             4350 millisecs     1%
    optimize              1167 millisecs     0%
    schedule              5367 millisecs     1%
    unroll                1533 millisecs     0%
    Total time          317683 millisecs
% pgCC -V12.4 -w -c test.cc -fast -time
  Timing stats:
    init                    33 millisecs     0%
    parser                1683 millisecs     8%
    expand                2366 millisecs    12%
    vectorize             5468 millisecs    28%
    optimize              1450 millisecs     7%
    schedule              6584 millisecs    33%
    unroll                1916 millisecs     9%
    Total time           19500 millisecs

Thanks for the update, Mat. I wasn’t aware someone reported already. Is there a quick link to find existing TPRs for the future?


Mat. I wasn’t aware someone reported already

It’s not a problem. We’d rather have duplicate reports than no report.

Is there a quick link to find existing TPRs for the future?

Sorry, no. The problem is that since we need to maintain confidentiality with customer reported issues as well as our TPR system tracks internal issues, we decided we could not publicly expose the reports. For our premier support customers we do offer access to an online tracking system, however, they are limited in what can be viewed.

Actually, this is one reason why we started the PGI UF in 2004. If an issue is reported via the UF, it is implicitly public and therefore not confidential (with the exception of the posters identity).

  • Mat