<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic System clock and the new Fortran 2023 standard in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/System-clock-and-the-new-Fortran-2023-standard/m-p/1547070#M169387</link>
    <description>&lt;P&gt;Fortran 2023 standard talks about the issue with &lt;STRONG&gt;system_clock&lt;/STRONG&gt; routine. The user was previously free to use integer of any kind for the actual argument for system_clock.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I use the same integer kind for system_clock actual arguments&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;integer ( 8 ) :: start_count&lt;BR /&gt;&amp;nbsp;integer ( 8 ) :: rate, stop_count&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;program system_clock_test
  implicit none

  integer ( 4 ), parameter :: x = 100 , y = 100, dx = 1, dy = 1
  integer ( 4 ) :: steps = 100000 , step, i, j, ip, jp, im, jm
  integer ( 8 ) :: start_count
  integer ( 8 ) :: rate, stop_count
  real ( 8 )   :: dt = 0.01 ,  m = 1.0 , k = 0.5
  real ( 8 ), dimension ( :, : ), allocatable :: r, c, f, cc, dc, md


  allocate ( r(x,y) , c(x,y), f(x,y), cc(x,y), dc(x,y), md(x,y) )

  !====
  call system_clock(count=start_count , count_rate=rate)
  !====


  call random_number ( r )
  c = 0.4 + 0.02*( 0.5 - r )


  do step = 1, steps

     do concurrent ( integer :: i=1:x, j=1:y ) 

        f(i,j) =  24.0*c(i,j)*( 1.50 - c(i,j) )**2 - &amp;amp;
             &amp;amp;c(i,j)**3*( 1.03 - c(i,j) )   

        jp = j + 1
        jm = j - 1

        ip = i + 1
        im = i - 1

        if ( im == 0 ) im = x
        if ( ip == ( x + 1) ) ip = 1
        if ( jm == 0 ) jm = y
        if ( jp == ( y + 1) ) jp = 1

        cc(i,j)   = ( c(ip,j) + c(im,j) + c(i,jm) + c(i,jp) - &amp;amp;
             4.0*c(i,j) ) /( dx*dy )

        dc(i,j) = f(i,j) - k*cc(i,j)

        md(i,j) = ( dc(ip,j) + dc(im,j) + dc(i,jm) &amp;amp;
             + dc(i,jp) - 4.0*dc(i,j) ) / ( dx*dy )


        c(i,j) =  c(i,j) + dt*m*md(i,j)

     end do

  end do



  !=====
  call system_clock(count=stop_count)
  !=====

  print*, ' system clock time        : ', real(max(stop_count - start_count , 1_8 )) /real(rate),' seconds'
  print*, ' kind type start_count    : ', kind(start_count)
  print*, ' kind type stop_count     : ', kind(stop_count)


end program system_clock_test&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;and run with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;C:\Users\owner\Desktop&amp;gt;ifx test.f90 /O1
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

C:\Users\owner\Desktop&amp;gt;test
  system clock time        :    10.40300      seconds
  kind type start_count    :            8
  kind type stop_count     :            8&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Next I change the integer kind for &lt;STRONG&gt;system_clock&lt;/STRONG&gt; actual arguments&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;integer ( 8 ) :: start_count&lt;BR /&gt;integer ( 4 ) :: rate, stop_count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and run with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;C:\Users\owner\Desktop&amp;gt;ifx test.f90 /O1
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

C:\Users\owner\Desktop&amp;gt;test
  system clock time        :   1.0000000E-06  seconds
  kind type start_count    :            8
  kind type stop_count     :            4&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;As expected, there is an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is, should not the latest Intel compiler throw the warning or error message of using different integer kinds ? Or this warning message is expected to be in the next version ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 24 Nov 2023 07:27:15 GMT</pubDate>
    <dc:creator>Fortran10</dc:creator>
    <dc:date>2023-11-24T07:27:15Z</dc:date>
    <item>
      <title>System clock and the new Fortran 2023 standard</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/System-clock-and-the-new-Fortran-2023-standard/m-p/1547070#M169387</link>
      <description>&lt;P&gt;Fortran 2023 standard talks about the issue with &lt;STRONG&gt;system_clock&lt;/STRONG&gt; routine. The user was previously free to use integer of any kind for the actual argument for system_clock.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;I use the same integer kind for system_clock actual arguments&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;integer ( 8 ) :: start_count&lt;BR /&gt;&amp;nbsp;integer ( 8 ) :: rate, stop_count&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;program system_clock_test
  implicit none

  integer ( 4 ), parameter :: x = 100 , y = 100, dx = 1, dy = 1
  integer ( 4 ) :: steps = 100000 , step, i, j, ip, jp, im, jm
  integer ( 8 ) :: start_count
  integer ( 8 ) :: rate, stop_count
  real ( 8 )   :: dt = 0.01 ,  m = 1.0 , k = 0.5
  real ( 8 ), dimension ( :, : ), allocatable :: r, c, f, cc, dc, md


  allocate ( r(x,y) , c(x,y), f(x,y), cc(x,y), dc(x,y), md(x,y) )

  !====
  call system_clock(count=start_count , count_rate=rate)
  !====


  call random_number ( r )
  c = 0.4 + 0.02*( 0.5 - r )


  do step = 1, steps

     do concurrent ( integer :: i=1:x, j=1:y ) 

        f(i,j) =  24.0*c(i,j)*( 1.50 - c(i,j) )**2 - &amp;amp;
             &amp;amp;c(i,j)**3*( 1.03 - c(i,j) )   

        jp = j + 1
        jm = j - 1

        ip = i + 1
        im = i - 1

        if ( im == 0 ) im = x
        if ( ip == ( x + 1) ) ip = 1
        if ( jm == 0 ) jm = y
        if ( jp == ( y + 1) ) jp = 1

        cc(i,j)   = ( c(ip,j) + c(im,j) + c(i,jm) + c(i,jp) - &amp;amp;
             4.0*c(i,j) ) /( dx*dy )

        dc(i,j) = f(i,j) - k*cc(i,j)

        md(i,j) = ( dc(ip,j) + dc(im,j) + dc(i,jm) &amp;amp;
             + dc(i,jp) - 4.0*dc(i,j) ) / ( dx*dy )


        c(i,j) =  c(i,j) + dt*m*md(i,j)

     end do

  end do



  !=====
  call system_clock(count=stop_count)
  !=====

  print*, ' system clock time        : ', real(max(stop_count - start_count , 1_8 )) /real(rate),' seconds'
  print*, ' kind type start_count    : ', kind(start_count)
  print*, ' kind type stop_count     : ', kind(stop_count)


end program system_clock_test&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;and run with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;C:\Users\owner\Desktop&amp;gt;ifx test.f90 /O1
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

C:\Users\owner\Desktop&amp;gt;test
  system clock time        :    10.40300      seconds
  kind type start_count    :            8
  kind type stop_count     :            8&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Next I change the integer kind for &lt;STRONG&gt;system_clock&lt;/STRONG&gt; actual arguments&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;integer ( 8 ) :: start_count&lt;BR /&gt;integer ( 4 ) :: rate, stop_count&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and run with&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;C:\Users\owner\Desktop&amp;gt;ifx test.f90 /O1
Intel(R) Fortran Compiler for applications running on Intel(R) 64, Version 2024.0.0 Build 20231017
Copyright (C) 1985-2023 Intel Corporation. All rights reserved.

Microsoft (R) Incremental Linker Version 14.32.31332.0
Copyright (C) Microsoft Corporation.  All rights reserved.

-out:test.exe
-subsystem:console
test.obj

C:\Users\owner\Desktop&amp;gt;test
  system clock time        :   1.0000000E-06  seconds
  kind type start_count    :            8
  kind type stop_count     :            4&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;As expected, there is an error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is, should not the latest Intel compiler throw the warning or error message of using different integer kinds ? Or this warning message is expected to be in the next version ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Nov 2023 07:27:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/System-clock-and-the-new-Fortran-2023-standard/m-p/1547070#M169387</guid>
      <dc:creator>Fortran10</dc:creator>
      <dc:date>2023-11-24T07:27:15Z</dc:date>
    </item>
    <item>
      <title>Re:System clock and the new Fortran 2023 standard</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/System-clock-and-the-new-Fortran-2023-standard/m-p/1550349#M169722</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I learned from the following post:&lt;/P&gt;&lt;P&gt;&lt;A href="https://fortran-lang.discourse.group/t/fortran-2023-standard-and-system-clock/6861" target="_blank"&gt;https://fortran-lang.discourse.group/t/fortran-2023-standard-and-system-clock/6861&lt;/A&gt;&lt;/P&gt;&lt;P&gt;that the Fortran 2023 does not allow mixed type in this function call (cite: "&lt;A href="https://j3-fortran.org/doc/year/21/21-117r3.txt" target="_blank"&gt;https://j3-fortran.org/doc/year/21/21-117r3.txt&lt;/A&gt;").  I also test the case with all variables in integer(4), and it works as everything in integer(8).&lt;/P&gt;&lt;P&gt;$ ifx -what test.f90&lt;/P&gt;&lt;P&gt;&amp;nbsp;Intel(R) Fortran 23.0-1769.01&lt;/P&gt;&lt;P&gt;$ ./a.out&lt;/P&gt;&lt;P&gt;&amp;nbsp;system clock time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;&amp;nbsp;13.75390&amp;nbsp;&amp;nbsp;&amp;nbsp;seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;kind type start_count&amp;nbsp;&amp;nbsp;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;&amp;nbsp;kind type stop_count&amp;nbsp;&amp;nbsp;&amp;nbsp;:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;4&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;/P&gt;&lt;BR /&gt;</description>
      <pubDate>Mon, 04 Dec 2023 18:59:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/System-clock-and-the-new-Fortran-2023-standard/m-p/1550349#M169722</guid>
      <dc:creator>Shiquan_Su</dc:creator>
      <dc:date>2023-12-04T18:59:11Z</dc:date>
    </item>
  </channel>
</rss>

