Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
elpa
elpa
Commits
0913a668
Commit
0913a668
authored
May 26, 2015
by
Lorenz Huedepohl
Browse files
Factor-out the command-line handling of the tests
parent
adae127f
Changes
10
Hide whitespace changes
Inline
Side-by-side
test/shared_sources/read_input_parameters.F90
View file @
0913a668
...
...
@@ -45,19 +45,32 @@ module mod_read_input_parameters
contains
subroutine
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
#ifdef HAVE_ISO_FORTRAN_ENV
use
iso_fortran_env
,
only
:
stderr
=>
error_unit
#else
#define stderr 0
#endif
implicit
none
include
'mpif.h'
integer
,
intent
(
out
)
::
na
,
nev
,
nblk
logical
,
intent
(
out
)
::
write_to_file
integer
,
intent
(
inout
)
::
na
,
nev
,
nblk
logical
,
intent
(
inout
)
::
write_to_file
! Command line arguments
character
(
len
=
128
)
::
arg1
,
arg2
,
arg3
,
arg4
integer
::
mpierr
!-------------------------------------------------------------------------------
! Parse command line argumnents, if given
character
*
16
arg1
character
*
16
arg2
character
*
16
arg3
character
*
16
arg4
! default parameters
na
=
4000
nev
=
1500
nblk
=
16
write_to_file
=
.false.
if
(
.not.
any
(
COMMAND_ARGUMENT_COUNT
()
==
[
0
,
3
,
4
]))
then
write
(
stderr
,
'(a,i0,a)'
)
"Invalid number ("
,
COMMAND_ARGUMENT_COUNT
(),
") of command line arguments!"
write
(
stderr
,
*
)
"Expected: program [ [matrix_size num_eigenvalues block_size]
""
output
""
]"
stop
1
endif
if
(
COMMAND_ARGUMENT_COUNT
()
==
3
)
then
call
GET_COMMAND_ARGUMENT
(
1
,
arg1
)
...
...
@@ -77,10 +90,14 @@ module mod_read_input_parameters
read
(
arg1
,
*
)
na
read
(
arg2
,
*
)
nev
read
(
arg3
,
*
)
nblk
endif
if
(
arg4
.eq.
"output"
)
then
write_to_file
=
.true.
if
(
arg4
.eq.
"output"
)
then
write_to_file
=
.true.
else
write
(
stderr
,
*
)
"Invalid value for output flag! Must be
""
output
""
or omitted"
stop
1
endif
endif
end
subroutine
...
...
test/test_complex.F90
View file @
0913a668
...
...
@@ -126,16 +126,11 @@ program test_complex
#endif
logical
::
write_to_file
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
success
=
.true.
write_to_file
=
.false.
nblk
=
16
na
=
4000
nev
=
1500
success
=
.true.
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
...
...
test/test_complex2.F90
View file @
0913a668
...
...
@@ -128,7 +128,6 @@ program test_complex2
complex
*
16
,
allocatable
::
a
(:,:),
z
(:,:),
tmp1
(:,:),
tmp2
(:,:),
as
(:,:)
integer
::
iseed
(
4096
)
! Random seed, size should be sufficient for every generator
integer
::
STATUS
...
...
@@ -140,19 +139,13 @@ program test_complex2
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
! MPI Initialization
...
...
test/test_complex2_choose_kernel_with_api.F90
View file @
0913a668
...
...
@@ -142,19 +142,13 @@ program test_complex2
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
...
...
test/test_complex2_default_kernel.F90
View file @
0913a668
...
...
@@ -140,19 +140,13 @@ program test_complex2
logical
::
write_to_file
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
! MPI Initialization
...
...
test/test_real.F90
View file @
0913a668
...
...
@@ -131,20 +131,13 @@ program test_real
!-------------------------------------------------------------------------------
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
success
=
.true.
write_to_file
=
.false.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
...
...
test/test_real2.F90
View file @
0913a668
...
...
@@ -133,19 +133,13 @@ program test_real2
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
...
...
test/test_real2_choose_kernel_with_api.F90
View file @
0913a668
...
...
@@ -136,21 +136,14 @@ program test_real2
#endif
logical
::
write_to_file
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
...
...
test/test_real2_default_kernel.F90
View file @
0913a668
...
...
@@ -135,19 +135,13 @@ program test_real2
logical
::
write_to_file
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
logical
::
success
success
=
.true.
write_to_file
=
.false.
success
=
.true.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
! MPI Initialization
...
...
test/test_real_with_c.F90
View file @
0913a668
...
...
@@ -136,25 +136,16 @@ program test_real
integer
::
checksWrong
,
checksWrongRecv
#ifndef HAVE_ISO_FORTRAN_ENV
integer
,
parameter
::
error_unit
=
6
integer
,
parameter
::
error_unit
=
6
#endif
logical
::
success
success
=
.true.
write_to_file
=
.false.
nblk
=
16
na
=
4000
nev
=
1500
! read input parameters if they are provided
call
read_input_parameters
(
na
,
nev
,
nblk
,
write_to_file
)
!-------------------------------------------------------------------------------
! MPI Initialization
call
setup_mpi
(
myid
,
nprocs
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment