start_benchmark Subroutine

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

Uses

    • face
  • proc~~start_benchmark~2~~UsesGraph proc~start_benchmark~2 forbenchmark_coarray::benchmark%start_benchmark face face proc~start_benchmark~2->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 benchmarks (optional)

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

Real arguments for benchmarks (optional)


Calls

proc~~start_benchmark~2~~CallsGraph proc~start_benchmark~2 forbenchmark_coarray::benchmark%start_benchmark colorize colorize proc~start_benchmark~2->colorize ctimer_start ctimer_start proc~start_benchmark~2->ctimer_start dtimer_start dtimer_start proc~start_benchmark~2->dtimer_start mtimer_start mtimer_start proc~start_benchmark~2->mtimer_start ptimer_start ptimer_start proc~start_benchmark~2->ptimer_start timer_start timer_start proc~start_benchmark~2->timer_start

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 benchmarks (optional)
      real(rk),    dimension(:), intent(in), optional :: argr         !! Real arguments for benchmarks (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

      sync all

      if (present(description) .and. present(argi) .and. this_image() == 1) 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 (.not. present(description) .and. present(argi) .and. this_image() == 1) then
         print'(a," ",a,*(g0,1x))',&
            colorize('Meth.: '//this%marks(this%imark)%method, color_fg='green',style='bold_on'),&
            '; Argi.:',&
            this%argi
      elseif (present(description) .and. .not. present(argi) .and. this_image() == 1) then
         print'(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. .not. present(argi) .and. this_image() == 1) then
         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_co(this%imark)%time%timer_start()
       case ('date_and_time')
         call this%marks_co(this%imark)%time%dtimer_start()
       case ('cpu')
         call this%marks_co(this%imark)%time%ctimer_start()
       case ('omp')
#if defined(USE_OMP)
         call this%marks_co(this%imark)%time%ptimer_start()
#else
         error stop 'Use -DUSE_OMP to enable OpenMP.'
#endif
       case ('mpi')
#if defined(USE_MPI)
         call this%marks_co(this%imark)%time%mtimer_start()
#else
         error stop 'Use -DUSE_MPI to enable MPI.'
#endif
      end select

   end subroutine start_benchmark