Sujet : Re: Continuations
De : already5chosen (at) *nospam* yahoo.com (Michael S)
Groupes : comp.archDate : 18. Jul 2024, 17:38:03
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240718193803.00004176@yahoo.com>
References : 1 2 3 4 5 6 7 8 9 10 11 12 13
User-Agent : Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-w64-mingw32)
On Thu, 18 Jul 2024 07:54:23 -0000 (UTC)
Thomas Koenig <
tkoenig@netcologne.de> wrote:
Stephen Fuld <SFuld@alumni.cmu.edu.invalid> schrieb:
[Arrhenius]
Good, I get that. But Thomas' original discussion of the problem
indicated that it was very parallel, so the question is, in your
design, how many of those calculations can go in in parallel?
I ran a little Arrhenius benchmark on an i7-11700. Main program was
program main
implicit none
integer, parameter :: n = 1024
double precision, dimension(n) :: k, a, ea, t
integer :: i
call random_number (a)
call random_number(ea)
ea = 10000+ea*30000
call random_number(t)
t = 400 + 200*t
do i=1,1024*1024
call arrhenius(k,a,ea,t,n)
end do
end program main
and the called routine was (in a separate file, so the compiler
could not notice that the results were actually never used)
subroutine arrhenius(k, a, ea, t, n)
implicit none
integer, intent(in) :: n
double precision, dimension(n), intent(out) :: k
double precision, dimension(n), intent(in) :: a, ea, t
double precision, parameter :: r = 8.314
k = a * exp(-ea/(r*t))
end subroutine arrhenius
Timing result (wall-clock time only):
-O0: 5.343s
-O2: 4.560s
-Ofast: 2.237s
-Ofast -march=native -mtune=native: 2.154
Of course, you kever know what speed your CPU is actually running
at these days, but if I assume 5GHz, that would give around 10
cycles per Arrhenius evaluation, which is quite fast (IMHO).
It uses an AVX2 version of exp, or so I gather from the function
name, _ZGVdN4v_exp_avx2 .
Does the benchmark represent a real-world use?
In particular,
1. Is there really a large number of different EA values or only around
dozen or hundred?
2. Does temperature vary all the time or there are relatively big
groups of points calculated at the same temperature?
A similar question can be asked about A, but it is of little practical
importance.
3. Is double precision really needed? According to my understanding,
empirical equations like this one have precision of something like 2
significant digits, or 3 digits at best. So I'd expect that single
precision is sufficient with digits to spare.
4. Dies the equation work at all when the temperature is not close to
the point of equilibrium ? If not, what is a sane range for ea/(r*t) ?