home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.fortran      Putting John Backus on a giant pedestal      5,127 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 4,824 of 5,127   
   Neil to All   
   system_clock   
   04 Nov 24 22:43:11   
   
   From: nddtwentyone@gmail.com   
      
   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.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca