Re: Optimization in gfortran
- From: David <redboy_xxx@xxxxxxxx>
- Date: Wed, 6 Jul 2005 10:27:20 +0200
On 2005-07-05 10:36:44 +0200, "FX" <coudert@xxxxxxxxxxxxx> said:
So I tried with -O3, it compiles but at a certain point while the program is running, it hungs and I must do a forced exit with (CTRL-C to stop the execution).
Does anyone know why?
How can I solve that problem (obviosly with -O instead of -O3, but why that?).
As someone else already mentionned, this could be a compiler bug (wrong optimisation leading to an infinite loop) but this could be a bug in your code too. Writing robust floating-point code can be very hard.
I'll try to reduce it. By now I have compiled a second program version that I have done. The first (the one for which doesn't work -O3) Is a "parallel" simulation the second is "serial". I explain myself:
I must do a simulation of a multiplescale flow using Langevin equation. All the subroutine (Random number generator, gaussian, Stochastic 4 order Runge-Kutta, the diffusion, velocity, etc..) are the same in the two codes. What change is the way I do the mean for the correlation function, mean displacement, diffusion, etc.
In the first case I put 10^5 particles in a 2pi x 2pi sqare (the flow is periodic) with a costant mesure, I wait they reach the asyntotic mesure and the I pass throw the integrator all the particle at the same time: for t=1 I integrate all the particle to t=1.01 and so on. For every time step I compute all the macroscopic variable and store it in a .txt file.
In the secondo I put a single particle, store the relevant quantity in an array, every x time I do a cut and I recall the particle as the second particle and so on. While I have performed 10^5 simulation. I compute the macroscopic quantity for every time via the stored array (really it is a matrix(n,t)).
Phisically speaking the first method makes an ensemble mean, the second a time mean.
The code is the same for about 98%
What really changes is the inversion of "time" and "particle number" do loop, and the change from a "continuous" I/O call to write the .txt file and an array storage with a finale file write.
Does anyone have any tips?
Thank to all, David.
.
- Follow-Ups:
- Re: Optimization in gfortran
- From: Chris Hulbert
- Re: Optimization in gfortran
- References:
- Re: Optimization in gfortran
- From: FX
- Re: Optimization in gfortran
- Prev by Date: Re: Pi.
- Next by Date: Re: Pi.
- Previous by thread: Re: Optimization in gfortran
- Next by thread: Re: Optimization in gfortran
- Index(es):
Relevant Pages
|