在大型数组中,“重定位被截断以适应Fortran错误” [英] `Relocation truncated to fit` error in Fortran with large arrays

查看:1302
本文介绍了在大型数组中,“重定位被截断以适应Fortran错误”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我写了一个Fortran 90代码来从分子模拟数据中提取角度。
在这段代码中,我使用了一个名称 all_parameter 的模块。在这个模块中,我定义了一个数组,例如: CH_Angles

  INTEGER, PARAMETER :: totalFrames = 32000 
INTEGER,PARAMETER :: AAA = 75
REAL,DIMENSION(45:AAA,1:256,1:totalFrames):: CH_Angles

如果我使用 AAA = 75 的值,错误,我可以得到我想要的值。但是,如果我将 AAA 的值更改为 AAA = 105 ,那么我会收到如下所示的错误消息:

  gfortran lipid-Tilt-Magnitude-thermo-cello.f90 
/tmp/ccXOhMqQ.o:在函数` __all_parameter_MOD_find_angle_ch':
lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x35):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o中.bss节中定义的符号'__all_parameter_MOD_x' b $ b lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x48):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o
脂质中的.bss节中定义的符号__all_parameter_MOD_y -Tilt-Magnitude-thermo-cello.f90 :(。text + 0x5b):重新定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o
中定义的符号`__all_parameter_MOD_z'.bss部分lipid-Tilt-Magnitude -thermo-cello.f90 :( .text + 0x6e):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o中.bss节中定义的符号__all_parameter_MOD_x
lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x81):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o
中.bss节中定义的符号__all_parameter_MOD_y脂肪倾斜幅度热电cello.f90 :(文本+ 0x94):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o
/ tmp / ccXOhMqQ中的.bss节中定义的符号__all_parameter_MOD_z .o:在函数`__all_parameter_MOD_find_mid_point_vector'中:
lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x126):重定位被截断为适合:R_X86_64_32S针对符号`__all_parameter_MOD_x' tmp / ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x139):重定位被截断为适合:R_X86_64_32S针对/ tmp / ccXOhMqQ中.bss节中定义的符号`__all_parameter_MOD_y'。 o
lipid-Tilt-Magnitude-thermo-cello.f90 :( .text + 0x14c):重定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o中.bss节中定义的符号'__all_parameter_MOD_z'
lipid-Tilt-Magnitude-thermo-cello.f90 :(。text + 0x15f):重新定位被截断为适合:R_X86_64_32S针对/tmp/ccXOhMqQ.o
脂质中的.bss节中定义的符号__all_parameter_MOD_x -Tilt-Magnitude-thermo-cello.f90 :( .text + 0x172):从输出中省略了额外的重定位溢出
collect2:ld返回1退出状态
vijay @ glycosim:〜/ Simulation-Folder- Feb-2013 / chapter5-thermo-paper2-Vj / thermo2-Analysis / analysis-bcm- / 23_acf-tail-tilt-angle-bcm-thermo2 / chain1 / acf-chain1-CH-bcm-thermo-all-layers $ gfortran lipid- Tilt-Magnitude-thermo-cello.f90

我也尝试用AAA的不同值编译此代码。值为80时,汇编无误。但是,如果AAA是85,那么编译将停止并显示错误消息。



我发现AAA = 82是限制值。任何超过82的AAA值,都会给出错误。



我找不出导致错误的原因。



是否有解决此问题的方法?



注意:我使用Ubuntu 11.10 64位的gfortran编译器和16 GB的RAM存储器。 方案

链接器返回错误,因为静态分配的块的大小超过了32位寻址指令(即2 GB)的寻址范围。这与使用32位还是64位整数索引数组无关 - 问题与静态分配数组的总大小有关。这在这里详细解释:

gfortran for dummies:mcmodel = medium做了什么?为了解决这个问题,正如你已经注意到的那样,你可以用 -mcmodel = medium -mcmodel = large 来编译你的代码。然后允许静态分配大于2 GB的数组。



处理这个问题的更好方法是动态分配任何大型数组。 p>

I have written a Fortran 90 code to extract angles from molecular simulation data. In this code I used a module with name all_parameter. In this module I defined an array such as: CH_Angles

INTEGER,PARAMETER :: totalFrames = 32000  
INTEGER,PARAMETER :: AAA=75
REAL,DIMENSION(45:AAA,1:256,1:totalFrames) :: CH_Angles

If I use the value of AAA = 75, I can compile this code without any error and I can get the values I wanted. But if I change the value of AAA to be AAA=105, then I get some error messages as shown below:

gfortran lipid-Tilt-Magnitude-thermo-cello.f90
/tmp/ccXOhMqQ.o: In function `__all_parameter_MOD_find_angle_ch':
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x35): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_x' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x48): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_y' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x5b): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_z' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x6e): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_x' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x81): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_y' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x94): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_z' defined in .bss section in /tmp/ccXOhMqQ.o
/tmp/ccXOhMqQ.o: In function `__all_parameter_MOD_find_mid_point_vector':
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x126): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_x' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x139): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_y' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x14c): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_z' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x15f): relocation truncated to fit: R_X86_64_32S against symbol `__all_parameter_MOD_x' defined in .bss section in /tmp/ccXOhMqQ.o
lipid-Tilt-Magnitude-thermo-cello.f90:(.text+0x172): additional relocation overflows omitted from the output
collect2: ld returned 1 exit status
vijay@glycosim:~/Simulation-Folder-Feb2013/chapter5-thermo-paper2-Vj/thermo2-Analysis/analysis-bcm-/23_acf-tail-tilt-angle-bcm-thermo2/chain1/acf-chain1-CH-bcm-thermo-all-layers$ gfortran lipid-Tilt-Magnitude-thermo-cello.f90

I also tried compiling this code with different values for AAA. With a value 80, the compilation goes without error. But, if the AAA is 85, then the compilation stop with error messages.

I found the AAA=82 is the limiting value. Any value of AAA more than 82, it gives error.

I can not figure out what causes the error.

Is there anyway to find solution for this issue?

Note: I am using gfortran compiler from Ubuntu 11.10 64 bit with 16 GB RAM memory.

解决方案

The error you get is returned by the linker because the size of the statically-allocated block exceeds the range of what can be addressed by a 32-bit addressing instruction, which is 2 GB. This is irrelevant of whether you index your array using 32-bit or 64-bit integers - the problem is related to the total size of a statically-allocated array. This is explained in details here:

gfortran for dummies: What does mcmodel=medium do exactly?

In order to work around this, as you have noticed, you can compile your code with -mcmodel=medium or -mcmodel=large. Statically-allocated arrays larger than 2 GB are then allowed.

A better way to deal with this, but involves more work, is to dynamically allocate any large arrays.

这篇关于在大型数组中,“重定位被截断以适应Fortran错误”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆