fortran - 使用 opencoarray 编译器的派生类型 coarray
问题描述
我在使用带有 opencoarrays 的派生类型的 coarray 时遇到了一些麻烦。我最小的工作示例是(“main.f90”):
module mod_parallel
implicit none
type :: array_type
real, allocatable :: d(:)
end type
contains
subroutine init_arr(arr)
type(array_type), intent(inout) :: arr
allocate(arr%d(5))
end subroutine init_arr
end module mod_parallel
program main
use mod_parallel
implicit none
type(array_type) :: array[*]
call init_arr(array)
array%d = 1.5*this_image()
sync all
if (this_image()==1) then
if (num_images()>1) then
array[1]%d(:) = array[2]%d(:)
endif
endif
end program main
我编译这个
caf main.f90 -o run
并运行
cafrun -n 2 ./run
并得到以下错误
*** An error occurred in MPI_Put
*** reported by process [3592486913,0]
*** on win rdma window 5
*** MPI_ERR_RMA_RANGE: invalid RMA address range
*** MPI_ERRORS_ARE_FATAL (processes in this win will now abort,
*** and potentially your MPI job)
Error: Command:
`/usr/bin/mpiexec -n 2 ./run`
failed to run.
据我所知,我的代码没有违反 Coarray 的 Fortran 标准。如果我使用“cafrun -n 1 ./run”运行,我不会收到错误消息。我正在使用 Ubuntu (20) 和一台有四核的笔记本电脑。
编辑:我正在使用 OpenCoarrays 2.9.0 版、Debian OpenMPI、4.0.3 版和 gfortran 9.3.0 版
解决方案
看起来问题与使用 OpenMPI 有关(特别是,我使用的是 Debian OpenMPI,版本 4.0.3)。我卸载了 OpenMPI(我使用的是 Ubuntu 20):
sudo apt purge openmpi-bin
并安装了 MPICH
sudo apt-get install mpich
然后我重新安装了opencoarrays。我现在发布的代码可以编译并运行,没有任何明显的问题。
我应该提到我安装了 MPICH 版本 3.3.2
推荐阅读
- python - Python 将 Treemap 图像拆分为组成部分
- python - 使用 Python 从经过训练的 Vertex AI 表格回归模型中获取特征重要性
- python - 将结构格式字符串转换为允许的 int 值范围
- python - 如何将芹菜任务保存到临时数据库,然后将其更新到主数据库
- postgresql - PostGIS 测试点是否与缩放的多边形相交有时会得到错误的答案
- windows - LibGDX 鼠标光标偏移全屏窗口中任务栏的高度
- java - Java 意图向我发送空白页
- javascript - 在 ejs 中有条件地显示错误消息
- mysql - 如何避免使用临时;在 MySql 查询上使用文件排序
- php - 仅识别默认 Lumen 路由