Switch availability

Hi

I have been using gnu compilers and pgi compilers to compile CHARMM and other programs. Apparently it is a good idea to initialise all local variables and arrays to zero and some of the older code snippets expect this from the compiler. GNU compilers provide the -finit-local-zero and -fno-automatic switches to handle this. Is there a PGI equivalent?

Thanks,
C

Hi C,

It’s not so much that you need to initialize all local variables to zero, it’s more that you need to initialize all local variables before they are read, i.e. an uninitalized memory read or UMR. So a better approach is to find and fix all UMRs. Of course, this is easier said then done and may require an external utility such as Valgrind to help find them.

As for an equivlent flag, we don’t have one. You can use “-Msave” which applies the SAVE attribute to all local variables and has the side effect of initializing these variable to zero. However, this is a big hammer approach and may cause other issues.

  • Mat

Hi Mat

Thank you for the information and for mentioning Valgrind!
Perhaps you could mention some of issues the -Msave flag may cause so that I could look out for them.
My impression of your compilers is that they require/implement the gnu compiler/libs in some way. Could you comment on this, does this lend itself to implementation of gnu type flags?

Thanks,
C

Hi C,

The SAVE attribute saves the value of local variables, retaining this value from call to call. So the major issue is the overhead cost of saving these values. This extra overhead can cause performance to degrade. While I don’t know this for a fact, my assumption is the GNU flags also require a similar overhead cost. Hence, the best solution is to find and fix the UMRs.

The PGI compilers do not implement nor are based from the GNU compilers. We do need to include system libraries and objects provided by the operating system. As for implementation of GNU type flags, I think you mean if we can implement non-standard GNU features. The answer to this is yes if customers request it and the feature seems benificial to our wider user community. For example we recently added support for extended asm.

  • Mat