system_clock
Sujet : system_clock
De : nddtwentyone (at) *nospam* gmail.com (Neil)
Groupes : comp.lang.fortranDate : 04. Nov 2024, 23:43:11
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vgbilt$152df$1@dont-email.me>
User-Agent : tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-48-generic (x86_64))
Hello,
I have a question about the behaviour of system_clock.
Consider the following little program:
wayland-2022:~> cat t.f90
PROGRAM t
IMPLICIT NONE
INTEGER icount,icount_rate,icount_max
CALL system_CLOCK(icount,icount_rate,icount_max)
WRITE(*,*)'count, count_rate, count_max = ',icount,icount_rate,icount_max
END PROGRAM t
When I compile and (repeatedly) run this with nvfortran, it always
gives count=0:
wayland-2022:~> nvfortran --version
nvfortran 23.9-0 64-bit target on x86-64 Linux -tp cascadelake
NVIDIA Compilers and Tools
Copyright (c) 2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
wayland-2022:~> nvfortran t.f90
wayland-2022:~> ./a.out
count, count_rate, count_max = 0 1000000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 0 1000000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 0 1000000 2147483647
This is surely incorrect behaviour? It happens even if I insert some
delaying code before the call to system_clock.
By contrast the behaviour is as expected with gfortran, with a
plausible time interval of a second or so between my re-runs:
wayland-2022:~> gfortran --version
GNU Fortran (GCC) 8.5.0 20210514 (Red Hat 8.5.0-22)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
wayland-2022:~> gfortran t.f90
wayland-2022:~> ./a.out
count, count_rate, count_max = 627874925 1000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 627876335 1000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 627878101 1000 2147483647
(The zero of time seems to be when the machine was powered on in this
case.)
Likewise ifort gives the sort of behaviour I would expect, with the
interval between re-runs being a second or so:
wayland-2022:~> ifort --version
ifort (IFORT) 2021.4.0 20210910
Copyright (C) 1985-2021 Intel Corporation. All rights reserved.
wayland-2022:~> ifort t.f90
wayland-2022:~> ./a.out
count, count_rate, count_max = 1045988618 10000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 1046003030 10000 2147483647
wayland-2022:~> ./a.out
count, count_rate, count_max = 1046017558 10000 2147483647
Why is nvfortran so different? Is this a compiler bug or is it
something permitted by the standard?
Thanks very much,
Neil.
Date | Sujet | # | | Auteur |
5 Nov 24 | system_clock | 2 | | Neil |
5 Nov 24 | Re: system_clock | 1 | | Lawrence D'Oliveiro |
Haut de la page
Les messages affichés proviennent d'usenet.
NewsPortal