1D start, count, stride through a 3D variable?

Rob Latham robl at mcs.anl.gov
Mon Feb 9 10:01:38 CST 2015



On 02/09/2015 09:45 AM, Helen Kershaw wrote:
>
> We are working on an application where the we would like to have a
> strided read, but ignore the number of dimensions a variable has.  The
> stride would always be one-dimensional.  So in our code, each variable
> (1D,2D,3D, etc.) is treated as 1D. So if there were 10 mpi tasks, each
> task would pick up every 10th element of the variable.
>
> Is this something that is possible with pnetcdf? From the documentation
> it seems that it is not, but I might be missing something.

How would you do this in Unidata NetCDF?

It sounds like you want to, in a sense, cast or otherwise coerce the 
library into treating a 2d or 3d variable like a 1d variable.

Some "simple" arithmetic can give you a 1d ordering of elements:
if X, Y, and Z are dimensions of the variable, then an array element at 
x, y, z is going to be the z*Z*Y+y*Z+x 'th element.

==rob

-- 
Rob Latham
Mathematics and Computer Science Division
Argonne National Lab, IL USA


More information about the parallel-netcdf mailing list