pgf90 6.2 and NetCDF with FLAG: mcmodel=medium

Hi there,

I need to use the mcmodel=medium flag in my main program.
With this flag, my calls to the NetCDF routine nf90_get_var returns only 0s
Without the flag, it returns the correct values.

I saw the post: https://forums.developer.nvidia.com/t/usr-bin-ld-share-liblam-libs-liblam-so-no-s/130411/1
and I tried to compile NetCDF with the following env:

env CC=pgcc CXX=pgCC FC=pgf90 F90=pgf90 CFLAGS=" -O2 -fpic -Mlarge_arrays" CXXFLAGS=" -fpic -Mlarge_arrays" FFLAGS=" -O2 -w -fpic -Mlarge_arrays" F90FLAGS=" -O2 -w -fpic -Mlarge_arrays"


Unfortunately, It was unsuccessful.
Perhaps someone can help me.

Thanks,
Vincent

pgf90 -V
pgf90 6.2-5 64-bit target on x86-64 Linux
(Got the same results with 7.0-4)

Hi Vincent,

Unfortunately NetCDF itself hasn’t been ported to use the medium memory model or large arrays. However, your application should run correctly so long as you’re not trying to pass large arrays to NetCDF. What values are you passing to ‘nf90_get_var’?

Thanks,
Mat

Hi Mat,
I do not pass large arrays from NetCDF to Fortran.
The typical array is a float array of dim(100,100)
And I still have only 0s…
Thanks,
Vincent.

Hi Vincent,

I was able to reproduce the issue with “-Mlarge_arrays” and will investigate the cause. Since it’s not needed, I think the best thing to do is to simply remove “-Mlarge_arrays” and just compile NetCDF with “-fastsse -fpic”.

  • Mat

Hi All,

I have recently encountered the same problem and I was wondering if you had resolved this?
We have the same situation in PGI 6.1, when we compile with -mcmodel=medium, the results of reading a netcdf file using ncdf_get_var() are 0’s. We don’t seem to have any problems with reading other details from the netcdf file, its just when we dynamically allocate memory.

rv = nf90_Inquire_Dimension(FileID, tecId, len=numrec)
print*, 'numrec', numrec
 
allocate(tecarray(0:numRec-1), STAT=allocateStatus)
rv = nf90_get_var(FileID, tecId, tecarray)
print*, tecarray(0:10)

prints:

 numrec        23752
    0.000000000000000         0.000000000000000         0.000000000000000
    0.000000000000000         0.000000000000000         0.000000000000000
    0.000000000000000         0.000000000000000         0.000000000000000
    0.000000000000000         0.000000000000000

We previously used mcmodel=medium in PGI 5.1, without any issues, so we’re a bit baffled why this would show up in 6.1.

We can probably get by w.o using the mcmodel, but we would like to resolve it.
Any help would be greatly appreciated.
Regards,
Natalie

Hi Natalie,

In 6.1 or later, -mcmodel=medium implies -Mlarge_arrays. That’s why you see that error.

Hongyon