我刚开始学习MPI I / O,所以我得到了一个简单的测试代码,如下所示
PROGRAM main
use mpi
integer :: ierr, myrank, thefile, numprocs, &
etype, filetype
character(len = 20) :: data_rep
integer(kind=MPI_OFFSET_KIND) :: disp, disp_get
call MPI_INIT(ierr)
call MPI_COMM_RANK(MPI_COMM_WORLD, myrank, ierr)
call mpi_comm_size(mpi_comm_world, numprocs, ierr)
thefile = 1
call MPI_FILE_OPEN(MPI_COMM_WORLD, 'testfile', &
MPI_MODE_WRONLY+MPI_MODE_CREATE, &
MPI_INFO_NULL, thefile, ierr)
disp = myrank*2
call MPI_FILE_SET_VIEW(thefile, disp, MPI_INTEGER, &
MPI_INTEGER, 'internal', &
MPI_INFO_NULL, ierr)
call mpi_file_get_view(thefile, disp_get, etype, filetype, &
data_rep, ierr)
print *, myrank, disp_get, etype, filetype, data_rep
call MPI_FILE_CLOSE(thefile, ierr)
call MPI_FINALIZE(ierr)
END PROGRAM main
我使用-np = 4,所以我希望输出为:
0 0 1 1 internal
1 2 1 1 internal
2 4 1 1 internal
3 6 1 1 internal
相反,我得到了
0 0 1 1 native
1 0 1 1 native
2 0 1 1 native
3 0 1 1 native
好像函数mpi_file_set_view
根本不起作用。有什么建议吗?
我在Ubuntu上使用了OpenMPI 1.7和ifort 13。