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,*) 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 定义为哪种类型,代码都会失败并出现相同的错误。请注意,各种类型的变量来自我真正想要理解的更大的代码。)

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)