WRF 3.2 with PGI and gcc

Hello,
I am trying to compile WRF 3.2 with openmp, using pgf90 8.0-3 and gcc 4.3.2, in a 4-core 64-bit opensuse 11.1 computer.

The problem is some undefined references when using pgf90 in compilation:

libwrflib.a(setfeenv.o): In function setfeenv_': setfeenv.c:(.text+0x46): undefined reference to GOMP_parallel_start’
setfeenv.c:(.text+0x53): undefined reference to `GOMP_parallel_end’


gcc has always this references has undefined, but gfortran doesn’t complain. How can I solve this, using pgf90?

best regards
R.

Hi arosa,

These are references from the GNU OpenMP library which means that you most likely added the gcc flag “-fopenmp” to your configure.wrf (I don’t think it gets added by defult). Different vendor’s OpenMP implementations are not compatible. To fix, you’ll need to remove the “-fopenmp” flag.

The OpenMP section of code in this file is new and fixes a problem with WRF where the floating point control status registers were not being set properly for OpenMP threads. This can lead to wrong answers.

Because of this, the better fix would be for you to compile the “setfeenv.c” file using pgcc (or all C files) and “-mp”.

We’ll let the folks at NCAR know about this problem.

Thanks,
Mat

Thank you for the explanation. I will have a try at the pgcc.

Just to understand that this has nothing to do with WRF, I did a simple test with testF.f and testC.c from http://www.yolinux.com/TUTORIALS/LinuxTutorialMixingFortranAndC.html. Compiling with:

pgf90 -c testF.f90
gcc -c -fopenmp testC.c
pgf90 -mp -o test_pgi.exe testF.o testC.o

gives, in the linking step:

testC.o: In function doubleijk_': testC.c:(.text+0x26): undefined reference to GOMP_parallel_start’
testC.c:(.text+0x34): undefined reference to `GOMP_parallel_end’

.i.e. the same error I got in compiling WRF 3.2 with pgf90 and just gcc.

Best regards
R.

Hi R.,

You would get this error any time you’re missing a library or object from the link line that another library or object has an external reference.

In this case, you’re missing the GNU OpenMP runtime library. While you could simply resolve this issue by adding this library to the link line, most vendor OpenMP implementations are not compatible. Hence, it’s better to use pgcc.

  • Mat

Hi R.,

FYI, we took a look at WRF 3.2 and they are doing things correctly. In the “configure.wrf” file, they added a new variable “CCOMP” which is defined to be ‘pgcc’. This variable is only used for compiling “setfeenv.c”.

To fix your original problem, simply use the default configuration.

  • Mat