Intel MPI_SIZEOF 不适用于 Fortran 复杂类型
Intel MPI_SIZEOF not working for Fortran complex type
给定以下 Fortran 代码:
integer, parameter :: double = kind(1.0d0)
integer :: integerTest
real(double) :: doubleTest
complex(double) :: complexTest
integer :: testSize
integer :: ierr
integerTest = 0
doubleTest = real(0.d0, kind=double)
complexTest = cmplx(0.d0, 0.d0, kind=double)
call MPI_SIZEOF(integerTest, testSize, ierr)
! ...
call MPI_SIZEOF(doubleTest, testSize, ierr)
! ...
call MPI_SIZEOF(complexTest, testSize, ierr)
使用 Intel MPI 编译时,出现错误:
error #6285: There is no matching specific subroutine for this generic subroutine call. [MPI_SIZEOF]
在线
call MPI_SIZEOF(complexTest, testSize, ierr)
此代码使用 OpenMPI 编译和执行没有问题。这个错误的原因是什么?它似乎正在寻找 complexTest
类型的特定匹配项,但 MPI_SIZEOF
的全部意义不就是几乎可以与任何类型一起工作吗?
可能是 MPI 库中的错误,他们可能忘记将此特定功能添加到模块中。顺便说一句 "nearly any type" 肯定是错误的,MPI_SIZEOF
只适用于内部类型。
作为解决方法,您可以使用
testSize = storage_size(complexTest) / character_storage_size
(或 / 8
)
给定以下 Fortran 代码:
integer, parameter :: double = kind(1.0d0)
integer :: integerTest
real(double) :: doubleTest
complex(double) :: complexTest
integer :: testSize
integer :: ierr
integerTest = 0
doubleTest = real(0.d0, kind=double)
complexTest = cmplx(0.d0, 0.d0, kind=double)
call MPI_SIZEOF(integerTest, testSize, ierr)
! ...
call MPI_SIZEOF(doubleTest, testSize, ierr)
! ...
call MPI_SIZEOF(complexTest, testSize, ierr)
使用 Intel MPI 编译时,出现错误:
error #6285: There is no matching specific subroutine for this generic subroutine call. [MPI_SIZEOF]
在线
call MPI_SIZEOF(complexTest, testSize, ierr)
此代码使用 OpenMPI 编译和执行没有问题。这个错误的原因是什么?它似乎正在寻找 complexTest
类型的特定匹配项,但 MPI_SIZEOF
的全部意义不就是几乎可以与任何类型一起工作吗?
可能是 MPI 库中的错误,他们可能忘记将此特定功能添加到模块中。顺便说一句 "nearly any type" 肯定是错误的,MPI_SIZEOF
只适用于内部类型。
作为解决方法,您可以使用
testSize = storage_size(complexTest) / character_storage_size
(或 / 8
)