WRF with Intel oneAPI

22 May 2024, Han Soo Lee

WRF (v4.4 and v4.6.0) compilation with Intel oneAPI

Before installing the WRF, you must install the Netcdf with Intel oneAPI first. Then, compile the WRF with the following steps.

Install necessary library such as libpng and Jasper. The other libraries such as zlib, szip, CUnit, UDUNITS, curl, Netcdf should be installed beforehand following the instruction.

  • In the following build_scripts, you have to modify HOME variable according to your HPC system environment. Check out the versions of the library carefully as well.
  • We used the Downloads in home directory for the process below.


make a script, build_libpng.sh, in ~/Downloads/ as below, and run the code after changing the mode, chmod a+x build_libpng.sh


# build_libpng.sh
wget http://prdownloads.sourceforge.net/libpng/libpng-${version_libpng}.tar.gz

tar xvf libpng-${version_libpng}.tar.gz
cd libpng-${version_libpng}/

./configure --prefix=${HOME}/libpng/${version_libpng}
make install


make a script, build_udunits.sh, and run the script in the same way as above.


# build_jasper.sh
wget https://www.ece.uvic.ca/~frodo/jasper/software/jasper-${version_jasper}.tar.gz
tar xvf jasper-${version_jasper}.tar.gz
cd jasper-${version_jasper}/
./configure --prefix=${HOME}/jasper/${version_jasper}
make install

add the following in ~/.bashrc, then log-in again. You have to change “/home/hslee/Downloads/wrf_libs_intel” according to your environment.

export JASPERLIB="-L/home/hslee/Downloads/wrf_libs_intel/jasper/1.900.29/lib"
export JASPERINC="-I/home/hslee/Downloads/wrf_libs_intel/jasper/1.900.29/include"

WRF (v4.4 and v4.6.0) compilation

You have to change NETCDF according to your environment as you already installed by following the instruction.

export NETCDF=/home/hslee/Downloads/wrf_libs_intel/netcdf4-intel/
export HDF5=/home/hslee/Downloads/wrf_libs_intel/hdf5/1.12.0
wget https://github.com/wrf-model/WRF/archive/v4.4.tar.gz
#wget https://github.com/wrf-model/WRF/archive/v4.6.0.tar.gz
tar xvf v4.4.tar.gz
cd WRF-4.4/


checking for perl5... no
checking for perl... found /usr/bin/perl (perl)
Will use NETCDF in dir: /home/hslee/Downloads/wrf_libs_intel/netcdf4-intel
ADIOS2 not set in environment. Will configure WRF for use without.
HDF5 not set in environment. Will configure WRF for use without.
PHDF5 not set in environment. Will configure WRF for use without.
Will use 'time' to report timing information

If you REALLY want Grib2 output from WRF, modify the arch/Config.pl script.
Right now you are not getting the Jasper lib, from the environment, compiled into WRF.

Please select from among the following Linux x86_64 options:

  1. (serial)   2. (smpar)   3. (dmpar)   4. (dm+sm)   PGI (pgf90/gcc)
  5. (serial)   6. (smpar)   7. (dmpar)   8. (dm+sm)   PGI (pgf90/pgcc): SGI MPT
  9. (serial)  10. (smpar)  11. (dmpar)  12. (dm+sm)   PGI (pgf90/gcc): PGI accelerator
 13. (serial)  14. (smpar)  15. (dmpar)  16. (dm+sm)   INTEL (ifort/icc)
                                         17. (dm+sm)   INTEL (ifort/icc): Xeon Phi (MIC architecture)
 18. (serial)  19. (smpar)  20. (dmpar)  21. (dm+sm)   INTEL (ifort/icc): Xeon (SNB with AVX mods)
 22. (serial)  23. (smpar)  24. (dmpar)  25. (dm+sm)   INTEL (ifort/icc): SGI MPT
 26. (serial)  27. (smpar)  28. (dmpar)  29. (dm+sm)   INTEL (ifort/icc): IBM POE
 30. (serial)               31. (dmpar)                PATHSCALE (pathf90/pathcc)
 32. (serial)  33. (smpar)  34. (dmpar)  35. (dm+sm)   GNU (gfortran/gcc)
 36. (serial)  37. (smpar)  38. (dmpar)  39. (dm+sm)   IBM (xlf90_r/cc_r)
 40. (serial)  41. (smpar)  42. (dmpar)  43. (dm+sm)   PGI (ftn/gcc): Cray XC CLE
 44. (serial)  45. (smpar)  46. (dmpar)  47. (dm+sm)   CRAY CCE (ftn $(NOOMP)/cc): Cray XE and XC
 48. (serial)  49. (smpar)  50. (dmpar)  51. (dm+sm)   INTEL (ftn/icc): Cray XC
 52. (serial)  53. (smpar)  54. (dmpar)  55. (dm+sm)   PGI (pgf90/pgcc)
 56. (serial)  57. (smpar)  58. (dmpar)  59. (dm+sm)   PGI (pgf90/gcc): -f90=pgf90
 60. (serial)  61. (smpar)  62. (dmpar)  63. (dm+sm)   PGI (pgf90/pgcc): -f90=pgf90
 64. (serial)  65. (smpar)  66. (dmpar)  67. (dm+sm)   INTEL (ifort/icc): HSW/BDW
 68. (serial)  69. (smpar)  70. (dmpar)  71. (dm+sm)   INTEL (ifort/icc): KNL MIC
 72. (serial)  73. (smpar)  74. (dmpar)  75. (dm+sm)   AMD (flang/clang) :  AMD ZEN1/ ZEN2/ ZEN3 Architectures
 76. (serial)  77. (smpar)  78. (dmpar)  79. (dm+sm)   INTEL (ifx/icx) : oneAPI LLVM
 80. (serial)  81. (smpar)  82. (dmpar)  83. (dm+sm)   FUJITSU (frtpx/fccpx): FX10/FX100 SPARC64 IXfx/Xlfx

Enter selection [1-83] : 15
Compile for nesting? (1=basic, 2=preset moves, 3=vortex following) [default 1]: 1

Configuration successful! 
testing for fseeko and fseeko64
fseeko64 is supported

Edit configure.wrf

Edit the following for (dmpar) option in configure.wrf:

DM_FC           =       mpiifort
DM_CC           =       mpiicc

compile the code

./compile em_real | tee compile.log

Here, it will take around 30-40 min to complete the compilation. Chill out with a cup of coffee! Fingers crossed!


--->                  Executables successfully built                  <---
-rwxrwxr-x 1 wrf wrf 40691640 Jul 30 12:35 main/ndown.exe
-rwxrwxr-x 1 wrf wrf 40572760 Jul 30 12:35 main/real.exe
-rwxrwxr-x 1 wrf wrf 40048888 Jul 30 12:35 main/tc.exe
-rwxrwxr-x 1 wrf wrf 44609360 Jul 30 12:35 main/wrf.exe

Sometimes, you have to re-run the configure and compile again, if you do not have the *.exe files as the output.

./clean -a

Then, repeat the configure and compile process.

WPS compilation

It will be updated soon.