Commit c8b27c48 authored by Andreas Marek's avatar Andreas Marek

Template for ELPA 1stage C-interface

parent 0fc5ac33
......@@ -53,6 +53,7 @@ EXTRA_libelpa@SUFFIX@_private_la_DEPENDENCIES = \
src/elpa2_compute_complex_template.X90 \
src/elpa1_template.X90 \
src/elpa2_template.X90 \
src/elpa1_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 \
......@@ -973,6 +974,7 @@ EXTRA_DIST = \
src/elpa2_symm_matrix_allreduce_real_template.X90 \
src/elpa1_template.X90 \
src/elpa2_template.X90 \
src/elpa1_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 \
......
function solve_elpa1_evp_&
&MATH_DATATTYPE&
&_wrapper_&
&PRECISION&
& (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) result(success) bind(C,name="elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
&PRECISION&
&_precision")
use, intrinsic :: iso_c_binding
use elpa1
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
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 */
#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
successFortran = elpa_solve_evp_&
&MATH_DATATYPE&
&_1stage_&
&PRECISION &
& (na, nev, a, lda, ev, q, ldq, nblk, matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
if (successFortran) then
success = 1
else
success = 0
endif
end function
......@@ -145,71 +145,22 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c>*/
#define DOUBLE_PRECISION_REAL 1
#ifdef DOUBLE_PRECISION_REAL
#define REALCASE 1
#define DOUBLE_PRECISION 1
#include "precision_macros.h"
#if DOUBLE_PRECISION == 1
!c> int elpa_solve_evp_real_1stage_double_precision(int na, int nev, double *a, int lda, double *ev, double *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#else
!c> int elpa_solve_evp_real_1stage_single_precision(int na, int nev, float *a, int lda, float *ev, float *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#endif
#ifdef DOUBLE_PRECISION_REAL
function solve_elpa1_evp_real_wrapper_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_real_1stage_double_precision")
#else
function solve_elpa1_evp_real_wrapper_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_real_1stage_single_precision")
#endif
use, intrinsic :: iso_c_binding
use elpa1
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
#ifdef DOUBLE_PRECISION_REAL
real(kind=c_double) :: ev(1:na)
#ifdef USE_ASSUMED_SIZE
real(kind=c_double) :: a(lda,*), q(ldq,*)
#else
real(kind=c_double) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
#endif
#else /* SINGLE_PRECISION */
real(kind=c_float) :: ev(1:na)
#ifdef USE_ASSUMED_SIZE
real(kind=c_float) :: a(lda,*), q(ldq,*)
#else
real(kind=c_float) :: a(1:lda,1:matrixCols), ev(1:na), q(1:ldq,1:matrixCols)
#endif
#endif
logical :: successFortran
#ifdef DOUBLE_PRECISION_REAL
successFortran = elpa_solve_evp_real_1stage_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#else
successFortran = elpa_solve_evp_real_1stage_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#endif
if (successFortran) then
success = 1
else
success = 0
endif
end function
#include "elpa1_c_interface_template.X90"
#undef REALCASE
#undef DOUBLE_PRECISION
#ifdef WANT_SINGLE_PRECISION_REAL
#undef DOUBLE_PRECISION_REAL
!c> /*! \brief C interface to solve the single-precision real eigenvalue problem with 1-stage solver
!c> *
!c> * \param na Order of matrix a
......@@ -233,58 +184,22 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c>*/
#ifdef DOUBLE_PRECISION_REAL
#define REALCASE 1
#undef DOUBLE_PRECISION
#define SINGLE_PRECISION 1
#include "precision_macros.h"
#if DOUBLE_PRECISION == 1
!c> int elpa_solve_evp_real_1stage_double_precision(int na, int nev, double *a, int lda, double *ev, double *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#else
!c> int elpa_solve_evp_real_1stage_single_precision(int na, int nev, float *a, int lda, float *ev, float *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#endif
#ifdef DOUBLE_PRECISION_REAL
function solve_elpa1_evp_real_wrapper_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
ueGPU) &
result(success) bind(C,name="elpa_solve_evp_real_1stage_double_precision")
#else
function solve_elpa1_evp_real_wrapper_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_real_1stage_single_precision")
#endif
use, intrinsic :: iso_c_binding
use elpa1
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
#ifdef DOUBLE_PRECISION_REAL
real(kind=c_double) :: a(1:lda,1:matrixCols), ev(1:na), q(1:ldq,1:matrixCols)
#else
real(kind=c_float) :: a(1:lda,1:matrixCols), ev(1:na), q(1:ldq,1:matrixCols)
#endif
logical :: successFortran
#ifdef DOUBLE_PRECISION_REAL
successFortran = elpa_solve_evp_real_1stage_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#else
successFortran = elpa_solve_evp_real_1stage_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#endif
if (successFortran) then
success = 1
else
success = 0
endif
end function
#include "elpa1_c_interface_template.X90"
#undef SINGLE_PRECISION
#undef REALCASE
#endif /* WANT_SINGLE_PRECISION_REAL */
!c> /*! \brief C interface to solve the double-precision complex eigenvalue problem with 1-stage solver
!c> *
!c> * \param na Order of matrix a
......@@ -308,67 +223,20 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c> */
#define DOUBLE_PRECISION_COMPLEX 1
#ifdef DOUBLE_PRECISION_COMPLEX
!c> int elpa_solve_evp_complex_1stage_double_precision(int na, int nev, double complex *a, int lda, double *ev, double complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#else
!c> int elpa_solve_evp_complex_1stage_single_precision(int na, int nev, complex *a, int lda, float *ev, complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#endif
#ifdef DOUBLE_PRECISION_COMPLEX
function solve_evp_real_wrapper_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_complex_1stage_double_precision")
#else
function solve_evp_real_wrapper_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_complex_1stage_single_precision")
#endif
use, intrinsic :: iso_c_binding
use elpa1
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
#ifdef DOUBLE_PRECISION_COMPLEX
real(kind=c_double) :: ev(1:na)
#ifdef USE_ASSUMED_SIZE
complex(kind=c_double_complex) :: a(lda,*), q(ldq,*)
#else
complex(kind=c_double_complex) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
#endif
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
#include "precision_macros.h"
#else /* SINGLE_PRECISION */
real(kind=c_float) :: ev(1:na)
#ifdef USE_ASSUMED_SIZE
complex(kind=c_float_complex) :: a(lda,*), q(ldq,*)
#else
complex(kind=c_float_complex) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
#endif
#endif
logical :: successFortran
#ifdef DOUBLE_PRECISION_COMPLEX
successFortran = elpa_solve_evp_complex_1stage_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#if DOUBLE_PRECISION == 1
!c> int elpa_solve_evp_complex_1stage_double_precision(int na, int nev, double complex *a, int lda, double *ev, double complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#else
successFortran = elpa_solve_evp_complex_1stage_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
!c> int elpa_solve_evp_complex_1stage_single_precision(int na, int nev, complex *a, int lda, float *ev, complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#endif
if (successFortran) then
success = 1
else
success = 0
endif
end function
#include "elpa1_c_interface_template.X90"
#undef COMPLEXCASE
#undef DOUBLE_PRECISION
#ifdef WANT_SINGLE_PRECISION_COMPLEX
......@@ -395,58 +263,21 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c> */
#undef DOUBLE_PRECISION_COMPLEX
#ifdef DOUBLE_PRECISION_COMPLEX
#define COMPLEXCASE 1
#undef DOUBLE_PRECISION
#define SINGLE_PRECISION
#include "precision_macros.h"
#if DOUBLE_PRECISION == 1
!c> int elpa_solve_evp_complex_1stage_double_precision(int na, int nev, double complex *a, int lda, double *ev, double complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#else
!c> int elpa_solve_evp_complex_1stage_single_precision(int na, int nev, complex *a, int lda, float *ev, complex *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int useGPU);
#endif
#ifdef DOUBLE_PRECISION_COMPLEX
function solve_evp_real_wrapper_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_complex_1stage_double_precision")
#else
function solve_evp_real_wrapper_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU) &
result(success) bind(C,name="elpa_solve_evp_complex_1stage_single_precision")
#endif
use, intrinsic :: iso_c_binding
use elpa1
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
#ifdef DOUBLE_PRECISION_COMPLEX
complex(kind=c_double_complex) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
real(kind=c_double) :: ev(1:na)
#else
complex(kind=c_float_complex) :: a(1:lda,1:matrixCols), q(1:ldq,1:matrixCols)
real(kind=c_float) :: ev(1:na)
#endif
logical :: successFortran
#ifdef DOUBLE_PRECISION_COMPLEX
successFortran = elpa_solve_evp_complex_1stage_double(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#else
successFortran = elpa_solve_evp_complex_1stage_single(na, nev, a, lda, ev, q, ldq, nblk, &
matrixCols, mpi_comm_rows, mpi_comm_cols, mpi_comm_all, &
useGPU == 1)
#endif
if (successFortran) then
success = 1
else
success = 0
endif
end function
#include "elpa1_c_interface_template.X90"
#undef SINGLE_PRECISION
#undef COMPLEXCASE
#endif /* WANT_SINGLE_PRECISION_COMPLEX */
......@@ -476,6 +307,7 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c> */
#undef DOUBLE_PRECISION_REAL
#define DOUBLE_PRECISION_REAL 1
#ifdef DOUBLE_PRECISION_REAL
!c> int elpa_solve_evp_real_2stage_double_precision(int na, int nev, double *a, int lda, double *ev, double *q, int ldq, int nblk, int matrixCols, int mpi_comm_rows, int mpi_comm_cols, int mpi_comm_all, int THIS_REAL_ELPA_KERNEL_API, int useQR, int useGPU);
......@@ -673,6 +505,7 @@
!c> *
!c> * \result int: 1 if error occured, otherwise 0
!c> */
#undef DOUBLE_PRECISION_COMPLEX
#define DOUBLE_PRECISION_COMPLEX 1
#ifdef DOUBLE_PRECISION_COMPLEX
......
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