Commit 0dd9d3a7 authored by Andreas Marek's avatar Andreas Marek

Introduce test program for all tests

parent 5f0d27a0
......@@ -369,6 +369,7 @@ dist_files_DATA = \
test/Fortran/test_invert_trm_real.F90 \
test/Fortran/test_cholesky_complex.F90 \
test/Fortran/test_invert_trm_complex.F90 \
test/Fortran/elpa_tests.F90 \
src/elpa2_print_kernels.F90
#end needed
......@@ -381,6 +382,7 @@ pkgconfig_DATA = @PKG_CONFIG_FILE@
# programs
bin_PROGRAMS = \
elpa_tests@SUFFIX@ \
elpa2_print_kernels@SUFFIX@
noinst_PROGRAMS = \
......@@ -625,6 +627,10 @@ elpa2_print_kernels@SUFFIX@_SOURCES = src/elpa2_print_kernels.F90
elpa2_print_kernels@SUFFIX@_LDADD = $(build_lib)
elpa2_print_kernels@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
elpa_tests@SUFFIX@_SOURCES = test/Fortran/elpa_tests.F90
elpa_tests@SUFFIX@_LDADD = $(build_lib)
elpa_tests@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
if WANT_SINGLE_PRECISION_REAL
elpa1_test_real_single_precision@SUFFIX@_SOURCES = test/Fortran/test_real_single.F90
elpa1_test_real_single_precision@SUFFIX@_LDADD = $(build_lib)
......@@ -804,6 +810,7 @@ check_SCRIPTS = \
elpa1_complex_invert_trm@SUFFIX@.sh \
elpa1_complex_transpose_multiply@SUFFIX@.sh \
elpa2_print_kernels@SUFFIX@ \
elpa_tests@SUFFIX@.sh \
elpa1_test_real_c_version@SUFFIX@.sh \
elpa1_test_complex_c_version@SUFFIX@.sh \
elpa2_test_real_c_version@SUFFIX@.sh \
......
......@@ -148,7 +148,7 @@
! if kernel is not choosen via api
! check whether set by environment variable
THIS_ELPA_KERNEL = get_actual_&
THIS_ELPA_KERNEL = elpa_get_actual_&
&MATH_DATATYPE&
&_kernel()
endif
......
......@@ -70,7 +70,7 @@ module ELPA2_utilities
! The following routines are public:
public :: get_actual_real_kernel_name, get_actual_complex_kernel_name
public :: elpa_get_actual_real_kernel_name, elpa_get_actual_complex_kernel_name
public :: REAL_ELPA_KERNEL_GENERIC, REAL_ELPA_KERNEL_GENERIC_SIMPLE, &
REAL_ELPA_KERNEL_BGP, REAL_ELPA_KERNEL_BGQ, &
REAL_ELPA_KERNEL_SSE, REAL_ELPA_KERNEL_SSE_BLOCK2, &
......@@ -95,7 +95,7 @@ module ELPA2_utilities
public :: REAL_ELPA_KERNEL_NAMES, COMPLEX_ELPA_KERNEL_NAMES
public :: get_actual_complex_kernel, get_actual_real_kernel
public :: elpa_get_actual_complex_kernel, elpa_get_actual_real_kernel
public :: check_allowed_complex_kernels, check_allowed_real_kernels
......@@ -104,6 +104,10 @@ module ELPA2_utilities
public :: print_available_real_kernels, print_available_complex_kernels
public :: query_available_real_kernels, query_available_complex_kernels
public :: elpa_number_of_real_kernels, elpa_number_of_complex_kernels
public :: elpa_real_kernel_is_available, elpa_complex_kernel_is_available
public :: elpa_real_kernel_name, elpa_complex_kernel_name
public :: qr_decomposition_via_environment_variable
integer, parameter :: number_of_real_kernels = ELPA2_NUMBER_OF_REAL_KERNELS
......@@ -661,6 +665,140 @@ module ELPA2_utilities
!******
contains
function elpa_number_of_real_kernels() result(number)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer :: number
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_number_of_real_kernels")
#endif
number = number_of_real_kernels
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_number_of_real_kernels")
#endif
return
end function
function elpa_number_of_complex_kernels() result(number)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer :: number
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_number_of_complex_kernels")
#endif
number = number_of_complex_kernels
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_number_of_complex_kernels")
#endif
return
end function
function elpa_real_kernel_is_available(THIS_ELPA_REAL_KERNEL) result(available)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer, intent(in) :: THIS_ELPA_REAL_KERNEL
logical :: available
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_real_kernel_is_available")
#endif
available = .false.
if (AVAILABLE_REAL_ELPA_KERNELS(THIS_ELPA_REAL_KERNEL) .eq. 1) then
available = .true.
endif
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_real_kernel_is_available")
#endif
return
end function
function elpa_complex_kernel_is_available(THIS_ELPA_COMPLEX_KERNEL) result(available)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer, intent(in) :: THIS_ELPA_COMPLEX_KERNEL
logical :: available
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_real_kernel_is_available")
#endif
available = .false.
if (AVAILABLE_COMPLEX_ELPA_KERNELS(THIS_ELPA_COMPLEX_KERNEL) .eq. 1) then
available = .true.
endif
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_real_kernel_is_available")
#endif
return
end function
function elpa_real_kernel_name(THIS_ELPA_REAL_KERNEL) result(name)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer, intent(in) :: THIS_ELPA_REAL_KERNEL
character(35) :: name
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_real_kernel_name")
#endif
if (AVAILABLE_REAL_ELPA_KERNELS(THIS_ELPA_REAL_KERNEL) .eq. 1) then
name = trim(REAL_ELPA_KERNEL_NAMES(THIS_ELPA_REAL_KERNEL))
endif
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_real_kernel_name")
#endif
return
end function
function elpa_complex_kernel_name(THIS_ELPA_COMPLEX_KERNEL) result(name)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
implicit none
integer, intent(in) :: THIS_ELPA_COMPLEX_KERNEL
character(35) :: name
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("elpa_complex_kernel_name")
#endif
if (AVAILABLE_COMPLEX_ELPA_KERNELS(THIS_ELPA_COMPLEX_KERNEL) .eq. 1) then
name = trim(COMPLEX_ELPA_KERNEL_NAMES(THIS_ELPA_COMPLEX_KERNEL))
endif
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("elpa_complex_kernel_name")
#endif
return
end function
subroutine print_available_real_kernels
#ifdef HAVE_DETAILED_TIMINGS
use timings
......@@ -681,7 +819,7 @@ module ELPA2_utilities
enddo
write(*,*) " "
write(*,*) " At the moment the following kernel would be choosen:"
write(*,*) get_actual_real_kernel_name()
write(*,*) elpa_get_actual_real_kernel_name()
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("print_available_real_kernels")
......@@ -708,7 +846,7 @@ module ELPA2_utilities
enddo
write(error_unit,*) " "
write(error_unit,*) " At the moment the following kernel would be choosen:"
write(error_unit,*) get_actual_real_kernel_name()
write(error_unit,*) elpa_get_actual_real_kernel_name()
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("query_available_real_kernels")
......@@ -735,7 +873,7 @@ module ELPA2_utilities
enddo
write(*,*) " "
write(*,*) " At the moment the following kernel would be choosen:"
write(*,*) get_actual_complex_kernel_name()
write(*,*) elpa_get_actual_complex_kernel_name()
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("print_available_complex_kernels")
......@@ -762,7 +900,7 @@ module ELPA2_utilities
enddo
write(error_unit,*) " "
write(error_unit,*) " At the moment the following kernel would be choosen:"
write(error_unit,*) get_actual_complex_kernel_name()
write(error_unit,*) elpa_get_actual_complex_kernel_name()
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("query_available_complex_kernels")
......@@ -770,7 +908,7 @@ module ELPA2_utilities
end subroutine query_available_complex_kernels
function get_actual_real_kernel() result(actual_kernel)
function elpa_get_actual_real_kernel() result(actual_kernel)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
......@@ -780,7 +918,7 @@ module ELPA2_utilities
integer(kind=ik) :: actual_kernel
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("get_actual_real_kernel")
call timer%start("elpa_get_actual_real_kernel")
#endif
......@@ -804,12 +942,12 @@ module ELPA2_utilities
!#endif
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("get_actual_real_kernel")
call timer%stop("elpa_get_actual_real_kernel")
#endif
end function get_actual_real_kernel
end function elpa_get_actual_real_kernel
function get_actual_real_kernel_name() result(actual_kernel_name)
function elpa_get_actual_real_kernel_name() result(actual_kernel_name)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
......@@ -820,19 +958,19 @@ module ELPA2_utilities
integer(kind=ik) :: actual_kernel
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("get_actual_real_kernel_name")
call timer%start("elpa_get_actual_real_kernel_name")
#endif
actual_kernel = get_actual_real_kernel()
actual_kernel = elpa_get_actual_real_kernel()
actual_kernel_name = REAL_ELPA_KERNEL_NAMES(actual_kernel)
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("get_actual_real_kernel_name")
call timer%stop("elpa_get_actual_real_kernel_name")
#endif
end function get_actual_real_kernel_name
end function elpa_get_actual_real_kernel_name
function get_actual_complex_kernel() result(actual_kernel)
function elpa_get_actual_complex_kernel() result(actual_kernel)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
......@@ -841,7 +979,7 @@ module ELPA2_utilities
integer(kind=ik) :: actual_kernel
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("get_actual_complex_kernel")
call timer%start("elpa_get_actual_complex_kernel")
#endif
......@@ -866,12 +1004,12 @@ module ELPA2_utilities
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("get_actual_complex_kernel")
call timer%stop("elpa_get_actual_complex_kernel")
#endif
end function get_actual_complex_kernel
end function elpa_get_actual_complex_kernel
function get_actual_complex_kernel_name() result(actual_kernel_name)
function elpa_get_actual_complex_kernel_name() result(actual_kernel_name)
#ifdef HAVE_DETAILED_TIMINGS
use timings
#endif
......@@ -881,17 +1019,17 @@ module ELPA2_utilities
integer(kind=ik) :: actual_kernel
#ifdef HAVE_DETAILED_TIMINGS
call timer%start("get_actual_complex_kernel_name")
call timer%start("elpa_get_actual_complex_kernel_name")
#endif
actual_kernel = get_actual_complex_kernel()
actual_kernel = elpa_get_actual_complex_kernel()
actual_kernel_name = COMPLEX_ELPA_KERNEL_NAMES(actual_kernel)
#ifdef HAVE_DETAILED_TIMINGS
call timer%stop("get_actual_complex_kernel_name")
call timer%stop("elpa_get_actual_complex_kernel_name")
#endif
end function get_actual_complex_kernel_name
end function elpa_get_actual_complex_kernel_name
function check_allowed_real_kernels(THIS_REAL_ELPA_KERNEL) result(err)
#ifdef HAVE_DETAILED_TIMINGS
......
This diff is collapsed.
......@@ -214,7 +214,7 @@ program test_complex2_default_kernel_double_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_complex_kernel_name())," as complex kernel"
print *, " The settings are: ",trim(elpa_get_actual_complex_kernel_name())," as complex kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -214,7 +214,7 @@ program test_complex2_default_kernel_single_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_complex_kernel_name())," as complex kernel"
print *, " The settings are: ",trim(elpa_get_actual_complex_kernel_name())," as complex kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -84,7 +84,7 @@ program test_real2_default_kernel_double_precision
use mod_check_for_gpu, only : check_for_gpu
use elpa_utilities, only : error_unit
use elpa2_utilities, only : get_actual_real_kernel_name
use elpa2_utilities, only : elpa_get_actual_real_kernel_name
use mod_read_input_parameters
use mod_check_correctness
use mod_setup_mpi
......@@ -208,7 +208,7 @@ program test_real2_default_kernel_double_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_real_kernel_name())," as real kernel"
print *, " The settings are: ",trim(elpa_get_actual_real_kernel_name())," as real kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -84,7 +84,7 @@ program test_real2_default_kernel_single_precision
use mod_check_for_gpu, only : check_for_gpu
use elpa_utilities, only : error_unit
use elpa2_utilities, only : get_actual_real_kernel_name
use elpa2_utilities, only : elpa_get_actual_real_kernel_name
use mod_read_input_parameters
use mod_check_correctness
use mod_setup_mpi
......@@ -208,7 +208,7 @@ program test_real2_default_kernel_single_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_real_kernel_name())," as real kernel"
print *, " The settings are: ",trim(elpa_get_actual_real_kernel_name())," as real kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -85,7 +85,7 @@ program test_real2_default_kernel_qr_decomposition_double_precision
use mod_check_for_gpu, only : check_for_gpu
use elpa_utilities, only : error_unit
use elpa2_utilities, only : get_actual_real_kernel_name
use elpa2_utilities, only : elpa_get_actual_real_kernel_name
use mod_read_input_parameters
use mod_check_correctness
use mod_setup_mpi
......@@ -246,7 +246,7 @@ program test_real2_default_kernel_qr_decomposition_double_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_real_kernel_name())," as real kernel"
print *, " The settings are: ",trim(elpa_get_actual_real_kernel_name())," as real kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -85,7 +85,7 @@ program test_real2_default_kernel_qr_decomposition_single_precision
use mod_check_for_gpu, only : check_for_gpu
use elpa_utilities, only : error_unit
use elpa2_utilities, only : get_actual_real_kernel_name
use elpa2_utilities, only : elpa_get_actual_real_kernel_name
use mod_read_input_parameters
use mod_check_correctness
use mod_setup_mpi
......@@ -252,7 +252,7 @@ program test_real2_default_kernel_qr_decomposition_single_precision
#endif
print *, "since the ELPA API call does not contain any kernel specification"
print *
print *, " The settings are: ",trim(get_actual_real_kernel_name())," as real kernel"
print *, " The settings are: ",trim(elpa_get_actual_real_kernel_name())," as real kernel"
print *
#ifdef WITH_ONE_SPECIFIC_COMPLEX_KERNEL
print *," However, this version of ELPA was build with only one of all the available"
......
......@@ -43,9 +43,271 @@
#include "config-f90.h"
module mod_read_input_parameters
use output_types
implicit none
type input_options_t
integer :: datatype
integer :: na, nev, nblk
type(output_t) :: write_to_file
integer :: this_real_kernel, this_complex_kernel
logical :: realKernelIsSet, complexKernelIsSet
integer :: useQrIsSet, useGPUIsSet
logical :: doSolveTridi, do1stage, do2stage
end type
interface read_input_parameters
module procedure read_input_parameters_general
module procedure read_input_parameters_traditional
end interface
contains
subroutine read_input_parameters(na, nev, nblk, write_to_file)
subroutine parse_arguments(command_line_argument, input_options)
use elpa2_utilities
use precision
use output_types
implicit none
type(input_options_t) :: input_options
character(len=128) :: command_line_argument
integer :: kernels
if (command_line_argument == "--help") then
print *,"usage: elpa_unified_test [--help] [datatype={real|complex}] [na=number] [nev=number] "
print *," [nblk=size of block cyclic distribution] [--output_eigenvalues]"
print *," [--output_eigenvectors] [--real-kernel=name_of_kernel]"
print *," [--complex-kernel=name_of_kernel] [--use-gpu={0|1}]"
print *," [--use-qr={0,1}] [--tests={all|solve-tridi|1stage|2stage}]"
endif
if (command_line_argument(1:11) == "--datatype=") then
if (command_line_argument(12:15) == "real") then
input_options%datatype=1
else
if (command_line_argument(12:18) == "complex") then
input_options%datatype=2
else
print *,"datatype unknown! use either --datatype=real or --datatpye=complex"
stop
endif
endif
endif
if (command_line_argument(1:3) == "na=") then
read(command_line_argument(4:), *) input_options%na
endif
if (command_line_argument(1:4) == "nev=") then
read(command_line_argument(5:), *) input_options%nev
endif
if (command_line_argument(1:5) == "nblk=") then
read(command_line_argument(6:), *) input_options%nblk
endif
if (command_line_argument(1:21) == "--output_eigenvectors") then
input_options%write_to_file%eigenvectors = .true.
endif
if (command_line_argument(1:20) == "--output_eigenvalues") then
input_options%write_to_file%eigenvalues = .true.
endif
if (command_line_argument(1:14) == "--real-kernel=") then
do kernels = 1, elpa_number_of_real_kernels()
if ( trim(command_line_argument(15:)) .eq. elpa_real_kernel_name(kernels)) then
input_options%this_real_kernel = kernels
print *,"Setting ELPA2 real kernel to ",elpa_real_kernel_name(kernels)
input_options%realKernelIsSet = .true.
endif
enddo
endif
if (command_line_argument(1:17) == "--complex-kernel=") then
do kernels = 1, elpa_number_of_complex_kernels()
if ( trim(command_line_argument(18:)) .eq. elpa_complex_kernel_name(kernels)) then
input_options%this_complex_kernel = kernels
print *,"Setting ELPA2 complex kernel to ",elpa_complex_kernel_name(kernels)
input_options%realKernelIsSet = .true.
endif
enddo
endif
if (command_line_argument(1:9) == "--use-qr=") then
read(command_line_argument(10:), *) input_options%useQrIsSet
endif
if (command_line_argument(1:10) == "--use-gpu=") then
read(command_line_argument(11:), *) input_options%useGPUIsSet
endif
if (command_line_argument(1:8) == "--tests=") then
if (command_line_argument(9:11) == "all") then
input_options%doSolveTridi=.true.
input_options%do1stage=.true.
input_options%do2stage=.true.
else if (command_line_argument(9:19) == "solve-tride") then
input_options%doSolveTridi=.true.
input_options%do1stage=.false.
input_options%do2stage=.false.
else if (command_line_argument(9:14) == "1stage") then
input_options%doSolveTridi=.false.
input_options%do1stage=.true.
input_options%do2stage=.false.
else if (command_line_argument(9:14) == "2stage") then
input_options%doSolveTridi=.false.
input_options%do1stage=.false.
input_options%do2stage=.true.
else
print *,"unknown test specified"
stop
endif
endif
end subroutine
subroutine read_input_parameters_general(input_options)
use ELPA_utilities, only : error_unit
use precision
use elpa_mpi
use elpa2_utilities
use output_types
implicit none
type(input_options_t) :: input_options
! Command line arguments
character(len=128) :: arg1, arg2, arg3, arg4, arg5, arg6, arg7, arg8, arg9, arg10
integer(kind=ik) :: mpierr, kernels
! default parameters
input_options%datatype = 1
input_options%na = 4000
input_options%nev = 1500
input_options%nblk = 16
input_options%write_to_file%eigenvectors = .false.
input_options%write_to_file%eigenvalues = .false.
input_options%this_real_kernel = DEFAULT_REAL_ELPA_KERNEL
input_options%this_complex_kernel = DEFAULT_COMPLEX_ELPA_KERNEL
input_options%realKernelIsSet = .false.
input_options%complexKernelIsSet = .false.
input_options%useQrIsSet = 0
input_options%useGPUIsSet = 0
input_options%do1Stage = .true.
input_options%do2Stage = .true.
input_options%doSolveTridi = .true.
! test na=1500 nev=50 nblk=16 --help --kernel --output_eigenvectors --output_eigenvalues
if (COMMAND_ARGUMENT_COUNT() .gt. 8) then
write(error_unit, '(a,i0,a)') "Invalid number (", COMMAND_ARGUMENT_COUNT(), ") of command line arguments!"
stop 1
endif
if (COMMAND_ARGUMENT_COUNT() .gt. 0) then
call get_COMMAND_ARGUMENT(1, arg1)
call parse_arguments(arg1, input_options)
if (COMMAND_ARGUMENT_COUNT() .ge. 2) then
! argument 2
call get_COMMAND_ARGUMENT(2, arg2)
call parse_arguments(arg2, input_options)
endif
! argument 3
if (COMMAND_ARGUMENT_COUNT() .ge. 3) then