Commit ac061bca authored by Lorenz Huedepohl's avatar Lorenz Huedepohl
Browse files

Adapt legacy interface to new API

The legacy API is has been (internally) ported to use the new interface.
The intent is that users of the legacy API do not have to change their
codes.

Next step is to completely adapt the .gitlab-ci.yml file
parent 8ed932f5
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
...@@ -547,8 +547,8 @@ dnl Deal with --with-fixed-[real|complex]-kernel arguments ...@@ -547,8 +547,8 @@ dnl Deal with --with-fixed-[real|complex]-kernel arguments
m4_foreach_w([elpa_m4_kind],[real complex],[ m4_foreach_w([elpa_m4_kind],[real complex],[
AC_ARG_WITH([fixed-]elpa_m4_kind[-kernel], m4_expand([AS_HELP_STRING([--with-fixed-]elpa_m4_kind[-kernel]=KERNEL, AC_ARG_WITH([fixed-]elpa_m4_kind[-kernel], m4_expand([AS_HELP_STRING([--with-fixed-]elpa_m4_kind[-kernel]=KERNEL,
[compile with only a single specific ]elpa_m4_kind[ kernel. Available kernels are:] [compile with only a single specific ]elpa_m4_kind[ kernel. Available kernels are:]
m4_expand(elpa_m4_[]elpa_m4_kind[]_kernels))]), m4_foreach_w([elpa_m4_kernel],m4_expand(elpa_m4_[]elpa_m4_kind[]_kernels),[m4_bpatsubst(elpa_m4_kernel,elpa_m4_kind[]_,[]) ]))]),
[fixed_]elpa_m4_kind[_kernel="$withval"],[fixed_]elpa_m4_kind[_kernel=""]) [fixed_]elpa_m4_kind[_kernel="]elpa_m4_kind[_$withval"],[fixed_]elpa_m4_kind[_kernel=""])
if test -n "$fixed_[]elpa_m4_kind[]_kernel" ; then if test -n "$fixed_[]elpa_m4_kind[]_kernel" ; then
m4_foreach_w([elpa_m4_otherkernel],m4_expand(elpa_m4_[]elpa_m4_kind[]_kernels),[ m4_foreach_w([elpa_m4_otherkernel],m4_expand(elpa_m4_[]elpa_m4_kind[]_kernels),[
if test "$fixed_]elpa_m4_kind[_kernel" = "]elpa_m4_otherkernel[" ; then if test "$fixed_]elpa_m4_kind[_kernel" = "]elpa_m4_otherkernel[" ; then
......
...@@ -29,9 +29,9 @@ elpa/elpa_generated_fortran_interfaces.h: $(wildcard $(top_srcdir)/src/elpa2/ker ...@@ -29,9 +29,9 @@ elpa/elpa_generated_fortran_interfaces.h: $(wildcard $(top_srcdir)/src/elpa2/ker
$(call extract_interface,#!f>) $(call extract_interface,#!f>)
src/fortran_constants.X90: $(top_srcdir)/src/fortran_constants.h src/fortran_constants.X90: $(top_srcdir)/src/fortran_constants.h
$(CPP) $(CPPFLAGS) -I$(top_builddir)/ -I$(top_srcdir)/ -I. $< -o $@_ || { rm -f $@; exit 1; } @$(CPP) $(CPPFLAGS) -I$(top_builddir)/ -I$(top_srcdir)/ -I. $< -o $@_ || { rm -f $@; exit 1; }
awk '/!ELPA_C_DEFINE/ {gsub(/!ELPA_C_DEFINE/, "\n"); gsub(/NEWLINE/, "\n"); print;}' < $@_ > $@ || { rm -f $@; exit 1; } @awk '/!ELPA_C_DEFINE/ {gsub(/!ELPA_C_DEFINE/, "\n"); gsub(/NEWLINE/, "\n"); print;}' < $@_ > $@ || { rm -f $@; exit 1; }
rm $@_ @rm $@_
generated_headers= config-f90.h elpa/elpa_generated.h test/shared/generated.h elpa/elpa_generated_fortran_interfaces.h src/fortran_constants.X90 generated_headers= config-f90.h elpa/elpa_generated.h test/shared/generated.h elpa/elpa_generated_fortran_interfaces.h src/fortran_constants.X90
......
...@@ -286,11 +286,10 @@ module ELPA1_AUXILIARY ...@@ -286,11 +286,10 @@ module ELPA1_AUXILIARY
#include "../../general/precision_macros.h" #include "../../general/precision_macros.h"
function elpa_cholesky_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, & function elpa_cholesky_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, &
wantDebug) result(success) wantDebug) result(success)
#include "./elpa_cholesky_template_legacy.X90" #include "./elpa_cholesky_template_legacy.X90"
end function
end function elpa_cholesky_real_double
#ifdef WANT_SINGLE_PRECISION_REAL #ifdef WANT_SINGLE_PRECISION_REAL
#define REALCASE 1 #define REALCASE 1
...@@ -314,11 +313,10 @@ module ELPA1_AUXILIARY ...@@ -314,11 +313,10 @@ module ELPA1_AUXILIARY
!> \param wantDebug logical, more debug information on failure !> \param wantDebug logical, more debug information on failure
!> \param succes logical, reports success or failure !> \param succes logical, reports success or failure
function elpa_cholesky_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, & function elpa_cholesky_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, &
wantDebug) result(success) wantDebug) result(success)
#include "./elpa_cholesky_template_legacy.X90" #include "./elpa_cholesky_template_legacy.X90"
end function
end function elpa_cholesky_real_single
#endif /* WANT_SINGLE_PRECSION_REAL */ #endif /* WANT_SINGLE_PRECSION_REAL */
...@@ -339,9 +337,9 @@ module ELPA1_AUXILIARY ...@@ -339,9 +337,9 @@ module ELPA1_AUXILIARY
!> \param mpi_comm_cols MPI communicator for columns !> \param mpi_comm_cols MPI communicator for columns
!> \param wantDebug logical, more debug information on failure !> \param wantDebug logical, more debug information on failure
!> \result succes logical, reports success or failure !> \result succes logical, reports success or failure
function elpa_invert_trm_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_invert_trm_real_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_invert_trm_legacy.X90" #include "./elpa_invert_trm_legacy.X90"
end function elpa_invert_trm_real_double end function
#if WANT_SINGLE_PRECISION_REAL #if WANT_SINGLE_PRECISION_REAL
#define REALCASE 1 #define REALCASE 1
...@@ -364,7 +362,7 @@ module ELPA1_AUXILIARY ...@@ -364,7 +362,7 @@ module ELPA1_AUXILIARY
!> \result succes logical, reports success or failure !> \result succes logical, reports success or failure
function elpa_invert_trm_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_invert_trm_real_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_invert_trm_legacy.X90" #include "./elpa_invert_trm_legacy.X90"
end function elpa_invert_trm_real_single end function
#endif /* WANT_SINGLE_PRECISION_REAL */ #endif /* WANT_SINGLE_PRECISION_REAL */
...@@ -389,10 +387,8 @@ module ELPA1_AUXILIARY ...@@ -389,10 +387,8 @@ module ELPA1_AUXILIARY
!> \param wantDebug logical, more debug information on failure !> \param wantDebug logical, more debug information on failure
!> \result succes logical, reports success or failure !> \result succes logical, reports success or failure
function elpa_cholesky_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_cholesky_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_cholesky_template_legacy.X90" #include "./elpa_cholesky_template_legacy.X90"
end function
end function elpa_cholesky_complex_double
#ifdef WANT_SINGLE_PRECISION_COMPLEX #ifdef WANT_SINGLE_PRECISION_COMPLEX
...@@ -416,10 +412,8 @@ module ELPA1_AUXILIARY ...@@ -416,10 +412,8 @@ module ELPA1_AUXILIARY
!> \param wantDebug logical, more debug information on failure !> \param wantDebug logical, more debug information on failure
!> \result succes logical, reports success or failure !> \result succes logical, reports success or failure
function elpa_cholesky_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_cholesky_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_cholesky_template_legacy.X90" #include "./elpa_cholesky_template_legacy.X90"
end function
end function elpa_cholesky_complex_single
#endif /* WANT_SINGLE_PRECISION_COMPLEX */ #endif /* WANT_SINGLE_PRECISION_COMPLEX */
...@@ -442,9 +436,9 @@ module ELPA1_AUXILIARY ...@@ -442,9 +436,9 @@ module ELPA1_AUXILIARY
!> \param wantDebug logical, more debug information on failure !> \param wantDebug logical, more debug information on failure
!> \result succes logical, reports success or failure !> \result succes logical, reports success or failure
function elpa_invert_trm_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_invert_trm_complex_double(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_invert_trm_legacy.X90" #include "./elpa_invert_trm_legacy.X90"
end function elpa_invert_trm_complex_double end function
#ifdef WANT_SINGLE_PRECISION_COMPLEX #ifdef WANT_SINGLE_PRECISION_COMPLEX
#define COMPLEXCASE 1 #define COMPLEXCASE 1
...@@ -468,7 +462,7 @@ module ELPA1_AUXILIARY ...@@ -468,7 +462,7 @@ module ELPA1_AUXILIARY
function elpa_invert_trm_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success) function elpa_invert_trm_complex_single(na, a, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, wantDebug) result(success)
#include "./elpa_invert_trm_legacy.X90" #include "./elpa_invert_trm_legacy.X90"
end function elpa_invert_trm_complex_single end function
#endif /* WANT_SINGE_PRECISION_COMPLEX */ #endif /* WANT_SINGE_PRECISION_COMPLEX */
......
...@@ -68,7 +68,7 @@ function elpa_solve_evp_& ...@@ -68,7 +68,7 @@ function elpa_solve_evp_&
#endif #endif
use iso_c_binding use iso_c_binding
use elpa_mpi use elpa_mpi
use elpa_type use elpa
implicit none implicit none
integer(kind=c_int), intent(in) :: na, nev, lda, ldq, nblk, matrixCols, mpi_comm_rows, & integer(kind=c_int), intent(in) :: na, nev, lda, ldq, nblk, matrixCols, mpi_comm_rows, &
...@@ -103,7 +103,7 @@ function elpa_solve_evp_& ...@@ -103,7 +103,7 @@ function elpa_solve_evp_&
integer(kind=c_int) :: successInternal integer(kind=c_int) :: successInternal
type(elpa_t) :: e class(elpa_t), pointer :: e
call timer%start("elpa_solve_evp_& call timer%start("elpa_solve_evp_&
&MATH_DATATYPE& &MATH_DATATYPE&
&_1stage_& &_1stage_&
...@@ -120,7 +120,7 @@ function elpa_solve_evp_& ...@@ -120,7 +120,7 @@ function elpa_solve_evp_&
return return
endif endif
e = elpa_allocate() e => elpa_allocate()
call e%set("na", na) call e%set("na", na)
call e%set("nev", nev) call e%set("nev", nev)
...@@ -185,7 +185,7 @@ function elpa_solve_evp_& ...@@ -185,7 +185,7 @@ function elpa_solve_evp_&
time_evp_solve = e%get_double("time_evp_solve") time_evp_solve = e%get_double("time_evp_solve")
time_evp_back = e%get_double("time_evp_back") time_evp_back = e%get_double("time_evp_back")
endif endif
call e%destroy() call elpa_deallocate(e)
call elpa_uninit() call elpa_uninit()
......
...@@ -43,17 +43,14 @@ ...@@ -43,17 +43,14 @@
! the original distribution, the GNU Lesser General Public License. ! the original distribution, the GNU Lesser General Public License.
#include "../../general/sanity.X90" #include "../../general/sanity.X90"
use elpa_type use elpa
! use elpa1_compute
! use elpa_utilities
use elpa_mpi
#ifdef HAVE_DETAILED_TIMINGS #ifdef HAVE_DETAILED_TIMINGS
use timings use timings
#else #else
use timings_dummy use timings_dummy
#endif #endif
use precision use precision
implicit none implicit none
integer(kind=ik) :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols integer(kind=ik) :: na, lda, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols
#if REALCASE == 1 #if REALCASE == 1
...@@ -70,26 +67,12 @@ ...@@ -70,26 +67,12 @@
complex(kind=COMPLEX_DATATYPE) :: a(lda,matrixCols) complex(kind=COMPLEX_DATATYPE) :: a(lda,matrixCols)
#endif #endif
#endif #endif
! integer(kind=ik) :: my_prow, my_pcol, np_rows, np_cols, mpierr integer(kind=ik) :: nev
integer(kind=ik) :: nev
! integer(kind=ik) :: l_cols, l_rows, l_col1, l_row1, l_colx, l_rowx
! integer(kind=ik) :: n, nc, i, info
! integer(kind=ik) :: lcs, lce, lrs, lre
! integer(kind=ik) :: tile_size, l_rows_tile, l_cols_tile
!#if REALCASE == 1
! real(kind=REAL_DATATYPE), allocatable :: tmp1(:), tmp2(:,:), tmatr(:,:), tmatc(:,:)
!#endif
!#if COMPLEXCASE == 1
! complex(kind=COMPLEX_DATATYPE), allocatable :: tmp1(:), tmp2(:,:), tmatr(:,:), tmatc(:,:)
!#endif
logical, intent(in) :: wantDebug logical, intent(in) :: wantDebug
logical :: success logical :: success
integer(kind=ik) :: successInternal integer(kind=ik) :: successInternal
! integer(kind=ik) :: istat
! character(200) :: errorMessage
type(elpa_t) :: e class(elpa_t), pointer :: e
call timer%start("elpa_cholesky_& call timer%start("elpa_cholesky_&
&MATH_DATATYPE& &MATH_DATATYPE&
...@@ -105,7 +88,7 @@ ...@@ -105,7 +88,7 @@
return return
endif endif
e = elpa_allocate() e => elpa_allocate()
call e%set("na", na) call e%set("na", na)
call e%set("nev", nev) call e%set("nev", nev)
...@@ -131,7 +114,7 @@ ...@@ -131,7 +114,7 @@
else else
success =.true. success =.true.
endif endif
call e%destroy() call elpa_deallocate(e)
call elpa_uninit() call elpa_uninit()
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
#include "../../general/sanity.X90" #include "../../general/sanity.X90"
use precision use precision
use elpa_type use elpa
! use elpa1_compute ! use elpa1_compute
! use elpa_utilities ! use elpa_utilities
use elpa_mpi use elpa_mpi
...@@ -96,7 +96,7 @@ ...@@ -96,7 +96,7 @@
! character(200) :: errorMessage ! character(200) :: errorMessage
integer(kind=iK) :: successInternal integer(kind=iK) :: successInternal
type(elpa_t) :: e class(elpa_t), pointer :: e
call timer%start("elpa_invert_trm_& call timer%start("elpa_invert_trm_&
&MATH_DATATYPE& &MATH_DATATYPE&
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
return return
endif endif
e = elpa_allocate() e => elpa_allocate()
call e%set("na", na) call e%set("na", na)
call e%set("local_nrows", lda) call e%set("local_nrows", lda)
...@@ -137,7 +137,7 @@ ...@@ -137,7 +137,7 @@
else else
success =.true. success =.true.
endif endif
call e%destroy() call elpa_deallocate(e)
call elpa_uninit() call elpa_uninit()
......
...@@ -54,7 +54,7 @@ ...@@ -54,7 +54,7 @@
#include "../../general/sanity.X90" #include "../../general/sanity.X90"
use elpa_type use elpa
#ifdef HAVE_DETAILED_TIMINGS #ifdef HAVE_DETAILED_TIMINGS
use timings use timings
#else #else
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
! character(200) :: errorMessage ! character(200) :: errorMessage
logical :: success logical :: success
integer(kind=ik) :: successInternal integer(kind=ik) :: successInternal
type(elpa_t) :: e class(elpa_t), pointer :: e
call timer%start("elpa_mult_at_b_& call timer%start("elpa_mult_at_b_&
&MATH_DATATYPE& &MATH_DATATYPE&
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
return return
endif endif
e = elpa_allocate() e => elpa_allocate()
call e%set("na", na) call e%set("na", na)
call e%set("local_nrows", lda) call e%set("local_nrows", lda)
...@@ -149,7 +149,7 @@ ...@@ -149,7 +149,7 @@
success = .false. success = .false.
return return
endif endif
call e%destroy() call elpa_deallocate(e)
call elpa_uninit() call elpa_uninit()
......
...@@ -75,7 +75,7 @@ ...@@ -75,7 +75,7 @@
logical, intent(in) :: wantDebug logical, intent(in) :: wantDebug
logical :: success logical :: success
integer(kind=iK) :: successInternal integer(kind=iK) :: successInternal
type(elpa_t) :: elpa class(elpa_t), pointer :: obj
call timer%start("elpa_solve_tridi_& call timer%start("elpa_solve_tridi_&
&PRECISION& &PRECISION&
...@@ -88,24 +88,24 @@ ...@@ -88,24 +88,24 @@
success = .false. success = .false.
endif endif
elpa = elpa_allocate() obj => elpa_allocate()
call elpa%set("na", na) call obj%set("na", na)
call elpa%set("nev", nev) call obj%set("nev", nev)
call elpa%set("local_nrows", ldq) call obj%set("local_nrows", ldq)
call elpa%set("local_ncols", matrixCols) call obj%set("local_ncols", matrixCols)
call elpa%set("nblk", nblk) call obj%set("nblk", nblk)
call elpa%set("mpi_comm_rows", mpi_comm_rows) call obj%set("mpi_comm_rows", mpi_comm_rows)
call elpa%set("mpi_comm_cols", mpi_comm_cols) call obj%set("mpi_comm_cols", mpi_comm_cols)
if (elpa%setup() .ne. ELPA_OK) then if (obj%setup() .ne. ELPA_OK) then
print *, "Cannot setup ELPA instance" print *, "Cannot setup ELPA instance"
success = .false. success = .false.
return return
endif endif
call elpa%solve_tridi(d(1:na), e(1:na), q(1:ldq,1:matrixCols), successInternal) call obj%solve_tridi(d(1:na), e(1:na), q(1:ldq,1:matrixCols), successInternal)
if (successInternal .ne. ELPA_OK) then if (successInternal .ne. ELPA_OK) then
print *, "Cannot run solve_tridi" print *, "Cannot run solve_tridi"
...@@ -115,7 +115,7 @@ ...@@ -115,7 +115,7 @@
else else
success =.true. success =.true.
endif endif
call elpa%destroy() call elpa_deallocate(obj)
call elpa_uninit() call elpa_uninit()
......
...@@ -65,8 +65,8 @@ ...@@ -65,8 +65,8 @@
!> Synopsis: print_available_elpa2_kernels !> Synopsis: print_available_elpa2_kernels
!> !>
!> \author A. Marek (MPCDF) !> \author A. Marek (MPCDF)
program print_available_elpa2_kernels
program print_available_elpa2_kernels
use precision use precision
use elpa use elpa
...@@ -74,6 +74,7 @@ program print_available_elpa2_kernels ...@@ -74,6 +74,7 @@ program print_available_elpa2_kernels
integer(kind=ik) :: i integer(kind=ik) :: i
class(elpa_t), pointer :: e class(elpa_t), pointer :: e
integer :: option
if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then if (elpa_init(CURRENT_API_VERSION) /= ELPA_OK) then
print *, "Unsupported ELPA API Version" print *, "Unsupported ELPA API Version"
...@@ -108,7 +109,7 @@ program print_available_elpa2_kernels ...@@ -108,7 +109,7 @@ program print_available_elpa2_kernels
print *, " AVX kernels are optimized for FMA (AVX2)" print *, " AVX kernels are optimized for FMA (AVX2)"
#endif #endif
print * print *
call e%print_options("real_kernel") call print_options(e, "real_kernel")
print * print *
print * print *
...@@ -126,10 +127,25 @@ program print_available_elpa2_kernels ...@@ -126,10 +127,25 @@ program print_available_elpa2_kernels
print *, " AVX kernels are optimized for FMA (AVX2)" print *, " AVX kernels are optimized for FMA (AVX2)"
#endif #endif
print * print *
call e%print_options("complex_kernel") call print_options(e, "complex_kernel")
print * print *
print * print *
call elpa_deallocate(e) call elpa_deallocate(e)
contains
subroutine print_options(e, option_name)
class(elpa_t), intent(in) :: e
character(len=*), intent(in) :: option_name
integer :: i, option
do i = 0, elpa_option_cardinality(option_name) - 1
option = elpa_option_enumerate(option_name, i)
if (e%can_set(option_name, option) == ELPA_OK) then
print *, " ", elpa_int_value_to_string(option_name, option)
endif
end do
end subroutine
end program print_available_elpa2_kernels end program print_available_elpa2_kernels
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
use timings_dummy use timings_dummy
#endif #endif
use iso_c_binding use iso_c_binding
use elpa_type use elpa
use elpa_mpi use elpa_mpi
implicit none implicit none
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
logical :: success logical :: success
integer(kind=c_int) :: successInternal integer(kind=c_int) :: successInternal
type(elpa_t) :: e class(elpa_t), pointer :: e
call timer%start("solve_evp_&