Crash if trying to write a parameter or a constant in a Fortran application
Rob Latham
robl at mcs.anl.gov
Tue Jul 9 08:53:24 CDT 2013
On Fri, Jul 05, 2013 at 02:31:40PM +0200, Philippe Wautelet wrote:
> Apparently, pnetcdf tried to swap bytes of the 'variable'. But as it is a
> parameter, its address is not modifiable. There is an easy workaround: copy the
> data in a 'true' variable but I think it is something that should be
> corrected.
Thanks for the bug report and the test case.
Does serial netcdf exhibit this behavior?
We can copy the data -- we already do that in our "flexible mode"
interface when processing a user-defined non-contiguous datatype, or
when the type-in-file differs from the type-in-memory.
I'm worried, though, that for large I/O transfers we'll have the
problem that pnetcdf will try to allocate too much memory.
Is there some portable way our fortran bindings, written in C, can
know if a buffer is a parameter?
==rob
>
> Best regards,
>
> Philippe Wautelet
>
>
> --------------------------------------------------------------------
> Philippe Wautelet (Research Engineer) wautelet at idris.fr
> Tel. : 01 69 35 85 76 Fax : 01 69 85 37 75
> IDRIS, Batiment 506, BP 167, 91403 ORSAY Cedex, France
> Prof. website : http://www.idris.fr
> --------------------------------------------------------------------
> program pnetcdf_parameter_bug
> use mpi
> use pnetcdf
> implicit none
>
> integer :: f_id, var_id, varp_id
> integer :: ierr, mode, status, var
> integer,parameter :: varp = 1
> integer(kind=mpi_offset_kind),dimension(1),parameter::one=(/1/)
>
> call MPI_Init(ierr)
>
> mode = NF_CLOBBER+NF_64BIT_DATA
> status = nfmpi_create(MPI_COMM_WORLD,"test.nc",mode,MPI_INFO_NULL,f_id)
>
> status = nfmpi_def_var(f_id,'var', NF_INT,0,(/0/),var_id)
> status = nfmpi_def_var(f_id,'varp',NF_INT,0,(/0/),varp_id)
> status = nfmpi_enddef(f_id)
>
> status = nfmpi_begin_indep_data(f_id)
> var = 1
> !Write of an integer is OK
> status = nfmpi_put_var1_int(f_id,var_id, one,var)
> !Crash if we try to write a parameter (or constant)
> status = nfmpi_put_var1_int(f_id,varp_id,one,varp)
>
> status = nfmpi_close(f_id)
> call MPI_Finalize(ierr)
> end program
--
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA
More information about the parallel-netcdf
mailing list