pgf90 and NetCDF Problems

I am having a problem with the Fortran90 interface to the NetCDF libraries (NetCDF version 3.6.1). The easiest way to put it is, they don’t work. The C, C++ and f77 interfaces work just fine. The f90 interfaces either always return an error or, when reading data arrays, all zeros.

I am using the 6.0 version of the PGI compilers (I am awaiting funds to renew my support and upgrade):

bash-2.05b$ pgf90 -V

pgf90 6.0-2 64-bit target on x86-64 Linux
Copyright 1989-2000, The Portland Group, Inc. All Rights Reserved.
Copyright 2000-2005, STMicroelectronics, Inc. All Rights Reserved.

And I compiled NetCDF using this from the PGI Website:

env CC=pgcc CFLAGS=“-O2 -Msignextend -V” FC=pgf90 F90=pgf90 FFLAGS=“-O2 -w -V” CXX=pgCC CPPFLAGS=“-DNDEBUG -DpgiFortran” ./configure

There are no errors output during the configure nor during the make or make test commands. I have tested all the interfaces (C, C++, f77 and f90) and only the f90 fail. Please note, the PGI 5.x suites compile this library and all the interfaces just fine.

I have sent a note to Unidata but heard nothing back. I am hoping someone here can help.

–Case

Hi Case,

I’m unaware of any issues related to NetCDF from the 6.0-2 compiler and all internal testing from that time revealed no defects. I’m wondering if the problem has more to do with the application rather than the NetCDF library? Is it possible for you to submit a test case to trs@pgroup.com which illustrates the problem or describe how you are conducting your testing so I can recreate it here? Also, which OS are you using?

Thanks,
Mat

Hi Mat,

I sent a test case from my gmail account (our mailer won’t let me send the 3+ MB NetCDF files. Hopefully, it will route to you correctly.

I can’t include the main code as it is proprietary. I am hoping it’s something simple.


–EDIT: If I compile everything in 32 bits, it works. Unfortunately, I’m going to need mcmodel=medium to run the production code.

C

C,

Support forwarded me your test case and I’ve determined that the issue is an inconsistant addressing mode between your application and the NetCDF library. When compiling with “-mcmodel=medium”, as your application does, all static libraries need to be compiled with “-fpic -Mlarge_arrays”. Hence, the solution is to either remove “-mcmodel=medium” from your compile, or rebuild NetCDF with “-fpic -Mlarge_arrays”. I was able to successfully run your program in both cases.

  • Mat

Mat,

That fixed it! Whew. I would have continued to wonder where the error was. I guess what really tripped me up is the fact that this didn’t happen with the v5 compilers.

Case