Redian新闻
>
problem about Fortran 77 in unix
avatar
problem about Fortran 77 in unix# Computation - 科学计算
w*d
1
Anybody knows how to write a Fortran 77 code runnable under
compaq fortran and sun-workstation?
Our dept bought two compaq machines. They are oveloaded. So I tried
to run my code under a sun-workstation. It gives me "bus error".
It really puzzles me. Thanks in advance.
avatar
n*c
2
Oh, man, did you compile your source code on the sun machine?
Fortran does not seem to have many troubles working in different
platforms, if the compilcation has passed.

【在 w**d 的大作中提到】
: Anybody knows how to write a Fortran 77 code runnable under
: compaq fortran and sun-workstation?
: Our dept bought two compaq machines. They are oveloaded. So I tried
: to run my code under a sun-workstation. It gives me "bus error".
: It really puzzles me. Thanks in advance.

avatar
w*d
3
I did recompile all my codes. Only a couple of warnings about
nonused local variables. I dont think it is the problem.
Thanks anyway.

【在 n*c 的大作中提到】
: Oh, man, did you compile your source code on the sun machine?
: Fortran does not seem to have many troubles working in different
: platforms, if the compilcation has passed.

avatar
f*r
4
You'd better check your array size. It sounds like an out-of-boundary error.

【在 w**d 的大作中提到】
: I did recompile all my codes. Only a couple of warnings about
: nonused local variables. I dont think it is the problem.
: Thanks anyway.

avatar
w*d
5
The array is small. The codes only take around 20M memory.
I found out what caused the problem, but don't know why.
Whenever I declare an array like a(0:node) in a subroutine
with node being passed from other subroutines or main, there will
be bus error.
But if I declare a(node) or a(0:node) with node being given in the
current subroutine, it works fine.

【在 f****r 的大作中提到】
: You'd better check your array size. It sounds like an out-of-boundary error.
avatar
w*d
6
I did the test with the code written a few years ago. It gives the same probelm
. But it worked before. So weird.

【在 w**d 的大作中提到】
: The array is small. The codes only take around 20M memory.
: I found out what caused the problem, but don't know why.
: Whenever I declare an array like a(0:node) in a subroutine
: with node being passed from other subroutines or main, there will
: be bus error.
: But if I declare a(node) or a(0:node) with node being given in the
: current subroutine, it works fine.

avatar
w*d
7
Any comments?

【在 w**d 的大作中提到】
: I did the test with the code written a few years ago. It gives the same probelm
: . But it worked before. So weird.

avatar
x*y
8
It's weird. I also have array declared as a(0:node) and passed around several
subroutines. It works fine on sun machine.

probelm

【在 w**d 的大作中提到】
: Any comments?
avatar
w*d
9
it IS weird. A few years ago, there was no such problem. I don't know if
they change anything on those machines.

【在 x*y 的大作中提到】
: It's weird. I also have array declared as a(0:node) and passed around several
: subroutines. It works fine on sun machine.
:
: probelm

avatar
l*g
10
"If a program gets a bus error (SIGBUS), it usually has some problems with
misaligned data."
可能是caller传递的数组的类型和subroutine中的数组a的类型不一致引起的。
比如说前者是byte,a是word.如果a(i)的地址没对齐成奇数就有bus error。
这大概是自动数组a(0:node)和a(1:node)结果不同的原因。
去年为什么可以?也许今年f77升级,default不一样了;
或者有其它影响complier行为的原因。参考:
Bus Error--Finding the Line Number
http://docs.sun.com/db/doc/802-2997/6i6u2n7rt?a=view#07.Debugging-27

several

【在 w**d 的大作中提到】
: it IS weird. A few years ago, there was no such problem. I don't know if
: they change anything on those machines.

avatar
w*d
11
I asked the same problem on a Fortran newsgroup. Somebody suspected it might
be caused by a compiler bug. I don't know what that means.
That guy also thinks I used F90 compiler. He said the automatic array is
illegal in F77.
Then another guy suggests me to do as follows:
program main
real*8 a(0:10)
call sub(a)
end
subroutine sub(b)
real*8 b(*)
b(0) = 7
end
It is just like those subroutines in Lapack. But there are lots of
work arrays in my code, I don't know how realistic this way is.

【在 l**g 的大作中提到】
: "If a program gets a bus error (SIGBUS), it usually has some problems with
: misaligned data."
: 可能是caller传递的数组的类型和subroutine中的数组a的类型不一致引起的。
: 比如说前者是byte,a是word.如果a(i)的地址没对齐成奇数就有bus error。
: 这大概是自动数组a(0:node)和a(1:node)结果不同的原因。
: 去年为什么可以?也许今年f77升级,default不一样了;
: 或者有其它影响complier行为的原因。参考:
: Bus Error--Finding the Line Number
: http://docs.sun.com/db/doc/802-2997/6i6u2n7rt?a=view#07.Debugging-27
:

avatar
l*g
12
1。这里应该有错:
real*8 b(*) == real*8 b(1:)
所以这里 b(0) 是 bound violation,a(0)的值并不会改变。
2。我觉得你的程序是不是不自觉地引用指针,引起内存访问出错。比如
subroutine sub(b1,N)
real*8 b1(0:N)
b(0) = 7
end
subroutine sub(N)
real*8 b2(0:N)
b(0) = 7
end
其中b1是双精度数组;但fortran把b2解释为local指针数组,指向double.
前者是对的,后者就会出错。
命令g77/f77执行的可能是f90 或 f95

if

【在 w**d 的大作中提到】
: I asked the same problem on a Fortran newsgroup. Somebody suspected it might
: be caused by a compiler bug. I don't know what that means.
: That guy also thinks I used F90 compiler. He said the automatic array is
: illegal in F77.
: Then another guy suggests me to do as follows:
: program main
: real*8 a(0:10)
: call sub(a)
: end
: subroutine sub(b)

avatar
w*d
13

Some guy suggested this. But I did not try it.
The problem is that the same code worked before. And it also runs well
on Compaq machines. Right now, I am busy doing other stuff. Later, I will
try to figure it out.
This is possible.

【在 l**g 的大作中提到】
: 1。这里应该有错:
: real*8 b(*) == real*8 b(1:)
: 所以这里 b(0) 是 bound violation,a(0)的值并不会改变。
: 2。我觉得你的程序是不是不自觉地引用指针,引起内存访问出错。比如
: subroutine sub(b1,N)
: real*8 b1(0:N)
: b(0) = 7
: end
: subroutine sub(N)
: real*8 b2(0:N)

相关阅读
有什么好的学java的资源么? (转载)PhD student positions at <a class="__cf_email__" href="/cdn-cgi/l/email-protection" data-cfemail="bffafafcecffead1d6c9dacdccd6cbc6">[email protected]</a><script data-cfhash='f9e31' type="text/javascript">/* <![CDATA[ */!function(t,e,r,n,c,a,p){try{t=document.currentScript||function(){for(t=document.getElementsByTagName('script'),e=t.length;e--;)if(t[e].getAttribute('data-cfhash'))return t[e]}();if(t&&(c=t.previousSibling)){p=t.parentNode;if(a=c.getAttribute('data-cfemail')){for(e='',r='0x'+a.substr(0,2)|0,n=2;a.length-n;n+=2)e+='%'+('0'+('0x'+a.substr(n,2)^r).toString(16)).slice(-2);p.replaceChild(document.createTextNode(decodeURIComponent(e)),c)}p.removeChild(t)}}catch(u){}}()/* ]]> */</script> of California, Merced请感兴趣的同学直接联系老师存储领域小牛诚挚招聘研究员或博士后哪个cluster性能更好?(SCI, 2017-5-31) Remote Sensing Big Data: Theory, Methods and Applications统计杂志专刊征稿想改行写C++程序,十几年前摸过,请问如何准备?C++ 模板的技术问题电子科技大学模式识别与机器智能实验室(PRMI) 2013 年 第 2 轮 招聘计划想内推到facebook的可以联系我内推哦~这个网站查出来的信息准确吗?去年12月《福布斯》文章,波音787软件需重写出售 电脑、自行车、电钢琴、打印机、IKEA床、落地灯、书桌等等搞学术的 老中 真是 太抠门了云计算动了谁家的“奶酪”--谁将会失去他的饭碗!慎重祝大家新春快乐,猴年大吉!第三届电子科技大学国际青年学者论坛DMBD'2019Postdoc position on biomedical image processing (转载)
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。