NetCDF: One or more variable sizes violate format constraints

Wei-keng Liao wkliao at eecs.northwestern.edu
Wed Aug 1 10:14:28 CDT 2018


Strange. I was able to run the codes with 1.6.1 and below is from command ncdump -h.
I am using gfortran based MPI compiler but having some minor problem when
compiling your codes, particularly when calling nf90mpi_def_var.
You do not need to specify the length of dimension ID array. Fortran 90
checks that automatically.

My code is attached. Please give it a try and let me know.

% mpifort put_var.f90 -I$HOME/PnetCDF/1.6.1/include -o put_var -L$HOME/PnetCDF/1.6.1/lib -lpnetcdf
% ./put_var
% ncdump -h testfile.nc
netcdf testfile {
dimensions:
	t = UNLIMITED ; // (0 currently)
	x = 400 ;
	y = 400 ;
	z = 200 ;
variables:
	double t(t) ;
	double x(x) ;
	double y(y) ;
	double z(z) ;
	double hy_dens(z) ;
	double hy_dens_theta(z) ;
	double dens(t, z, y, x) ;
	double uwnd(t, z, y, x) ;
	double vwnd(t, z, y, x) ;
	double wwnd(t, z, y, x) ;
	double theta(t, z, y, x) ;
	double windmag(t, z, y, x) ;
	double ke(t, z, y, x) ;
	double vort_xy(t, z, y, x) ;
	double vort_xz(t, z, y, x) ;
	double tracer1(t, z, y, x) ;
	double tracer2(t, z, y, x) ;
	double tracer3(t, z, y, x) ;
}

Wei-keng

-------------- next part --------------
A non-text attachment was scrubbed...
Name: put_var.f90
Type: application/octet-stream
Size: 4427 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/parallel-netcdf/attachments/20180801/b1c894bd/attachment.obj>
-------------- next part --------------

> On Aug 1, 2018, at 9:13 AM, Norman, Matthew R. <normanmr at ornl.gov> wrote:
> 
> I'm getting the error: "NetCDF: One or more variable sizes violate format constraints" upon nf90mpi_enddef(ncid). I'm using the 64bit offset flag, but it doesn't seem to get rid of the error. This works for smaller problem sizes. Is this simply getting too large to use a record dimension, and do I need to split this up into one file per output? If so, is there any way to get things into a single file? The relevant code is below. I'm using parallel-netcdf version 1.6.1. Thanks,
> 
> -Matt
> 
> ntracers = 3
> nx_glob = 400
> ny_glob = 400
> nz_glob = 200
> integer(kind=MPI_OFFSET_KIND) :: len
> call ncwrap( nf90mpi_create( MPI_COMM_WORLD , trim(fname) , ior( nf90_clobber , nf90_64bit_offset ) , MPI_INFO_NULL , ncid ) , __LINE__ )
> 
> len=nf90_unlimited; call ncwrap( nf90mpi_def_dim( ncid , 't' , len , t_dimid ) , __LINE__ )
> len=nx_glob       ; call ncwrap( nf90mpi_def_dim( ncid , 'x' , len , x_dimid ) , __LINE__ )
> len=ny_glob       ; call ncwrap( nf90mpi_def_dim( ncid , 'y' , len , y_dimid ) , __LINE__ )
> len=nz_glob       ; call ncwrap( nf90mpi_def_dim( ncid , 'z' , len , z_dimid ) , __LINE__ )
> 
> call ncwrap( nf90mpi_def_var( ncid , 't' , nf90_double , 1 , (/ t_dimid /) , t_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'x' , nf90_double , 1 , (/ x_dimid /) , x_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'y' , nf90_double , 1 , (/ y_dimid /) , y_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'z' , nf90_double , 1 , (/ z_dimid /) , z_varid ) , __LINE__ )
> 
> call ncwrap( nf90mpi_def_var( ncid , 'hy_dens'       , nf90_double , 1 , (/                     z_dimid           /) ,       hy_dens_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'hy_dens_theta' , nf90_double , 1 , (/                     z_dimid           /) , hy_dens_theta_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'dens'          , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,          dens_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'uwnd'          , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,          uwnd_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'vwnd'          , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,          vwnd_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'wwnd'          , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,          wwnd_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'theta'         , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,         theta_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'windmag'       , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,       windmag_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'ke'            , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,            ke_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'vort_xy'       , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,       vort_xy_varid ) , __LINE__ )
> call ncwrap( nf90mpi_def_var( ncid , 'vort_xz'       , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,       vort_xz_varid ) , __LINE__ )
> do i = 1 , ntracers
>   tname = trim(tracer_names(i))
>   call ncwrap( nf90mpi_def_var( ncid , tname         , nf90_double , 4 , (/ x_dimid , y_dimid , z_dimid , t_dimid /) ,    tracer_varids(i) ) , __LINE__ )
> enddo
> call ncwrap( nf90mpi_enddef( ncid ) , __LINE__ )
> 
> 



More information about the parallel-netcdf mailing list