!___________________________________________________________________________________________________ ! Aleksandar Donev ! PHY201 Solutions to Worksheet ! December, 2000, MSU !___________________________________________________________________________________________________ ! MODULE Erf_Timing USE Precision USE Erf_Series, ONLY: ErfSeries IMPLICIT NONE PUBLIC ! INTEGER, PARAMETER :: n_repetitions = 100000 ! The number of repetitions in the timing ! CONTAINS FUNCTION TimeErf (x) RESULT (time) REAL (KIND=wp), INTENT (IN) :: x REAL (KIND=sp) :: time ! INTEGER :: i, clock_start, clock_end, clock_rate REAL (KIND=wp) :: erf ! CALL SYSTEM_CLOCK (COUNT_RATE=clock_rate)! This measures the speed of the CPU clock ! CALL SYSTEM_CLOCK (COUNT=clock_start) DO i = 1, n_repetitions erf = ErfSeries (x) END DO CALL SYSTEM_CLOCK (COUNT=clock_end) time = 1E6 * REAL (clock_end-clock_start) / REAL (n_repetitions*clock_rate) END FUNCTION TimeErf ! END MODULE Erf_Timing !