test_dot1 Program

Uses

  • program~~test_dot1~~UsesGraph program~test_dot1 test_dot1 forunittest forunittest program~test_dot1->forunittest kinds kinds program~test_dot1->kinds module~fordot fordot program~test_dot1->module~fordot module~fordot->kinds module~fordot_opts fordot_opts module~fordot->module~fordot_opts module~fordot_opts->kinds

Calls

program~~test_dot1~~CallsGraph program~test_dot1 test_dot1 check check program~test_dot1->check interface~dot_product dot_product program~test_dot1->interface~dot_product proc~dot_r0r1r1_rel dot_R0R1R1_rel interface~dot_product->proc~dot_r0r1r1_rel proc~dot_r0r1r1_rel_block dot_R0R1R1_rel_block interface~dot_product->proc~dot_r0r1r1_rel_block proc~dot_r0r1r1_rel_coarray dot_R0R1R1_rel_coarray interface~dot_product->proc~dot_r0r1r1_rel_coarray interface~dot_opts dot_opts proc~dot_r0r1r1_rel->interface~dot_opts proc~compute_block_ranges compute_block_ranges proc~dot_r0r1r1_rel_block->proc~compute_block_ranges reduce reduce proc~dot_r0r1r1_rel_block->reduce proc~dot_r0r1r1_rel_coarray->proc~compute_block_ranges proc~dot_r0r1r1_rel_opts dot_R0R1R1_rel_opts interface~dot_opts->proc~dot_r0r1r1_rel_opts proc~md_2 md_2 proc~dot_r0r1r1_rel_opts->proc~md_2 proc~md_3 md_3 proc~dot_r0r1r1_rel_opts->proc~md_3 proc~md_4 md_4 proc~dot_r0r1r1_rel_opts->proc~md_4 interface~dot dot proc~md_2->interface~dot

Variables

Type Attributes Name Initial
real(kind=rk) :: a
real(kind=rk) :: a_ref
integer :: m
real(kind=rk), allocatable :: u(:)
type(unit_test) :: ut
real(kind=rk), allocatable :: v(:)

Source Code

program test_dot1

   use kinds
   use fordot, only: fdot_product => dot_product ! rename dot_product to fdot_product to avoid overloading
   use forunittest, only: unit_test

   implicit none

   real(rk), allocatable :: u(:), v(:)
   real(rk)              :: a_ref, a
   integer               :: m
   type(unit_test)       :: ut

   ! a = u(m).v(m)
   m = 300

   allocate(u(m),v(m))
   call random_number(u)
   call random_number(v)
   u = u*100.0_rk
   v = v*100.0_rk

   a_ref = dot_product(u,v)

   a = fdot_product(u,v)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.1')

   a = fdot_product(u,v, option='m1')
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.2')

   a = fdot_product(u,v, option='m2')
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.3')

   a = fdot_product(u,v, option='m3')
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.4')

   a = fdot_product(u,v, option='m4')
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.5')

   a = fdot_product(u,v, nblock=16)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.6')

   a = fdot_product(u,v, option='m1b', nblock=16)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.7')

   a = fdot_product(u,v, option='m2b', nblock=16)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.8')

   a = fdot_product(u,v, option='m3b', nblock=16)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.9')

   a = fdot_product(u,v, option='m4b', nblock=16)
   call ut%check(a, a_ref, tol=1e-5_rk, msg='test_dot1.10')

end program test_dot1