start_benchmark Subroutine

private impure subroutine start_benchmark(this, imark, method, description, argi, argr)

Uses

    • face
  • proc~~start_benchmark~~UsesGraph proc~start_benchmark forbenchmark_default::benchmark%start_benchmark face face proc~start_benchmark->face

Start a specific benchmark

Type Bound

benchmark

Arguments

Type IntentOptional Attributes Name
class(benchmark), intent(inout) :: this

Benchmark object

integer, intent(in) :: imark

Index of the current method

character(len=*), intent(in) :: method

Name of the method being benchmarked

character(len=*), intent(in), optional :: description

Description of the method being benchmarked (optional)

integer(kind=ik), intent(in), optional, dimension(:) :: argi

Integer arguments for the benchmark (optional)

real(kind=rk), intent(in), optional, dimension(:) :: argr

Real arguments for the benchmark (optional)


Calls

proc~~start_benchmark~~CallsGraph proc~start_benchmark forbenchmark_default::benchmark%start_benchmark colorize colorize proc~start_benchmark->colorize ctimer_start ctimer_start proc~start_benchmark->ctimer_start dtimer_start dtimer_start proc~start_benchmark->dtimer_start mtimer_start mtimer_start proc~start_benchmark->mtimer_start otimer_start otimer_start proc~start_benchmark->otimer_start timer_start timer_start proc~start_benchmark->timer_start

Called by

proc~~start_benchmark~~CalledByGraph proc~start_benchmark forbenchmark_default::benchmark%start_benchmark program~demo demo program~demo->proc~start_benchmark

Source Code

   impure subroutine start_benchmark(this, imark, method, description, argi, argr)
      !! author: Seyed Ali Ghasemi
      !! Start a specific benchmark
      !!
      use face

      class(benchmark),          intent(inout)        :: this          !! Benchmark object
      integer,                   intent(in)           :: imark         !! Index of the current method
      character(*),              intent(in)           :: method        !! Name of the method being benchmarked
      integer(ik), dimension(:), intent(in), optional :: argi          !! Integer arguments for the benchmark (optional)
      real(rk),    dimension(:), intent(in), optional :: argr          !! Real arguments for the benchmark (optional)
      character(*),              intent(in), optional :: description   !! Description of the method being benchmarked (optional)

      if (imark <= 0 .or. imark > size(this%marks)) error stop 'imark is out of range.'

      this%imark = imark

      this%marks(this%imark)%description = description
      this%marks(this%imark)%method      = method

      if (present(argi)) then
         this%argi = argi
      else
         if(.not. allocated(this%argi)) allocate(this%argi(0))
      endif

      if (present(argr)) then
         this%argr = argr
      else
         if(.not. allocated(this%argr)) allocate(this%argr(0))
      endif

      if (present(description) .and. present(argi)) then
         print'(a,a," ",a,*(g0,1x))',&
            colorize('Meth.: '//this%marks(this%imark)%method, color_fg='green',style='bold_on'),&
            colorize('; Des.: '//this%marks(this%imark)%description, color_fg='green_intense'),&
            '; Argi.:',&
            this%argi
      elseif (present(description) .and. .not. present(argi)) then
         print'(a,a," ",a)',&
            colorize('Meth.: '//this%marks(this%imark)%method, color_fg='green',style='bold_on'),&
            colorize('; Des.: '//this%marks(this%imark)%description, color_fg='green_intense')
      elseif (.not. present(description) .and. present(argi)) then
         print'(a,a,*(g0,1x))',&
            colorize('Meth.: '//this%marks(this%imark)%method, color_fg='green',style='bold_on'),&
            '; Argi.:',&
            this%argi
      else
         print'(a)', colorize('Meth.: '//this%marks(this%imark)%method, color_fg='green',style='bold_on')
      end if

      select case (trim(this%timer))
       case ('wall')
         call this%marks(this%imark)%time%timer_start()
       case ('date_and_time')
         call this%marks(this%imark)%time%dtimer_start()
       case ('cpu')
         call this%marks(this%imark)%time%ctimer_start()
       case ('omp')
#if defined(USE_OMP)
         call this%marks(this%imark)%time%otimer_start()
#else
         error stop 'Use -DUSE_OMP to enable OpenMP.'
#endif
       case ('mpi')
#if defined(USE_MPI)
         call this%marks(this%imark)%time%mtimer_start()
#else
         error stop 'Use -DUSE_MPI to enable MPI.'
#endif
      end select
   end subroutine start_benchmark