Commit d5e99096 authored by Andreas Marek's avatar Andreas Marek

Template for ELPA driver C-interface

parent bb404e4a
......@@ -51,10 +51,11 @@ EXTRA_libelpa@SUFFIX@_private_la_DEPENDENCIES = \
src/elpa1_compute_template.X90 \
src/elpa2_compute_real_template.X90 \
src/elpa2_compute_complex_template.X90 \
src/elpa1_template.X90 \
src/elpa2_template.X90 \
src/elpa1_c_interface_template.X90 \
src/elpa2_c_interface_template.X90 \
src/elpa1_template.X90 \
src/elpa2_template.X90 \
src/elpa1_c_interface_template.X90 \
src/elpa2_c_interface_template.X90 \
src/elpa_driver_c_interface_template.X90 \
src/elpa2_bandred_template.X90 \
src/elpa2_symm_matrix_allreduce_real_template.X90 \
src/elpa2_trans_ev_band_to_full_template.X90 \
......@@ -977,6 +978,7 @@ EXTRA_DIST = \
src/elpa2_template.X90 \
src/elpa1_c_interface_template.X90 \
src/elpa2_c_interface_template.X90 \
src/elpa_driver_c_interface_template.X90 \
src/elpa2_tridiag_band_template.X90 \
src/elpa2_trans_ev_band_to_full_template.X90 \
src/elpa2_trans_ev_tridi_to_band_template.X90 \
......
This diff is collapsed.
function elpa_solve_evp_&
&MATH_DATATYPE&
&_wrapper_&
&PRECISION&
& (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
#if REALCASE == 1
THIS_REAL_ELPA_KERNEL_API, useQR, &
#endif
#if COMPLEXCASE == 1
THIS_COMPLEX_ELPA_KERNEL_API, &
#endif
useGPU, method) result(success) bind(C,name="elpa_solve_evp_&
&MATH_DATATYPE&
&_&
&PRECISION&
&")
use, intrinsic :: iso_c_binding
use elpa, only : elpa_solve_evp_&
&MATH_DATATYPE&
&_&
&PRECISION
implicit none
integer(kind=c_int) :: success
integer(kind=c_int), value, intent(in) :: na, nev, lda, ldq, nblk, matrixCols, mpi_comm_cols, mpi_comm_rows, &
mpi_comm_all
integer(kind=c_int), value, intent(in) :: useGPU
#if REALCASE == 1
integer(kind=c_int), value, intent(in) :: THIS_REAL_ELPA_KERNEL_API, useQR
#endif
#if COMPLEXCASE == 1
integer(kind=c_int), value, intent(in) :: THIS_COMPLEX_ELPA_KERNEL_API
#endif
real(kind=C_DATATYPE_KIND) :: ev(1:na)
#if REALCASE == 1
#ifdef USE_ASSUMED_SIZE
real(kind=C_DATATYPE_KIND) :: a(lda,*), q(ldq,*)
#else
real(kind=C_DATATYPE_KIND) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
#endif
#endif /* REALCASE == 1 */
#if COMPLEXCASE == 1
#ifdef USE_ASSUMED_SIZE
complex(kind=C_DATATYPE_KIND) :: a(lda,*), q(ldq,*)
#else
complex(kind=C_DATATYPE_KIND) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
#endif
#endif /* COMPLEXCASE == 1 */
logical :: successFortran, useQRFortran
character(kind=c_char,len=1), intent(in) :: method(*)
character(len=6) :: methodFortran
integer(kind=c_int) :: charCount
#if REALCASE == 1
if (useQR .eq. 0) then
useQRFortran =.false.
else
useQRFortran = .true.
endif
#endif
charCount = 1
do
if (method(charCount) == c_null_char) exit
charCount = charCount + 1
enddo
charCount = charCount - 1
if (charCount .ge. 1) then
methodFortran(1:charCount) = transfer(method(1:charCount), methodFortran)
successFortran = elpa_solve_evp_&
&MATH_DATATYPE&
&_&
&PRECISION&
& (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
#if REALCASE == 1
THIS_REAL_ELPA_KERNEL_API, useQRFortran, &
#endif
#if COMPLEXCASE == 1
THIS_COMPLEX_ELPA_KERNEL_API, &
#endif
useGPU == 1, methodFortran)
else
successFortran = elpa_solve_evp_&
&MATH_DATATYPE&
&_&
&PRECISION&
& (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
#if REALCASE == 1
THIS_REAL_ELPA_KERNEL_API, useQRFortran, &
#endif
#if COMPLEXCASE == 1
THIS_COMPLEX_ELPA_KERNEL_API, &
#endif
useGPU == 1)
endif
if (successFortran) then
success = 1
else
success = 0
endif
end function
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