Skip to content

GitLab

  • Menu
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • wslda wslda
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • wtools
  • wsldawslda
  • Wiki
  • Parallelization scheme of static codes

You need to sign in or sign up before continuing.

Parallelization scheme of static codes · Changes

Page history
Update Parallelization scheme of static codes authored Oct 01, 2025 by Gabriel Wlazłowski's avatar Gabriel Wlazłowski
Hide whitespace changes
Inline Side-by-side
Parallelization-scheme-of-static-codes.md
View page @ 0959400c
The most time-consuming part of the static codes is BdG matrix diagonalization. It is important to know how the BdG matrix is decomposed in the computing process to utilize `st-wslda` codes efficiently. The decomposition depends on the dimensionality version of the code.
The most time-consuming part of the static codes is BdG matrix diagonalization. It is essential to understand how the BdG matrix is decomposed during the computational process to utilize `st-wslda` codes efficiently. The decomposition depends on the dimensionality of the code.
# st-wslda-3d
## Block-cyclic decomposition of BdG matrix
The code diagonalizes one matrix per iteration of size `matrix_size=2*NX*NY*NZ`. The matrix is decomposed between MPI processes in a block-cyclic (bc) fashion. To understand the idea of bc decomposition, let us suppose that our (artificial) BdG matrix has size 9x9 (in practice, this cannot happen since the size will always be an even number). The code will be executed on `np=6` processes:
The code diagonalizes one matrix per iteration of size `matrix_size=2*NX*NY*NZ`. The matrix is decomposed between MPI processes in a block-cyclic (bc) fashion. To understand the concept of bc decomposition, let us suppose that our (artificial) BdG matrix has a size of 9x9 (in practice, this is not possible since the size will always be an even number). The code will be executed on `np=6` processes:
```bash
mpirun -np 6 ./st-wslda-3d input.txt
```
In the input file we set:
In the input file, we set:
```
# BLACS grid
p 2
......@@ -27,8 +27,8 @@ To learn more about bc decomposition, see [here](http://wlazlowski.fizyka.pw.edu
## Selecting p, q, mb and nb
By construction, the following constraint must be satisfied: `np=p*q`. When selecting decomposition parameters, the user should take into account:
* Typically, the best performance is achieved for `p=q`; thus, it is recommended to select `p` and `q` to be as close as possible. If `p` and `q` are commented out, then the algorithm will automatically select their values to satisfy this requirement.
*Note*: Typically, the constraint `p=q` cannot be satisfied. Then we empirically found that setting with `p<q` gives a better performance than settings with `p>q`. For example, if we run code with `np=24` than we have two options `(p,q)=(4,6)` or `(p,q)=(6,4)`. According to our expertise, we expect that setting `(p,q)=(4,6)` will provide better performance of the computation process.
* By construction, block sizes must satisfy the following constraints: `mb<=matrix_size/p` and `nb<=matrix_size/q`. In the case of decomposition codes (like diagonalization), settings block sizes to their maximal values do not perform well. We find that the best performance is obtained if `mb` and `nb` are much smaller than their maximal allowed values and at the same time number of matrix elements in the block `mb*nb` is significant (of the order of a hundred or higher). Empirically we find that typically good performance is obtained for block sizes to be 16, 32, 64 (powers of 2). We recommend the user try these values and based on the results, decide if further increase or decrease is profitable.
*Note*: Typically, the constraint `p=q` cannot be satisfied. We empirically found that the setting with `p<q` yields better performance than those with `p>q`. For example, if we run code with `np=24` than we have two options `(p,q)=(4,6)` or `(p,q)=(6,4)`. According to our expertise, we expect that setting `(p,q)=(4,6)` will provide better performance of the computation process.
* By construction, block sizes must satisfy the following constraints: `mb<=matrix_size/p` and `nb<=matrix_size/q`. In the case of decomposition codes (such as diagonalization), setting block sizes to their maximum values does not perform well. We find that the best performance is obtained if `mb` and `nb` are much smaller than their maximal allowed values, and at the same time, the number of matrix elements in the block `mb*nb` is significant (of the order of a hundred or higher). Empirically, we find that typically good performance is obtained for block sizes of 16, 32, 64 (powers of 2). We recommend that the user try these values and, based on the results, decide whether further increasing or decreasing is profitable.
* If `p=q=1`, then the parallelization is not applied. It corresponds to the single CPU version of the code. The code should work for these settings as well (do not expect that you will be able to solve large problems then).
# st-wslda-2d
......@@ -40,7 +40,7 @@ where
```math
k_z = 0, \pm 1 \frac{2\pi}{L_z}, \pm 2 \frac{2\pi}{L_z}, \ldots , +(N_z-1) \frac{2\pi}{L_z}
```
and $`L_z = NZ*DZ`$ is the box length along the z-direction. From the physical point of view, it means that we impose translation symmetry along the z-direction. Under this assumption, BdG matrix acquires block-diagonal form:
and $`L_z = NZ*DZ`$ is the box length along the z-direction. From the physical point of view, it means that we impose translation symmetry along the z-direction. Under this assumption, the BdG matrix acquires a block-diagonal form:
![HBdG-2d](uploads/9659540e2c865b7a6736e55cec10aa50/HBdG-2d.png)
and diagonalization of the matrix is equivalent to diagonalizations of submatrices $`H(k_{z,i})`$, each of them of size `matrix_size=2*NX*NY`. Moreover, the translation symmetry imposes that $`H(k_{z})=H(-k_{z})`$ and in practice it is sufficient to diagonalize only submatrices for positive $`k_z`$, which takes `NZ/2` values. Submatrices can be diagonalized simultaneously.
......@@ -102,9 +102,9 @@ and it is reflected in the code output:
# Number of nwf in [-ecut,+ecut] to be extracted is: 976 (50.8% of total number of states)
```
## Selecting p, q, and np
By construction, the following constraint must be satisfied: `np/(p*q) = i` where `i` is an integer number (number of subgroups) and `i<=NZ/2`. If `p` and `q` are specified in the input file, the code will select them in such a way as to maximize the number of simultaneous diagonalizations. Concerning matrix distribution, all requirements as described for 3D case apply here as well.
By construction, the following constraint must be satisfied: `np/(p*q) = i` where `i` is an integer number (number of subgroups) and `i<=NZ/2`. If `p` and `q` are not specified in the input file, the code will select them in such a way as to maximize the number of simultaneous diagonalizations. Concerning matrix distribution, all requirements as described for 3D case apply here as well.
# st-wslda-1d
The diagonalization scheme for 1D code is the same as for 2D code, which modification that now submatrices depend on two wave-vectors $`H(k_{y,i}, k_{z,j})`$.
The diagonalization scheme for 1D code is the same as for 2D code, with the modification that now submatrices depend on two wave-vectors $`H(k_{y,i}, k_{z,j})`$.
In 1D case, typically, we need to diagonalize a large number of small matrices of size `matrix_size=2*NX`. For small sizes of the order of thousand, typically, the best performance is obtained for `p=q=1`, i.e. no block-cyclic distribution of the submatrices.
\ No newline at end of file
In the 1D case, typically, we need to diagonalize a large number of small matrices of size `matrix_size=2*NX`. For small sizes of the order of thousands, typically, the best performance is obtained for `p=q=1`, i.e., no block-cyclic distribution of the submatrices.
\ No newline at end of file
Clone repository

Content of Documentation
Official webpage
W-BSK Toolkit