Commit e1c2c811 authored by Pavel Kus's avatar Pavel Kus

using cannons algorithm for real singe as well

parent f20ce4de
......@@ -38,7 +38,7 @@ int numroc_(int*, int*, int*, int*, int*);
//***********************************************************************************************************
/*
!f> interface
!f> subroutine cannons_reduction(A, U, local_rows, local_cols, a_desc, Res, toStore, row_comm, col_comm) &
!f> subroutine cannons_reduction_d(A, U, local_rows, local_cols, a_desc, Res, toStore, row_comm, col_comm) &
!f> bind(C, name="cannons_reduction_c_d")
!f> use, intrinsic :: iso_c_binding
!f> real(c_double) :: A(local_rows, local_cols), U(local_rows, local_cols), Res(local_rows, local_cols)
......@@ -52,10 +52,40 @@ int numroc_(int*, int*, int*, int*, int*);
void cannons_reduction_c_d(double* A, double* U, int local_rows, int local_cols, int* a_desc,
double *Res, int ToStore, int row_comm, int col_comm);
#define REALCASE 1
#define SINGLE_PRECISION 1
#include "../general/precision_macros.h"
#include "cannon_forw_template.c"
#undef SINGLE_PRECISION
#undef REALCASE
//***********************************************************************************************************
/*
!f> interface
!f> subroutine cannons_reduction_f(A, U, local_rows, local_cols, a_desc, Res, toStore, row_comm, col_comm) &
!f> bind(C, name="cannons_reduction_c_f")
!f> use, intrinsic :: iso_c_binding
!f> real(c_float) :: A(local_rows, local_cols), U(local_rows, local_cols), Res(local_rows, local_cols)
!f> !type(c_ptr), value :: A, U, Res
!f> integer(kind=c_int) :: a_desc(9)
!f> integer(kind=c_int),value :: local_rows, local_cols
!f> integer(kind=c_int),value :: row_comm, col_comm, ToStore
!f> end subroutine
!f> end interface
*/
void cannons_reduction_c_f(float* A, float* U, int local_rows, int local_cols, int* a_desc,
float *Res, int ToStore, int row_comm, int col_comm);
#else
// Just because of the Intel preprocessor
// TODO do something with it
void cannons_reduction_c_d(double* A, double* U, int local_rows, int local_cols, int* a_desc,
double *Res, int ToStore, int row_comm, int col_comm)
{
}
void cannons_reduction_c_f(float* A, float* U, int local_rows, int local_cols, int* a_desc,
float *Res, int ToStore, int row_comm, int col_comm)
{
}
#endif
This diff is collapsed.
......@@ -34,9 +34,9 @@
call self%timer_start("transform_generalized()")
call self%get("cannon_for_generalized",use_cannon,error)
#if !defined(REALCASE) || !defined(DOUBLE_PRECISION)
#if !defined(REALCASE)
if(my_p == 0) then
write(*,*) "Cannons algorithm can be used only for real double at the moment"
write(*,*) "Cannons algorithm can be used only for real at the moment"
write(*,*) "Switching to elpa Hermitian and scalapack"
end if
use_cannon = 0
......@@ -81,10 +81,12 @@
call self%timer_start("cannons_reduction")
#if defined(REALCASE) && defined(DOUBLE_PRECISION)
#if defined(REALCASE)
! BEWARE! even though tmp is output from the routine, it has to be zero on input!
tmp = 0.0_rck
call cannons_reduction(a, b, self%local_nrows, self%local_ncols, &
call cannons_reduction_&
&ELPA_IMPL_SUFFIX&
&(a, b, self%local_nrows, self%local_ncols, &
sc_desc, tmp, BuffLevelInt, mpi_comm_rows, mpi_comm_cols)
#endif
call self%timer_stop("cannons_reduction")
......
......@@ -11,6 +11,11 @@
#undef REAL_DATATYPE
#undef C_REAL_DATATYPE
#undef C_GEMM
#undef C_LACPY
#undef C_PLACPY
#undef C_PTRAN
#undef PRECISION_TRTRI
#undef PRECISION_POTRF
#undef PRECISION_TRSM
......@@ -48,6 +53,7 @@
#undef MPI_REAL_PRECISION
#undef MPI_MATH_DATATYPE_PRECISION
#undef MPI_MATH_DATATYPE_PRECISION_C
#undef MPI_MATH_DATATYPE_PRECISION_EXPL
#undef C_DATATYPE_KIND
#undef THRESHOLD
......@@ -103,9 +109,15 @@
#define scal_PRECISION_LASET PDLASET
#define MPI_REAL_PRECISION MPI_REAL8
#define MPI_MATH_DATATYPE_PRECISION MPI_REAL8
#define MPI_MATH_DATATYPE_PRECISION_C MPI_DOUBLE
#define MPI_MATH_DATATYPE_PRECISION_EXPL MPI_REAL8
#define C_DATATYPE_KIND c_double
#define C_GEMM dgemm_
#define C_LACPY dlacpy_
#define C_PLACPY pdlacpy_
#define C_PTRAN pdtran_
#define THRESHOLD 1e-11_rk8
#endif /* DOUBLE_PRECISION */
......@@ -157,9 +169,15 @@
#define scal_PRECISION_LASET PSLASET
#define MPI_REAL_PRECISION MPI_REAL4
#define MPI_MATH_DATATYPE_PRECISION MPI_REAL4
#define MPI_MATH_DATATYPE_PRECISION_C MPI_FLOAT
#define MPI_MATH_DATATYPE_PRECISION_EXPL MPI_REAL4
#define C_DATATYPE_KIND c_float
#define C_GEMM sgemm_
#define C_LACPY slacpy_
#define C_PLACPY pslacpy_
#define C_PTRAN pstran_
#define THRESHOLD 1e-4_rk4
#endif /* SINGLE_PRECISION */
......@@ -179,6 +197,11 @@
#undef REAL_DATATYPE
#undef C_REAL_DATATYPE
#undef C_GEMM
#undef C_LACPY
#undef C_PLACPY
#undef C_PTRAN
#undef PRECISION_TRTRI
#undef PRECISION_POTRF
#undef PRECISION_TRSM
......@@ -216,6 +239,7 @@
#undef ELPA_IMPL_SUFFIX
#undef MPI_COMPLEX_PRECISION
#undef MPI_MATH_DATATYPE_PRECISION
#undef MPI_MATH_DATATYPE_PRECISION_C
#undef MPI_MATH_DATATYPE_PRECISION_EXPL
#undef MPI_COMPLEX_EXPLICIT_PRECISION
#undef MPI_REAL_PRECISION
......@@ -244,6 +268,11 @@
#define REAL_DATATYPE RK8
#define C_REAL_DATATYPE c_double
#define C_GEMM zgemm_
#define C_LACPY zlacpy_
#define C_PLACPY pzlacpy_
#define C_PTRAN pztran_
#define PRECISION_TRTRI ZTRTRI
#define PRECISION_POTRF ZPOTRF
#define PRECISION_TRSM ZTRSM
......@@ -278,6 +307,7 @@
#define scal_PRECISION_LASET PZLASET
#define MPI_COMPLEX_PRECISION MPI_DOUBLE_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION MPI_DOUBLE_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION_C MPI_DOUBLE_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION_EXPL MPI_COMPLEX16
#define MPI_COMPLEX_EXPLICIT_PRECISION MPI_COMPLEX16
#define MPI_REAL_PRECISION MPI_REAL8
......@@ -302,6 +332,11 @@
#define REAL_DATATYPE RK4
#define C_REAL_DATATYPE c_float
#define C_GEMM cgemm_
#define C_LACPY clacpy_
#define C_PLACPY pclacpy_
#define C_PTRAN pctran_
#define PRECISION_TRTRI CTRTRI
#define PRECISION_POTRF CPOTRF
#define PRECISION_TRSM CTRSM
......@@ -336,6 +371,7 @@
#define scal_PRECISION_LASET PCLASET
#define MPI_COMPLEX_PRECISION MPI_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION MPI_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION_C MPI_COMPLEX
#define MPI_MATH_DATATYPE_PRECISION_EXPL MPI_COMPLEX8
#define MPI_COMPLEX_EXPLICIT_PRECISION MPI_COMPLEX8
#define MPI_REAL_PRECISION MPI_REAL4
......
#ifdef REALCASE
#ifdef DOUBLE_PRECISION
//typedef double math_type;
#define math_type double
#endif
#ifdef SINGLE_PRECISION
//typedef float math_type;
#define math_type float
#endif
#endif
#ifdef COMPLEXCASE
#ifdef DOUBLE_PRECISION
#endif
#ifdef SINGLE_PRECISION
#endif
#endif
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