|
1 | 1 | [](){#ref-uenv-quantumespresso} |
2 | 2 | # Quantum ESPRESSO |
3 | | -!!! todo |
4 | | - complete docs |
| 3 | + |
| 4 | +[Quantum ESPRESSO](https://www.quantum-espresso.org/) is an integrated suite of Open-Source computer codes for electronic-structure calculations and materials modeling at the nanoscale. It is based on density-functional theory, plane waves, and pseudopotentials: |
| 5 | + |
| 6 | +* `pw.x`: Plane-Wave Self-Consistent Field (PWscf) |
| 7 | +* `pw.x` First Principles Molecular Dynamics (FPMD) |
| 8 | +* `cp.x` Car-Parrinello (CP) |
| 9 | + |
| 10 | + |
| 11 | +!!! note "uenvs" |
| 12 | + |
| 13 | + [Quantum ESPRESSO](https://www.quantum-espresso.org/) is provided on [ALPS][platforms-on-alps] via [uenv][ref-uenv]. |
| 14 | + Please have a look at the [uenv documentation][ref-uenv] for more information about uenvs and how to use them. |
| 15 | + |
| 16 | + |
| 17 | +## How to run |
| 18 | + |
| 19 | +The following sbatch script can be used as a template. |
| 20 | + |
| 21 | +=== "GH200" |
| 22 | + |
| 23 | + ```bash |
| 24 | + #SBATCH -N 1 |
| 25 | + #SBATCH --ntasks-per-node=4 |
| 26 | + #SBATCH --cpus-per-task=71 |
| 27 | + #SBATCH --gpus-per-task=1 |
| 28 | + #SBATCH -A <account> |
| 29 | + #SBATCH --uenv=quantumespresso/v7.4:v2 |
| 30 | + #SBATCH --view=default |
| 31 | + |
| 32 | + export OMP_NUM_THREADS=20 |
| 33 | + export MPICH_GPU_SUPPORT_ENABLED=1 |
| 34 | + export OMP_PLACES=cores |
| 35 | + |
| 36 | + srun -u --cpu-bind=socket /user-environment/env/default/bin/pw.x < pw.in |
| 37 | + ``` |
| 38 | + Current observation is that best perfomance is achieved using [one MPI rank per GPU][ref-slurm-gh200-single-rank-per-gpu]. How to run multiple ranks per GPU is described [here][ref-slurm-gh200-multi-rank-per-gpu]. |
| 39 | + |
| 40 | +=== "Eiger" |
| 41 | + |
| 42 | + ```bash |
| 43 | + #SBATCH -N 1 |
| 44 | + #SBATCH --ntasks-per-node=128 |
| 45 | + #SBATCH -A <account> |
| 46 | + #SBATCH --uenv=quantumespresso/v7.3.1 |
| 47 | + #SBATCH --view=default |
| 48 | + #SBATCH --hint=nomultithread |
| 49 | + |
| 50 | + export OMP_NUM_THREADS=1 |
| 51 | + |
| 52 | + srun -u /user-environment/env/default/bin/pw.x < pw.in |
| 53 | + ``` |
| 54 | + |
| 55 | + |
| 56 | +## Building QE from Source |
| 57 | + |
| 58 | +### Using modules |
| 59 | + |
| 60 | +=== "GH200" |
| 61 | + |
| 62 | + ```bash |
| 63 | + uenv start --view=modules quantumespresso/v7.4:v2 |
| 64 | + module load cmake \ |
| 65 | + fftw \ |
| 66 | + nvhpc \ |
| 67 | + nvpl-lapack \ |
| 68 | + nvpl-blas \ |
| 69 | + cray-mpich \ |
| 70 | + netlib-scalapack \ |
| 71 | + libxc |
| 72 | + |
| 73 | + mkdir build && cd build |
| 74 | + FC=mpif90 CXX=mpic++ CC=mpicc cmake .. \ |
| 75 | + -DQE_ENABLE_MPI=ON \ |
| 76 | + -DQE_ENABLE_OPENMP=ON \ |
| 77 | + -DQE_ENABLE_SCALAPACK:BOOL=OFF \ |
| 78 | + -DQE_ENABLE_LIBXC=ON \ |
| 79 | + -DQE_ENABLE_CUDA=ON \ |
| 80 | + -DQE_ENABLE_PROFILE_NVTX=ON \ |
| 81 | + -DQE_CLOCK_SECONDS:BOOL=OFF \ |
| 82 | + -DQE_ENABLE_MPI_GPU_AWARE:BOOL=OFF \ |
| 83 | + -DQE_ENABLE_OPENACC=ON |
| 84 | + make -j20 |
| 85 | + ``` |
| 86 | + |
| 87 | +=== "A100" |
| 88 | + |
| 89 | + ```bash |
| 90 | + uenv start --view=modules quantumespresso/v7.3.1:v2 |
| 91 | + module load cmake \ |
| 92 | + cray-mpich |
| 93 | + cuda \ |
| 94 | + fftw \ |
| 95 | + gcc \ |
| 96 | + libxc \ |
| 97 | + nvhpc \ |
| 98 | + openblas |
| 99 | + mkdir build && cd build |
| 100 | + FC=mpif90 CXX=mpic++ CC=mpicc cmake .. \ |
| 101 | + -DQE_ENABLE_MPI=ON \ |
| 102 | + -DQE_ENABLE_OPENMP=ON \ |
| 103 | + -DQE_ENABLE_SCALAPACK:BOOL=OFF \ |
| 104 | + -DQE_ENABLE_LIBXC=ON \ |
| 105 | + -DQE_ENABLE_CUDA=ON \ |
| 106 | + -DQE_CLOCK_SECONDS:BOOL=OFF \ |
| 107 | + -DQE_ENABLE_MPI_GPU_AWARE:BOOL=OFF \ |
| 108 | + -DQE_ENABLE_OPENACC=ON |
| 109 | + make -j20 |
| 110 | + ``` |
| 111 | + |
| 112 | +### Using spack |
| 113 | + |
| 114 | +1. Clone spack using the same version that has been used to build the uenv. |
| 115 | +```bash |
| 116 | +uenv start quantumespresso/v7.3.1 |
| 117 | +# clone the same spack version as has been used to build the uenv |
| 118 | +git clone -b $(jq -r .spack.commit /user-environment/meta/configure.json) $(jq -r .spack.repo /user-environment/meta/configure.json) $SCRATCH/spack |
| 119 | +``` |
| 120 | + |
| 121 | +2. Activate spack with the uenv configured as upstream |
| 122 | +```bash |
| 123 | +# ensure spack is using the uenv as upstream repository (always required) |
| 124 | +export SPACK_SYSTEM_CONFIG_PATH=/user-environment/config |
| 125 | +# active spack (always required) |
| 126 | +. $SCRATCH/spack/share/spack/setup-env.sh |
| 127 | +``` |
| 128 | + |
| 129 | +3. Create an anonymous environment for QE |
| 130 | +```bash |
| 131 | +spack env create -d $SCRATCH/qe-env |
| 132 | +spack -e $SCRATCH/qe-env add quantum-espresso%nvhpc +cuda |
| 133 | +spack -e $SCRATCH/qe-env config add packages:all:prefer:cuda_arch=90 |
| 134 | +spack -e $SCRATCH/qe-env develop -p /path/to/your/QE-src quantum-espresso@=develop |
| 135 | +spack -e $SCRATCH/qe-env concretize -f |
| 136 | +``` |
| 137 | +Check the output of `spack concretize -f`. All dependencies should have been picked up from spack upstream, marked eiter by a green `[^]` or `[e]`. |
| 138 | +Next we create a local filesystem view, this instructs spack to create symlinks for binaries and libraries in a local directory `view`. |
| 139 | +```bash |
| 140 | +spack -e $SCRATCH/qe-env env view enable view |
| 141 | +spack -e $SCRATCH/qe-env install |
| 142 | +``` |
| 143 | +To recompile QE after editing the source code re-run `spack -e $SCRATCH/qe-env install`. |
| 144 | + |
| 145 | +4. Run `pw.x` using the filesystem view generated in 3. |
| 146 | +```bash |
| 147 | +uenv start quantumespresso/v7.3.1 |
| 148 | +MPICH_GPU_SUPPORT_ENABLED=1 srun [...] $SCRATCH/qe-env/view/bin/pw.x < pw.in |
| 149 | +``` |
| 150 | +Note: The `pw.x` is linked to the uenv, it won't work without activating the uenv, also it will only work with the exact same version of the uenv. The physical installation path is in `$SCRATCH/spack`, deleting this directory will leave the anonymous spack environment created in 3. with dangling symlinks. |
| 151 | + |
| 152 | + |
| 153 | + |
| 154 | + |
0 commit comments