Commit a0ed7d18 authored by Andreas Marek's avatar Andreas Marek
Browse files

Update test code, in order to allow automatic test

As in ELPA_2011.12 the files in ./test now
check for the size of the residual and orthogonality and either
return exit code 0, or 1. Needed for automake check target
parent 780e4570
...@@ -65,7 +65,8 @@ program test_complex ...@@ -65,7 +65,8 @@ program test_complex
! nblk: Blocking factor in block cyclic distribution ! nblk: Blocking factor in block cyclic distribution
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
integer, parameter :: na = 4000, nev = 1500, nblk = 16 integer :: nblk
integer na, nev
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Local Variables ! Local Variables
...@@ -85,14 +86,33 @@ program test_complex ...@@ -85,14 +86,33 @@ program test_complex
complex*16, parameter :: CZERO = (0.d0,0.d0), CONE = (1.d0,0.d0) complex*16, parameter :: CZERO = (0.d0,0.d0), CONE = (1.d0,0.d0)
integer :: iseed(4096) ! Random seed, size should be sufficient for every generator integer :: iseed(4096) ! Random seed, size should be sufficient for every generator
integer :: STATUS
!-------------------------------------------------------------------------------
! Parse command line argumnents, if given
character*16 arg1
character*16 arg2
character*16 arg3
nblk = 16
na = 4000
nev = 1500
if (iargc() == 3) then
call getarg(1, arg1)
call getarg(2, arg2)
call getarg(3, arg3)
read(arg1, *) na
read(arg2, *) nev
read(arg3, *) nblk
endif
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! MPI Initialization ! MPI Initialization
call mpi_init(mpierr) call mpi_init(mpierr)
call mpi_comm_rank(mpi_comm_world,myid,mpierr) call mpi_comm_rank(mpi_comm_world,myid,mpierr)
call mpi_comm_size(mpi_comm_world,nprocs,mpierr) call mpi_comm_size(mpi_comm_world,nprocs,mpierr)
STATUS = 0
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Selection of number of processor rows/columns ! Selection of number of processor rows/columns
! We try to set up the grid square-like, i.e. start the search for possible ! We try to set up the grid square-like, i.e. start the search for possible
...@@ -261,6 +281,9 @@ program test_complex ...@@ -261,6 +281,9 @@ program test_complex
if(myid==0) print * if(myid==0) print *
if(myid==0) print *,'Error Residual :',errmax if(myid==0) print *,'Error Residual :',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
! 2. Eigenvector orthogonality ! 2. Eigenvector orthogonality
! tmp1 = Z**T * Z ! tmp1 = Z**T * Z
...@@ -278,14 +301,17 @@ program test_complex ...@@ -278,14 +301,17 @@ program test_complex
err = maxval(abs(tmp1)) err = maxval(abs(tmp1))
call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr) call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr)
if(myid==0) print *,'Error Orthogonality:',errmax if(myid==0) print *,'Error Orthogonality:',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
deallocate(z) deallocate(z)
deallocate(tmp1) deallocate(tmp1)
deallocate(tmp2) deallocate(tmp2)
deallocate(ev) deallocate(ev)
call mpi_finalize(mpierr) call mpi_finalize(mpierr)
call EXIT(STATUS)
end end
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -66,7 +66,7 @@ program test_complex2 ...@@ -66,7 +66,7 @@ program test_complex2
! nblk: Blocking factor in block cyclic distribution ! nblk: Blocking factor in block cyclic distribution
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
integer, parameter :: nblk = 16 integer :: nblk
integer na, nev integer na, nev
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -88,19 +88,23 @@ program test_complex2 ...@@ -88,19 +88,23 @@ program test_complex2
integer :: iseed(4096) ! Random seed, size should be sufficient for every generator integer :: iseed(4096) ! Random seed, size should be sufficient for every generator
integer :: STATUS
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Pharse command line argumnents, if given ! Parse command line argumnents, if given
character*16 arg1 character*16 arg1
character*16 arg2 character*16 arg2
character*16 arg3
nblk = 16
na = 4000 na = 4000
nev = 1500 nev = 1500
if (iargc() == 2) then if (iargc() == 3) then
call getarg(1, arg1) call getarg(1, arg1)
call getarg(2, arg2) call getarg(2, arg2)
call getarg(3, arg3)
read(arg1, *) na read(arg1, *) na
read(arg2, *) nev read(arg2, *) nev
read(arg3, *) nblk
endif endif
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -110,6 +114,7 @@ program test_complex2 ...@@ -110,6 +114,7 @@ program test_complex2
call mpi_comm_rank(mpi_comm_world,myid,mpierr) call mpi_comm_rank(mpi_comm_world,myid,mpierr)
call mpi_comm_size(mpi_comm_world,nprocs,mpierr) call mpi_comm_size(mpi_comm_world,nprocs,mpierr)
STATUS = 0
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Selection of number of processor rows/columns ! Selection of number of processor rows/columns
! We try to set up the grid square-like, i.e. start the search for possible ! We try to set up the grid square-like, i.e. start the search for possible
...@@ -251,6 +256,10 @@ program test_complex2 ...@@ -251,6 +256,10 @@ program test_complex2
if(myid==0) print * if(myid==0) print *
if(myid==0) print *,'Error Residual :',errmax if(myid==0) print *,'Error Residual :',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
! 2. Eigenvector orthogonality ! 2. Eigenvector orthogonality
! tmp1 = Z**T * Z ! tmp1 = Z**T * Z
...@@ -269,13 +278,17 @@ program test_complex2 ...@@ -269,13 +278,17 @@ program test_complex2
call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr) call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr)
if(myid==0) print *,'Error Orthogonality:',errmax if(myid==0) print *,'Error Orthogonality:',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
deallocate(z) deallocate(z)
deallocate(tmp1) deallocate(tmp1)
deallocate(tmp2) deallocate(tmp2)
deallocate(ev) deallocate(ev)
call mpi_finalize(mpierr) call mpi_finalize(mpierr)
call EXIT(STATUS)
end end
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -65,8 +65,9 @@ program test_real ...@@ -65,8 +65,9 @@ program test_real
! nev: Number of eigenvectors to be calculated ! nev: Number of eigenvectors to be calculated
! nblk: Blocking factor in block cyclic distribution ! nblk: Blocking factor in block cyclic distribution
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
integer :: nblk
integer, parameter :: na = 4000, nev = 1500, nblk = 16 integer na, nev
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Local Variables ! Local Variables
...@@ -83,6 +84,27 @@ program test_real ...@@ -83,6 +84,27 @@ program test_real
integer :: iseed(4096) ! Random seed, size should be sufficient for every generator integer :: iseed(4096) ! Random seed, size should be sufficient for every generator
integer :: STATUS
!-------------------------------------------------------------------------------
! Parse command line argumnents, if given
character*16 arg1
character*16 arg2
character*16 arg3
nblk = 16
na = 4000
nev = 1500
if (iargc() == 3) then
call getarg(1, arg1)
call getarg(2, arg2)
call getarg(3, arg3)
read(arg1, *) na
read(arg2, *) nev
read(arg3, *) nblk
endif
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! MPI Initialization ! MPI Initialization
...@@ -96,6 +118,9 @@ program test_real ...@@ -96,6 +118,9 @@ program test_real
! divisors of nprocs with a number next to the square root of nprocs ! divisors of nprocs with a number next to the square root of nprocs
! and decrement it until a divisor is found. ! and decrement it until a divisor is found.
STATUS = 0
do np_cols = NINT(SQRT(REAL(nprocs))),2,-1 do np_cols = NINT(SQRT(REAL(nprocs))),2,-1
if(mod(nprocs,np_cols) == 0 ) exit if(mod(nprocs,np_cols) == 0 ) exit
enddo enddo
...@@ -252,6 +277,12 @@ program test_real ...@@ -252,6 +277,12 @@ program test_real
if(myid==0) print * if(myid==0) print *
if(myid==0) print *,'Error Residual :',errmax if(myid==0) print *,'Error Residual :',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
! 2. Eigenvector orthogonality ! 2. Eigenvector orthogonality
! tmp1 = Z**T * Z ! tmp1 = Z**T * Z
...@@ -270,6 +301,10 @@ program test_real ...@@ -270,6 +301,10 @@ program test_real
call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr) call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr)
if(myid==0) print *,'Error Orthogonality:',errmax if(myid==0) print *,'Error Orthogonality:',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
deallocate(z) deallocate(z)
deallocate(tmp1) deallocate(tmp1)
deallocate(tmp2) deallocate(tmp2)
...@@ -277,6 +312,9 @@ program test_real ...@@ -277,6 +312,9 @@ program test_real
call mpi_finalize(mpierr) call mpi_finalize(mpierr)
call EXIT(STATUS)
end end
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -67,7 +67,7 @@ program test_real2 ...@@ -67,7 +67,7 @@ program test_real2
! nblk: Blocking factor in block cyclic distribution ! nblk: Blocking factor in block cyclic distribution
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
integer, parameter :: nblk = 16 integer :: nblk
integer na, nev integer na, nev
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -84,20 +84,25 @@ program test_real2 ...@@ -84,20 +84,25 @@ program test_real2
real*8, allocatable :: a(:,:), z(:,:), tmp1(:,:), tmp2(:,:), as(:,:), ev(:) real*8, allocatable :: a(:,:), z(:,:), tmp1(:,:), tmp2(:,:), as(:,:), ev(:)
integer :: iseed(4096) ! Random seed, size should be sufficient for every generator integer :: iseed(4096) ! Random seed, size should be sufficient for every generator
integer :: STATUS
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Pharse command line argumnents, if given ! Parse command line argumnents, if given
character*16 arg1 character*16 arg1
character*16 arg2 character*16 arg2
character*16 arg3
nblk = 16
na = 4000 na = 4000
nev = 1500 nev = 1500
if (iargc() == 2) then if (iargc() == 3) then
call getarg(1, arg1) call getarg(1, arg1)
call getarg(2, arg2) call getarg(2, arg2)
call getarg(3, arg3)
read(arg1, *) na read(arg1, *) na
read(arg2, *) nev read(arg2, *) nev
read(arg3, *) nblk
endif endif
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
...@@ -107,6 +112,7 @@ program test_real2 ...@@ -107,6 +112,7 @@ program test_real2
call mpi_comm_rank(mpi_comm_world,myid,mpierr) call mpi_comm_rank(mpi_comm_world,myid,mpierr)
call mpi_comm_size(mpi_comm_world,nprocs,mpierr) call mpi_comm_size(mpi_comm_world,nprocs,mpierr)
STATUS = 0
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
! Selection of number of processor rows/columns ! Selection of number of processor rows/columns
! We try to set up the grid square-like, i.e. start the search for possible ! We try to set up the grid square-like, i.e. start the search for possible
...@@ -272,6 +278,10 @@ program test_real2 ...@@ -272,6 +278,10 @@ program test_real2
if(myid==0) print * if(myid==0) print *
if(myid==0) print *,'Error Residual :',errmax if(myid==0) print *,'Error Residual :',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
! 2. Eigenvector orthogonality ! 2. Eigenvector orthogonality
! tmp1 = Z**T * Z ! tmp1 = Z**T * Z
...@@ -289,6 +299,10 @@ program test_real2 ...@@ -289,6 +299,10 @@ program test_real2
err = maxval(abs(tmp1)) err = maxval(abs(tmp1))
call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr) call mpi_allreduce(err,errmax,1,MPI_REAL8,MPI_MAX,MPI_COMM_WORLD,mpierr)
if(myid==0) print *,'Error Orthogonality:',errmax if(myid==0) print *,'Error Orthogonality:',errmax
if (errmax .gt. 5e-12) then
status = 1
endif
deallocate(z) deallocate(z)
deallocate(tmp1) deallocate(tmp1)
...@@ -296,7 +310,7 @@ program test_real2 ...@@ -296,7 +310,7 @@ program test_real2
deallocate(ev) deallocate(ev)
call mpi_finalize(mpierr) call mpi_finalize(mpierr)
call EXIT(STATUS)
end end
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment