Commit de263a3
committed
Revisit of aligment hints for setting the offset of header and data section
The setting is based on the followings.
Each time ncmpi__enddef() is called, use env variable and MPI info
object to recalculate ncp->v_align and ncp->r_align, which are later
used to calculate the file starting offsets for fix-sized variable
section and record variable section.
if (env variable of v_align is set)
ncp->v_align = env value
else if (MPI info hint of v_align is set)
ncp->v_align = hint value
else if (v_align passed to ncmpi__enddef() > 0)
ncp->v_align = v_align + 4 - v_align % 4;
else /* Not set by user, <= 0 */
ncp->v_align = 0;
if has fix-sized variables
if ncp->v_align > 0 /* v_align is set by users */
use it
else
ncp->v_align = default 512
* use ncp->v_align to set ncp->begin_var
if ncp->r_align > 0 /* r_align is set by users */
use it
else
ncp->r_align = default 4
* use ncp->r_align to set ncp->begin_rec
else
discard ncp->v_align
discard ncp->v_minfree
if ncp->r_align > 0 /* r_align is set by users */
use it
else
ncp->r_align = default 512
* use ncp->r_align to set ncp->begin_rec
* set ncp->begin_var == ncp->begin_rec
Do not reuse ncp->v_align or ncp->r_align in next ncmpi_enddef() !1 parent 79c415b commit de263a3
1 file changed
Lines changed: 185 additions & 253 deletions
0 commit comments