# dbcsr_t_pgrid_create_expert Subroutine

## public subroutine dbcsr_t_pgrid_create_expert(mp_comm, dims, pgrid, map1_2d, map2_2d, tensor_dims, nsplit, dimsplit)

Create an n-dimensional process grid. We can not use a n-dimensional MPI cartesian grid for tensors since the mapping between n-dim. and 2-dim. index allows for an arbitrary reordering of tensor index. Therefore we can not use n-dim. MPI Cartesian grid because it may not be consistent with the respective 2d grid. The 2d Cartesian MPI grid is the reference grid (since tensor data is stored as DBCSR matrix) and this routine creates an object that is a n-dim. interface to this grid. map1_2d and map2_2d don't need to be specified (correctly), grid may be redefined in dbcsr_t_distribution_new Note that pgrid is equivalent to a MPI cartesian grid only if map1_2d and map2_2d don't reorder indices (which is the case if [map1_2d, map2_2d] == [1, 2, ..., ndims]). Otherwise the mapping of grid coordinates to processes depends on the ordering of the indices and is not equivalent to a MPI cartesian grid.

### Arguments

Type IntentOptional Attributes Name
integer, intent(in) :: mp_comm

simple MPI Communicator

integer, intent(inout), DIMENSION(:) :: dims

grid dimensions - if entries are 0, dimensions are chosen automatically.

type(dbcsr_t_pgrid_type), intent(out) :: pgrid

n-dimensional grid object

integer, intent(in), DIMENSION(:) :: map1_2d

which nd-indices map to first matrix index and in which order which nd-indices map to first matrix index and in which order

integer, intent(in), DIMENSION(:) :: map2_2d

which nd-indices map to first matrix index and in which order which nd-indices map to first matrix index and in which order

integer, intent(in), optional, DIMENSION(:) :: tensor_dims

tensor block dimensions. If present, process grid dimensions are created such that good load balancing is ensured even if some of the tensor dimensions are small (i.e. on the same order or smaller than nproc**(1/ndim) where ndim is the tensor rank)

integer, intent(in), optional :: nsplit

impose a constant split factor which matrix dimension to split

integer, intent(in), optional :: dimsplit

impose a constant split factor which matrix dimension to split