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
  • Memory usage of st wslda

Memory usage of st wslda · Changes

Page history
Update Memory usage of st wslda authored Feb 20, 2026 by Gabriel Wlazłowski's avatar Gabriel Wlazłowski
Hide whitespace changes
Inline Side-by-side
Memory-usage-of-st-wslda.md
View page @ 958fc793
# Arithmetics # Arithmetics
Static codes support two types of arithmetics: Static codes support two types of arithmetics:
* `double complex`: `ELEMENT_SIZE=16B` * `double complex`: `ELEMENT_SIZE=16B`
default mode: matrix elements of hamiltonian are assumed to be of complex numbers. default mode: matrix elements of the Hamiltonian are assumed to be of complex numbers.
* `double`: `ELEMENT_SIZE=8B` * `double`: `ELEMENT_SIZE=8B`
if you know that matrix elements, as well as the solution, will be real numbers (for examples based on symmetries of your problem) you can speed-up the calculation process by switching to double arithmetics. To do this you need to activate in [predefines.h](https://gitlab.fizyka.pw.edu.pl/wtools/wslda/-/blob/public/st-project-template/predefines.h) flag: if you know that matrix elements, as well as the solution, will be real numbers (for examples based on symmetries of your problem) you can speed-up the calculation process by switching to double arithmetics. To do this, you need to activate in [predefines.h](https://gitlab.fizyka.pw.edu.pl/wtools/wslda/-/blob/public/st-project-template/predefines.h) the flag:
```c ```c
/** /**
* activate this if you know that Hamiltonian matrix is real, * Activate this if you know that the Hamiltonian matrix is real.
* the code will utilize it in order to speed-up the calculations * The code will utilize it in order to speed up the calculations by a factor of 4x (approximately)
* */ * */
#define MATRIX_IS_REAL // #define HAMILTONIAN_IS_REAL
``` ```
# st-wslda-3d # st-wslda-3d
3D version of the code diagonalizes matrix of size: 3D version of the code diagonalizes a matrix of size:
`MATRIX_DIM = NX*NY*NZ*2`. `MATRIX_DIM = NX*NY*NZ*2`.
Memory needed store this matrix in memory is The memory needed to store this matrix in memory is
`MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`. `MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`.
To execute diagonalization routine `st-wslda-3d` code needs at most: To execute the diagonalization routine `st-wslda-3d` code needs:
`REQUIRED_MEMORY < 4*MATRIX_SIZE`, `REQUIRED_MEMORY = k*MATRIX_SIZE`,
Factor 4 accounts for storage for matrix, storage for eigen-vectors, working space which depends on selected [diagonalization engine](Setting up diagonalization engine) and execution parameters. Factor `k` is in [3,10] and accounts for storage for matrix, storage for eigen-vectors, working space, which depends on the selected [diagonalization engine](Setting-up-diagonalization-engine), and execution parameters.
# st-wslda-2d # st-wslda-2d
In (quasi) 2D formulation of the problem diagonalization of full hamiltonian matrix factorizes into a series of `max(NZ/2,1)` diagonalizations of matrices of size (`NZ/2` arises from fact that there is the degeneracy of states with respect to sign of $`k_z`$ wave-vectors): In (quasi) 2D formulation of the problem, diagonalization of the full Hamiltonian matrix factorizes into a series of `max(NZ/2,1)` diagonalizations of matrices of size (`NZ/2` arises from the fact that there is the degeneracy of states with respect to the sign of $`k_z`$ wave-vectors):
`MATRIX_DIM = NX*NY*2` `MATRIX_DIM = NX*NY*2`
and the corresponding matrix size is and the corresponding matrix size is
`MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`. `MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`.
Number of matrices diagonalized simultaneously is: The number of matrices diagonalized simultaneously is:
`NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS = np / (p*q)` `NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS = np / (p*q)`
where `np` is number of MPI processes (provided to mpi execution command) and `p` and `q` are input file parameters. where `np` is the number of MPI processes (provided to the mpi execution command) and `p` and `q` are input file parameters.
To execute diagonalization routine `st-wslda-2d` code needs at most: To execute the diagonalization routine `st-wslda-2d` code needs:
`REQUIRED_MEMORY < 4*MATRIX_SIZE*NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS`. `REQUIRED_MEMORY = k*MATRIX_SIZE*NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS`.
*Note*: if `p` and `q` are not specified in the input file, by default `st-wslda-2d` will select the values that provide the highest parallelization (maximization of a number of simultaneous diagonalization). It means the highest memory request. *Note*: if `p` and `q` are not specified in the input file, by default `st-wslda-2d` will select the values that provide the highest parallelization (maximization of the number of simultaneous diagonalizations). It means the highest memory request.
# st-wslda-1d # st-wslda-1d
In (quasi) 1D formulation of the problem diagonalization of full hamiltonian matrix factorizes into a series of `max(NY*NZ/4,1)` diagonalizations of matrices of size: In (quasi) 1D formulation of the problem, diagonalization ofthe full Hamiltonian matrix factorizes into a series of `max(NY*NZ/4,1)` diagonalizations of matrices of size:
`MATRIX_DIM = NX*2` `MATRIX_DIM = NX*2`
and the corresponding matrix size is and the corresponding matrix size is
`MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`. `MATRIX_SIZE = MATRIX_DIM*MATRIX_DIM*ELEMENT_SIZE`.
Number of matrices diagonalized simultaneously is: The number of matrices diagonalized simultaneously is:
`NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS = np / (p*q)` `NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS = np / (p*q)`
where `np` is number of MPI processes (provided to mpi execution command) and `p` and `q` are input file parameters. where `np` is the number of MPI processes (provided to the mpi execution command) and `p` and `q` are input file parameters.
To execute diagonalization routine `st-wslda-1d` code needs at most: To execute the diagonalization routine `st-wslda-1d` code needs at most:
`REQUIRED_MEMORY < 4*MATRIX_SIZE*NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS`. `REQUIRED_MEMORY = k*MATRIX_SIZE*NUMBER_OF_SIMULTANUES_DIAGONALIZATIONS`.
*Note*: if `p` and `q` are not specified in the input file, by default `st-wslda-1d` will select the values that provide the highest parallelization (maximization of a number of simultaneous diagonalization). It means the highest memory request. *Note*: if `p` and `q` are not specified in the input file, by default `st-wslda-1d` will select the values that provide the highest parallelization (maximization of the number of simultaneous diagonalizations). It means the highest memory request.
\ No newline at end of file \ No newline at end of file
Clone repository

Content of Documentation
Official webpage
W-BSK Toolkit