Fad*_*mic 3 fortran mpi intel-fortran
给出以下 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)
Run Code Online (Sandbox Code Playgroud)
使用 Intel MPI 编译时,出现错误:
error #6285: There is no matching specific subroutine for this generic subroutine call. [MPI_SIZEOF]
Run Code Online (Sandbox Code Playgroud)
在线上
call MPI_SIZEOF(complexTest, testSize, ierr)
Run Code Online (Sandbox Code Playgroud)
使用 OpenMPI 编译和执行此代码不会出现任何问题。出现这个错误的原因是什么?看起来它正在寻找 类型的特定匹配complexTest,但是 的全部意义不就是MPI_SIZEOF与几乎任何类型通用吗?
可能是 MPI 库中的错误,他们可能忘记将此特定功能添加到模块中。顺便说一句,“几乎任何类型”肯定是错误的,MPI_SIZEOF仅适用于内在类型。
作为解决方法,您可以使用
testSize = storage_size(complexTest) / character_storage_size
Run Code Online (Sandbox Code Playgroud)
(要不就/ 8)
| 归档时间: |
|
| 查看次数: |
239 次 |
| 最近记录: |