mrzlh 发表于 2017-2-28 20:47:39

新手求教A common block or variable may not exceed 2147483647 bytes

电脑操作系统64位,内存16G,数组大小5,800,000*40,双精度,在debug x64/win32下编译均顺利通过,
但将数组加大到6,000,000*40时,在win32下出现:
错误 1error #5520: A common block or variable may not exceed 2147483647 bytes
错误 2Compilation Aborted (code 1)

在x64下出现:错误 1 Compilation Aborted (code 1)

搜索了论坛贴子把设置改成 Support Addresses Larger Than 2 GB (/LARGEADDRESSAWARE) 仍出现以上情况。
请高手帮忙!

fcode 发表于 2017-2-28 22:07:59

错误信息已经很明确了。
请把数组改小一点。合理利用内存资源。

详解 http://memory.w.fcode.cn

mrzlh 发表于 2017-3-1 11:15:46

谢谢回复。
需要将这么多数据读入内存处理,以后还会更大。此数组按计算占用1.8G多点内存(6,000,000*40*8/1024/1024=1.83G,其它数组占用内存很小,可以忽略),远小于16G啊,为什么改了设置编译都不能通过,若按此需求内存怎么设置能通过,请赐教。

fcode 发表于 2017-3-1 13:08:50

可能是这个数组被用于 common 公共区了,而编译器对公共区又有另一个限定。

强烈建议摒弃 common

mrzlh 发表于 2017-3-1 21:23:48

没有定义common公共区。

fcode 发表于 2017-3-1 22:15:31

上代码,截图

mrzlh 发表于 2017-3-3 19:33:34


   Program Main
    Implicit None
    Integer, Parameter:: Num_All=7000000, Num_List=40,Num_File=15000
    Integer I10,I11,I12,J10,K0,Num_Data
    Character*8 Filename(Num_File)
    Double Precision Num_Total(Num_All, Num_List)
    K0=1
    Open(Unit=10,File='D:\File.txt')
    Do I10=1,Num_File
      Read(10,*)Filename(I10)
    End Do
    Close(10)
    Do I11=1,Num_File
      Open(Unit=11,file='d:\File\'//Filename(I11)//'.txt')
      Read(11,*)Num_Data
      Do I12=1,Num_Data
            Read(11,*)(Num_Total(K0,J10),J10=1,Num_List)
            K0=K0+1
      End Do
      Close(11)
    End Do
    End Program Main

vvt 发表于 2017-3-3 22:39:43

在我这里,错误提示是:The size of the array dimension is too large, and overflow occurred when computing the array size.
当 Num_All=7000000 时
降低到 6000000,则可以编译和链接(32位)
64位则都可以编译链接。

7,000,000*40*8/1024/1024=2.13G,已经超过了32位内存容许。但没有超过64位的。
建议:合理有效的利用内存。

mrzlh 发表于 2017-3-4 07:37:59

vvt 发表于 2017-3-3 22:39
在我这里,错误提示是:The size of the array dimension is too large, and overflow occurred when compu ...

是的,但我的是64位,16G内存。数组大小不能减小,还会慢慢增加。

vvt 发表于 2017-3-4 08:39:28

本帖最后由 vvt 于 2017-3-4 09:01 编辑

要使用64位编译器,你必须保证:
1.你的CPU是64位的
2.你的操作系统(windows,linux)是64位的。
3.您按照了64位的编译器。
4.您切换了编译器的编译选项为64位。(这一条很多人忽略)
正如您在主楼说的那样。debug/x64 win32 可以编译。

至于数组大小不能减小,还会慢慢增加。这只是因为你使用了不恰当的数据结构和算法。
有很多关于小内存干大事的实例,比如系数矩阵存储(Sparse matrices)和求解器,比如波前法(front algorithm),比如级联抽样(Cascade decimate)还有数值算法中很常见的思想:分而治之(divide and rule)
没有什么数组是不能减少的。你可以详细看看沙发提供的文章链接。


页: [1] 2
查看完整版本: 新手求教A common block or variable may not exceed 2147483647 bytes