Compiler construction 在Fortran 90中调整MPI类型创建大小时出现编译错误

Compiler construction 在Fortran 90中调整MPI类型创建大小时出现编译错误,compiler-construction,mpi,intel,fortran90,Compiler Construction,Mpi,Intel,Fortran90,我需要在Fortran 90代码中分散一个具有非连续块的2D数组。代码需要调用MPI_TYPE_CREATE_RESIZED来更改新向量类型的边界和扩展,然后再调用MPI_SCATTER。我使用的编译器是英特尔XE 12.1 使用“英特尔MPI”时,代码编译性能良好,但有一条警告消息,我认为不应该出现: mpiifort -c test.f90 test.f90(21): warning #6075: The data type of the actual argument does not m

我需要在Fortran 90代码中分散一个具有非连续块的2D数组。代码需要调用MPI_TYPE_CREATE_RESIZED来更改新向量类型的边界和扩展,然后再调用MPI_SCATTER。我使用的编译器是英特尔XE 12.1

使用“英特尔MPI”时,代码编译性能良好,但有一条警告消息,我认为不应该出现:

mpiifort -c test.f90
test.f90(21): warning #6075: The data type of the actual argument does not match the definition.   [EXTENT]
call MPI_TYPE_CREATE_RESIZED(oldtype, 1, extent, newtype, ierr)
-----------------------------------------^
使用OpenMPI时,编译将终止,并出现错误:

mpif90 -c test.f90 
test.f90(21): error #6285: There is no matching specific subroutine for this generic subroutine call.   [MPI_TYPE_CREATE_RESIZED]
call MPI_TYPE_CREATE_RESIZED(oldtype, 1, extent, newtype, ierr)
-----^
compilation aborted for test.f90 (code 1)
这是OpenMPI中的错误吗?有人知道怎么修吗?谢谢

测试代码粘贴在下面:

program test
!
USE MPI
implicit none
!
integer :: numprocs, ierr, status(MPI_STATUS_SIZE)
integer ::  rows, cols
integer :: typesize, extent, oldtype, newtype
!=============================================================
!
call MPI_INIT( ierr )
call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
!
cols = 8
!
rows = cols
!
call MPI_TYPE_VECTOR(cols, rows/numprocs, rows, MPI_REAL8, oldtype, ierr) 
call MPI_TYPE_SIZE(MPI_REAL8, typesize, ierr)
extent = rows/numprocs*typesize
call MPI_TYPE_CREATE_RESIZED(oldtype, 1, extent, newtype, ierr)
call MPI_TYPE_COMMIT(newtype, ierr)
!
call MPI_TYPE_FREE(oldtype, ierr)
call MPI_TYPE_FREE(newtype, ierr)
call MPI_FINALIZE(ierr)

stop
end

这是编译器对参数类型的挑剔,这是一件好事;这里的下限和范围必须是
MPI\u ADDRESS\u kind
类型的整数。所以这是可行的:

program test
!
USE MPI
implicit none
!
integer :: numprocs, ierr, status(MPI_STATUS_SIZE)
integer ::  rows, cols, typesize
integer(kind=mpi_address_kind) :: lb, extent
integer :: oldtype, newtype
!=============================================================
!
call MPI_INIT( ierr )
call MPI_COMM_SIZE( MPI_COMM_WORLD, numprocs, ierr )
!
cols = 8
!
rows = cols
!
call MPI_TYPE_VECTOR(cols, rows/numprocs, rows, MPI_REAL8, oldtype, ierr)
call MPI_TYPE_SIZE(MPI_REAL8, typesize, ierr)
extent = rows/numprocs*typesize
lb = 1
call MPI_TYPE_CREATE_RESIZED(oldtype, lb, extent, newtype, ierr)
call MPI_TYPE_COMMIT(newtype, ierr)
!
call MPI_TYPE_FREE(oldtype, ierr)
call MPI_TYPE_FREE(newtype, ierr)
call MPI_FINALIZE(ierr)

stop
end

谢谢你,乔纳森。这修复了来自英特尔MPI的警告消息。您知道如何修复来自OpenMPI的错误消息吗?非常感谢。这是同样的原因;对于openmpi v1.4.4和1.6.4版的英特尔编译器以及英特尔mpi,上述操作非常有效。更改后,我仍然会收到相同的错误。我使用openmpi v1.4.3和v1.6.0进行了测试。错误抱怨没有匹配MPI类型的子例程,这很奇怪。Jonathan,我没有更改下限的常数。在我改变之后,它修复了错误。非常感谢。为了清楚起见,编译器无法匹配子例程的原因是因为它找不到具有适当类型参数的子例程版本。OpenMPI的fortran绑定在这方面比IntelMPI的更挑剔,这通常是一件好事,即使有时会令人讨厌。