Documentation for module qs_fb_com_tasks_types

...

source: qs_fb_com_tasks_types.F
Loading...

public Types:

fb_com_tasks_obj
defines a fb_com_tasks object
fb_com_atom_pairs_obj
defines a fb_com_atom_pairs object

public Subroutines/Functions:

Calculate the MPI send or recv buffer sizes according to the communication pairs (atom_pairs) and DBCSR matrix data. Each atom_pair corresponds to one DBCSR matrix block that needs to be sent or recerived.
Creates and initialises an empty fb_com_atom_pairs object
Decodes a single integer into the (rank, iatom, jatom) index of a communication task to send/receive a block to/from a process
Given send and recv fb_com_atom_pair object, distribute the matrix blocks stored in a fb_matrix_data object to a compatable DBCSR matrix. It is assumed in this subroutine that the sizes of each block stored in fb_matrix_data object is consistent with the pre-defined block sizes in the DBCSR matrix.
Given send and recv fb_com_atom_pair object, gather all the relevant DBCSR matrix blocks together, and add them to a fb_matrix_data object for storage
Gets attributes from a fb_com_atom_pairs object, one should only access the data content in a fb_com_atom_pairs object outside this module via this procedure.
Checks if a fb_com_atom_pairs object is associated with an actual data content or not
Initialises an fb_com_atom_pairs object, and makes it empty
Nullifies a fb_com_atom_pairs object, note that it does not release the original object. This procedure is used to nullify the pointer contained in the object which is used to associate to the actual object content
Releases an fb_com_atom_pairs object
Generate send or receive atom_pair lists from a com_tasks object. atom_pair list is used as a condensed index for the local/remote matrix blocks to be sent/received.
Creates and initialises an empty fb_com_tasks object
Dncodes a single integer into (iatom, jatom) pair index of a block into a single
Encodes (iatom, jatom) pair index of a block into a single integer
Gets attributes from a fb_com_tasks object, one should only access the data content in a fb_com_tasks object outside this module via this procedure.
Nullifies a fb_com_tasks object, note that it does not release the original object. This procedure is used to nullify the pointer contained in the object which is used to associate to the actual object content
Releases an fb_com_tasks object
Sets attributes in a fb_com_tasks object, one should only access the data content in a fb_com_tasks object outside this module via this procedure.
Start from a local set of tasks that has desc/src process equal to the local MPI rank, communicate with other processes so that a new local set of tasks is constructed with src/desc process equal to the local MPI rank

Parameters:

INTEGER
:: task_cost = 4
INTEGER
:: task_dest = 1
INTEGER
:: task_n_records = 4
INTEGER
:: task_pair = 3
INTEGER
:: task_src = 2

public Types:

TYPE :: fb_com_atom_pairs_obj

defines a fb_com_atom_pairs object


POINTER, PRIVATE :: obj ...

TYPE :: fb_com_tasks_obj

defines a fb_com_tasks object


POINTER, PRIVATE :: obj ...

SUBROUTINEfb_com_atom_pairs_calc_buffer_sizes(atom_pairs, nprocs, row_blk_sizes, col_blk_sizes, sendrecv_sizes, sendrecv_disps, sendrecv_pair_counts, sendrecv_pair_disps, row_map, col_map)

Calculate the MPI send or recv buffer sizes according to the communication pairs (atom_pairs) and DBCSR matrix data. Each atom_pair corresponds to one DBCSR matrix block that needs to be sent or recerived.

Arguments:
INTENT(in)
:: atom_pairs the communication pair object for either sending or receiving
INTEGER,
INTENT(in)
:: nprocs total number of MPI processes in communicator
INTEGER,
INTENT(in)
:: row_blk_sizes(:) row_blk_sizes(iblkrow) = number of element rows in each block in the iblkrow-th block row of the DBCSR matrix
INTEGER,
INTENT(in)
:: col_blk_sizes(:) col_blk_sizes(iblkcol) = number of element cols in each block in the iblkcol-th block col of the DBCSR matrix
INTEGER,
INTENT(out)
:: sendrecv_sizes(:) size required for the send of recv buffer for each dest/src process
INTEGER,
INTENT(out)
:: sendrecv_disps(:) sendrecv_disps(ipe) + 1 = starting location in send/recv buffer for data destined for process ipe
INTEGER,
INTENT(out)
:: sendrecv_pair_counts(:) sendrecv_pair_counts(ipe) = number of pairs (blocks) to be sent to or recv from process ipe
INTEGER,
INTENT(out)
:: sendrecv_pair_disps(:) send_recv_pair_disps(ipe) + 1 = start location in atom_pairs array for all the pairs to be sent to or recv from process ipe
INTEGER,
INTENT(in),
OPTIONAL
:: row_map(:) optional blk row map for the DBCSR blocks
INTEGER,
INTENT(in),
OPTIONAL
:: col_map(:) optional blk col map for the DBCSR blocks

SUBROUTINEfb_com_atom_pairs_create(atom_pairs)

Creates and initialises an empty fb_com_atom_pairs object

Arguments:
INTENT(inout)
:: atom_pairs the fb_com_atom_pairs object, its content must be NULL and cannot be UNDEFINED

SUBROUTINEfb_com_atom_pairs_decode(ind, pe, iatom, jatom, natoms)

Decodes a single integer into the (rank, iatom, jatom) index of a communication task to send/receive a block to/from a process

Arguments:
INTEGER(int_8),
INTENT(in)
:: ind encoded integer
INTEGER,
INTENT(out)
:: pe the rank of the process the block to be send to or receive from
INTEGER,
INTENT(out)
:: iatom the first index of the (iatom, jatom) block index
INTEGER,
INTENT(out)
:: jatom the second index of the (iatom, jatom) block index
INTEGER,
INTENT(in)
:: natoms the total number of atoms iatom and jatom indexes

SUBROUTINEfb_com_atom_pairs_distribute_blks(matrix_storage, atom_pairs_send, atom_pairs_recv, para_env, dbcsr_mat)

Given send and recv fb_com_atom_pair object, distribute the matrix blocks stored in a fb_matrix_data object to a compatable DBCSR matrix. It is assumed in this subroutine that the sizes of each block stored in fb_matrix_data object is consistent with the pre-defined block sizes in the DBCSR matrix.

Arguments:
INTENT(in)
:: matrix_storage the fb_matrix_data object
INTENT(in)
:: atom_pairs_send prescription on exactly which DBCSR blocks are to be sent to where
INTENT(in)
:: atom_pairs_recv prescription on exactly which DBCSR blocks are to be received from where
POINTER
:: para_env CP2K parallel environment
TYPE(dbcsr_type),
POINTER
:: dbcsr_mat the DBCSR matrix where the matrix blocks will be distributed to

SUBROUTINEfb_com_atom_pairs_gather_blks(dbcsr_mat, atom_pairs_send, atom_pairs_recv, para_env, matrix_storage)

Given send and recv fb_com_atom_pair object, gather all the relevant DBCSR matrix blocks together, and add them to a fb_matrix_data object for storage

Arguments:
TYPE(dbcsr_type),
POINTER
:: dbcsr_mat the DBCSR matrix where the matrix blocks will be obtained from
INTENT(in)
:: atom_pairs_send prescription on exactly which DBCSR blocks are to be sent to where
INTENT(in)
:: atom_pairs_recv prescription on exactly which DBCSR blocks are to be received from where
POINTER
:: para_env CP2K parallel environment
INTENT(inout)
:: matrix_storage the fb_matrix_data object to store the received DBCSR matrix blocks

SUBROUTINEfb_com_atom_pairs_get(atom_pairs, npairs, natoms_encode, pairs)

Gets attributes from a fb_com_atom_pairs object, one should only access the data content in a fb_com_atom_pairs object outside this module via this procedure.

Arguments:
INTENT(in)
:: atom_pairs the fb_com_atom_pairs object, its content must not be NULL or UNDEFINED
INTEGER,
INTENT(out),
OPTIONAL
:: npairs if present, outputs atom_pairs%obj%npairs
INTEGER,
INTENT(out),
OPTIONAL
:: natoms_encode if present, outputs atom_pairs%obj%natoms_encode
INTEGER(int_8),
OPTIONAL, POINTER
:: pairs(:) if present, outputs pointer atom_pairs%obj%pairs

FUNCTIONfb_com_atom_pairs_has_data(atom_pairs)

Checks if a fb_com_atom_pairs object is associated with an actual data content or not

Return Value ::
LOGICAL
Arguments:
INTENT(in)
:: atom_pairs the fb_com_atom_pairs object

SUBROUTINEfb_com_atom_pairs_init(atom_pairs)

Initialises an fb_com_atom_pairs object, and makes it empty

Arguments:
INTENT(inout)
:: atom_pairs the fb_com_atom_pairs object, its content must not be NULL or UNDEFINED

SUBROUTINEfb_com_atom_pairs_nullify(atom_pairs)

Nullifies a fb_com_atom_pairs object, note that it does not release the original object. This procedure is used to nullify the pointer contained in the object which is used to associate to the actual object content

Arguments:
INTENT(inout)
:: atom_pairs the fb_com_atom_pairs object

SUBROUTINEfb_com_atom_pairs_release(atom_pairs)

Releases an fb_com_atom_pairs object

Arguments:
INTENT(inout)
:: atom_pairs the fb_com_atom_pairs object, its content must not be UNDEFINED, and the subroutine does nothing if the content points to NULL

SUBROUTINEfb_com_tasks_build_atom_pairs(com_tasks, atom_pairs, natoms_encode, send_or_recv)

Generate send or receive atom_pair lists from a com_tasks object. atom_pair list is used as a condensed index for the local/remote matrix blocks to be sent/received.

Arguments:
INTENT(in)
:: com_tasks the com_tasks object
INTENT(inout)
:: atom_pairs fb_com_atom_pairs_obj containing list of encoded atomic pair indices and the dest/src proc id for the matrix block to be sent/received.
INTEGER,
INTENT(in)
:: natoms_encode the total number of atoms the atomic pair indices corresponds to, and it is used for encode the atom_pairs values
CHARACTER(*),
INTENT(in)
:: send_or_recv whether the atom_pair to be generated is for the local matrix blocks to be sent or the remote matrix blocks to be received for this MPI process

SUBROUTINEfb_com_tasks_create(com_tasks)

Creates and initialises an empty fb_com_tasks object

Arguments:
INTENT(inout)
:: com_tasks the fb_com_tasks object, its content must be NULL and cannot be UNDEFINED

SUBROUTINEfb_com_tasks_decode_pair(ind, iatom, jatom, natoms)

Dncodes a single integer into (iatom, jatom) pair index of a block into a single

Arguments:
INTEGER(int_8),
INTENT(in)
:: ind encoded integer
INTEGER,
INTENT(out)
:: iatom the first index of the (iatom, jatom) block index
INTEGER,
INTENT(out)
:: jatom the second index of the (iatom, jatom) block index
INTEGER,
INTENT(in)
:: natoms the total number of atoms iatom and jatom indexes

SUBROUTINEfb_com_tasks_encode_pair(ind, iatom, jatom, natoms)

Encodes (iatom, jatom) pair index of a block into a single integer

Arguments:
INTEGER(int_8),
INTENT(out)
:: ind encoded integer
INTEGER,
INTENT(in)
:: iatom the first index of the (iatom, jatom) block index
INTEGER,
INTENT(in)
:: jatom the second index of the (iatom, jatom) block index
INTEGER,
INTENT(in)
:: natoms the total number of atoms iatom and jatom indexes

SUBROUTINEfb_com_tasks_get(com_tasks, task_dim, ntasks, nencode, tasks)

Gets attributes from a fb_com_tasks object, one should only access the data content in a fb_com_tasks object outside this module via this procedure.

Arguments:
INTENT(in)
:: com_tasks the fb_com_tasks object, its content must not be NULL or UNDEFINED
INTEGER,
INTENT(out),
OPTIONAL
:: task_dim if present, outputs com_tasks%obj%task_dim
INTEGER,
INTENT(out),
OPTIONAL
:: ntasks if present, outputs com_tasks%obj%ntasks
INTEGER,
INTENT(out),
OPTIONAL
:: nencode if present, outputs com_tasks%obj%nencode
INTEGER(int_8),
OPTIONAL, POINTER
:: tasks(:,:) if present, outputs pointer com_tasks%obj%tasks

SUBROUTINEfb_com_tasks_nullify(com_tasks)

Nullifies a fb_com_tasks object, note that it does not release the original object. This procedure is used to nullify the pointer contained in the object which is used to associate to the actual object content

Arguments:
INTENT(inout)
:: com_tasks the com_tasks object

SUBROUTINEfb_com_tasks_release(com_tasks)

Releases an fb_com_tasks object

Arguments:
INTENT(inout)
:: com_tasks the fb_com_tasks object, its content must not be UNDEFINED, and the subroutine does nothing if the content points to NULL

SUBROUTINEfb_com_tasks_set(com_tasks, task_dim, ntasks, nencode, tasks)

Sets attributes in a fb_com_tasks object, one should only access the data content in a fb_com_tasks object outside this module via this procedure.

Arguments:
INTENT(inout)
:: com_tasks the fb_com_tasks object, its content must not be NULL or UNDEFINED
INTEGER,
INTENT(in),
OPTIONAL
:: task_dim if present, sets com_tasks%obj%task_dim
INTEGER,
INTENT(in),
OPTIONAL
:: ntasks if present, sets com_tasks%obj%ntasks
INTEGER,
INTENT(in),
OPTIONAL
:: nencode if present, sets com_tasks%obj%nencode
INTEGER(int_8),
OPTIONAL, POINTER
:: tasks(:,:) if present, associates pointer com_tasks%obj%tasks

SUBROUTINEfb_com_tasks_transpose_dest_src(tasks_dest_is_me, direction, tasks_src_is_me, para_env)

Start from a local set of tasks that has desc/src process equal to the local MPI rank, communicate with other processes so that a new local set of tasks is constructed with src/desc process equal to the local MPI rank

Arguments:
INTENT(inout)
:: tasks_dest_is_me the local com_task object with all tasks having the desc process id equal to my_id
CHARACTER,
INTENT(in)
:: direction direction of operation: ">" means from tasks_dest_is_me construct tasks_src_is_me "<" means from tasks_src_is_me construct tasks_dest_is_me
INTENT(inout)
:: tasks_src_is_me the local com_task object with all tasks having the src process id equal to my_id
POINTER
:: para_env CP2K parallel environment object that stores MPI related information of the current run

private Parameters/Types:

private Types:

TYPE :: fb_com_atom_pairs_data

data content for the list of block coordinates with the associated src/dest proc id for communication. These will be generated from the fb_com_tasks object


INTEGER
:: id_nr unique id for the object
INTEGER
:: ref_count reference count on the object
INTEGER(int_8),
DIMENSION(:), POINTER :: pairs the list of communication tasks, which is represented by a 2D array, first dim stores info for the communication: src and desc procs and the atomic pair indexing the matrix block to be communicated, etc.
INTEGER
:: npairs number of blks to be communicated in the atom pair list
INTEGER
:: natoms_encode the total number of atoms used for encoding the proc + block coordinates (pe, iatom, jatom)

TYPE :: fb_com_tasks_data

data content for communication tasks used for send and receive matrix blocks


INTEGER
:: id_nr unique id for the object
INTEGER
:: ref_count reference count on the object
INTEGER(int_8),
DIMENSION(:,:), POINTER :: tasks the list of communication tasks, which is represented by a 2D array, first dim stores info for the communication: src and desc procs and the atomic pair indexing the matrix block to be communicated, etc.
INTEGER
:: task_dim the size of the first dimension of tasks
INTEGER
:: ntasks total number of local tasks
INTEGER
:: nencode the total number of atoms used for encoding the block coordinates (iatom, jatom)