Open dqwu opened 6 years ago
Similar issue for pio_var3 in pio_buf_lim_tests.F90.in:
#ifdef PIO_TEST_CLOSE_OPEN_FOR_SYNC
...
ierr = PIO_inq_varid(pio_file, PIO_VAR1_NAME, pio_var1)
ierr = PIO_inq_varid(pio_file, PIO_VAR2_NAME, pio_var2)
#else
call PIO_syncfile(pio_file)
#endif
...
! ============ Flush every 2 vars ======================
...
! Flush for the previous 2 vars, pio_var1 and pio_var2 should happen
! inside PIO_write_darray(pio_var3)
call PIO_write_darray(pio_file, pio_var3, iodesc, wbuf, ierr)
Looks like a bug (it works mostly because the underlying library just increments the id for vars). Can you go ahead and fix it (or do you want me to) - just add the missing inq_vars?
When PIO_TEST_CLOSE_OPEN_FOR_SYNC is ON, we first close a file and then reopen it.
After PIO_closefile is called, all existing var_desc_t type handles (obtained from previous PIO_def_var/PIO_inq_varid calls) become invalid and we should use PIO_inq_varid to renew them after reopening the file.
In pio_buf_lim_tests.F90.in, pio_var4 handle is not renewed, but it is still used to call PIO_write_darray.
PS, only ADIOS type can show the failure (for other types, the invalid handle for var4 happens to work)