test12.f90 Source File


This file depends on

sourcefile~~test12.f90~~EfferentGraph sourcefile~test12.f90 test12.f90 sourcefile~formatmul.f90 formatmul.f90 sourcefile~test12.f90->sourcefile~formatmul.f90 sourcefile~formatmul_opts.f90 formatmul_opts.f90 sourcefile~formatmul.f90->sourcefile~formatmul_opts.f90 sourcefile~external_interfaces.f90 external_interfaces.f90 sourcefile~formatmul_opts.f90->sourcefile~external_interfaces.f90

Source Code

program test_matmul14

   use kinds
   use formatmul
   use forunittest

   implicit none

   real(rk), allocatable :: A(:,:), v(:)
   real(rk), allocatable :: w_ref(:), w(:)
   integer               :: m, n, im
   type(unit_test)       :: ut

#if defined(USE_COARRAY)
   im = this_image()
#else
   im = 1
#endif

   ! w(m) = A(m,n).v(n)
   m = 500
   n = 300

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


   w_ref = matmul(A,v)

   w = matmul(A,v, coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.1')

   w = matmul(A,v, option='m1', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.2')

   w = matmul(A,v, option='m2', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.3')

   w = matmul(A,v, option='m3', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.4')

   w = matmul(A,v, option='m4', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.5')

   w = matmul(A,v, option='m5', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.6')

   w = matmul(A,v, option='m6', coarray=.true.)
   if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.7')

   ! w = matmul(A,v, option='m7', coarray=.true.)
   ! if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.8')

   ! w = matmul(A,v, option='m8', coarray=.true.)
   ! if (im==1) call ut%check(w, w_ref, tol=1e-5_rk, msg='test_matmul14.9')

end program test_matmul14