Skip to content

Commit 5ba5ac4

Browse files
updates
1 parent c6c1a62 commit 5ba5ac4

File tree

1 file changed

+108
-20
lines changed

1 file changed

+108
-20
lines changed

docs/software/sciapps/quantumespresso.md

Lines changed: 108 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,18 @@
33

44
[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:
55

6-
PWscf (Plane-Wave Self-Consistent Field)
7-
FPMD (First Principles Molecular Dynamics)
8-
CP (Car-Parrinello)
6+
* `pw.x`: Plane-Wave Self-Consistent Field (PWscf)
7+
* `pw.x` First Principles Molecular Dynamics (FPMD)
8+
* `cp.x` Car-Parrinello (CP)
99

10-
## ALPS (GH200)
11-
### Setup
12-
Download the uenv image for QuantumESPRESSO:
1310

11+
!!! note "uenvs"
1412

15-
### List available images
13+
[Quantum ESPRESSO] 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.
1615

17-
```bash
18-
uenv image find quantumespresso
19-
```
20-
21-
### Pull the image of interest
22-
23-
```
24-
uenv image pull quantumespresso/v7.4:v2
25-
```
26-
27-
28-
QuantumESPRESSO can be compiled from source using the above uenv. The procedure is described in https://eth-cscs.github.io/alps-uenv/uenv-qe/#building-a-custom-version.
2916

30-
### How to run
17+
## How to run
3118

3219
The following sbatch script can be used as a template.
3320

@@ -48,6 +35,7 @@ The following sbatch script can be used as a template.
4835

4936
srun -u --cpu-bind=socket /user-environment/env/default/bin/pw.x < pw.in
5037
```
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 describe [here][ref-slurm-gh200-multi-rank-per-gpu].
5139

5240
=== "Eiger"
5341

@@ -64,3 +52,103 @@ The following sbatch script can be used as a template.
6452
srun -u /user-environment/env/default/bin/pw.x < pw.in
6553
```
6654

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

Comments
 (0)