63 type(states_elec_t),
intent(in) :: st
64 type(namespace_t),
intent(in) :: namespace
65 type(mesh_t),
intent(in) :: mesh
66 integer,
intent(out) :: blocksize(2)
67 integer,
intent(out) :: total_np
79 if (.not. st%scalapack_compatible)
then
80 message(1) =
"Attempt to use ScaLAPACK when processes have not been distributed in compatible layout."
81 message(2) =
"You need to set ScaLAPACKCompatible = yes in the input file and re-run."
85 if (mesh%parallel_in_domains)
then
86 blocksize(1) = maxval(mesh%pv%np_local_vec) + (st%d%dim - 1) * &
87 maxval(mesh%pv%np_local_vec + mesh%pv%np_bndry + mesh%pv%np_ghost)
89 blocksize(1) = mesh%np + (st%d%dim - 1)*mesh%np_part
92 if (st%parallel_in_states)
then
93 blocksize(2) = maxval(st%dist%num)
98 total_np = blocksize(1)*st%dom_st_proc_grid%nprow
101 assert(st%d%dim*mesh%np_part >= blocksize(1))
121 type(states_elec_t),
intent(inout) :: this
127 assert(
allocated(this%group%psib))
129 if (this%st_kpt_mpi_grp%size == 1)
then
134 assert(.not.
allocated(this%group%rma_win))
136 safe_allocate(this%group%rma_win(1:this%group%nblocks, 1:this%nik))
139 do ib = 1, this%group%nblocks
140 if (this%group%block_is_local(ib, iqn))
then
141 call this%group%psib(ib, iqn)%remote_access_start(this%st_kpt_mpi_grp, this%group%rma_win(ib, iqn))
145 call mpi_win_create(0, int(0, mpi_address_kind), 1, &
146 mpi_info_null, this%st_kpt_mpi_grp%comm, this%group%rma_win(ib, iqn))
162 type(states_elec_t),
intent(inout) :: this
166 if (.not.
allocated(this%group%rma_win))
return
170 assert(
allocated(this%group%psib))
173 do ib = 1, this%group%nblocks
174 if (this%group%block_is_local(ib, iqn))
then
175 call this%group%psib(ib, iqn)%remote_access_stop(this%group%rma_win(ib, iqn))
178 call mpi_win_free(this%group%rma_win(ib, iqn))
184 safe_deallocate_a(this%group%rma_win)
193 integer,
intent(in) :: np
194 integer,
intent(in) :: ib
195 integer,
intent(in) :: ik
196 logical,
optional,
intent(in) :: packed
205 call swfs_elec_init(psib, st%d%dim, st%group%block_range(ib, 1), st%group%block_range(ib, 2), &
206 np, ik, packed=packed)
208 call dwfs_elec_init(psib, st%d%dim, st%group%block_range(ib, 1), st%group%block_range(ib, 2), &
209 np, ik, packed=packed)
213 call cwfs_elec_init(psib, st%d%dim, st%group%block_range(ib, 1), st%group%block_range(ib, 2), &
214 np, ik, packed=packed)
216 call zwfs_elec_init(psib, st%d%dim, st%group%block_range(ib, 1), st%group%block_range(ib, 2), &
217 np, ik, packed=packed)
233 class(
mesh_t),
intent(in) :: mesh
234 integer,
intent(in) :: ib
235 integer,
intent(in) :: iqn
236 class(
wfs_elec_t),
pointer,
intent(out) :: psib
238 integer :: total_size
244 if (this%group%block_is_local(ib, iqn))
then
245 psib => this%group%psib(ib, iqn)
253 assert(
allocated(this%group%rma_win))
255 call psib%do_pack(copy = .false.)
256 assert(product(psib%pack_size) < huge(0_int32))
257 total_size = product(int(psib%pack_size, int32))
262 call mpi_win_lock(mpi_lock_shared, this%group%block_node(ib, iqn), 0, this%group%rma_win(ib, iqn))
265 call mpi_get(psib%dff_pack(1, 1), total_size, mpi_double_precision, &
266 this%group%block_node(ib, iqn), int(0, mpi_address_kind), total_size, mpi_double_precision, &
267 this%group%rma_win(ib, iqn))
269 call mpi_get(psib%zff_pack(1, 1), total_size, mpi_double_complex, &
270 this%group%block_node(ib, iqn), int(0, mpi_address_kind), total_size, mpi_double_complex, &
271 this%group%rma_win(ib, iqn))
274 call mpi_win_unlock(this%group%block_node(ib, iqn), this%group%rma_win(ib, iqn))
289 integer,
intent(in) :: ib
294 if (this%group%block_is_local(ib, psib%ik))
then
298 safe_deallocate_p(psib)
308#include "states_elec_parallel_inc.F90"
311#include "complex.F90"
312#include "states_elec_parallel_inc.F90"
This module implements batches of mesh functions.
This module defines the meshes, which are used in Octopus.
character(len=256), dimension(max_lines), public message
to be output by fatal, warning
subroutine, public messages_fatal(no_lines, only_root_writes, namespace)
subroutine, public profiling_out(label)
Increment out counter and sum up difference between entry and exit time.
subroutine, public profiling_in(label, exclude)
Increment in counter and save entry time.
pure logical function, public states_are_real(st)
This module provides routines for communicating states when using states parallelization.
subroutine, public states_elec_parallel_remote_access_stop(this)
stop remote memory access for states on other processors
subroutine dstates_elec_parallel_gather_3(st, dims, psi)
gather distributed states into a local array
subroutine dstates_elec_parallel_gather_1(st, aa)
gather a one-dimensional array, distributed over states
subroutine zstates_elec_parallel_gather_1(st, aa)
gather a one-dimensional array, distributed over states
subroutine, public states_elec_parallel_get_block(this, mesh, ib, iqn, psib)
retrieve wave functions from a different node
subroutine, public states_elec_parallel_allocate_batch(st, psib, np, ib, ik, packed)
Initializes a wfs_elec_t for np points, given block index ib, ad the k-point index ik.
subroutine, public states_elec_parallel_remote_access_start(this)
start remote memory access for states on other processors
subroutine zstates_elec_parallel_gather_3(st, dims, psi)
gather distributed states into a local array
subroutine, public states_elec_parallel_blacs_blocksize(st, namespace, mesh, blocksize, total_np)
determine the block size for a BLACS distribution
subroutine, public states_elec_parallel_release_block(this, ib, psib)
logical pure function, public type_is_single(this)
subroutine, public zwfs_elec_init(this, dim, st_start, st_end, np, ik, special, packed)
initialize an empty wfs_elec_t object
subroutine, public cwfs_elec_init(this, dim, st_start, st_end, np, ik, special, packed)
initialize an empty wfs_elec_t object
subroutine, public dwfs_elec_init(this, dim, st_start, st_end, np, ik, special, packed)
initialize an empty wfs_elec_t object
subroutine, public swfs_elec_init(this, dim, st_start, st_end, np, ik, special, packed)
initialize an empty wfs_elec_t object
Describes mesh distribution to nodes.
The states_elec_t class contains all electronic wave functions.
batches of electronic states