MPI I/O をテストしています。
subroutine save_vtk
integer :: filetype, fh, unit
integer(MPI_OFFSET_KIND) :: pos
real(RP),allocatable :: buffer(:,:,:)
integer :: ie
if (master) then
open(newunit=unit,file="out.vtk", &
access='stream',status='replace',form="unformatted",action="write")
! write the header
close(unit)
end if
call MPI_Barrier(mpi_comm,ie)
call MPI_File_open(mpi_comm,"out.vtk", MPI_MODE_APPEND + MPI_MODE_WRONLY, MPI_INFO_NULL, fh, ie)
call MPI_Type_create_subarray(3, int(ng), int(nxyz), int(off), &
MPI_ORDER_FORTRAN, MPI_RP, filetype, ie)
call MPI_type_commit(filetype, ie)
call MPI_Barrier(mpi_comm,ie)
call MPI_File_get_position(fh, pos, ie)
call MPI_Barrier(mpi_comm,ie)
call MPI_File_set_view(fh, pos, MPI_RP, filetype, "native", MPI_INFO_NULL, ie)
buffer = BigEnd(Phi(1:nx,1:ny,1:nz))
call MPI_File_write_all(fh, buffer, nx*ny*nz, MPI_RP, MPI_STATUS_IGNORE, ie)
call MPI_File_close(fh, ie)
end subroutine
未定義の変数はホストの関連付けに由来し、一部のエラー チェックが削除されました。国内のアカデミック クラスターで実行すると、次のエラーが表示されます。
*** An error occurred in MPI_Isend
*** reported by process [3941400577,18036219417246826496]
*** on communicator MPI COMMUNICATOR 20 DUP FROM 0
*** MPI_ERR_BUFFER: invalid buffer pointer
*** MPI_ERRORS_ARE_FATAL (processes in this communicator will now abort,
*** and potentially your MPI job)
エラーは、への呼び出しによってトリガーされますMPI_File_write_all
。nx*ny*nz
.の順序でいっぱいになって10^5
いるバッファのサイズに関連している可能性があると思われますが10^6
、MPI I/O の経験がないため、プログラミング エラーを除外することはできません。
使用される MPI 実装はOpenMPI 1.8.0
、Intel Fortran 14.0.2 でのものです。
それを機能させてファイルを書き込む方法を知っていますか?
--- 編集2 ---
簡略化されたバージョンをテストします。重要なコードは同じままです。完全なソースはこちらです。gfortran で動作し、Intel では異なる MPI で失敗することに注意してください。PGIでコンパイルできませんでした。また、異なるノードでのみ失敗し、単一のプロセス実行でも失敗するという点で間違っていました。
>module ad gcc-4.8.1
>module ad openmpi-1.8.0-gcc
>mpif90 save.f90
>./a.out
Trying to decompose in 1 1 1 process grid.
>mpirun a.out
Trying to decompose in 1 1 2 process grid.
>module rm openmpi-1.8.0-gcc
>module ad openmpi-1.8.0-intel
>mpif90 save.f90
>./a.out
Trying to decompose in 1 1 1 process grid.
ERROR write_all
MPI_ERR_IO: input/output error
>module rm openmpi-1.8.0-intel
>module ad openmpi-1.6-intel
>mpif90 save.f90
>./a.out
Trying to decompose in 1 1 1 process grid.
ERROR write_all
MPI_ERR_IO: input/output error
[luna24.fzu.cz:24260] *** An error occurred in MPI_File_set_errhandler
[luna24.fzu.cz:24260] *** on a NULL communicator
[luna24.fzu.cz:24260] *** Unknown error
[luna24.fzu.cz:24260] *** MPI_ERRORS_ARE_FATAL: your MPI job will now abort
--------------------------------------------------------------------------
An MPI process is aborting at a time when it cannot guarantee that all
of its peer processes in the job will be killed properly. You should
double check that everything has shut down cleanly.
Reason: After MPI_FINALIZE was invoked
Local host: luna24.fzu.cz
PID: 24260
--------------------------------------------------------------------------
>module rm openmpi-1.6-intel
>module ad mpich2-intel
>mpif90 save.f90
>./a.out
Trying to decompose in 1 1 1 process grid.
ERROR write_all
Other I/O error , error stack:
ADIOI_NFS_WRITECONTIG(70): Other I/O error Bad a
ddress