avatar
p*s
1
We have some Monte Carlo simulation code in Fortran,
it is very slow,
if assuming the code is reasonable written
do you think rewriting it in C will improve the performance a lot?
if just wrap it using C, will speed it ?
thanks
avatar
f*r
2
Generally speaking, the performance of Fortran 77 program is better than
Fortran 90, while both of them are better than C and C++.
See www.cs.rpi.edu/~nortonc/OOF90/performance.html for some benchmark.

【在 p*******s 的大作中提到】
: We have some Monte Carlo simulation code in Fortran,
: it is very slow,
: if assuming the code is reasonable written
: do you think rewriting it in C will improve the performance a lot?
: if just wrap it using C, will speed it ?
: thanks

avatar
p*s
3
thanks a lot

【在 f****r 的大作中提到】
: Generally speaking, the performance of Fortran 77 program is better than
: Fortran 90, while both of them are better than C and C++.
: See www.cs.rpi.edu/~nortonc/OOF90/performance.html for some benchmark.

avatar
h*o
4
use gnu profile (gprof) to analyze which part is the most time
consuming, then try to optimize that part.

【在 p*******s 的大作中提到】
: We have some Monte Carlo simulation code in Fortran,
: it is very slow,
: if assuming the code is reasonable written
: do you think rewriting it in C will improve the performance a lot?
: if just wrap it using C, will speed it ?
: thanks

avatar
n*t
5

~~~
move this out.

【在 f****r 的大作中提到】
: Generally speaking, the performance of Fortran 77 program is better than
: Fortran 90, while both of them are better than C and C++.
: See www.cs.rpi.edu/~nortonc/OOF90/performance.html for some benchmark.

avatar
f*r
6
Well, the performance of C could be really close to Fortran, but need some
extra work on programming. For example, quoted from
"www.hpcf.cam.ac.uk/C_rant.html",
The bottom line effect of this difficulty easy to see: compiling the standard
sources of LINPACK on babbage achieves 54 MFLOPS in FORTRAN and only
34 MFLOPS in C - significantly in FORTRAN's favour. The use of
(non-portable) directives does improve
this, with equal performance being achievable with C
and FORTRAN on babbage.

【在 n******t 的大作中提到】
:
: ~~~
: move this out.

avatar
r*d
7
no, I think Fortran is faster than C in most cases.
Why do you think it is slow?

【在 p*******s 的大作中提到】
: We have some Monte Carlo simulation code in Fortran,
: it is very slow,
: if assuming the code is reasonable written
: do you think rewriting it in C will improve the performance a lot?
: if just wrap it using C, will speed it ?
: thanks

avatar
o*d
8
they are comparable, when you check the corresponding assembly codes of
the C and Fortran. this claim is true. Fortran does not support recursion.
if you use recursions in C, but use the functionally equivalent loops in
Fortran, of course Fortran outperforms C.

【在 r*****d 的大作中提到】
: no, I think Fortran is faster than C in most cases.
: Why do you think it is slow?

avatar
n*t
9
I think we are talking about a different concept.
the potential speed of a certian language and
the difficulty of an optimize implemention.

【在 f****r 的大作中提到】
: Well, the performance of C could be really close to Fortran, but need some
: extra work on programming. For example, quoted from
: "www.hpcf.cam.ac.uk/C_rant.html",
: The bottom line effect of this difficulty easy to see: compiling the standard
: sources of LINPACK on babbage achieves 54 MFLOPS in FORTRAN and only
: 34 MFLOPS in C - significantly in FORTRAN's favour. The use of
: (non-portable) directives does improve
: this, with equal performance being achievable with C
: and FORTRAN on babbage.

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。