22#include "../base/base_uses.f90"
25 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_blacs_types'
32#if defined(__parallel)
33 INTEGER :: context_handle = -1
35 INTEGER,
DIMENSION(2),
PUBLIC :: mepos = -1, num_pe = -1
38 PROCEDURE,
PUBLIC, pass(this), non_overridable :: gridexit => cp_blacs_gridexit
39 PROCEDURE,
PRIVATE, pass(this), non_overridable :: gridinfo => cp_blacs_gridinfo
40 PROCEDURE,
PUBLIC, pass(this), non_overridable :: set => cp_blacs_set
41 PROCEDURE,
PUBLIC, pass(this), non_overridable :: zgebs2d => cp_blacs_zgebs2d
42 PROCEDURE,
PUBLIC, pass(this), non_overridable :: dgebs2d => cp_blacs_dgebs2d
43 PROCEDURE,
PUBLIC, pass(this), non_overridable :: zgebr2d => cp_blacs_zgebr2d
44 PROCEDURE,
PUBLIC, pass(this), non_overridable :: dgebr2d => cp_blacs_dgebr2d
45 PROCEDURE,
PUBLIC, pass(this), non_overridable :: get_handle => cp_blacs_get_handle
47 PROCEDURE,
PRIVATE, pass(this), non_overridable :: cp_context_is_equal
48 generic,
PUBLIC ::
OPERATOR(==) => cp_context_is_equal
50 PROCEDURE,
PRIVATE, pass(this), non_overridable :: cp_context_is_not_equal
51 generic,
PUBLIC ::
OPERATOR(/=) => cp_context_is_not_equal
53 PROCEDURE,
PUBLIC, pass(this), non_overridable :: interconnect => cp_blacs_interconnect
70 CHARACTER(len=1),
INTENT(IN):: order
71 INTEGER,
INTENT(IN) :: nprow, npcol
72#if defined(__parallel)
73 INTEGER :: context_handle
74 context_handle = comm%get_handle()
75 CALL blacs_gridinit(context_handle, order, nprow, npcol)
76 this%context_handle = context_handle
91 SUBROUTINE cp_blacs_gridexit(this)
93#if defined(__parallel)
94 CALL blacs_gridexit(this%context_handle)
98 END SUBROUTINE cp_blacs_gridexit
104 SUBROUTINE cp_blacs_gridinfo(this)
106#if defined(__parallel)
107 CALL blacs_gridinfo(this%context_handle, this%num_pe(1), this%num_pe(2), this%mepos(1), this%mepos(2))
113 END SUBROUTINE cp_blacs_gridinfo
128 SUBROUTINE cp_blacs_set(this, what, val)
130 INTEGER,
INTENT(IN) :: what, val
131#if defined(__parallel)
132 CALL blacs_set(this%context_handle, what, val)
138 END SUBROUTINE cp_blacs_set
150 SUBROUTINE cp_blacs_zgebs2d(this, SCOPE, TOP, M, N, A, LDA)
152 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
153 INTEGER,
INTENT(IN) :: M, N, LDA
154 COMPLEX(KIND=dp) :: A
155#if defined(__parallel)
156 CALL zgebs2d(this%context_handle, scope, top, m, n, a, lda)
179 SUBROUTINE cp_blacs_zgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
181 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
182 INTEGER,
INTENT(IN) :: M, N, LDA
183 INTEGER,
INTENT(IN) :: RSRC, CSRC
184 COMPLEX(KIND=dp) :: A
185#if defined(__parallel)
186 CALL zgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
210 SUBROUTINE cp_blacs_dgebs2d(this, SCOPE, TOP, M, N, A, LDA)
212 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
213 INTEGER,
INTENT(IN) :: M, N, LDA
215#if defined(__parallel)
216 CALL dgebs2d(this%context_handle, scope, top, m, n, a, lda)
239 SUBROUTINE cp_blacs_dgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
241 CHARACTER(len=1),
INTENT(IN) :: scope, top
242 INTEGER,
INTENT(IN) :: m, n, lda
243 INTEGER,
INTENT(IN) :: rsrc, csrc
245#if defined(__parallel)
246 CALL dgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
265 ELEMENTAL INTEGER FUNCTION cp_blacs_get_handle(this)
267#if defined(__parallel)
268 cp_blacs_get_handle = this%context_handle
271 cp_blacs_get_handle = -1
281 ELEMENTAL LOGICAL FUNCTION cp_context_is_equal(this, other)
283#if defined(__parallel)
284 cp_context_is_equal = (this%context_handle == other%context_handle)
288 cp_context_is_equal = .true.
290 END FUNCTION cp_context_is_equal
298 ELEMENTAL LOGICAL FUNCTION cp_context_is_not_equal(this, other)
300#if defined(__parallel)
301 cp_context_is_not_equal = (this%context_handle /= other%context_handle)
305 cp_context_is_not_equal = .false.
307 END FUNCTION cp_context_is_not_equal
315 TYPE(
mp_comm_type) FUNCTION cp_blacs_interconnect(this, comm_super)
319 INTEGER :: blacs_coord
322 blacs_coord = this%mepos(1)*this%num_pe(2) + this%mepos(2)
324 CALL cp_blacs_interconnect%from_split(comm_super, blacs_coord)
326 END FUNCTION cp_blacs_interconnect
wrappers for the actual blacs calls. all functionality needed in the code should actually be provide ...
subroutine cp_blacs_gridinit(this, comm, order, nprow, npcol)
...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.