[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SGI ncdump-3.3.1 of >2GB Cray file



> I built 3.3.1 on my SGI here, no problem.  But an attempt to ncdump
> a 2.4GB Cray file failed:
>
>     ncdump: /archive/jps/tmpdir/ab.nc: Not a netCDF file

John:

I finally got access to a system with 64 bit off_t's
and enough space to debug the problem.

Turns out I was doing some intermediate calculatation at
'size_t' precision, which truncated the result on n32 SGI's.
(On these platforms, sizeof(off_t) == 8 && sizeof(size_t) == 4.)

A patch to src/libsrc/putget.m4 is attached.
This will be included in the next general release.

Thanks for pointing out this problem, and thanks to Dan Packman
for providing the disk space.

-glenn
Index: putget.m4
===================================================================
RCS file: /upc/share/CVS/netcdf-3/libsrc/putget.m4,v
retrieving revision 2.40
retrieving revision 2.41
diff -c -r2.40 -r2.41
*** putget.m4   1997/06/04 18:17:19     2.40
--- putget.m4   1997/07/22 16:41:26     2.41
***************
*** 12,18 ****
   *    Copyright 1996, University Corporation for Atmospheric Research
   *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
   */
! /* $Id: putget.m4,v 2.40 1997/06/04 18:17:19 davis Exp $ */
  
  #include "nc.h"
  #include <string.h>
--- 12,18 ----
   *    Copyright 1996, University Corporation for Atmospheric Research
   *      See netcdf/COPYRIGHT file for copying and redistribution conditions.
   */
! /* $Id: putget.m4,v 2.41 1997/07/22 16:41:26 davis Exp $ */
  
  #include "nc.h"
  #include <string.h>
***************
*** 200,206 ****
        offset = varp->begin;
        if(IS_RECVAR(varp))
        {
!               offset += (off_t)(ncp->recsize * recno);
        }
  
        assert(remaining > 0);
--- 200,206 ----
        offset = varp->begin;
        if(IS_RECVAR(varp))
        {
!               offset += (off_t)ncp->recsize * recno;
        }
  
        assert(remaining > 0);
***************
*** 435,447 ****
        if(varp->ndims == 1)
        {
                if(IS_RECVAR(varp))
!                       return varp->begin + (off_t)(*coord * ncp->recsize);
                /* else */
!               return varp->begin + (off_t)(*coord * varp->xsz);
        }
        /* else */
        {
!               size_t lcoord = coord[varp->ndims -1];
  
                size_t *up = varp->dsizes +1;
                const size_t *ip = coord;
--- 435,447 ----
        if(varp->ndims == 1)
        {
                if(IS_RECVAR(varp))
!                       return varp->begin + (off_t)(*coord) * ncp->recsize;
                /* else */
!               return varp->begin + (off_t)(*coord) * varp->xsz;
        }
        /* else */
        {
!               off_t lcoord = coord[varp->ndims -1];
  
                size_t *up = varp->dsizes +1;
                const size_t *ip = coord;
***************
*** 456,465 ****
                lcoord *= varp->xsz;
                
                if(IS_RECVAR(varp))
!                       lcoord += *coord * ncp->recsize;
                
                lcoord += varp->begin;
!               return (off_t) lcoord;
        }
  }
  
--- 456,465 ----
                lcoord *= varp->xsz;
                
                if(IS_RECVAR(varp))
!                       lcoord += (off_t)(*coord) * ncp->recsize;
                
                lcoord += varp->begin;
!               return lcoord;
        }
  }