|
| 1 | +[](){#ref-software-packages-wrf} |
| 2 | +# WRF |
| 3 | + |
| 4 | +[The Weather Research & Forecasting Model](https://www.mmm.ucar.edu/models/wrf) (WRF) is a numerical weather prediction system designed for both atmospheric research and weather forecasting. |
| 5 | + |
| 6 | +It is used for CPU-only simulation on [Eiger][ref-cluster-eiger], for which this guide applies. |
| 7 | + |
| 8 | +## Using Spack |
| 9 | + |
| 10 | +Spack provides the [wrf](https://packages.spack.io/package.html?name=wrf) package, which we can install using the [uenv-spack][ref-building-uenv-spack] tool. |
| 11 | + |
| 12 | +First create a working directory where you will install the software. |
| 13 | +Here, we create it in your project's [Store][ref-storage-store] path, where the package can be accessed by all users in your project. |
| 14 | +```bash |
| 15 | +mkdir $STORE/wrf |
| 16 | +cd $STORE/wrf |
| 17 | +``` |
| 18 | + |
| 19 | +Then follow the steups in the [uenv-spack][ref-building-uenv-spack] guide to install `uenv-spack` |
| 20 | + |
| 21 | +```bash |
| 22 | +git clone https://github.com/eth-cscs/uenv-spack.git |
| 23 | +(cd uenv-spack && ./bootstrap) |
| 24 | +``` |
| 25 | + |
| 26 | +The [`prgenv-gnu`][ref-uenv-prgenv-gnu] uenv is suitable for building WRF. |
| 27 | +``` |
| 28 | +uenv start prgenv-gnu/24.11:v2 --view=spack |
| 29 | +``` |
| 30 | +In this example we use the latest version of `prgenv-gnu` on Eiger at the time of writing -- check the `prgenv-gnu` [guide][ref-uenv-prgenv-gnu] for the latest version. |
| 31 | + |
| 32 | +```bash |
| 33 | +# build the latest version provided by the version of Spack used by prgenv-gnu |
| 34 | +$ uenv-spack/uenv-spack $PWD/build --uarch=zen2 --specs=wrf |
| 35 | + |
| 36 | +# build a specific version |
| 37 | +$ uenv-spack/uenv-spack $PWD/build --uarch=zen2 [email protected] |
| 38 | + |
| 39 | +# build a specific version with WRF-Chem enabled |
| 40 | +$ uenv-spack/uenv-spack $PWD/build --uarch=zen2 [email protected] +chem |
| 41 | +``` |
| 42 | + |
| 43 | +!!! note |
| 44 | + See the wrf Spack [package documentation](https://packages.spack.io/package.html?name=wrf) for information about options that can be enabled disabled. |
| 45 | + |
| 46 | +Finally, it is time to build the software: |
| 47 | + |
| 48 | +``` |
| 49 | +cd build |
| 50 | +./build |
| 51 | +``` |
| 52 | + |
| 53 | +This will take 30-60 minutes, while Spack builds some dependencies then WRF. |
| 54 | + |
| 55 | +### Using the Spack installation |
| 56 | + |
| 57 | +The installation creates a module file in the `wrf/build` path, that you created. |
| 58 | +Let's assume you have installed it in the `$STORE` path for your project, add the following to the top of your sbatch script: |
| 59 | + |
| 60 | +```bash |
| 61 | +#SBATCH --uenv=prgenv-gnu/24.11:v2 |
| 62 | + |
| 63 | +module use $STORE/wrf/build/modules |
| 64 | +module load wrf |
| 65 | +``` |
| 66 | + |
| 67 | +!!! example "Modules installed by Spack" |
| 68 | + Spack creates a module for ever |
| 69 | + ```console |
| 70 | + $ module use $STORE/wrf/build/modules |
| 71 | + $ module avail |
| 72 | + |
| 73 | + ------------------ /capstor/store/cscs/cscs/csstaff/wrf/build/modules ------------------ |
| 74 | + boost/1.86.0 kokkos-tools/develop netlib-scalapack/2.2.0 |
| 75 | + cmake/3.30.5 kokkos/4.4.01 ninja/1.12.1 |
| 76 | + cray-mpich/8.1.30 libtree/3.1.1 openblas/0.3.28 |
| 77 | + fftw/3.3.10 lua/5.4.6 osu-micro-benchmarks/5.9 |
| 78 | + fmt/11.0.2 lz4/1.10.0 python/3.12.5 |
| 79 | + gcc/13.3.0 meson/1.5.1 superlu/5.3.0 |
| 80 | + gsl/2.8 netcdf-c/4.9.2 wrf/4.6.1 |
| 81 | + hdf5/1.14.5 netcdf-cxx/4.2 zlib-ng/2.2.1 |
| 82 | + kokkos-kernels/4.4.01 netcdf-fortran/4.6.1 |
| 83 | + |
| 84 | + $ module load wrf |
| 85 | + $ which wrf.exe |
| 86 | + /capstor/store/cscs/cscs/csstaff/wrf/build/store/linux-sles15-zen2/gcc-13.3.0/wrf-4.6.1-owj2dsfeslzkulaobdqbad4kh6ojh6n5/main/wrf.exe |
| 87 | + ``` |
| 88 | + |
| 89 | +## Installing by hand |
| 90 | + |
| 91 | +The process for building by hand is more difficult -- so try the Spack approach first, before contacting us. |
| 92 | + |
0 commit comments