fortran - Fortran 代码在 Intel 和 GNU 下执行,在 Cray 下失败
问题描述
我使这个程序尽可能简单:
module buffers
complex(8), allocatable :: iobuff(:,:)
end module buffers
program useAllocate
use buffers
integer(kind=4) :: rc=0
character(len=16) :: instr
integer(kind=8) :: abwds
integer(kind=4) :: anbs
call get_command_argument(1, instr)
read(instr,*) abwds
call get_command_argument(2, instr)
read(instr,*) anbs
call allocateBuffers(abwds, anbs, rc)
end program
SUBROUTINE allocateBuffers(arg_buff_wds, arg_num_buffs, retcode)
use buffers
IMPLICIT none
integer(kind=8), INTENT(in) :: arg_buff_wds
integer(kind=4), INTENT(in) :: arg_num_buffs
integer(kind=4), INTENT(out) :: retcode
print *,'allocating iobuff ', arg_buff_wds,'X',arg_num_buffs
ALLOCATE(iobuff(arg_buff_wds, arg_num_buffs), stat = retcode)
print *,'iobuff allocated'
print *,'iobuff has shape ',shape(iobuff)
DEALLOCATE(iobuff)
print *,'iobuff freed'
END SUBROUTINE allocateBuffers
它在 Intel 或 GNU 构建下运行良好:
> ./a.out 3 3
allocating iobuff 3 X 3
iobuff allocated
iobuff has shape 3 3
iobuff freed
但是 Cray Fortran,由于某种原因无法处理分配:
> ./a.out 3 3
allocating iobuff 3 X 3
Illegal instruction (core dumped)
有人知道为什么吗?
(注意:complex(8)
类型iobuff
不是问题;无论我定义什么类型,代码都会失败并出现相同的错误iobuff
。请注意,各种类型的变量来自我真正想要理解的更大的代码。)
解决方案
推荐阅读
- ios - 移动 Chrome 中的 webRTC,iOS 版本低于 14.3
- youtube-api - 将字幕发送到 YouTube 直播
- java - 最新版本的 h2 出错 - 无法解析 com.h2database:h2:1.4.200
- google-bigquery - 在 dbt-external-tables 侧载期间从 gcp 存储中检索“文件名”?
- java - 滑动按钮上的图标
- html - 如何控制文本的位置
- ?
- ios - 需要更改已发布 iOS 应用的应用描述
- python - 在写入文本文件时添加分隔符
- swift - iOS 上的 Swift FileManager:执行/读/写的错误/不同的资源值
- angular - Angular Material 动态绑定按钮类型