Reputation: 1
The below code gives me 4 variables saving 4 different rows with 10 colums, whereas I need to save like 4 columns in 10 rows. I'm using hexdump syntax to extract from the file
program main
use mpi
integer :: wsize,wrank,ierr,i,fh,offset
integer , parameter :: count = 10
integer :: buf1(count),buf2(count),buf3(count),buf4(count)
integer , dimension(10,2) :: buf
call MPI_Init(ierr)
call MPI_Comm_rank(MPI_COMM_WORLD,wrank,ierr)
call MPI_Comm_size(MPI_COMM_WORLD,wsize,ierr)
offset = 0;
call MPI_File_open(MPI_COMM_WORLD, "test1.dat", MPI_MODE_RDWR + MPI_MODE_CREATE, MPI_INFO_NULL, fh, ierr)
do i = 1,count
buf1(i) = 1*i
buf2(i) = 2*i
buf3(i) = 3*i
buf4(i) = 4*i
end do
call MPI_FILE_WRITE_AT(fh, offset, /buf1,buf2,buf3,buf4/), 4*count, MPI_INTEGER, mpi_status_ignore, ierr)
call MPI_File_close(fh,ierr)
call MPI_FINALIZE(ierr)
end program main
using Hexdump command:
hexdump -v -e ' "%10d" ' -e ' "\n"' test1.dat > hextest1.dat`
If you try to open hextest1.dat after conversions it seems to be like what I posted.
1 2 3 4 5 6 7 8 9 10
2 4 6 8 10 12 14 16 18 20
3 6 9 12 15 18 21 24 27 30
4 8 12 16 20 24 28 32 36 40
Upvotes: 0
Views: 211