/mobile Handheld Friendly website

 performance measurements

Each table row shows performance measurements for this Fortran Intel program with a particular command-line input value N.

 N  CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
5000.060.07?568  0% 0% 0% 100%
3,0002.342.351,272568  0% 0% 1% 100%
5,5007.867.871,300568  0% 1% 0% 100%

Read the ↓ make, command line, and program output logs to see how this program was run.

Read spectral-norm benchmark to see what this program should do.

 notes

Intel(R) Fortran Compiler XE for applications running on IA-32, Version 13.0.1.117 Build 20121010

 spectral-norm Fortran Intel program source code

! The Computer Language Benchmarks Game
! http://benchmarksgame.alioth.debian.org/
!
! contributed by Steve Decker based on the version by Simon Geard
! September 2008, Simon Geard, Added OpenMP directives
!
! compilation:
!   g95 -O1 -fomit-frame-pointer -funroll-loops spectral_norm.f90
!   ifort -ipo -O3 -openmp spectral_norm.f90
!   gfortran -O3 -openmp spectral_norm.f90 (not tested)

module norm_subs
  implicit none

  public :: MultiplyAtAv
  public :: dp

  private
  integer, parameter :: dp = selected_real_kind(12)

contains

  ! Multiply v by A
  pure function MultiplyAv(v) result (Av)
    real(dp), dimension(:), intent(in) :: v
    real(dp), dimension(size(v))       :: Av
    real(dp) :: r
    integer :: n, i, j

    n = size(v)
    !$omp parallel do shared(Av, v, n) private(i, j, r)
    do i = 1, n
       r = 0.0d0
       do j = 1, n
          r = r + A() * v(j)
       end do
       Av(i) = r
    end do
    !omp end parallel do

  contains
    pure real(dp) function A
      ! Return element i,j of infinite matrix A
      a = 1.d0 / ((i+j-2) * (i+j-1)/2 + i)
    end function A
  end function MultiplyAv
       
  ! Multiply v by A transpose
  pure function MultiplyAtv(v) result (Atv)
    real(dp), dimension(:), intent(in) :: v
    real(dp), dimension(size(v))       :: Atv

    real(dp) :: r
    integer :: n, i, j

    n = size(v)
    Atv = 0.d0
    !$omp parallel do shared(Atv, v, n) private(i, j, r)
    do i = 1, n
       r = 0.0d0
       do j = 1, n
          r = r + AT() * v(j)
       end do
       Atv(i) = r
    end do
    !omp end parallel do

  contains
    pure real(dp) function AT
      ! Return element j,i of infinite matrix A
      AT = 1.d0 / ((i+j-2) * (i+j-1)/2 + j)
    end function AT
  end function MultiplyAtv

  ! Multiply v by A and then by A transpose
  pure function MultiplyAtAv(v) result (AtAv)
    real(dp), dimension(:), intent(in) :: v
    real(dp), dimension(size(v))       :: AtAv
    
    AtAv = MultiplyAtv(MultiplyAv(v))
  end function MultiplyAtAv
end module norm_subs

program spectral_norm
  use norm_subs
  implicit none

  real(dp), dimension(:), allocatable :: u, v
  integer          :: i, n
  character(len=6) :: argv

  integer, external :: omp_get_num_procs

  ! By default the number of threads should be set to the number of processors
  ! but the number can be controlled with one of the folowing
  ! export OMP_NUM_THREADS=4
  ! call omp_set_num_threads(omp_get_num_procs())

  call get_command_argument(1, argv)
  read(argv, *) n

  allocate(u(n), v(n))
  u = 1.d0
  do i = 1, 10
     v = MultiplyAtAv(u)
     u = MultiplyAtAv(v)
  end do

  write(*, "(f0.9)") sqrt(dot_product(u,v) / dot_product(v,v))
  deallocate(u, v)
end program spectral_norm

 make, command-line, and program output logs

Tue, 15 Jan 2013 07:47:21 GMT

MAKE:
/usr/local/src/intel/bin/ifort -O3 -fast -openmp spectralnorm.f90 -o spectralnorm.ifc_run
ipo: remark #11001: performing single-file optimizations
ipo: remark #11006: generating object file /tmp/ipo_ifortxn1vk8.o
rm spectralnorm.f90
0.52s to complete and log all make actions

COMMAND LINE:
./spectralnorm.ifc_run 5500

PROGRAM OUTPUT:
1.274224153

Revised BSD license

  Home   Conclusions   License   Play