Cross-compile WRF for Windows Azure
For many HPC applications, porting from Linux to Windows is as straightforward as recompiling the application source code with a special toolchain. More complex applications may require a little more work, but even complex HPC applications can be ported in this way. Visit the PToolsWin page for more information.
This step of the tutorial will guide you through the process of recompiling WRF 3.3.1 with the PToolsWin development environment. PToolsWin generates native Windows code (no intermediate POSIX layer is required), so your application will perform as well as a native Windows application.
Prerequisites
Before you continue, make sure you have these software prerequisites:
Build WRF as a Windows Executable
- Open a command line in your HPC Linux distro and load the PToolsWin module:
module load ptoolswin module list
- Begin by creating a directory for WRF:
setenv WRFDIR ${HOME}/windows/WRF mkdir -p $WRFDIR cd $WRFDIR
- Download and unpack the WRF source code:
wget http://www.mmm.ucar.edu/wrf/src/WRFV3.3.1.TAR.gz tar xzf WRFV3.3.1.TAR.gz
-
Apply paratools-WRFV3.3.1 to the WRF source code to fix a few known problems and add a new build configuration for PToolsWin:
wget http://paratools.com/Azure/WRF/Step2/paratools-WRFV3.3.1.patch -O paratools-WRFV3.3.1.patch<br>cd WRFV3 patch -p1 < ../paratools-WRFV3.3.1.patch
- Configure your environment. WRF relies on several environment variables to locate NetCDF and select the appropriate configuration files:
setenv NETCDF ${HOME}/windows/netcdf-4.1.3 setenv WRFIO_NCD_LARGE_FILE_SUPPORT 1 setenv WRF_EM_CORE 1 setenv WRF_OS Windows
-
Configure WRF. Select Windows 64-bit, PToolsWin (dmpar) (Option 7) and basic nesting (Option 1):
./configure
-
Compile WRF 1. There is a race condition in the build process, so it’s a good idea to do a second, serial compilation after the first:
./compile em_real |& tee compile.log ./compile -j 1 em_real |& tee compile.log.2
Verify that the ptoolswin module is loaded before you begin compiling. You can view loaded modules with the command module list -
You should now have several program executables in the main folder:
[paratools07] 136 > echo $WRFDIR /home/livetau/windows/WRF [paratools07] 137 > pwd /home/livetau/windows/WRF/WRFV3 [paratools07] 138 > ls main/*.exe main/ndown.exe main/nup.exe main/real.exe main/tc.exe main/wrf.exe [paratools07] 139 >
If any of these .exe files are missing from main, check configure.log.2 for errors ( do a case-insensitive search for “Error”) and try re-compiling. Otherwise, continue to Step 3.
Notes
- Check the Compile module of the WRF ARW Online Tutorial for more information on compiling WRF. (1)