This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
howto:wrf [2016/04/13 13:00] ccrosby |
howto:wrf [2022/10/27 18:42] (current) thlatshwayo |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Running ARW / WRF at the CHPC ====== | ====== Running ARW / WRF at the CHPC ====== | ||
| - | WRF-3.8, compiled with the Intel compilers and using Intel MPI, is installed on the filesystem in ''/ | ||
| - | There is a gcc-compiled WRF-3.7 installed | + | **NEW: |
| + | |||
| + | There are several versions of WRF, using different combinations of compiler and MPI implementation, | ||
| - | WRF-3.8 with parallel netcdf is installed on the filesystem in ''/ | + | ====== Warning: mpirun parameters changed ====== |
| - | WRF-3.8 with the added chemistry model and kinetic pre-processor is available | + | It has been necessary to change some of our MPI installations. The reason for this is that these installations were compiled without support for the PBS scheduler, which could result |
| - | <code> | + | '' |
| + | |||
| + | **The simple solution to this error is to remove the '' | ||
| + | |||
| + | |||
| + | |||
| + | ==== OpenMP ==== | ||
| + | WRF-4.0, WRF-4.1.1 and WRF-4.2 have been installed with support for OpenMP. It is therefore possible to run using the same number of cores in total, but fewer MPI processes. | ||
| + | |||
| + | ==== WRF, Parallel NetCDF and I/O Quilting ==== | ||
| + | WRF versions compiled with support for parallel netcdf have '' | ||
| + | |||
| + | Making effective use of Parallel NetCDF with I/O quilting requires some changes to the namelist.input file as well as the PBS script. | ||
| + | * It is recommended that the domain decomposition be specified manually by setting appropriate values for nproc_x, nproc_y, nio_tasks_per_group and nio_groups in namelist.input. | ||
| + | * **However, for the real.exe pre-processing step, it is necessary to have nproc_x and nproc_y set to -1** | ||
| + | * There is conflicting advice on suitable values for the above parameters. | ||
| + | * The nocolons flag should be set to T. This should also be done in the namelist.wps file to ensure that met_em* files without colons are built for WRF. | ||
| + | * Set lustre stripe count for the output files (see example script). | ||
| + | * Issue the mpirun command for nproc=(nproc_x*nproc_y) + (nio_tasks_per_group * nio_groups) | ||
| + | |||
| + | === Notes on compiling WRF for use with Parallel NetCDF and quilting === | ||
| + | With acknowledgement to John Michalakes (NREL) and Andrew Porter (STFC Daresbury). | ||
| + | |||
| + | Configure with PNETCDF set in shell env. to installation dir. for pnetcdf | ||
| + | * Edit configure.wrf and | ||
| + | * modify ARCHFLAGS to add/remove -DPNETCDF_QUILT | ||
| + | * touch frame/ | ||
| + | * recompile (no need to recompile the whole code if it has already been built) | ||
| + | |||
| + | |||
| + | === WRFCHEM === | ||
| + | WRF installations with the added chemistry model and kinetic pre-processor are also available in ''/ | ||
| + | |||
| + | |||
| + | === Example scripts === | ||
| + | |||
| + | |||
| + | <file bash runWRF.qsub> | ||
| # | # | ||
| #### For the distributed memory versions of the code that we use at CHPC, mpiprocs should be equal to ncpus | #### For the distributed memory versions of the code that we use at CHPC, mpiprocs should be equal to ncpus | ||
| #### Here we have selected the maximum resources available to a regular CHPC user | #### Here we have selected the maximum resources available to a regular CHPC user | ||
| #### Obviously provide your own project identifier | #### Obviously provide your own project identifier | ||
| + | #### For your own benefit, try to estimate a realistic walltime request. | ||
| + | #### wallclock requirement interferes with efficient scheduling, will delay the launch of the job, | ||
| + | #### and ties up more of your CPU-time allocation untill the job has finished. | ||
| #PBS -l select=10: | #PBS -l select=10: | ||
| #PBS -l walltime=3: | #PBS -l walltime=3: | ||
| - | #PBS -o /home/username/scratch/ | + | #PBS -o /mnt/lustre/users/ |
| - | #PBS -e /home/username/scratch/ | + | #PBS -e /mnt/lustre/users/jblogs/ |
| #PBS -m abe | #PBS -m abe | ||
| - | #PBS -M username@unseenuniversity.ac.za | + | #PBS -M jblogs@unseenuniversity.ac.za |
| - | ### Source the WRF-3.8 environment: | + | ### Source the WRF-4.1.1 environment: |
| - | export WRFDIR=/ | + | export WRFDIR=/ |
| . $WRFDIR/ | . $WRFDIR/ | ||
| # Set the stack size unlimited for the intel compiler | # Set the stack size unlimited for the intel compiler | ||
| Line 26: | Line 67: | ||
| ##### Running commands | ##### Running commands | ||
| # Set PBS_JOBDIR to where YOUR simulation will be run | # Set PBS_JOBDIR to where YOUR simulation will be run | ||
| - | export PBS_JOBDIR=/ | + | export PBS_JOBDIR=/ |
| # First though, change to YOUR WPS directory | # First though, change to YOUR WPS directory | ||
| - | export WPS_DIR=/export/home/username/scratch/WPS_test | + | export WPS_DIR=/mnt/lustre/users/jblogs/WPS_test |
| cd $WPS_DIR | cd $WPS_DIR | ||
| # Clean the directory of old files | # Clean the directory of old files | ||
| Line 38: | Line 79: | ||
| ./ | ./ | ||
| # Run geogrid.exe | # Run geogrid.exe | ||
| - | mpirun -np 1 -machinefile $PBS_NODEFILE | + | geogrid.exe &> geogrid.out |
| # Run ungrib.exe | # Run ungrib.exe | ||
| - | mpirun -np 1 -machinefile $PBS_NODEFILE | + | ungrib.exe &> ungrib.out |
| # Run metgrid.exe | # Run metgrid.exe | ||
| - | mpirun -np 1 -machinefile $PBS_NODEFILE | + | metgrid.exe &> metgrid.out |
| # Now change to the main job directory | # Now change to the main job directory | ||
| cd $PBS_JOBDIR | cd $PBS_JOBDIR | ||
| Line 54: | Line 95: | ||
| nnodes=`cat hosts | wc -l` | nnodes=`cat hosts | wc -l` | ||
| # Run real.exe with one process per node | # Run real.exe with one process per node | ||
| - | exe=$WRFDIR/ | + | exe=$WRFDIR/ |
| mpirun -np $nnodes -machinefile hosts $exe &> real.out | mpirun -np $nnodes -machinefile hosts $exe &> real.out | ||
| # Run wrf.exe with the full number of processes | # Run wrf.exe with the full number of processes | ||
| - | exe=$WRFDIR/ | + | exe=$WRFDIR/ |
| - | mpirun -np $nproc | + | mpirun -np $nproc $exe &> wrf.out |
| - | </code> | + | </file> |
| + | The following script runs wrf.exe only, with Parallel NetCDF: | ||
| + | |||
| + | <file bash runWRF_pnc.qsub> | ||
| + | # | ||
| + | #### For the distributed memory versions of the code that we use at CHPC, mpiprocs should be equal to ncpus | ||
| + | #### Here we have selected the maximum resources available to a regular CHPC user | ||
| + | #### Obviously provide your own project identifier | ||
| + | #### For your own benefit, try to estimate a realistic walltime request. | ||
| + | #### wallclock requirement interferes with efficient scheduling, will delay the launch of the job, | ||
| + | #### and ties up more of your CPU-time allocation untill the job has finished. | ||
| + | #PBS -l select=10: | ||
| + | #PBS -l walltime=3: | ||
| + | #PBS -o / | ||
| + | #PBS -e / | ||
| + | #PBS -m abe | ||
| + | #PBS -M jblogs@unseenuniversity.ac.za | ||
| + | ### Source the WRF-4.1.1 environment with parallel NetCDF: | ||
| + | export WRFDIR=/ | ||
| + | . $WRFDIR/ | ||
| + | # Set the stack size unlimited for the intel compiler | ||
| + | ulimit -s unlimited | ||
| + | ##### Running commands | ||
| + | # Set PBS_JOBDIR to where YOUR simulation will be run | ||
| + | export PBS_JOBDIR=/ | ||
| + | cd $PBS_JOBDIR | ||
| + | exe=$WRFDIR/ | ||
| + | # Clear and re-set the lustre striping for the job directory. | ||
| + | # used by CHPC, a stripe size of 12 should work well. | ||
| + | lfs setstripe -d $PBS_JOBDIR | ||
| + | lfs setstripe -c 12 ./ | ||
| + | ## For this example, assume that nproc_x=8, nproc_y=28, nio_tasks_per_group=4 and nio_groups=4, | ||
| + | ## of 16 I/O processes and 228 solver processes, therefore 240 MPI processes in total. | ||
| + | mpirun -np 240 $exe &> wrf.out | ||
| + | </ | ||
| + | |||
| + | The following script runs wrf.exe only, with Parallel NetCDF and OpenMP. | ||
| + | |||
| + | <file bash runWRF_pnc_omp.qsub> | ||
| + | #!/bin/bash | ||
| + | ### Request 10 compute nodes with 6 MPI processes per node | ||
| + | #PBS -l select=10: | ||
| + | #PBS -q normal | ||
| + | #PBS -P ERTH1234 | ||
| + | #PBS -l walltime=06: | ||
| + | #PBS -N WRF4-10X6X4 | ||
| + | #PBS -o / | ||
| + | #PBS -e / | ||
| + | ### These two stack size settings are essential for use with Intel-compiled code | ||
| + | ulimit -s unlimited | ||
| + | export OMP_STACKSIZE=2G | ||
| + | ### Source the appropriate environment script | ||
| + | . / | ||
| + | export PBSJOBDIR=/ | ||
| + | cd $PBSJOBDIR | ||
| + | ### Get total number of MPI ranks | ||
| + | nproc=`cat $PBS_NODEFILE | wc -l` | ||
| + | ### Clear and set the lustre stripes for the working directory | ||
| + | lfs setstripe -d $PBSJOBDIR | ||
| + | lfs setstripe -c 12 ./ | ||
| + | ### Issue the command line, passing the number of OpenMP threads. | ||
| + | ### These affinity settings work OK, but may be unnecessary. YMMV. | ||
| + | time mpirun -np $nproc -genv OMP_NUM_THREADS 4 -genv KMP_AFFINITY " | ||
| + | </ | ||
| + | |||
| + | |||
| + | For use with Parallel NetCDF, the namelist.input file has to contain the following: | ||
| | | ||
| - | For post-processing, | + | <file txt namelist.input> |
| + | . | ||
| + | & | ||
| + | . | ||
| + | . | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | | ||
| + | . | ||
| + | . | ||
| + | & | ||
| + | . | ||
| + | . | ||
| + | | ||
| + | | ||
| + | | ||
| + | . | ||
| + | . | ||
| + | & | ||
| + | | ||
| + | | ||
| + | / | ||
| + | |||
| + | </ | ||
| + | |||
| + | For post-processing, | ||
| + | |||
| + | ==== Parallel scaling ==== | ||
| + | The four line graphs below illustrate parallel scaling of WRF-3.7 and WRF-3.8 on the cluster, using MPI parallelisation only. Please note that if you are using a large number of cores, writing hourly output files will significantly slow down the run. Use a version of WRF compiled with parallel NetCDF support, and an appropriate input file to overcome this. Check in the rsl.out.0000 file to see how much time is being used for writing output files. | ||
| + | |||
| + | The bar graph explores the different parallelisation options with WRF-4.0. | ||
| + | * Using 24 cores per node instead of 12 cores produces a relatively modest improvement | ||
| + | * Trading off MPI processes in favour of more OpenMP threads improves performance up to 4 OpenMP threads, when using the Intel-compiled version | ||
| + | * Although there are many options for setting process and thread affinity, the defaults generally work quite well | ||
| + | * For this particular problem set on only 10 nodes, there is a small penalty associated with using parallel I/O, but this will be reversed if more nodes are used | ||
| + | * Although the PGI version is competitive with the Intel version when using MPI only, it does not benefit from using OpenMP processes as well. The GCC version is generally not competitive, | ||
| + | |||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | |||
| | | ||