1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-12-23 04:43:38 +01:00
qp_plugins_scemama/devel/ccsd_gpu/gpu_module.f90

170 lines
7.4 KiB
Fortran
Raw Normal View History

2023-07-16 09:54:58 +02:00
module gpu_module
use iso_c_binding
implicit none
interface
2023-08-02 16:17:43 +02:00
type(c_ptr) function gpu_init(nO, nV, cholesky_mo_num, &
cc_space_v_oo_chol, cc_space_v_ov_chol, cc_space_v_vo_chol, cc_space_v_vv_chol, &
2023-08-04 15:49:48 +02:00
cc_space_v_oooo, cc_space_v_vooo, cc_space_v_voov, cc_space_v_oovv, cc_space_v_vvoo, &
2023-08-03 01:21:16 +02:00
cc_space_v_oovo, cc_space_v_ovvo, cc_space_v_ovov, cc_space_v_ovoo, &
2023-08-04 14:07:49 +02:00
cc_space_f_oo, cc_space_f_ov, cc_space_f_vo, cc_space_f_vv) bind(C)
2023-08-02 16:17:43 +02:00
import c_int, c_double, c_ptr
integer(c_int), intent(in), value :: nO, nV, cholesky_mo_num
2023-07-17 14:51:50 +02:00
real(c_double), intent(in) :: cc_space_v_oo_chol(cholesky_mo_num,nO,nO)
2023-07-17 02:55:14 +02:00
real(c_double), intent(in) :: cc_space_v_ov_chol(cholesky_mo_num,nO,nV)
2023-07-16 09:54:58 +02:00
real(c_double), intent(in) :: cc_space_v_vo_chol(cholesky_mo_num,nV,nO)
real(c_double), intent(in) :: cc_space_v_vv_chol(cholesky_mo_num,nV,nV)
2023-07-16 20:34:35 +02:00
real(c_double), intent(in) :: cc_space_v_oooo(nO,nO,nO,nO)
real(c_double), intent(in) :: cc_space_v_vooo(nV,nO,nO,nO)
2023-08-04 15:49:48 +02:00
real(c_double), intent(in) :: cc_space_v_voov(nV,nO,nO,nV)
2023-07-16 20:34:35 +02:00
real(c_double), intent(in) :: cc_space_v_oovv(nO,nO,nV,nV)
2023-07-16 21:18:57 +02:00
real(c_double), intent(in) :: cc_space_v_vvoo(nV,nV,nO,nO)
2023-07-20 14:53:40 +02:00
real(c_double), intent(in) :: cc_space_v_oovo(nO,nO,nV,nO)
real(c_double), intent(in) :: cc_space_v_ovvo(nO,nV,nV,nO)
2023-08-03 01:21:16 +02:00
real(c_double), intent(in) :: cc_space_v_ovov(nO,nV,nO,nV)
2023-07-20 17:54:10 +02:00
real(c_double), intent(in) :: cc_space_v_ovoo(nO,nV,nO,nO)
2023-08-03 19:46:41 +02:00
real(c_double), intent(in) :: cc_space_f_oo(nO,nO)
2023-08-04 14:07:49 +02:00
real(c_double), intent(in) :: cc_space_f_ov(nO,nV)
2023-07-17 02:55:14 +02:00
real(c_double), intent(in) :: cc_space_f_vo(nV,nO)
2023-08-03 19:46:41 +02:00
real(c_double), intent(in) :: cc_space_f_vv(nV,nV)
2023-08-02 16:17:43 +02:00
end function
2023-08-21 12:34:55 +02:00
type(c_ptr) function gpu_init_sp(nO, nV, cholesky_mo_num, &
cc_space_v_oo_chol, cc_space_v_ov_chol, cc_space_v_vo_chol, cc_space_v_vv_chol, &
cc_space_v_oooo, cc_space_v_vooo, cc_space_v_voov, cc_space_v_oovv, cc_space_v_vvoo, &
cc_space_v_oovo, cc_space_v_ovvo, cc_space_v_ovov, cc_space_v_ovoo, &
cc_space_f_oo, cc_space_f_ov, cc_space_f_vo, cc_space_f_vv) bind(C)
import c_int, c_double, c_ptr
integer(c_int), intent(in), value :: nO, nV, cholesky_mo_num
real(c_double), intent(in) :: cc_space_v_oo_chol(cholesky_mo_num,nO,nO)
real(c_double), intent(in) :: cc_space_v_ov_chol(cholesky_mo_num,nO,nV)
real(c_double), intent(in) :: cc_space_v_vo_chol(cholesky_mo_num,nV,nO)
real(c_double), intent(in) :: cc_space_v_vv_chol(cholesky_mo_num,nV,nV)
real(c_double), intent(in) :: cc_space_v_oooo(nO,nO,nO,nO)
real(c_double), intent(in) :: cc_space_v_vooo(nV,nO,nO,nO)
real(c_double), intent(in) :: cc_space_v_voov(nV,nO,nO,nV)
real(c_double), intent(in) :: cc_space_v_oovv(nO,nO,nV,nV)
real(c_double), intent(in) :: cc_space_v_vvoo(nV,nV,nO,nO)
real(c_double), intent(in) :: cc_space_v_oovo(nO,nO,nV,nO)
real(c_double), intent(in) :: cc_space_v_ovvo(nO,nV,nV,nO)
real(c_double), intent(in) :: cc_space_v_ovov(nO,nV,nO,nV)
real(c_double), intent(in) :: cc_space_v_ovoo(nO,nV,nO,nO)
real(c_double), intent(in) :: cc_space_f_oo(nO,nO)
real(c_double), intent(in) :: cc_space_f_ov(nO,nV)
real(c_double), intent(in) :: cc_space_f_vo(nV,nO)
real(c_double), intent(in) :: cc_space_f_vv(nV,nV)
end function
2023-08-05 00:50:58 +02:00
subroutine gpu_upload(gpu_data, nO, nV, t1, t2) bind(C)
2023-08-03 17:29:57 +02:00
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: nO, nV
real(c_double), intent(in) :: t1(nO,nV)
real(c_double), intent(in) :: t2(nO,nO,nV,nV)
end subroutine
2023-08-21 12:34:55 +02:00
subroutine gpu_upload_sp(gpu_data, nO, nV, t1, t2) bind(C)
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: nO, nV
real(c_double), intent(in) :: t1(nO,nV)
real(c_double), intent(in) :: t2(nO,nO,nV,nV)
end subroutine
2023-08-05 00:50:58 +02:00
2023-08-04 15:49:48 +02:00
subroutine compute_H_oo_chol_gpu(gpu_data, igpu) bind(C)
2023-08-21 12:34:55 +02:00
import c_int, c_ptr
2023-08-03 19:46:41 +02:00
type(c_ptr), value :: gpu_data
2023-08-04 15:49:48 +02:00
integer(c_int), intent(in), value :: igpu
2023-08-03 19:46:41 +02:00
end subroutine
2023-08-04 15:49:48 +02:00
subroutine compute_H_vo_chol_gpu(gpu_data, igpu) bind(C)
2023-08-21 12:34:55 +02:00
import c_int, c_ptr
2023-08-04 12:33:52 +02:00
type(c_ptr), value :: gpu_data
2023-08-04 15:49:48 +02:00
integer(c_int), intent(in), value :: igpu
2023-08-04 12:33:52 +02:00
end subroutine
2023-08-04 15:49:48 +02:00
subroutine compute_H_vv_chol_gpu(gpu_data, igpu) bind(C)
2023-08-21 12:34:55 +02:00
import c_int, c_ptr
2023-08-04 12:09:07 +02:00
type(c_ptr), value :: gpu_data
2023-08-04 15:49:48 +02:00
integer(c_int), intent(in), value :: igpu
2023-08-04 12:09:07 +02:00
end subroutine
2023-08-04 14:07:49 +02:00
subroutine compute_r1_space_chol_gpu(gpu_data, nO, nV, t1, r1, max_r1) bind(C)
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: nO, nV
real(c_double), intent(in) :: t1(nO,nV)
real(c_double), intent(out) :: r1(nO,nO,nV,nV)
real(c_double), intent(out) :: max_r1
end subroutine
2023-08-03 17:29:57 +02:00
subroutine compute_r2_space_chol_gpu(gpu_data, nO, nV, t1, r2, max_r2) bind(C)
2023-08-02 16:17:43 +02:00
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
2023-08-03 17:29:57 +02:00
integer(c_int), intent(in), value :: nO, nV
2023-08-02 16:17:43 +02:00
real(c_double), intent(in) :: t1(nO,nV)
2023-07-16 09:54:58 +02:00
real(c_double), intent(out) :: r2(nO,nO,nV,nV)
2023-08-03 12:00:09 +02:00
real(c_double), intent(out) :: max_r2
2023-07-16 09:54:58 +02:00
end subroutine
2023-08-05 00:50:58 +02:00
double precision function ccsd_energy_space_gpu(gpu_data) bind(C)
import c_ptr
type(c_ptr), value :: gpu_data
end function
2023-07-17 02:55:14 +02:00
2023-08-21 12:34:55 +02:00
subroutine compute_H_oo_chol_gpu_sp(gpu_data, igpu) bind(C)
import c_int, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: igpu
end subroutine
subroutine compute_H_vo_chol_gpu_sp(gpu_data, igpu) bind(C)
import c_int, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: igpu
end subroutine
subroutine compute_H_vv_chol_gpu_sp(gpu_data, igpu) bind(C)
import c_int, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: igpu
end subroutine
subroutine compute_r1_space_chol_gpu_sp(gpu_data, nO, nV, t1, r1, max_r1) bind(C)
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: nO, nV
real(c_double), intent(in) :: t1(nO,nV)
real(c_double), intent(out) :: r1(nO,nO,nV,nV)
real(c_double), intent(out) :: max_r1
end subroutine
subroutine compute_r2_space_chol_gpu_sp(gpu_data, nO, nV, t1, r2, max_r2) bind(C)
import c_int, c_double, c_ptr
type(c_ptr), value :: gpu_data
integer(c_int), intent(in), value :: nO, nV
real(c_double), intent(in) :: t1(nO,nV)
real(c_double), intent(out) :: r2(nO,nO,nV,nV)
real(c_double), intent(out) :: max_r2
end subroutine
double precision function ccsd_energy_space_gpu_sp(gpu_data) bind(C)
import c_ptr
type(c_ptr), value :: gpu_data
end function
2023-07-16 15:39:37 +02:00
subroutine gpu_dgemm(transa, transb, m, n, k, alpha, A, lda, B, ldb, beta, C, ldc) bind(C)
import c_int, c_double, c_char
character(c_char), value :: transa, transb
integer(c_int), value :: m,n,k,lda,ldb,ldc
real(c_double), value :: alpha, beta
real(c_double) :: A(lda,*), B(ldb,*), C(ldc,*)
end subroutine
2023-07-16 09:54:58 +02:00
end interface
end module