Deutsch English Français Italiano |
<vgbilt$152df$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder2.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Neil <nddtwentyone@gmail.com> Newsgroups: comp.lang.fortran Subject: system_clock Date: Mon, 4 Nov 2024 22:43:11 -0000 (UTC) Organization: A noiseless patient Spider Lines: 78 Message-ID: <vgbilt$152df$1@dont-email.me> Injection-Date: Mon, 04 Nov 2024 23:43:11 +0100 (CET) Injection-Info: dont-email.me; posting-host="838ca57b47816341a44052b395709a93"; logging-data="1214895"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/4N4y25IcjqXTafpU8P+LG" User-Agent: tin/2.6.4-20240224 ("Banff") (Linux/6.8.0-48-generic (x86_64)) Cancel-Lock: sha1:lEICtktKvRjn/JnpaMpyG6Obsk0= Bytes: 3415 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.