26#include "../base/base_uses.f90"
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_blacs_types'
36#if defined(__parallel)
37 INTEGER :: context_handle = -1
39 INTEGER,
DIMENSION(2),
PUBLIC :: mepos = -1, num_pe = -1
42 PROCEDURE,
PUBLIC, pass(this), non_overridable :: gridexit => cp_blacs_gridexit
43 PROCEDURE,
PRIVATE, pass(this), non_overridable :: gridinfo => cp_blacs_gridinfo
44 PROCEDURE,
PUBLIC, pass(this), non_overridable :: set => cp_blacs_set
45 PROCEDURE,
PUBLIC, pass(this), non_overridable :: zgebs2d => cp_blacs_zgebs2d
46 PROCEDURE,
PUBLIC, pass(this), non_overridable :: dgebs2d => cp_blacs_dgebs2d
47 PROCEDURE,
PUBLIC, pass(this), non_overridable :: zgebr2d => cp_blacs_zgebr2d
48 PROCEDURE,
PUBLIC, pass(this), non_overridable :: dgebr2d => cp_blacs_dgebr2d
49 PROCEDURE,
PUBLIC, pass(this), non_overridable :: get_handle => cp_blacs_get_handle
51 PROCEDURE,
PRIVATE, pass(this), non_overridable :: cp_context_is_equal
52 generic,
PUBLIC ::
OPERATOR(==) => cp_context_is_equal
54 PROCEDURE,
PRIVATE, pass(this), non_overridable :: cp_context_is_not_equal
55 generic,
PUBLIC ::
OPERATOR(/=) => cp_context_is_not_equal
57 PROCEDURE,
PUBLIC, pass(this), non_overridable :: interconnect => cp_blacs_interconnect
74 CHARACTER(len=1),
INTENT(IN):: order
75 INTEGER,
INTENT(IN) :: nprow, npcol
76#if defined(__parallel)
77 INTEGER :: context_handle
78 context_handle = comm%get_handle()
79 CALL blacs_gridinit(context_handle, order, nprow, npcol)
80 this%context_handle = context_handle
98 SUBROUTINE cp_blacs_gridexit(this)
100#if defined(__parallel)
101 CALL blacs_gridexit(this%context_handle)
108 END SUBROUTINE cp_blacs_gridexit
114 SUBROUTINE cp_blacs_gridinfo(this)
116#if defined(__parallel)
117 CALL blacs_gridinfo(this%context_handle, this%num_pe(1), this%num_pe(2), this%mepos(1), this%mepos(2))
123 END SUBROUTINE cp_blacs_gridinfo
138 SUBROUTINE cp_blacs_set(this, what, val)
140 INTEGER,
INTENT(IN) :: what, val
141#if defined(__parallel)
142 CALL blacs_set(this%context_handle, what, val)
148 END SUBROUTINE cp_blacs_set
160 SUBROUTINE cp_blacs_zgebs2d(this, SCOPE, TOP, M, N, A, LDA)
162 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
163 INTEGER,
INTENT(IN) :: M, N, LDA
164 COMPLEX(KIND=dp) :: A
165#if defined(__parallel)
166 CALL zgebs2d(this%context_handle, scope, top, m, n, a, lda)
189 SUBROUTINE cp_blacs_zgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
191 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
192 INTEGER,
INTENT(IN) :: M, N, LDA
193 INTEGER,
INTENT(IN) :: RSRC, CSRC
194 COMPLEX(KIND=dp) :: A
195#if defined(__parallel)
196 CALL zgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
220 SUBROUTINE cp_blacs_dgebs2d(this, SCOPE, TOP, M, N, A, LDA)
222 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
223 INTEGER,
INTENT(IN) :: M, N, LDA
225#if defined(__parallel)
226 CALL dgebs2d(this%context_handle, scope, top, m, n, a, lda)
249 SUBROUTINE cp_blacs_dgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
251 CHARACTER(len=1),
INTENT(IN) :: scope, top
252 INTEGER,
INTENT(IN) :: m, n, lda
253 INTEGER,
INTENT(IN) :: rsrc, csrc
255#if defined(__parallel)
256 CALL dgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
275 ELEMENTAL INTEGER FUNCTION cp_blacs_get_handle(this)
277#if defined(__parallel)
278 cp_blacs_get_handle = this%context_handle
281 cp_blacs_get_handle = -1
291 ELEMENTAL LOGICAL FUNCTION cp_context_is_equal(this, other)
293#if defined(__parallel)
294 cp_context_is_equal = (this%context_handle == other%context_handle)
298 cp_context_is_equal = .true.
300 END FUNCTION cp_context_is_equal
308 ELEMENTAL LOGICAL FUNCTION cp_context_is_not_equal(this, other)
310#if defined(__parallel)
311 cp_context_is_not_equal = (this%context_handle /= other%context_handle)
315 cp_context_is_not_equal = .false.
317 END FUNCTION cp_context_is_not_equal
325 TYPE(
mp_comm_type) FUNCTION cp_blacs_interconnect(this, comm_super)
329 INTEGER :: blacs_coord
332 blacs_coord = this%mepos(1)*this%num_pe(2) + this%mepos(2)
334 CALL cp_blacs_interconnect%from_split(comm_super, blacs_coord)
336 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)
...
subroutine, public cp_dlaf_create_grid(blacs_context)
Create DLA-Future grid from BLACS context.
subroutine, public cp_dlaf_free_grid(blacs_context)
Free DLA-Future grid corresponding to BLACS context.
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.