Commit 582fe51f authored by Andreas Marek's avatar Andreas Marek

Use correct complex kind-type for Fortran/C interoperability

parent 98b9e152
......@@ -54,7 +54,7 @@
#include "config-f90.h"
!> \brief Fortran module which provides the routines to the ELPA solver (1 and 2 stage)
module ELPA
use, intrinsic :: iso_c_binding, only : c_double, c_int
use, intrinsic :: iso_c_binding, only : c_double, c_int, c_float, c_float_complex, c_double_complex
use elpa1
use elpa2
......@@ -426,9 +426,9 @@ module ELPA
integer(kind=c_int), intent(in) :: nblk
real(kind=c_double), intent(inout) :: ev(na)
#ifdef USE_ASSUMED_SIZE
complex(kind=c_double), intent(inout) :: a(lda,*), q(ldq,*)
complex(kind=c_double_complex), intent(inout) :: a(lda,*), q(ldq,*)
#else
complex(kind=c_double), intent(inout) :: a(lda,matrixCols), q(ldq,matrixCols)
complex(kind=c_double_complex), intent(inout) :: a(lda,matrixCols), q(ldq,matrixCols)
#endif
integer(kind=c_int), intent(in), optional :: THIS_COMPLEX_ELPA_KERNEL_API
logical, intent(in), optional :: useGPU
......@@ -523,9 +523,9 @@ module ELPA
integer(kind=c_int), intent(in) :: nblk
real(kind=c_float), intent(inout) :: ev(na)
#ifdef USE_ASSUMED_SIZE
complex(kind=c_float), intent(inout) :: a(lda,*), q(ldq,*)
complex(kind=c_float_complex), intent(inout) :: a(lda,*), q(ldq,*)
#else
complex(kind=c_float), intent(inout) :: a(lda,matrixCols), q(ldq,matrixCols)
complex(kind=c_float_complex), intent(inout) :: a(lda,matrixCols), q(ldq,matrixCols)
#endif
integer(kind=c_int), intent(in), optional :: THIS_COMPLEX_ELPA_KERNEL_API
logical, intent(in), optional :: useGPU
......
......@@ -389,7 +389,7 @@
#!f> use, intrinsic :: iso_c_binding
#!f> integer(kind=c_int) :: nb, nq, ldq, ldh
#!f> type(c_ptr), value :: q
#!f> real(kind=c_double) :: hh(nb,6)
#!f> real(kind=c_double_complex) :: hh(nb,6)
#!f> end subroutine
#!f> end interface
#!f>#endif
......@@ -714,8 +714,8 @@ return1:
#!f> subroutine single_hh_trafo_complex_double(q, hh, nb, nq, ldq) bind(C,name="single_hh_trafo_complex_double")
#!f> use, intrinsic :: iso_c_binding
#!f> integer(kind=c_int) :: nb, nq, ldq
#!f> complex(kind=c_double) :: q(*)
#!f> complex(kind=c_double) :: hh(nb,2)
#!f> complex(kind=c_double_complex) :: q(*)
#!f> complex(kind=c_double_complex) :: hh(nb,2)
#!f> end subroutine
#!f> end interface
#!f>#endif
......
......@@ -717,8 +717,8 @@ return1:
# subroutine single_hh_trafo_complex_single(q, hh, nb, nq, ldq)
#
# integer, intent(in) :: nb, nq, ldq
# complex*8, intent(inout) :: q(ldq,*)
# complex*8, intent(in) :: hh(*)
# complex(kind=c_float_complex), intent(inout) :: q(ldq,*)
# complex(kind=c_float_complex), intent(in) :: hh(*)
#
# Parameter mapping to registers
# parameter 1: %rdi : q
......@@ -734,8 +734,8 @@ return1:
#!f> subroutine single_hh_trafo_complex_single(q, hh, nb, nq, ldq) bind(C,name="single_hh_trafo_complex_single")
#!f> use, intrinsic :: iso_c_binding
#!f> integer(kind=c_int) :: nb, nq, ldq
#!f> complex(kind=c_float) :: q(*)
#!f> complex(kind=c_float) :: hh(nb,2)
#!f> complex(kind=c_float_complex) :: q(*)
#!f> complex(kind=c_float_complex) :: hh(nb,2)
#!f> end subroutine
#!f> end interface
#!f>#endif
......
......@@ -94,8 +94,8 @@ static __forceinline void hh_trafo_complex_kernel_4_AVX_1hv_double(double compl
!f> bind(C, name="single_hh_trafo_complex_avx_avx2_1hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -79,8 +79,8 @@ static __forceinline void hh_trafo_complex_kernel_4_AVX_1hv_single(float comple
!f> bind(C, name="single_hh_trafo_complex_avx_avx2_1hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -95,8 +95,8 @@ static __forceinline void hh_trafo_complex_kernel_2_AVX_2hv_double(double comple
!f> bind(C, name="double_hh_trafo_complex_avx_avx2_2hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -80,8 +80,8 @@ static __forceinline void hh_trafo_complex_kernel_4_AVX_2hv_single(float complex
!f> bind(C, name="double_hh_trafo_complex_avx_avx2_2hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -73,8 +73,8 @@ static __forceinline void hh_trafo_complex_kernel_8_AVX512_1hv_double(double co
!f> bind(C, name="single_hh_trafo_complex_avx512_1hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -71,8 +71,8 @@ static __forceinline void hh_trafo_complex_kernel_16_AVX512_1hv_single(float co
!f> bind(C, name="single_hh_trafo_complex_avx512_1hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -74,8 +74,8 @@ static __forceinline void hh_trafo_complex_kernel_8_AVX512_2hv_double(double com
!f> bind(C, name="double_hh_trafo_complex_avx512_2hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -73,8 +73,8 @@ static __forceinline void hh_trafo_complex_kernel_16_AVX512_2hv_single(float com
!f> bind(C, name="double_hh_trafo_complex_avx512_2hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -84,8 +84,8 @@ static __forceinline void hh_trafo_complex_kernel_2_SSE_1hv_double(double comple
!f> bind(C, name="single_hh_trafo_complex_sse_1hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -68,8 +68,8 @@ static __forceinline void hh_trafo_complex_kernel_2_SSE_1hv_single(float complex
!f> bind(C, name="single_hh_trafo_complex_sse_1hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -84,8 +84,8 @@ static __forceinline void hh_trafo_complex_kernel_1_SSE_2hv_double(double comple
!f> bind(C, name="double_hh_trafo_complex_sse_2hv_double")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_double) :: q(*)
!f> complex(kind=c_double) :: hh(pnb,2)
!f> complex(kind=c_double_complex) :: q(*)
!f> complex(kind=c_double_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -65,8 +65,8 @@ static __forceinline void hh_trafo_complex_kernel_4_SSE_2hv_single(float complex
!f> bind(C, name="double_hh_trafo_complex_sse_2hv_single")
!f> use, intrinsic :: iso_c_binding
!f> integer(kind=c_int) :: pnb, pnq, pldq, pldh
!f> complex(kind=c_float) :: q(*)
!f> complex(kind=c_float) :: hh(pnb,2)
!f> complex(kind=c_float_complex) :: q(*)
!f> complex(kind=c_float_complex) :: hh(pnb,2)
!f> end subroutine
!f> end interface
!f>#endif
......
......@@ -115,10 +115,10 @@
integer(kind=ik), intent(in) :: nb, ldq, ldh
complex(kind=ck), intent(inout) :: q(ldq/2,*)
complex(kind=ck8), intent(inout) :: q(ldq/2,*)
real(kind=rk8), intent(in) :: hh(ldh,*), s
complex(kind=ck) :: x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, q1, q2, q3, q4, q5, p1, p2, p3, p4, p5
complex(kind=ck8) :: x1, x2, x3, x4, x5, y1, y2, y3, y4, y5, q1, q2, q3, q4, q5, p1, p2, p3, p4, p5
real(kind=rk8) :: h1, h2
integer(kind=ik) :: i
......@@ -392,10 +392,10 @@
integer(kind=ik), intent(in) :: nb, ldq, ldh
complex(kind=ck), intent(inout) :: q(ldq/2,*)
complex(kind=ck8), intent(inout) :: q(ldq/2,*)
real(kind=rk8), intent(in) :: hh(ldh,*), s
complex(kind=ck) :: x1, x2, x3, x4, y1, y2, y3, y4, q1, q2, q3, q4, p1, p2, p3, p4
complex(kind=ck8) :: x1, x2, x3, x4, y1, y2, y3, y4, q1, q2, q3, q4, p1, p2, p3, p4
real(kind=rk8) :: h1, h2
integer(kind=ik) :: i
......@@ -634,10 +634,10 @@
integer(kind=ik), intent(in) :: nb, ldq, ldh
complex(kind=ck), intent(inout) :: q(ldq/2,*)
complex(kind=ck8), intent(inout) :: q(ldq/2,*)
real(kind=rk8), intent(in) :: hh(ldh,*), s
complex(kind=ck) :: x1, x2, y1, y2, q1, q2, p1, p2
complex(kind=ck8) :: x1, x2, y1, y2, q1, q2, p1, p2
real(kind=rk8) :: h1, h2
integer(kind=ik) :: i
......
......@@ -339,7 +339,7 @@ module cuda_routines
! character(1,C_CHAR),value :: cta, ctb
! integer(C_INT),value :: m,n,k
! integer(C_INT), intent(in), value :: lda,ldb,ldc
! complex(C_DOUBLE),value :: alpha,beta
! complex(C_DOUBLE_COMPLEX),value :: alpha,beta
! integer(C_SIZE_T), value :: a, b, c
!
! end subroutine cublas_zgemm
......@@ -376,7 +376,7 @@ module cuda_routines
! character(1,C_CHAR),value :: side, uplo, trans, diag
! integer(C_INT),value :: m,n
! integer(C_INT), intent(in), value :: lda,ldb
! complex(C_DOUBLE), value :: alpha
! complex(C_DOUBLE_complex), value :: alpha
! integer(C_SIZE_T), value :: a, b
!
! end subroutine cublas_ztrmm
......@@ -389,7 +389,7 @@ module cuda_routines
! character(1,C_CHAR),value :: uplo, trans
! integer(C_INT),value :: n, k
! integer(C_INT), intent(in), value :: lda,ldb
! complex(C_DOUBLE), value :: alpha, beta
! complex(C_DOUBLE_COMPLEX), value :: alpha, beta
! integer(c_size_t),value :: a,b
!
! end subroutine cublas_zherk
......
......@@ -303,7 +303,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta, ctb
integer(kind=C_INT),value :: m,n,k
integer(kind=C_INT), intent(in), value :: lda,ldb,ldc
complex(kind=C_DOUBLE),value :: alpha,beta
complex(kind=C_DOUBLE_COMPLEX),value :: alpha,beta
integer(kind=C_intptr_T), value :: a, b, c
end subroutine cublas_zgemm_c
......@@ -318,7 +318,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta, ctb
integer(kind=C_INT),value :: m,n,k
integer(kind=C_INT), intent(in), value :: lda,ldb,ldc
complex(kind=C_FLOAT),value :: alpha,beta
complex(kind=C_FLOAT_COMPLEX),value :: alpha,beta
integer(kind=C_intptr_T), value :: a, b, c
end subroutine cublas_cgemm_c
......@@ -333,7 +333,7 @@ module cuda_functions
character(1,C_CHAR),value :: side, uplo, trans, diag
integer(kind=C_INT),value :: m,n
integer(kind=C_INT), intent(in), value :: lda,ldb
complex(kind=C_DOUBLE), value :: alpha
complex(kind=C_DOUBLE_COMPLEX), value :: alpha
integer(kind=C_intptr_T), value :: a, b
end subroutine cublas_ztrmm_c
......@@ -348,7 +348,7 @@ module cuda_functions
character(1,C_CHAR),value :: side, uplo, trans, diag
integer(kind=C_INT),value :: m,n
integer(kind=C_INT), intent(in), value :: lda,ldb
complex(kind=C_FLOAT), value :: alpha
complex(kind=C_FLOAT_COMPLEX), value :: alpha
integer(kind=C_intptr_T), value :: a, b
end subroutine cublas_ctrmm_c
......@@ -391,7 +391,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT),value :: m,n
integer(kind=C_INT), intent(in), value :: lda,incx,incy
complex(kind=C_DOUBLE),value :: alpha,beta
complex(kind=C_DOUBLE_COMPLEX),value :: alpha,beta
integer(kind=C_intptr_T), value :: a, x, y
end subroutine cublas_zgemv_c
end interface
......@@ -405,7 +405,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT),value :: m,n
integer(kind=C_INT), intent(in), value :: lda,incx,incy
complex(kind=C_FLOAT),value :: alpha,beta
complex(kind=C_FLOAT_COMPLEX),value :: alpha,beta
integer(kind=C_intptr_T), value :: a, x, y
end subroutine cublas_cgemv_c
end interface
......@@ -448,7 +448,7 @@ module cuda_functions
! character(1,C_CHAR),value :: cta
! integer(kind=C_INT),value :: n
! integer(kind=C_INT), intent(in), value :: lda,incx,incy
! complex(kind=C_DOUBLE),value :: alpha,beta
! complex(kind=C_DOUBLE_COMPLEX),value :: alpha,beta
! integer(kind=C_intptr_T), value :: a, x, y
! end subroutine cublas_zsymv_c
! end interface
......@@ -462,7 +462,7 @@ module cuda_functions
! character(1,C_CHAR),value :: cta
! integer(kind=C_INT),value :: n
! integer(kind=C_INT), intent(in), value :: lda,incx,incy
! complex(kind=C_FLOAT),value :: alpha,beta
! complex(kind=C_FLOAT_COMPLEX),value :: alpha,beta
! integer(kind=C_intptr_T), value :: a, x, y
! end subroutine cublas_csymv_c
! end interface
......@@ -744,7 +744,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta, ctb
integer(kind=C_INT) :: m,n,k
integer(kind=C_INT), intent(in) :: lda,ldb,ldc
complex(kind=C_DOUBLE) :: alpha,beta
complex(kind=C_DOUBLE_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, b, c
#ifdef WITH_GPU_VERSION
call cublas_zgemm_c(cta, ctb, m, n, k, alpha, a, lda, b, ldb, beta, c,ldc)
......@@ -759,7 +759,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta, ctb
integer(kind=C_INT) :: m,n,k
integer(kind=C_INT), intent(in) :: lda,ldb,ldc
complex(kind=C_FLOAT) :: alpha,beta
complex(kind=C_FLOAT_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, b, c
#ifdef WITH_GPU_VERSION
call cublas_cgemm_c(cta, ctb, m, n, k, alpha, a, lda, b, ldb, beta, c,ldc)
......@@ -774,7 +774,7 @@ module cuda_functions
character(1,C_CHAR),value :: side, uplo, trans, diag
integer(kind=C_INT) :: m,n
integer(kind=C_INT), intent(in) :: lda,ldb
complex(kind=C_DOUBLE) :: alpha
complex(kind=C_DOUBLE_COMPLEX) :: alpha
integer(kind=C_intptr_T) :: a, b
#ifdef WITH_GPU_VERSION
call cublas_ztrmm_c(side, uplo, trans, diag, m, n, alpha, a, lda, b, ldb)
......@@ -789,7 +789,7 @@ module cuda_functions
character(1,C_CHAR),value :: side, uplo, trans, diag
integer(kind=C_INT) :: m,n
integer(kind=C_INT), intent(in) :: lda,ldb
complex(kind=C_FLOAT) :: alpha
complex(kind=C_FLOAT_COMPLEX) :: alpha
integer(kind=C_intptr_T) :: a, b
#ifdef WITH_GPU_VERSION
call cublas_ctrmm_c(side, uplo, trans, diag, m, n, alpha, a, lda, b, ldb)
......@@ -831,7 +831,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT) :: m,n
integer(kind=C_INT), intent(in) :: lda,incx,incy
complex(kind=C_DOUBLE) :: alpha,beta
complex(kind=C_DOUBLE_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, x, y
#ifdef WITH_GPU_VERSION
call cublas_zgemv_c(cta, m, n, alpha, a, lda, x, incx, beta, y, incy)
......@@ -845,7 +845,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT) :: m,n
integer(kind=C_INT), intent(in) :: lda,incx,incy
complex(kind=C_FLOAT) :: alpha,beta
complex(kind=C_FLOAT_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, x, y
#ifdef WITH_GPU_VERSION
call cublas_cgemv_c(cta, m, n, alpha, a, lda, x, incx, beta, y, incy)
......@@ -888,7 +888,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT) :: n
integer(kind=C_INT), intent(in) :: lda,incx,incy
complex(kind=C_DOUBLE) :: alpha,beta
complex(kind=C_DOUBLE_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, x, y
#ifdef WITH_GPU_VERSION
! call cublas_zsymv_c(cta, n, alpha, a, lda, x, incx, beta, y, incy)
......@@ -902,7 +902,7 @@ module cuda_functions
character(1,C_CHAR),value :: cta
integer(kind=C_INT) :: n
integer(kind=C_INT), intent(in) :: lda,incx,incy
complex(kind=C_FLOAT) :: alpha,beta
complex(kind=C_FLOAT_COMPLEX) :: alpha,beta
integer(kind=C_intptr_T) :: a, x, y
#ifdef WITH_GPU_VERSION
! call cublas_csymv_c(cta, n, alpha, a, lda, x, incx, beta, y, incy)
......
......@@ -42,13 +42,13 @@
#include "config-f90.h"
module precision
use iso_c_binding, only : C_FLOAT, C_DOUBLE, C_INT32_T, C_INT64_T
use iso_c_binding, only : C_FLOAT, C_DOUBLE, C_FLOAT_COMPLEX, C_DOUBLE_COMPLEX, C_INT32_T, C_INT64_T
implicit none
integer, parameter :: rk8 = C_DOUBLE
integer, parameter :: rk4 = C_FLOAT
integer, parameter :: ck8 = C_DOUBLE
integer, parameter :: ck4 = C_FLOAT
integer, parameter :: ck8 = C_DOUBLE_COMPLEX
integer, parameter :: ck4 = C_FLOAT_COMPLEX
integer, parameter :: ik = C_INT32_T
integer, parameter :: lik = C_INT64_T
end module precision
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