26 #include "../base/base_uses.f90"
29 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'cp_blacs_types'
32 PUBLIC :: cp_blacs_type
36 #if defined(__SCALAPACK)
37 INTEGER :: context_handle = -1
39 INTEGER,
DIMENSION(2),
PUBLIC :: mepos = -1, num_pe = -1
41 PROCEDURE,
PUBLIC, PASS(this), NON_OVERRIDABLE :: gridinit => cp_blacs_gridinit
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
71 SUBROUTINE cp_blacs_gridinit(this, comm, order, nprow, npcol)
72 CLASS(cp_blacs_type),
INTENT(OUT) :: this
73 CLASS(mp_comm_type),
INTENT(IN) :: comm
74 CHARACTER(len=1),
INTENT(IN):: order
75 INTEGER,
INTENT(IN) :: nprow, npcol
76 #if defined(__SCALAPACK)
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
93 END SUBROUTINE cp_blacs_gridinit
99 SUBROUTINE cp_blacs_gridexit(this)
100 CLASS(cp_blacs_type),
INTENT(IN) :: this
101 #if defined(__SCALAPACK)
102 CALL blacs_gridexit(this%context_handle)
110 END SUBROUTINE cp_blacs_gridexit
116 SUBROUTINE cp_blacs_gridinfo(this)
117 CLASS(cp_blacs_type),
INTENT(INOUT) :: this
118 #if defined(__SCALAPACK)
119 CALL blacs_gridinfo(this%context_handle, this%num_pe(1), this%num_pe(2), this%mepos(1), this%mepos(2))
125 END SUBROUTINE cp_blacs_gridinfo
140 SUBROUTINE cp_blacs_set(this, what, val)
141 CLASS(cp_blacs_type),
INTENT(IN) :: this
142 INTEGER,
INTENT(IN) :: what, val
143 #if defined(__SCALAPACK)
144 CALL blacs_set(this%context_handle, what, val)
150 END SUBROUTINE cp_blacs_set
162 SUBROUTINE cp_blacs_zgebs2d(this, SCOPE, TOP, M, N, A, LDA)
163 CLASS(cp_blacs_type),
INTENT(IN) :: this
164 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
165 INTEGER,
INTENT(IN) :: M, N, LDA
166 COMPLEX(KIND=dp) :: A
167 #if defined(__SCALAPACK)
168 CALL zgebs2d(this%context_handle, scope, top, m, n, a, lda)
191 SUBROUTINE cp_blacs_zgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
192 CLASS(cp_blacs_type),
INTENT(IN) :: this
193 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
194 INTEGER,
INTENT(IN) :: M, N, LDA
195 INTEGER,
INTENT(IN) :: RSRC, CSRC
196 COMPLEX(KIND=dp) :: A
197 #if defined(__SCALAPACK)
198 CALL zgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
222 SUBROUTINE cp_blacs_dgebs2d(this, SCOPE, TOP, M, N, A, LDA)
223 CLASS(cp_blacs_type),
INTENT(IN) :: this
224 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
225 INTEGER,
INTENT(IN) :: M, N, LDA
227 #if defined(__SCALAPACK)
228 CALL dgebs2d(this%context_handle, scope, top, m, n, a, lda)
251 SUBROUTINE cp_blacs_dgebr2d(this, SCOPE, TOP, M, N, A, LDA, RSRC, CSRC)
252 CLASS(cp_blacs_type),
INTENT(IN) :: this
253 CHARACTER(len=1),
INTENT(IN) :: SCOPE, TOP
254 INTEGER,
INTENT(IN) :: M, N, LDA
255 INTEGER,
INTENT(IN) :: RSRC, CSRC
257 #if defined(__SCALAPACK)
258 CALL dgebr2d(this%context_handle, scope, top, m, n, a, lda, rsrc, csrc)
277 ELEMENTAL INTEGER FUNCTION cp_blacs_get_handle(this)
278 CLASS(cp_blacs_type),
INTENT(IN) :: this
279 #if defined(__SCALAPACK)
280 cp_blacs_get_handle = this%context_handle
283 cp_blacs_get_handle = -1
293 ELEMENTAL LOGICAL FUNCTION cp_context_is_equal(this, other)
294 CLASS(cp_blacs_type),
INTENT(IN) :: this, other
295 #if defined(__SCALAPACK)
296 cp_context_is_equal = (this%context_handle == other%context_handle)
300 cp_context_is_equal = .true.
302 END FUNCTION cp_context_is_equal
310 ELEMENTAL LOGICAL FUNCTION cp_context_is_not_equal(this, other)
311 CLASS(cp_blacs_type),
INTENT(IN) :: this, other
312 #if defined(__SCALAPACK)
313 cp_context_is_not_equal = (this%context_handle /= other%context_handle)
317 cp_context_is_not_equal = .false.
319 END FUNCTION cp_context_is_not_equal
327 TYPE(mp_comm_type) FUNCTION cp_blacs_interconnect(this, comm_super)
328 CLASS(cp_blacs_type),
INTENT(IN) :: this
329 CLASS(mp_comm_type),
INTENT(IN) :: comm_super
331 INTEGER :: blacs_coord
334 blacs_coord = this%mepos(1)*this%num_pe(2) + this%mepos(2)
336 CALL cp_blacs_interconnect%from_split(comm_super, blacs_coord)
338 END FUNCTION cp_blacs_interconnect
wrappers for the actual blacs calls. all functionality needed in the code should actually be provide ...
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.