Fortran MPI 状态错误
Fortran MPI status error
我在编译以下代码时遇到以下错误
代码:
IMPLICIT REAL*8(A-H,O-Z)
include 'common_files.inc'
CHARACTER*100 MNO, MESSAGE
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
starttime = MPI_WTIME()
/* ........rest of code.................
编译输出:
main.f:23.46:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: Variable 'mpi_status_size' cannot appear in the expression at (1)
main.f:23.62:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: The module or main program array 'status' at (1) must have constant shape
'common_files.inc' 文件包含像“include 'mpif.h'”这样的头文件。不幸的是,我不允许 post 剩余的代码。
我正在使用以下命令编译上面的内容
mpif90 -g main.f
错误的可能原因是什么?。
您显然对 include 'mpif.h'
语句有疑问:
参见示例:
IMPLICIT REAL*8(A-H,O-Z)
c include 'mpif.h'
integer rank, size, ierror, status(MPI_STATUS_SIZE)
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
print *, size, " ", rank
call MPI_Finalize(ierr)
end
给我:
$ mpif90 foo.f
foo.f:4.46:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: Variable 'mpi_status_size' cannot appear in the expression at (1)
foo.f:4.62:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: The module or main program array 'status' at (1) must have constant shape
而如果我取消注释 include 'mpif.h'
行,它就会编译并运行。
您应该仔细检查您的 common_files.inc
文件。
我在编译以下代码时遇到以下错误
代码:
IMPLICIT REAL*8(A-H,O-Z)
include 'common_files.inc'
CHARACTER*100 MNO, MESSAGE
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
starttime = MPI_WTIME()
/* ........rest of code.................
编译输出:
main.f:23.46:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: Variable 'mpi_status_size' cannot appear in the expression at (1)
main.f:23.62:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: The module or main program array 'status' at (1) must have constant shape
'common_files.inc' 文件包含像“include 'mpif.h'”这样的头文件。不幸的是,我不允许 post 剩余的代码。
我正在使用以下命令编译上面的内容
mpif90 -g main.f
错误的可能原因是什么?。
您显然对 include 'mpif.h'
语句有疑问:
参见示例:
IMPLICIT REAL*8(A-H,O-Z)
c include 'mpif.h'
integer rank, size, ierror, status(MPI_STATUS_SIZE)
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, rank, ierror)
print *, size, " ", rank
call MPI_Finalize(ierr)
end
给我:
$ mpif90 foo.f
foo.f:4.46:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: Variable 'mpi_status_size' cannot appear in the expression at (1)
foo.f:4.62:
integer rank, size, ierror, tag, status(MPI_STATUS_SIZE)
1
Error: The module or main program array 'status' at (1) must have constant shape
而如果我取消注释 include 'mpif.h'
行,它就会编译并运行。
您应该仔细检查您的 common_files.inc
文件。