--- Begin Message ---
- To: address@hidden
- Subject: Re: [netCDF #MCW-760344]: Strange behaviour of nc_put_var
- From: Jan Aschmann <address@hidden>
- Date: Thu, 6 Sep 2012 11:22:28 +0200
- Delivery-date: Thu Sep 6 03:22:42 2012Hi Russ, thank you very much for your help. I have used the newer version 4.2 of the library and now it works perfectly. And thanks for the advice that the C library is also necessary to compile the fortran variant. Actually I have tried to compile the fortran version before but always without the C library, so I eventually gave up and went back to 4.1.3. Perhaps it would be a good idea to explicitly point out on the Netcdf web site that the C library is required for the fortran library. For a newcomer like me that is not that obvious. Likely that I have overlooked something, but I didn't find anything on the your download web site nor in the supplied README in the fortran package. Only after I have downloaded the C version I found a corresponding hint in the INSTALL file. It might be a good idea to include such a file also in the fortran-4.2 package. Anyway, I greatly appreciate your prompt support. Best regards, Jan >> Full Name: Jan Aschmann >> Email Address: address@hidden >> Organization: University of Bremen, Institute of Environmental Physics >> Package Version: 4.1.3 >> Operating System: AIX 6.1 >> Hardware: IBM PowerPC 64-Bit >> Description of problem: >> >> Dear Sir or Madam, >> >> I have encountered a strange problem when trying to write an 2D integer >> array to a netcdf-file (see attached code). I use the 4.1.3 library on >> an IBM AIX 64-bit machine, compiled either completely with gcc/gfortran >> or xlC/xlf. In both cases, if I compile and run the attached program I >> get this kind of strange output (xlf version): >> >> xlf95_r -q64 -O0 -qstrict -o test test.f90 >> -L/hb/jaschman/netcdf4_withHDF5/lib -lnetcdff -lnetcdf >> -I/hb/jaschman/netcdf4_withHDF5/include -L/hb/jaschman/HDF5/lib -lhdf5_hl >> -lhdf5 ** test === End of Compilation 1 === >> 1501-510 Compilation successful for file test.f90. >> address@hidden:~> ./test >> write out to file... .nc >> 17 17 0 778986336 >> >> Apparently, the last line comes out of the nf90_put_var subroutine, >> representing a memory violation. This occurs also if I use gfortran with >> a correspondingly compiled netcdf-library. >> >> Have I done something wrong in compiling the library in the first place? I >> have used the following flags: export CC=xlc_r >> export CXX=xlC_r >> export F77=xlf_r >> export FC=xlf95_r >> export CFLAGS='-q64 -O3 -qstrict -qarch=auto -qtune=auto' >> export CXXFLAGS='-q64 -O3 -qstrict -qarch=auto -qtune=auto' >> export FFLAGS='-q64 -O3 -qstrict -qarch=auto -qtune=auto' >> export FCFLAGS='-qsuffix=f=f90 -q64 -O3 -qstrict -qarch=auto -qtune=auto' >> export CPPFLAGS='-DIBMR2Fortran' >> export ARFLAGS='-X64 -cru' >> export NMFLAGS=-X32_64 >> >> My configure: >> ./configure --prefix=/hb/jaschman/netcdf4_withHDF5 >> --with-hdf5=/hb/jaschman/hdf5 --disable-dap --disable-shared >> >> Note that I got the same behaviour if I disabled netcdf4 features >> (i.e. compile without HDF5). The abnormal behaviour vanishes if I use >> another data type as integer for the variable int_date or if I add >> another dimension. Strange enough the resulting nc file is always >> correctly created, whether the mysterious output appears or not. >> Perhaps you can help me out in this case. > >Hi Jan, > >You did nothing wrong, the problem is a debugging statement that was >unfortunatelyly left in the netCDF-4.1.3 Fortran-90 code, as described here: > > http://www.unidata.ucar.edu/support/help/MailArchives/netcdf/msg10490.html > >You could just remove the debugging statement and rebuild the library, or >you could upgrade to the latest version of the netCDF C library (188.8.131.52) >and Fortran library (4.2). They are not bundled together now, you need >to first build and install the C library, then build and install the Fortran >library, specifying where the C library was installed. This is described >here: > > http://www.unidata.ucar.edu/software/netcdf/docs/building.html > >I just tried it out on your example, and it worked fine. > >--Russ > >Russ Rew UCAR Unidata Program >address@hidden http://www.unidata.ucar.edu > > > >Ticket Details >=================== >Ticket ID: MCW-760344 >Department: Support netCDF >Priority: Normal >Status: Closed ________________________________________ Dr. Jan Aschmann Institute of Environmental Physics (IUP) Atmospheric Modeling Group http://www.iup.uni-bremen.de/atmospheric/ phone: ++49-(0)421-218-62114 email: address@hidden Room: U3220 University of Bremen (FB1) P.O. Box 330440 Otto-Hahn-Allee 1 28359 Bremen Germany
--- End Message ---
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata inquiry tracking system and then made publicly available through the web. If you do not want to have your interactions made available in this way, you must let us know in each email you send to us.