Commit b0301488 authored by Andreas Marek's avatar Andreas Marek

New interface: chose solver via set method

parent a0f52c60
......@@ -391,9 +391,11 @@ 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/test_new_interface_real.F90 \
test/Fortran/test_new_interface_complex.F90 \
test/Fortran/test_new_interface_real_2stage.F90 \
test/Fortran/test_new_interface_complex_2stage.F90 \
test/Fortran/elpa_tests.F90 \
test/Fortran/test_new_interface_real_1stage.F90 \
test/Fortran/test_new_interface_complex_1stage.F90 \
src/elpa2/elpa2_print_kernels.F90
#end needed
......@@ -436,8 +438,10 @@ noinst_PROGRAMS = \
elpa2_test_real_c_version@SUFFIX@ \
elpa2_test_complex_c_version@SUFFIX@ \
elpa_driver_real_c_version@SUFFIX@ \
elpa_test_new_interface_real@SUFFIX@ \
elpa_test_new_interface_complex@SUFFIX@ \
elpa_test_new_interface_real_2stage@SUFFIX@ \
elpa_test_new_interface_complex_2stage@SUFFIX@ \
elpa_test_new_interface_real_1stage@SUFFIX@ \
elpa_test_new_interface_complex_1stage@SUFFIX@ \
elpa_driver_complex_c_version@SUFFIX@
if WANT_SINGLE_PRECISION_COMPLEX
......@@ -451,7 +455,8 @@ noinst_PROGRAMS += \
elpa1_complex_invert_trm_single_precision@SUFFIX@ \
elpa2_test_complex_api_single_precision@SUFFIX@ \
elpa_driver_complex_c_version_single_precision@SUFFIX@ \
elpa_test_new_interface_complex_single@SUFFIX@
elpa_test_new_interface_complex_single_2stage@SUFFIX@ \
elpa_test_new_interface_complex_single_1stage@SUFFIX@
endif
if WANT_SINGLE_PRECISION_REAL
......@@ -467,7 +472,8 @@ noinst_PROGRAMS += \
elpa1_real_invert_trm_single_precision@SUFFIX@ \
elpa_driver_real_c_version_single_precision@SUFFIX@ \
elpa1_real_toeplitz_single_precision@SUFFIX@ \
elpa_test_new_interface_real_single@SUFFIX@
elpa_test_new_interface_real_single_2stage@SUFFIX@ \
elpa_test_new_interface_real_single_1stage@SUFFIX@
endif
if WITH_GPU_VERSION
......@@ -515,15 +521,25 @@ libelpatest@SUFFIX@_la_SOURCES += \
test/shared/redir.c \
test/shared/redirect.F90
endif
elpa_test_new_interface_real@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real.F90
elpa_test_new_interface_real@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_real_2stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real_2stage.F90
elpa_test_new_interface_real_2stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real_2stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real_2stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_complex@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex.F90
elpa_test_new_interface_complex@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_complex_2stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex_2stage.F90
elpa_test_new_interface_complex_2stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex_2stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex_2stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_real_1stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real_1stage.F90
elpa_test_new_interface_real_1stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real_1stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real_1stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_complex_1stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex_1stage.F90
elpa_test_new_interface_complex_1stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex_1stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex_1stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa1_test_real_c_version@SUFFIX@_SOURCES = test/C/elpa1_test_real_c_version.c
elpa1_test_real_c_version@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
......@@ -671,10 +687,15 @@ 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
elpa_test_new_interface_real_single@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real_single.F90
elpa_test_new_interface_real_single@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real_single@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real_single@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_real_single_2stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real_single_2stage.F90
elpa_test_new_interface_real_single_2stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real_single_2stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real_single_2stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_real_single_1stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_real_single_1stage.F90
elpa_test_new_interface_real_single_1stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_real_single_1stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_real_single_1stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa1_test_real_single_precision@SUFFIX@_SOURCES = test/Fortran/test_real_single.F90
elpa1_test_real_single_precision@SUFFIX@_LDADD = $(build_lib)
......@@ -736,10 +757,15 @@ EXTRA_elpa2_test_real_api_single_precision@SUFFIX@_DEPENDENCIES = test/Fortran/e
endif
if WANT_SINGLE_PRECISION_COMPLEX
elpa_test_new_interface_complex_single@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex_single.F90
elpa_test_new_interface_complex_single@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex_single@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex_single@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_complex_single_2stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex_single_2stage.F90
elpa_test_new_interface_complex_single_2stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex_single_2stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex_single_2stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa_test_new_interface_complex_single_1stage@SUFFIX@_SOURCES = test/Fortran/test_new_interface_complex_single_1stage.F90
elpa_test_new_interface_complex_single_1stage@SUFFIX@_LDADD = $(build_lib) $(FCLIBS)
elpa_test_new_interface_complex_single_1stage@SUFFIX@_FCFLAGS = $(AM_FCFLAGS) @FC_MODOUT@private_modules @FC_MODINC@private_modules
EXTRA_elpa_test_new_interface_complex_single_1stage@SUFFIX@_DEPENDENCIES = test/Fortran/elpa_print_headers.X90
elpa1_test_complex_single_precision@SUFFIX@_SOURCES = test/Fortran/test_complex_single.F90
elpa1_test_complex_single_precision@SUFFIX@_LDADD = $(build_lib)
......@@ -864,8 +890,10 @@ check_SCRIPTS = \
elpa2_test_real_c_version@SUFFIX@.sh \
elpa2_test_complex_c_version@SUFFIX@.sh \
elpa_driver_real_c_version@SUFFIX@.sh \
elpa_test_new_interface_real@SUFFIX@.sh \
elpa_test_new_interface_complex@SUFFIX@.sh \
elpa_test_new_interface_real_2stage@SUFFIX@.sh \
elpa_test_new_interface_complex_2stage@SUFFIX@.sh \
elpa_test_new_interface_real_1stage@SUFFIX@.sh \
elpa_test_new_interface_complex_1stage@SUFFIX@.sh \
elpa_driver_complex_c_version@SUFFIX@.sh
if WANT_SINGLE_PRECISION_REAL
......@@ -880,7 +908,8 @@ check_SCRIPTS += \
elpa1_real_transpose_multiply_single_precision@SUFFIX@.sh \
elpa2_test_real_api_single_precision@SUFFIX@.sh \
elpa_driver_real_c_version_single_precision@SUFFIX@.sh \
elpa_test_new_interface_real_single@SUFFIX@.sh
elpa_test_new_interface_real_single_2stage@SUFFIX@.sh \
elpa_test_new_interface_real_single_1stage@SUFFIX@.sh
endif
if WANT_SINGLE_PRECISION_COMPLEX
......@@ -894,7 +923,8 @@ check_SCRIPTS += \
elpa1_complex_transpose_multiply_single_precision@SUFFIX@.sh \
elpa2_test_complex_api_single_precision@SUFFIX@.sh \
elpa_driver_complex_c_version_single_precision@SUFFIX@.sh \
elpa_test_new_interface_complex_single@SUFFIX@.sh
elpa_test_new_interface_complex_single_2stage@SUFFIX@.sh \
elpa_test_new_interface_complex_single_1stage@SUFFIX@.sh
endif
if WITH_GPU_VERSION
......
......@@ -260,13 +260,33 @@ module elpa_type
real(kind=c_double) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols), &
ev(self%na)
integer, optional :: success
logical :: success_l
success_l = elpa_solve_evp_real_2stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
if (self%get("solver",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_real_1stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_real_2stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else
print *,"unknown solver"
stop
endif
if (present(success)) then
if (success_l) then
......@@ -289,16 +309,36 @@ module elpa_type
implicit none
class(elpa_t) :: self
real(kind=c_float) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols), &
real(kind=c_float) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols), &
ev(self%na)
integer, optional :: success
logical :: success_l
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
#ifdef WANT_SINGLE_PRECISION_REAL
success_l = elpa_solve_evp_real_2stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
if (self%get("solver",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_real_1stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_real_2stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else
print *,"unknown solver"
stop
endif
if (present(success)) then
if (success_l) then
......@@ -326,15 +366,36 @@ module elpa_type
class(elpa_t) :: self
complex(kind=c_double_complex) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
real(kind=c_double) :: ev(self%na)
real(kind=c_double) :: ev(self%na)
integer, optional :: success
logical :: success_l
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
success_l = elpa_solve_evp_complex_2stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
if (self%get("solver",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_complex_1stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_complex_2stage_double_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else
print *,"unknown solver"
stop
endif
if (present(success)) then
if (success_l) then
......@@ -356,19 +417,39 @@ module elpa_type
use iso_c_binding
implicit none
class(elpa_t) :: self
class(elpa_t) :: self
complex(kind=c_float_complex) :: a(self%local_nrows, self%local_ncols), q(self%local_nrows, self%local_ncols)
real(kind=c_float) :: ev(self%na)
real(kind=c_float) :: ev(self%na)
integer, optional :: success
logical :: success_l
integer, optional :: success
integer(kind=c_int) :: success_internal
logical :: success_l
#ifdef WANT_SINGLE_PRECISION_COMPLEX
success_l = elpa_solve_evp_complex_2stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
if (self%get("solver",success_internal) .eq. 1) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_complex_1stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else if (self%get("solver",success_internal) .eq. 2) then
if (success_internal .ne. ELPA_OK) then
print *,"Could not querry solver"
stop
endif
success_l = elpa_solve_evp_complex_2stage_single_new(self%na, self%nev, a, self%local_nrows, ev, q, &
self%local_nrows, self%nblk, self%local_ncols, &
self%mpi_comm_rows, self%mpi_comm_cols, &
self%mpi_comm_parent)
else
print *,"unknown solver"
stop
endif
if (present(success)) then
if (success_l) then
......
! This file is part of ELPA.
!
! The ELPA library was originally created by the ELPA consortium,
! consisting of the following organizations:
!
! - Max Planck Computing and Data Facility (MPCDF), formerly known as
! Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
! - Bergische Universität Wuppertal, Lehrstuhl für angewandte
! Informatik,
! - Technische Universität München, Lehrstuhl für Informatik mit
! Schwerpunkt Wissenschaftliches Rechnen ,
! - Fritz-Haber-Institut, Berlin, Abt. Theorie,
! - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
! Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
! and
! - IBM Deutschland GmbH
!
!
! More information can be found here:
! http://elpa.mpcdf.mpg.de/
!
! ELPA is free software: you can redistribute it and/or modify
! it under the terms of the version 3 of the license of the
! GNU Lesser General Public License as published by the Free
! Software Foundation.
!
! ELPA is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with ELPA. If not, see <http://www.gnu.org/licenses/>
!
! ELPA reflects a substantial effort on the part of the original
! ELPA consortium, and we ask you to respect the spirit of the
! license that we chose: i.e., please contribute any changes you
! may have back to the original ELPA library distribution, and keep
! any derivatives of ELPA under the same license that we chose for
! the original distribution, the GNU Lesser General Public License.
!
!
#include "config-f90.h"
#define stringify_(x) "x"
#define stringify(x) stringify_(x)
#define assert(x) call x_assert(x, stringify(x), __FILE__, __LINE__)
program test_interface
use precision
use assert
use mod_setup_mpi
use elpa_mpi
use elpa_type
use mod_prepare_matrix
use mod_read_input_parameters
use mod_blacs_infrastructure
use mod_check_correctness
implicit none
! matrix dimensions
integer :: na, nev, nblk
! mpi
integer :: myid, nprocs
integer :: na_cols, na_rows ! local matrix size
integer :: np_cols, np_rows ! number of MPI processes per column/row
integer :: my_prow, my_pcol ! local MPI task position (my_prow, my_pcol) in the grid (0..np_cols -1, 0..np_rows -1)
integer :: mpierr
! blacs
integer :: my_blacs_ctxt, sc_desc(9), info, nprow, npcol
! The Matrix
real(kind=C_DOUBLE_COMPLEX), allocatable :: a(:,:), as(:,:)
! eigenvectors
real(kind=C_DOUBLE_COMPLEX), allocatable :: z(:,:)
! eigenvalues
real(kind=C_DOUBLE), allocatable :: ev(:)
integer :: success, status
integer(kind=c_int) :: solver
integer(kind=c_int) :: qr
type(output_t) :: write_to_file
type(elpa_t) :: e
call read_input_parameters(na, nev, nblk, write_to_file)
call setup_mpi(myid, nprocs)
do np_cols = NINT(SQRT(REAL(nprocs))),2,-1
if(mod(nprocs,np_cols) == 0 ) exit
enddo
np_rows = nprocs/np_cols
my_prow = mod(myid, np_cols)
my_pcol = myid / np_cols
call set_up_blacsgrid(mpi_comm_world, my_blacs_ctxt, np_rows, np_cols, &
nprow, npcol, my_prow, my_pcol)
call set_up_blacs_descriptor(na, nblk, my_prow, my_pcol, np_rows, np_cols, &
na_rows, na_cols, sc_desc, my_blacs_ctxt, info)
allocate(a (na_rows,na_cols), as(na_rows,na_cols))
allocate(z (na_rows,na_cols))
allocate(ev(na))
a(:,:) = 0.0
z(:,:) = 0.0
ev(:) = 0.0
call prepare_matrix_double(na, myid, sc_desc, a, z, as)
if (elpa_init(20170403) /= ELPA_OK) then
error stop "ELPA API version not supported"
endif
e = elpa_create(na, nev, na_rows, na_cols, nblk, mpi_comm_world, my_prow, my_pcol, success)
assert(success == ELPA_OK)
qr = e%get("qr", success)
print *, "qr =", qr
assert(success == ELPA_OK)
solver = e%get("solver", success)
print *, "solver =", solver
assert(success == ELPA_OK)
call e%set("solver", ELPA_SOLVER_1STAGE, success)
assert(success == ELPA_OK)
call e%set("complex_kernel", ELPA_2STAGE_COMPLEX_GENERIC, success)
assert(success == ELPA_OK)
call e%solve(a, ev, z, success)
assert(success == ELPA_OK)
call e%destroy()
call elpa_uninit()
status = check_correctness_double(na, nev, as, z, ev, sc_desc, myid)
deallocate(a)
deallocate(as)
deallocate(z)
deallocate(ev)
#ifdef WITH_MPI
call mpi_finalize(mpierr)
#endif
end program
! This file is part of ELPA.
!
! The ELPA library was originally created by the ELPA consortium,
! consisting of the following organizations:
!
! - Max Planck Computing and Data Facility (MPCDF), formerly known as
! Rechenzentrum Garching der Max-Planck-Gesellschaft (RZG),
! - Bergische Universität Wuppertal, Lehrstuhl für angewandte
! Informatik,
! - Technische Universität München, Lehrstuhl für Informatik mit
! Schwerpunkt Wissenschaftliches Rechnen ,
! - Fritz-Haber-Institut, Berlin, Abt. Theorie,
! - Max-Plack-Institut für Mathematik in den Naturwissenschaften,
! Leipzig, Abt. Komplexe Strukutren in Biologie und Kognition,
! and
! - IBM Deutschland GmbH
!
!
! More information can be found here:
! http://elpa.mpcdf.mpg.de/
!
! ELPA is free software: you can redistribute it and/or modify
! it under the terms of the version 3 of the license of the
! GNU Lesser General Public License as published by the Free
! Software Foundation.
!
! ELPA is distributed in the hope that it will be useful,
! but WITHOUT ANY WARRANTY; without even the implied warranty of
! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
! GNU Lesser General Public License for more details.
!
! You should have received a copy of the GNU Lesser General Public License
! along with ELPA. If not, see <http://www.gnu.org/licenses/>
!
! ELPA reflects a substantial effort on the part of the original
! ELPA consortium, and we ask you to respect the spirit of the
! license that we chose: i.e., please contribute any changes you
! may have back to the original ELPA library distribution, and keep
! any derivatives of ELPA under the same license that we chose for
! the original distribution, the GNU Lesser General Public License.
!
!
#include "config-f90.h"
#define stringify_(x) "x"
#define stringify(x) stringify_(x)
#define assert(x) call x_assert(x, stringify(x), __FILE__, __LINE__)
program test_interface
use precision
use assert
use mod_setup_mpi
use elpa_mpi
use elpa_type
use mod_prepare_matrix
use mod_read_input_parameters
use mod_blacs_infrastructure
use mod_check_correctness
implicit none
! matrix dimensions
integer :: na, nev, nblk
! mpi
integer :: myid, nprocs
integer :: na_cols, na_rows ! local matrix size
integer :: np_cols, np_rows ! number of MPI processes per column/row
integer :: my_prow, my_pcol ! local MPI task position (my_prow, my_pcol) in the grid (0..np_cols -1, 0..np_rows -1)
integer :: mpierr
! blacs
integer :: my_blacs_ctxt, sc_desc(9), info, nprow, npcol
! The Matrix
real(kind=C_FLOAT_COMPLEX), allocatable :: a(:,:), as(:,:)
! eigenvectors
real(kind=C_FLOAT_COMPLEX), allocatable :: z(:,:)
! eigenvalues
real(kind=C_FLOAT), allocatable :: ev(:)
integer :: success, status
integer(kind=c_int) :: solver
integer(kind=c_int) :: qr
type(output_t) :: write_to_file
type(elpa_t) :: e
call read_input_parameters(na, nev, nblk, write_to_file)
call setup_mpi(myid, nprocs)
do np_cols = NINT(SQRT(REAL(nprocs))),2,-1
if(mod(nprocs,np_cols) == 0 ) exit
enddo
np_rows = nprocs/np_cols
my_prow = mod(myid, np_cols)
my_pcol = myid / np_cols
call set_up_blacsgrid(mpi_comm_world, my_blacs_ctxt, np_rows, np_cols, &
nprow, npcol, my_prow, my_pcol)
call set_up_blacs_descriptor(na, nblk, my_prow, my_pcol, np_rows, np_cols, &
na_rows, na_cols, sc_desc, my_blacs_ctxt, info)
allocate(a (na_rows,na_cols), as(na_rows,na_cols))
allocate(z (na_rows,na_cols))
allocate(ev(na))
a(:,:) = 0.0
z(:,:) = 0.0
ev(:) = 0.0
call prepare_matrix_single(na, myid, sc_desc, a, z, as)
if (elpa_init(20170403) /= ELPA_OK) then
error stop "ELPA API version not supported"
endif
e = elpa_create(na, nev, na_rows, na_cols, nblk, mpi_comm_world, my_prow, my_pcol, success)
assert(success == ELPA_OK)
qr = e%get("qr", success)
print *, "qr =", qr
assert(success == ELPA_OK)
solver = e%get("solver", success)
print *, "solver =", solver
assert(success == ELPA_OK)