In my parallel program there was a big matrix. Each process is calculated and its part is saved. The program then wrote the matrix to a file, allowing each process to write its own part of the matrix in the correct order. The output file is in "unformatted" form. But when I tried to read the file in sequential code (I have selected the correct size of the large matrix), I received an error that I do not understand.
My question is: how do you get a binary file in MPI as the output of a serial version for a large matrix that is stored by various processes?
Here is my attempt:
if(ThisProcs == RootProcs) then
open(unit = file_restart%unit, file = file_restart%file, form = 'unformatted')
write(file_restart%unit)psi
close(file_restart%unit)
endif
call mpi_barrier(mpi_comm_world,MPIerr)
do i = 1, NProcs - 1
if(ThisProcs == i) then
open(unit = file_restart%unit, file = file_restart%file, form = 'unformatted', status = 'old', position = 'append')
write(file_restart%unit)psi
close(file_restart%unit)
endif
call mpi_barrier(mpi_comm_world,MPIerr)
enddo
Psi is a large matrix, it stands out as:
Psi(N_lattice_points, NPsiStart:NPsiEnd)
But when I tried to load the file into serial code:
open(2,file=File1,form="unformatted")
read(2)psi
forrtl: severe (67): input statement requires too much data, unit 2 (I am using MSVS 2012+intel fortran 2013)
, ? , MPI, ?
1
. access = "stream", . , , , "" "".