NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi, I am fairly new to netcdf and I am having problems writting out a netcdf file which contains a variable with an unlimited dimension. When I try to write the variable I get the following error (on the nf90_put_var line): Unknown Error I have three programs two which work and one which doesn't. The one which doesn't work is parrallel and uses the dimension: call check( nf90_def_dim(ncid, REC_NAME, NF90_UNLIMITED, rec_dimid) ) This code works when I create the file in non-parrallel mode or when I use a specified number: call check( nf90_def_dim(ncid, REC_NAME, 2, rec_dimid) The code is: program pres_temp_4D_wr use netcdf implicit none include 'mpif.h' ! This is the name of the data file we will create. character (len = *), parameter :: FILE_NAME = "pres_temp_4D.nc" integer :: ncid ! We are writing 4D data, a 2 x 6 x 12 lvl-lat-lon grid, with 2 ! timesteps of data. integer, parameter :: NDIMS = 1, NRECS = 2 integer, parameter :: NLVLS = 2, NLATS = 6, NLONS = 12 character (len = *), parameter :: LVL_NAME = "level" character (len = *), parameter :: LAT_NAME = "latitude" character (len = *), parameter :: LON_NAME = "longitude" character (len = *), parameter :: REC_NAME = "time" integer :: lvl_dimid, lon_dimid, lat_dimid, rec_dimid ! The start and count arrays will tell the netCDF library where to ! write our data. integer :: start(NDIMS), count(NDIMS) ! These program variables hold the latitudes and longitudes. real :: lats(NLATS), lons(NLONS) integer :: lon_varid, lat_varid ! We will create two netCDF variables, one each for temperature and ! pressure fields. character (len = *), parameter :: PRES_NAME="pressure" integer :: pres_varid integer :: dimids(NDIMS) ! Program variables to hold the data we will write out. We will only ! need enough space to hold one timestep of data; one record. real :: pres_out real, parameter :: SAMPLE_PRESSURE = 900.0 ! MPI stuff: number of processors, rank of this processor, and error ! code. integer :: p, my_rank, ierr ! Loop indices integer :: lvl, lat, lon, rec, i ! Initialize MPI, learn local rank and total number of processors. call MPI_Init(ierr) call MPI_Comm_rank(MPI_COMM_WORLD, my_rank, ierr) call MPI_Comm_size(MPI_COMM_WORLD, p, ierr) ! Create pretend data. If this wasn't an example program, we would ! have some real data to write, for example, model output. pres_out = 1.1 call check( nf90_create(FILE_NAME, IOR(NF90_MPIIO, IOR(NF90_NETCDF4, NF90_CLOBBER)), ncid, comm= MPI_COMM_WORLD, info = MPI_INFO_NULL) ) call check( nf90_def_dim(ncid, REC_NAME, 1, rec_dimid) ) dimids = (/ rec_dimid /) call check( nf90_def_var(ncid, PRES_NAME, NF90_REAL, rec_dimid, pres_varid) ) call check( nf90_enddef(ncid) ) count = (/1 /) start = (/1 /) !start(1) = 1 call check( nf90_put_var(ncid, pres_varid, pres_out)) call check( nf90_close(ncid) ) ! MPI library must be shut down. call MPI_Finalize(ierr) if (my_rank .eq. 0) print *, "*** SUCCESS writing example file ", FILE_NAME, "! " contains subroutine check(status) integer, intent ( in) :: status if(status /= nf90_noerr) then print *, trim(nf90_strerror(status)) stop "Stopped" end if end subroutine check end program pres_temp_4D_wr I have had to build be own netcdf libraries on my platform which has a panasas file system. I have built the following: zlib 1.2.8 hdf5 1.8.12 netcdf 4.3.2 netcdf-fortran 4.2 with the following configuration Build z lib CC=mpicc ./configure --static --prefix=/home/users/jholt01/libs > ../zlib.log Hdf5: FC=mpif90 F77=mpif77 CC=mpicc ./configure --enable-fortran --enable-parallel --prefix=/home/users/jholt01/libs --with-zlib=/home/users/jholt01/libs --disable-shared > ../hdf5_conf.log Netcdfc: [jholt01@host040 netcdf-4.3.2]$ CPPFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ FFFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ FCFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ LDFLAGS="-L/home/users/jholt01/libs/lib" \ CFLAGS=-DpgiFortran \ LD_LIBRARY_PATH=/home/users/jholt01/libs/lib:${LD_LIBRARY_PATH} \ FC=mpif90 CC=mpicc \ LIBS=-ldl \ ./configure --disable-dap --disable-shared --enable-parallel-tests --prefix=/home/users/jholt01/libs > ../netcd_config.log Netcdf-fortran CPPFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ FFFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ FCFLAGS="-I/home/users/jholt01/libs/include -O3 -xHost -ip -no-prec-div -static-intel -DgPhi" \ LDFLAGS="-L/home/users/jholt01/libs/lib" \ CFLAGS=-DpgiFortran \ LD_LIBRARY_PATH=/home/users/jholt01/libs/lib:${LD_LIBRARY_PATH} \ F77=mpif77 FC=mpif90 CC=mpicc \ LIBS="-lnetcdf -lhdf5_hl -lhdf5 -lz -ldl" \ ./configure --disable-shared --enable-parallel-tests --prefix=/home/users/jholt01/libs > ../netcd_fortran_config.log The checks all pass apart from the hdf5 ph5diff checks. Any help would be greatly appreciated. John -- View this message in context: http://netcdf-group.1586084.n2.nabble.com/NF90-UNLIMITED-dimensions-failing-under-parralllel-netcdf-tp7575486.html Sent from the NetCDF Group mailing list archive at Nabble.com.
netcdfgroup
archives: