Parallel processing fortran netcdf关闭并行死锁

Parallel processing fortran netcdf关闭并行死锁,parallel-processing,fortran,mpi,hdf5,netcdf,Parallel Processing,Fortran,Mpi,Hdf5,Netcdf,我正在为某些类型的文件修改fortran mpi程序,从顺序写入改为并行写入。它使用netcdf 4.3.3.1/hdf5 1.8.9并行。我使用英特尔编译器版本14.0.3.174 完成所有读/写操作后,是关闭文件的时候了。此时,模拟不再继续。所以所有的电话都在等着。当我检查每个处理器的调用堆栈时,我可以看到主根与其他处理器相比是不同的 Mpi主处理器调用堆栈: __sched_yield, FP=7ffc6aa978b0 opa

我正在为某些类型的文件修改fortran mpi程序,从顺序写入改为并行写入。它使用netcdf 4.3.3.1/hdf5 1.8.9并行。我使用英特尔编译器版本14.0.3.174

完成所有读/写操作后,是关闭文件的时候了。此时,模拟不再继续。所以所有的电话都在等着。当我检查每个处理器的调用堆栈时,我可以看到主根与其他处理器相比是不同的

Mpi主处理器调用堆栈:

__sched_yield,                                 FP=7ffc6aa978b0
opal_progress,                                 FP=7ffc6aa978d0
ompi_request_default_wait_all,                 FP=7ffc6aa97940
ompi_coll_tuned_sendrecv_actual,               FP=7ffc6aa979e0
ompi_coll_tuned_barrier_intra_recursivedoubling, FP=7ffc6aa97a40
PMPI_Barrier,                                  FP=7ffc6aa97a60
H5AC_rsp__dist_md_write__flush,                FP=7ffc6aa97af0
H5AC_flush,                                    FP=7ffc6aa97b20
H5F_flush,                                     FP=7ffc6aa97b50
H5F_flush_mounts,                              FP=7ffc6aa97b80
H5Fflush,                                      FP=7ffc6aa97ba0
NC4_close,                                     FP=7ffc6aa97be0
nc_close,                                      FP=7ffc6aa97c00
restclo,                                       FP=7ffc6aa98660
driver,                                        FP=7ffc6aaa5ef0
 main,                                          FP=7ffc6aaa5f90
 __libc_start_main,                             FP=7ffc6aaa6050
 _start,    
__sched_yield,                                 FP=7fffe330cdd0
opal_progress,                                 FP=7fffe330cdf0
ompi_request_default_wait,                     FP=7fffe330ce50
ompi_coll_tuned_bcast_intra_generic,           FP=7fffe330cf30
ompi_coll_tuned_bcast_intra_binomial,          FP=7fffe330cf90
ompi_coll_tuned_bcast_intra_dec_fixed,         FP=7fffe330cfb0
mca_coll_sync_bcast,                           FP=7fffe330cff0
PMPI_Bcast,                                    FP=7fffe330d030
mca_io_romio_dist_MPI_File_set_size,           FP=7fffe330d080
PMPI_File_set_size,                            FP=7fffe330d0a0
H5FD_mpio_truncate,                            FP=7fffe330d0c0
H5FD_truncate,                                 FP=7fffe330d0f0
H5F_dest,                                      FP=7fffe330d110
H5F_try_close,                                 FP=7fffe330d340
H5F_close,                                     FP=7fffe330d360
H5I_dec_ref,                                   FP=7fffe330d370
H5I_dec_app_ref,                               FP=7fffe330d380
H5Fclose,                                      FP=7fffe330d3a0
NC4_close,                                     FP=7fffe330d3e0
nc_close,                                      FP=7fffe330d400
RESTCOM`restclo,                               FP=7fffe330de60
driver,                                        FP=7fffe331b6f0
main,                                          FP=7fffe331b7f0
__libc_start_main,                             FP=7fffe331b8b0
_start, 
剩余处理器调用堆栈:

__sched_yield,                                 FP=7ffc6aa978b0
opal_progress,                                 FP=7ffc6aa978d0
ompi_request_default_wait_all,                 FP=7ffc6aa97940
ompi_coll_tuned_sendrecv_actual,               FP=7ffc6aa979e0
ompi_coll_tuned_barrier_intra_recursivedoubling, FP=7ffc6aa97a40
PMPI_Barrier,                                  FP=7ffc6aa97a60
H5AC_rsp__dist_md_write__flush,                FP=7ffc6aa97af0
H5AC_flush,                                    FP=7ffc6aa97b20
H5F_flush,                                     FP=7ffc6aa97b50
H5F_flush_mounts,                              FP=7ffc6aa97b80
H5Fflush,                                      FP=7ffc6aa97ba0
NC4_close,                                     FP=7ffc6aa97be0
nc_close,                                      FP=7ffc6aa97c00
restclo,                                       FP=7ffc6aa98660
driver,                                        FP=7ffc6aaa5ef0
 main,                                          FP=7ffc6aaa5f90
 __libc_start_main,                             FP=7ffc6aaa6050
 _start,    
__sched_yield,                                 FP=7fffe330cdd0
opal_progress,                                 FP=7fffe330cdf0
ompi_request_default_wait,                     FP=7fffe330ce50
ompi_coll_tuned_bcast_intra_generic,           FP=7fffe330cf30
ompi_coll_tuned_bcast_intra_binomial,          FP=7fffe330cf90
ompi_coll_tuned_bcast_intra_dec_fixed,         FP=7fffe330cfb0
mca_coll_sync_bcast,                           FP=7fffe330cff0
PMPI_Bcast,                                    FP=7fffe330d030
mca_io_romio_dist_MPI_File_set_size,           FP=7fffe330d080
PMPI_File_set_size,                            FP=7fffe330d0a0
H5FD_mpio_truncate,                            FP=7fffe330d0c0
H5FD_truncate,                                 FP=7fffe330d0f0
H5F_dest,                                      FP=7fffe330d110
H5F_try_close,                                 FP=7fffe330d340
H5F_close,                                     FP=7fffe330d360
H5I_dec_ref,                                   FP=7fffe330d370
H5I_dec_app_ref,                               FP=7fffe330d380
H5Fclose,                                      FP=7fffe330d3a0
NC4_close,                                     FP=7fffe330d3e0
nc_close,                                      FP=7fffe330d400
RESTCOM`restclo,                               FP=7fffe330de60
driver,                                        FP=7fffe331b6f0
main,                                          FP=7fffe331b7f0
__libc_start_main,                             FP=7fffe331b8b0
_start, 
我确实意识到一个调用堆栈包含bcast,而另一个调用堆栈包含一个屏障。这可能会导致死锁。然而,我无法预见如何从这里继续下去。如果mpi调用未正确完成(例如,仅在1进程中调用),我希望出现错误消息,而不是此类行为

更新:源代码大约有10万行

文件以以下方式打开:

cmode = ior(NF90_NOCLOBBER,NF90_NETCDF4)
cmode = ior(cmode, NF90_MPIIO)
CALL ipslnc( NF90_CREATE(fname,cmode=cmode,ncid=ncfid, comm=MPI_COMM, info=MPI_INFO))
截止日期为:

iret = NF90_CLOSE(ncfid)

事实证明,当写入NF90_PUT_ATT时,根处理器的值与其他处理器的值不同。一旦解决,程序将按预期运行

我们必须查看代码。如果代码太长,请准备一份。对于一些只写文件并关闭的简单代码,会发生这种情况吗?我就是这样。但这也是一个大问题。