This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
howto:wrf [2015/05/20 16:03] 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.6.1 is installed on the filesystem in ''/ | ||
| - | WRF-3.6.1 with the added chemistry model is available | + | **NEW: |
| + | |||
| + | There are several versions of WRF, using different combinations of compiler and MPI implementation, | ||
| - | #!/bin/bash | + | ====== Warning: mpirun parameters changed ====== |
| - | #PBS -l select=10: | + | |
| - | #PBS -q workq | + | It has been necessary to change some of our MPI installations. |
| - | #PBS -l walltime=1:00:00 | + | |
| - | #PBS -o stdout | + | '' |
| - | #PBS -e stderr | + | |
| - | #PBS -m abe | + | **The simple solution to this error is to remove the '' |
| - | #PBS -M username@csir.co.za | + | |
| - | ### Source the WRF-3.6.1 environment: | + | |
| - | ### Please ensure that these lines also appear in your .bashrc file, | + | |
| - | ### preferably right at the end | + | ==== 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. |
| - | . $WRFDIR/ | + | |
| - | ##### Running commands | + | ==== WRF, Parallel NetCDF and I/O Quilting ==== |
| - | # The -d option used with moab no longer works. | + | WRF versions compiled with support for parallel netcdf have '' |
| - | export PBS_JOBDIR=/ | + | |
| - | # Explicitly | + | Making effective use of Parallel NetCDF with I/O quilting requires some changes to the namelist.input file as well as the PBS script. |
| - | cd $PBS_JOBDIR | + | * 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. |
| - | # Figure out how many processes for wrf.exe | + | * **However, for the real.exe pre-processing step, it is necessary to have nproc_x and nproc_y set to -1** |
| - | nproc=`cat $PBS_NODEFILE | wc -l` | + | * There is conflicting advice on suitable values for the above parameters. |
| - | # Now figure out how many nodes are being used | + | * 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. |
| - | cat $PBS_NODEFILE | sort -u > hosts | + | * Set lustre stripe count for the output files (see example script). |
| - | nnodes=`cat hosts | wc -l` | + | * Issue the mpirun command for nproc=(nproc_x*nproc_y) + (nio_tasks_per_group * nio_groups) |
| - | # Run real.exe with one process per node | + | |
| - | exe=$WRFDIR/ | + | === Notes on compiling WRF for use with Parallel NetCDF and quilting === |
| - | mpirun | + | With acknowledgement to John Michalakes (NREL) and Andrew Porter (STFC Daresbury). |
| - | # Run wrf.exe with the full number of processes | + | |
| - | exe=$WRFDIR/ | + | Configure with PNETCDF set in shell env. to installation dir. for pnetcdf |
| - | mpirun -np $nproc -machinefile | + | * 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> | ||
| + | #!/bin/bash | ||
| + | #### 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:00:00 | ||
| + | #PBS -o / | ||
| + | #PBS -e / | ||
| + | #PBS -m abe | ||
| + | #PBS -M jblogs@unseenuniversity.ac.za | ||
| + | ### Source the WRF-4.1.1 environment: | ||
| + | export WRFDIR=/apps/chpc/earth/WRF-4.1.1-pnc-impi | ||
| + | . $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=/ | ||
| + | # First though, | ||
| + | export WPS_DIR=/ | ||
| + | cd $WPS_DIR | ||
| + | # Clean the directory of old files | ||
| + | rm FILE* | ||
| + | rm GRIB* | ||
| + | rm geo_em* | ||
| + | rm met_em* | ||
| + | # Link to the grib files, obviously use the location of YOUR grib files | ||
| + | ./ | ||
| + | # Run geogrid.exe | ||
| + | geogrid.exe &> geogrid.out | ||
| + | # Run ungrib.exe | ||
| + | ungrib.exe &> ungrib.out | ||
| + | # Run metgrid.exe | ||
| + | metgrid.exe &> metgrid.out | ||
| + | # Now change to the main job directory | ||
| + | cd $PBS_JOBDIR | ||
| + | # Link the met_em* data files into this directory | ||
| + | ln -s $WPS_DIR/ | ||
| + | # Figure out how many processes | ||
| + | nproc=`cat $PBS_NODEFILE | wc -l` | ||
| + | # Now figure out how many nodes are being used | ||
| + | cat $PBS_NODEFILE | sort -u > hosts | ||
| + | # Number of nodes to be used for real.exe | ||
| + | nnodes=`cat hosts | wc -l` | ||
| + | # Run real.exe with one process per node | ||
| + | exe=$WRFDIR/ | ||
| + | mpirun -np $nnodes -machinefile | ||
| + | # Run wrf.exe with the full number of processes | ||
| + | exe=$WRFDIR/ | ||
| + | mpirun -np $nproc | ||
| + | </ | ||
| + | |||
| + | The following script runs wrf.exe only, with Parallel NetCDF: | ||
| + | |||
| + | <file bash runWRF_pnc.qsub> | ||
| + | #!/bin/bash | ||
| + | #### 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 | ||
| + | </ | ||
| + | |||
| + | The following script runs wrf.exe only, with Parallel NetCDF and OpenMP. | ||
| + | |||
| + | <file bash runWRF_pnc_omp.qsub> | ||
| + | # | ||
| + | ### 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, | ||
| + | |||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | {{: | ||
| + | |||
| | | ||