@@ -237,7 +237,7 @@ double precision function checkpoint_wr_ncmpi_par (filenum, simtime)
237237 integer global_offset
238238
239239 character (len= 40 ) :: flash_release
240- double precision unk_buf(1 , nxb,nyb,nzb,maxblocks)
240+ double precision unk_buf(nxb,nyb,nzb,maxblocks,nvar )
241241#ifdef TIMERS
242242 double precision time_start, time_io
243243#endif
@@ -248,7 +248,7 @@ double precision function checkpoint_wr_ncmpi_par (filenum, simtime)
248248 integer ncid, cmode, file_info
249249 integer (kind= MPI_OFFSET_KIND) starts(5 ), counts(4 ), put_size
250250 integer gsizes(5 ), subsizes(5 ), gstarts(5 )
251- integer buftype, reqs(nvar+6 ), stats(nvar+6 )
251+ integer reqs(nvar+6 ), stats(nvar+6 )
252252
253253!- ----------------------------------------------------------------------------
254254! compute the total number of blocks left of a given processor number
@@ -580,30 +580,6 @@ double precision function checkpoint_wr_ncmpi_par (filenum, simtime)
580580 time_start = MPI_Wtime()
581581#endif
582582
583- if (use_nonblocking_io) then
584- ! create an MPI derived data type for buffer unk
585- gsizes(1 ) = nvar
586- gsizes(2 ) = iu_bnd - il_bnd + 1
587- gsizes(3 ) = ju_bnd - jl_bnd + 1
588- gsizes(4 ) = ku_bnd - kl_bnd + 1
589- gsizes(5 ) = maxblocks
590- subsizes(1 ) = 1
591- subsizes(2 ) = nxb
592- subsizes(3 ) = nyb
593- subsizes(4 ) = nzb
594- subsizes(5 ) = lnblocks
595- gstarts(1 ) = 0
596- gstarts(2 ) = nguard
597- gstarts(3 ) = nguard* k2d
598- gstarts(4 ) = nguard* k3d
599- gstarts(5 ) = 0
600- call MPI_Type_create_subarray(5 , gsizes, subsizes, gstarts, &
601- MPI_ORDER_FORTRAN, &
602- MPI_DOUBLE_PRECISION, buftype, &
603- err)
604- call MPI_Type_commit(buftype, err)
605- endif
606-
607583 starts(1 ) = 1
608584 starts(2 ) = 1
609585 starts(3 ) = 1
@@ -616,17 +592,15 @@ double precision function checkpoint_wr_ncmpi_par (filenum, simtime)
616592 do i = 1 , nvar
617593 record_label = unklabels(i)
618594
619- if (.NOT. use_nonblocking_io) then
620- ! when using nonblocking flexible API, we don't even need unk_buf
621- unk_buf(1 , 1 :nxb, 1 :nyb, 1 :nzb, :) = &
622- unk(i, nguard+1 : nguard+ nxb, &
623- nguard* k2d+1 : nguard* k2d+ nyb, &
624- nguard* k3d+1 : nguard* k3d+ nzb, :)
625- endif
595+ ! pack write data into a contiguous buffer
596+ unk_buf(1 :nxb, 1 :nyb, 1 :nzb, :, i) = &
597+ unk(i, nguard+1 : nguard+ nxb, &
598+ nguard* k2d+1 : nguard* k2d+ nyb, &
599+ nguard* k3d+1 : nguard* k3d+ nzb, :)
626600
627601 if (use_nonblocking_io) then
628- err = nfmpi_iput_vara (ncid, varid(6 + i), starts, counts, &
629- unk(i, 1 , 1 , 1 , 1 ), 1_MPI_OFFSET_KIND , buftype , reqs(i+6 ))
602+ err = nfmpi_iput_vara_double (ncid, varid(6 + i), starts, counts, &
603+ unk_buf( 1 , 1 , 1 , 1 ,i) , reqs(i+6 ))
630604 if (err .NE. NF_NOERR) &
631605 call check(err, " nfmpi_iput_vara: unknowns" )
632606 else
@@ -656,7 +630,6 @@ double precision function checkpoint_wr_ncmpi_par (filenum, simtime)
656630 if (stats(i) .NE. NF_NOERR) &
657631 call check(stats(i), ' In nfmpi_wait(_all) req ' // trim (str))
658632 enddo
659- call MPI_Type_free(buftype, err)
660633 endif
661634
662635#ifdef TIMERS
0 commit comments