Commit 4e4a7074 authored by Pavel Kus's avatar Pavel Kus

complex case handled by cannon algorithm as well

parent dbcf4fe0
......@@ -2,6 +2,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <complex.h>
// most of the file is not compiled if not using MPI
#ifdef WITH_MPI
......@@ -58,6 +59,54 @@ void cannons_reduction_c_d(double* A, double* U, int local_rows, int local_cols,
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);
#define COMPLEXCASE 1
#define DOUBLE_PRECISION 1
#include "../general/precision_macros.h"
#include "cannon_forw_template.c"
#undef DOUBLE_PRECISION
#undef COMPLEXCASE
//***********************************************************************************************************
/*
!f> interface
!f> subroutine cannons_reduction_dc(A, U, local_rows, local_cols, a_desc, Res, toStore, row_comm, col_comm) &
!f> bind(C, name="cannons_reduction_c_dc")
!f> use, intrinsic :: iso_c_binding
!f> complex(c_double) :: 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_dc(double complex* A, double complex* U, int local_rows, int local_cols, int* a_desc,
double complex *Res, int ToStore, int row_comm, int col_comm);
#define COMPLEXCASE 1
#define SINGLE_PRECISION 1
#include "../general/precision_macros.h"
#include "cannon_forw_template.c"
#undef SINGLE_PRECISION
#undef COMPLEXCASE
//***********************************************************************************************************
/*
!f> interface
!f> subroutine cannons_reduction_fc(A, U, local_rows, local_cols, a_desc, Res, toStore, row_comm, col_comm) &
!f> bind(C, name="cannons_reduction_c_fc")
!f> use, intrinsic :: iso_c_binding
!f> complex(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_fc(float complex* A, float complex* U, int local_rows, int local_cols, int* a_desc,
float complex *Res, int ToStore, int row_comm, int col_comm);
#else
// Just because of the Intel preprocessor
// TODO do something with it
......@@ -70,4 +119,14 @@ void cannons_reduction_c_f(float* A, float* U, int local_rows, int local_cols, i
float *Res, int ToStore, int row_comm, int col_comm)
{
}
void cannons_reduction_c_dc(double complex* A, double complex* U, int local_rows, int local_cols, int* a_desc,
double complex *Res, int ToStore, int row_comm, int col_comm)
{
}
void cannons_reduction_c_fc(float complex* A, float complex* U, int local_rows, int local_cols, int* a_desc,
float complex *Res, int ToStore, int row_comm, int col_comm)
{
}
#endif
......@@ -34,13 +34,6 @@
call self%timer_start("transform_generalized()")
call self%get("cannon_for_generalized",use_cannon,error)
#if !defined(REALCASE)
if(my_p == 0) then
write(*,*) "Cannons algorithm can be used only for real at the moment"
write(*,*) "Switching to elpa Hermitian and scalapack"
end if
use_cannon = 0
#endif
#if !defined(WITH_MPI)
if(my_p == 0) then
......@@ -81,14 +74,12 @@
call self%timer_start("cannons_reduction")
#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_&
&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")
a(1:self%local_nrows, 1:self%local_ncols) = tmp(1:self%local_nrows, 1:self%local_ncols)
......
......@@ -271,7 +271,7 @@
#define C_GEMM zgemm_
#define C_LACPY zlacpy_
#define C_PLACPY pzlacpy_
#define C_PTRAN pztran_
#define C_PTRAN pztranc_
#define PRECISION_TRTRI ZTRTRI
#define PRECISION_POTRF ZPOTRF
......@@ -335,7 +335,7 @@
#define C_GEMM cgemm_
#define C_LACPY clacpy_
#define C_PLACPY pclacpy_
#define C_PTRAN pctran_
#define C_PTRAN pctranc_
#define PRECISION_TRTRI CTRTRI
#define PRECISION_POTRF CPOTRF
......
#ifdef REALCASE
#ifdef DOUBLE_PRECISION
//typedef double math_type;
#undef math_type
#define math_type double
#endif
#ifdef SINGLE_PRECISION
//typedef float math_type;
#undef math_type
#define math_type float
#endif
#endif
#ifdef COMPLEXCASE
#ifdef DOUBLE_PRECISION
#undef math_type
#define math_type double complex
#endif
#ifdef SINGLE_PRECISION
#undef math_type
#define math_type float complex
#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